DFT Input Files¶
This page documents how egqca generates DFT input files for Quantum ESPRESSO, FHI-aims, and VASP.
The package passes the dictionaries qe_par, aims_par, and vasp_par to ASE-based writers, so their structure should closely follow the structure of the corresponding solver input files.
In practice, this means:
- qe_par should use keys that match the Quantum ESPRESSO namelist structure
- aims_par should use keys that match the keywords expected in control.in
- vasp_par should use INCAR keywords, written in upper case
- the final input files are written with ASE, using the cluster structures generated by egqca
General Setup¶
The DFT input files are generated during the automated workflow through set_up_clusters_and_dft(). For each generated cluster, egqca creates the directory tree
S*/S*_i*_w*/vc-relax
and writes the relaxation input files there.
Additional directories are created for post-relaxation calculations:
- S*/S*_i*_w*/bands
- S*/S*_i*_w*/phonons
Three DFT backends are supported: Quantum ESPRESSO (qe_par), FHI-aims (aims_par), and VASP (vasp_par). Any combination may be provided in the same call and all selected backends will have their input files written.
Required Solver-Specific Paths¶
To generate the input files, the solver-specific resource directory must be provided explicitly.
The kpoints are set separately through the input parameter kpts=(6,6,6).
Quantum ESPRESSO¶
To generate Quantum ESPRESSO input files, qe_par must contain
qe_par = {
"pseudo_dir": "/path/to/pseudopotentials",
...
}
pseudo_dir must point to a directory containing pseudopotential files for all elements in the structure. The code searches this directory automatically and selects a matching element*.upf file per element (case-insensitive, e.g. Mg.pbe-n-kjpaw.UPF).
If qe_par is provided without pseudo_dir, Quantum ESPRESSO input files are not generated.
FHI-aims¶
To generate FHI-aims input files, aims_par must contain
aims_par = {
"species_dir": "/path/to/aims/species_defaults",
...
}
species_dir must point to a valid FHI-aims species defaults directory.
If aims_par is provided without species_dir, FHI-aims input files are not generated.
VASP¶
To generate VASP input files, vasp_par must contain
vasp_par = {
"potcar_dir": "/path/to/POTCAR/directory",
...
}
potcar_dir must point to the directory holding one subfolder per element, each containing a POTCAR file, i.e. <potcar_dir>/<element>/POTCAR. Individual element potentials can be customised with the optional potentials key, which replaces the subfolder name for that element:
vasp_par = {
"potcar_dir": "/path/to/POTCARs",
"potentials": {"Sr": "Sr_sv"}, # reads <potcar_dir>/Sr_sv/POTCAR
... # any INCAR keyword
}
For each cluster, egqca writes:
- vc-relax/POSCAR
- vc-relax/POTCAR
- vc-relax/INCAR
- vc-relax/KPOINTS
The atoms are sorted by chemical symbol before POSCAR is written, and the per-element POTCAR files are concatenated in the same order. potcar_dir and potentials are consumed by the writer and never end up in the INCAR.
If vasp_par is provided without potcar_dir, VASP input files are not generated.
Default Relaxation Values¶
The current defaults from VASP_DEFAULTS in constants.py are:
VASP_DEFAULTS = {
"SYSTEM": "vasp",
"NCORE": 1,
"ISMEAR": 0, # Gaussian smearing with width SIGMA
"SIGMA": 0.1,
"ENCUT": 600,
"IBRION": 2, # conjugate gradient
"ISIF": 3, # relax positions, cell shape, and volume
"NSW": 15, # maximum number of ionic steps
"EDIFFG": -0.0001, # force threshold in eV/Angstrom
"EDIFF": 1e-07,
"LREAL": "Auto",
}
Any additional key in vasp_par is written to the INCAR verbatim; booleans are converted to T and F.
Quantum ESPRESSO Input Dictionaries¶
For Quantum ESPRESSO, qe_par is expected to resemble the namelist structure of a pw.x or ph.x input file.
A typical structure looks like this:
qe_par = {
"pseudo_dir": "/path/to/pseudos",
"control": {
"calculation": "vc-relax",
"prefix": "job",
"outdir": "./tmp",
},
"system": {
"occupations": "smearing",
"smearing": "mp",
"degauss": 0.02,
},
"electrons": {
"conv_thr": 1e-10,
},
"ions": {
"ion_dynamics": "bfgs",
},
"cell": {
"cell_dynamics": "bfgs",
},
}
The package combines user input with internal defaults from QE_DEFAULTS in constants.py.
Default Relaxation Values¶
The current default values are:
QE_DEFAULTS = {
"control": {
"calculation": "vc-relax",
"prefix": "job",
"outdir": "./tmp",
"tstress": True,
"tprnfor": True,
"etot_conv_thr": 1e-7,
"forc_conv_thr": 1e-6,
},
"system": {
"occupations": "smearing",
"smearing": "mp",
"degauss": 0.02,
},
"electrons": {
"conv_thr": 1e-10,
"mixing_beta": 0.7,
"electron_maxstep": 200,
},
"ions": {
"ion_dynamics": "bfgs",
},
"cell": {
"cell_dynamics": "bfgs",
"cell_dofree": "all",
"press": 0,
},
}
In addition:
- title and prefix are set automatically from the cluster name
- calculation is set automatically depending on the type of run
- if ecutwfc is not provided, a default value based on the values from PseudoDojo is set.
- if ecutrho is not provided, it is set to 8 * ecutwfc
- the structure is rotated rigidly so the symmetry axes of its lattice lie along x, y, z (standard_orientation). A CIF stores no orientation, and in the orientation ASE builds from it pw.x can miss most symmetry operations (e.g. 12 instead of 48 for a 60° fcc cell). Lengths, angles and fractional positions are unchanged.
FHI-aims Input Dictionaries¶
For FHI-aims, aims_par is expected to follow the keyword structure used in control.in.
A typical structure looks like this:
aims_par = {
"species_dir": "/path/to/species_defaults",
"xc": "pbe",
"k_grid": (12, 12, 12),
"relax_geometry": "bfgs 1e-3",
"relax_unit_cell": "full",
"compute_forces": True,
}
The package combines user input with internal defaults from AIMS_DEFAULTS in constants.py.
Default Relaxation Values¶
The current defaults are:
AIMS_DEFAULTS = dict(
xc="pbe",
relax_geometry="bfgs 1e-3", # force threshold in eV/Angstrom
relax_unit_cell="full",
compute_forces=True,
)
In addition:
- k_grid is set from the kpts argument passed to the workflow. If kpts is None, a k_grid in aims_par is kept, otherwise DEFAULT_KPTS = (12, 12, 12) is used. It is therefore not part of AIMS_DEFAULTS.
- if aims_par contains both k_grid and kpts is passed, kpts takes precedence and a warning is raised
- if aims_par contains k_grid_density, that key takes precedence and no k_grid is written; passing kpts as well only triggers a warning
- geometry.in is written from the cluster structure with ASE
- control.in is written from aims_par with ASE
Relaxation Inputs¶
Quantum ESPRESSO¶
For each cluster, egqca writes:
- vc-relax/vc-relax.in
This file is generated with ASE's Quantum ESPRESSO writer using the current cluster structure, the qe_par dictionary, the detected pseudopotentials, and the selected k-point mesh.
FHI-aims¶
For each cluster, egqca writes:
- vc-relax/geometry.in
- vc-relax/control.in
These files are generated with ASE's FHI-aims writers using the current cluster structure and aims_par.
Rewriting Existing Inputs¶
update_DFT_in() takes the same qe_par, aims_par, vasp_par, and kpts arguments and rewrites the relaxation inputs of an existing folder tree. It runs the same writers as the initial setup, which overwrite the input files of the given solvers in every vc-relax/ folder. Nothing is deleted: input files of solvers not passed to the call, and other files such as DFT outputs from an earlier run, are left in place. Use it when solver parameters change after the clusters have been generated.
Bands Inputs¶
Band-structure input files are generated separately with create_bands_in() after the relaxation step.
Function Behavior¶
create_bands_in() reads the relaxed structure from the relaxation output and then writes new input files in
S*/S*_i*_w*/bands
The function supports Quantum ESPRESSO, FHI-aims, and VASP.
Shared Bands Parameters¶
The bands dictionary has the form
bands = {
"path": "",
"kpoint_density": 20,
}
where:
- path is an optional high-symmetry path string
- kpoint_density controls the sampling density along the band path
If path is empty, ASE determines a default band path from the Bravais lattice.
The path is set up once on the unrelaxed S0 cluster, which has the full symmetry of the parent lattice, and used for every cluster: all clusters get the same special points (in scaled coordinates) and the same number of k-points, for Quantum ESPRESSO, FHI-aims and VASP alike. Relaxed clusters are usually slightly distorted, and would otherwise get the default path of a lower-symmetry lattice, with other labels and k-points.
Quantum ESPRESSO Bands Inputs¶
To generate Quantum ESPRESSO band inputs, you must provide:
- qe_par including pseudo_dir
- espresso_out_file, pointing to the relaxation output file inside vc-relax/ to consider the relaxed structure.
The code then writes:
- bands/bands.in
- bands/bandpath.pdf
Additional behavior:
- calculation is switched automatically to bands
- title and prefix are set from the cluster name
- nbnd is set to 40 if not overridden
- ASE is used to generate the k-point path in reciprocal space
FHI-aims Bands Inputs¶
To generate FHI-aims band inputs, you must provide:
- aims_par including species_dir
- aims_out_file, pointing to the relaxation output file inside vc-relax/
The code then writes:
- bands/geometry.in
- bands/control.in
- bands/bandpath.pdf
Additional behavior:
- relaxation-related keywords such as relax_geometry and relax_unit_cell are removed
- the band path is converted into output band ... lines
- ASE is used to determine the special k-points and path segments
VASP Bands Inputs¶
To generate VASP band inputs, you must provide:
- vasp_par including potcar_dir
- vasp_out_file, pointing to the relaxation output (OUTCAR) inside vc-relax/
The code then writes:
- bands/POSCAR, bands/POTCAR, bands/INCAR
- bands/KPOINTS in line mode, one segment per pair of special points
- bands/bandpath.pdf
The INCAR is written for a non-self-consistent run: NSW=0, IBRION=-1, ICHARG=11, LORBIT=11, ISIF=0, LCHARG=False, and EDIFFG removed. ICHARG=11 means VASP reads the converged charge density, so the CHGCAR of the corresponding vc-relax run must be available.
Phonon Inputs¶
Phonon input files are generated separately with create_phonons_in(). VASP phonon inputs are not implemented; passing vasp_par only triggers a warning.
Quantum ESPRESSO Phonon Inputs¶
For Quantum ESPRESSO phonon calculations, qe_par is interpreted as a ph.x input dictionary rather than a pw.x dictionary.
The package merges the user dictionary with the defaults stored in QE_PHONON_DEFAULTS:
QE_PHONON_DEFAULTS = {
"fildvscf": "dvscf_q",
"outdir": "./tmp",
"ldisp": True,
"tr2_ph": 1e-14,
"nq1": 2,
"nq2": 2,
"nq3": 2,
}
For each cluster, the code writes:
- phonons/ph.in
To generate these files, qe_par must still contain pseudo_dir, because the workflow uses that key to determine whether Quantum ESPRESSO phonon inputs should be created.
FHI-aims Phonon Inputs¶
For FHI-aims phonon calculations, create_phonons_in() writes files in
- phonons/geometry.in
- phonons/control.in
The relaxed structure is the last structure in vc-relax/<aims_out_file>. If aims_out_file is None, vc-relax/geometry.in.next_step is used instead. A warning is raised if aims_out_file shows an unfinished run or an unconverged relaxation. The code:
- writes geometry.in for the phonon supercell, atoms.repeat(phonon_supercell), where phonon_supercell defaults to (1, 1, 1)
- with aims_calculate_friction=True, adds a calculate_friction .true. line after every atom in geometry.in
- writes control.in from aims_par, so every phonon-specific keyword is passed through as given
egqca.create_phonons_in(
out_dir,
aims_par=aims_par,
aims_out_file="aims.out",
phonon_supercell=(2, 2, 2),
aims_calculate_friction=True,
)
Practical Notes¶
- The dictionaries are intentionally close to the native solver input format, so it is useful to consult the corresponding Quantum ESPRESSO, FHI-aims, and ASE documentation when adding advanced keywords.
- ASE handles the actual file writing, so not every solver keyword is controlled directly by
egqcaitself. - For Quantum ESPRESSO, pseudopotential availability is checked automatically against the elements present in each structure.
- For FHI-aims, a valid species defaults directory is required before any input files can be written.