PAOFLOW.inputs.file_io#

Functions#

struct_from_outputfile_QE(fname)

Parse structural information from a Quantum ESPRESSO output file.

read_relaxed_coordinates_QE(fname)

Read relaxed atomic positions (and optionally cell parameters) from a QE output file.

struct_from_inputfile_QE(fname)

Parse structural information and Namelist blocks from a Quantum ESPRESSO input file.

create_atomic_inputfile(calculation, blocks, cards)

Write a Quantum ESPRESSO input file from Namelist blocks and card data.

create_acbn0_inputfile(savedir, pthr, outputdir[, ...])

Generate a PAOFLOW Python driver script for an ACBN0 calculation.

Module Contents#

PAOFLOW.inputs.file_io.struct_from_outputfile_QE(fname)[source]#

Parse structural information from a Quantum ESPRESSO output file.

Parameters:

fname (str) – Path to the QE .out file.

Returns:

Structure dictionary with keys:

  • 'lattice' : np.ndarray, shape (3, 3) — lattice vectors in Bohr.

  • 'abc' : np.ndarray, shape (nat, 3) — fractional atomic coordinates.

  • 'species' : list of str — atomic species labels.

  • 'lunit' : str — length unit ('bohr').

  • 'aunit' : str — atomic position unit ('alat').

Return type:

dict

Raises:

FileNotFoundError – If fname does not exist.

PAOFLOW.inputs.file_io.read_relaxed_coordinates_QE(fname)[source]#

Read relaxed atomic positions (and optionally cell parameters) from a QE output file.

Parameters:

fname (str) – Path to the QE .out (relaxation) file.

Returns:

Updated structure dictionary (from struct_from_outputfile_QE()) with two additional keys:

  • 'lattice' : np.ndarray, shape (nsteps+1, 3, 3) — lattice vectors at each ionic step (index 0 is the initial structure).

  • 'abc' : np.ndarray, shape (nsteps+1, nat, 3) — fractional atomic positions at each ionic step.

Return type:

dict

Raises:

Exception – If no atomic positions or cell coordinates are found in the file.

PAOFLOW.inputs.file_io.struct_from_inputfile_QE(fname)[source]#

Parse structural information and Namelist blocks from a Quantum ESPRESSO input file.

Parameters:

fname (str) – Path to the QE input file (e.g. .scf.in).

Returns:

  • blocks (dict) – Nested dictionary mapping Namelist names (lower-case) to {keyword: value} dictionaries.

  • cards (dict) – Dictionary mapping card names (e.g. 'ATOMIC_POSITIONS', 'ATOMIC_SPECIES', 'K_POINTS', 'CELL_PARAMETERS', 'HUBBARD') to lists of raw text lines.

Notes

Currently only control Namelist blocks are parsed; inline comments are stripped. The HUBBARD card accepts an arbitrary number of entries (U, V, J, …), terminated by the next card or end of file.

PAOFLOW.inputs.file_io.create_atomic_inputfile(calculation, blocks, cards)[source]#

Write a Quantum ESPRESSO input file from Namelist blocks and card data.

Parameters:
  • calculation (str) – Base name of the output file; the file is written to {calculation}.in.

  • blocks (dict) – Nested dictionary of Namelist blocks as returned by struct_from_inputfile_QE().

  • cards (dict) – Dictionary of card data as returned by struct_from_inputfile_QE(). The 'ATOMIC_SPECIES' card, if present, is written first and then removed from the dict before writing the remaining cards.

Returns:

Writes a file {calculation}.in to the current directory.

Return type:

None

PAOFLOW.inputs.file_io.create_acbn0_inputfile(savedir, pthr, outputdir, expand_wedge=False, use_local_basis=False, basispath=None, configuration='standard')[source]#

Generate a PAOFLOW Python driver script for an ACBN0 calculation.

Parameters:
  • savedir (str) – Path to the QE .save directory (relative to the PAOFLOW workpath), e.g. ./tmp/Si.save.

  • pthr (float) – Projectability threshold passed to paoflow.projectability().

  • outputdir (str) – Output directory passed to the PAOFLOW constructor.

  • expand_wedge (bool, optional) – Forwarded to paoflow.pao_hamiltonian. False (default) assumes QE produced the full BZ (nosym=.true., noinv=.true.); True expands the symmetry-reduced wedge to the full grid.

  • use_local_basis (bool, optional) – When True the projections are computed internally by PAOFLOW (PAOFLOW.PAOFLOW.PAOFLOW.projections()) instead of reading atomic_proj.xml from projwfc.x. The local projection orthonormalises the atomic orbitals, so the wavefunction overlap is set to the identity before the +U Hamiltonian is built, and the PAO basis metadata is dumped to <outputdir>/pao_basis.dat for the Hubbard-manifold selection in ACBN0.run_acbn0().

  • basispath (str, optional) – Directory with the per-element radial basis files; forwarded to projections when use_local_basis is True and configuration is 'standard' / 'extended'.

  • configuration (str or dict, optional) – Projection-basis preset ('minimal', 'standard' or 'extended') or an explicit {element: [shell_labels]} mapping forwarded to projections. A dict builds the all-electron basis from basispath (internal=True).

Returns:

Writes the script acbn0.py to the current directory.

Return type:

None