aiida_quantumespresso.calculations
#
Base CalcJob for implementations for pw.x and cp.x of Quantum ESPRESSO.
Subpackages#
aiida_quantumespresso.calculations.functions
aiida_quantumespresso.calculations.functions.xspectra
aiida_quantumespresso.calculations.functions.create_kpoints_from_distance
aiida_quantumespresso.calculations.functions.create_magnetic_configuration
aiida_quantumespresso.calculations.functions.merge_ph_outputs
aiida_quantumespresso.calculations.functions.seekpath_structure_analysis
aiida_quantumespresso.calculations.helpers
Submodules#
aiida_quantumespresso.calculations.bands
aiida_quantumespresso.calculations.base
aiida_quantumespresso.calculations.cp
aiida_quantumespresso.calculations.dos
aiida_quantumespresso.calculations.epw
aiida_quantumespresso.calculations.matdyn
aiida_quantumespresso.calculations.namelists
aiida_quantumespresso.calculations.neb
aiida_quantumespresso.calculations.open_grid
aiida_quantumespresso.calculations.ph
aiida_quantumespresso.calculations.pp
aiida_quantumespresso.calculations.projwfc
aiida_quantumespresso.calculations.pw
aiida_quantumespresso.calculations.pw2gw
aiida_quantumespresso.calculations.pw2wannier90
aiida_quantumespresso.calculations.pwimmigrant
aiida_quantumespresso.calculations.q2r
aiida_quantumespresso.calculations.xspectra
Package Contents#
Classes#
Structure data containing code agnostic info on Hubbard parameters. |
|
Utility class for handling HubbardStructureData for QuantumESPRESSO. |
|
Custom CalcJob class for aiida-quantumespresso calculations. |
|
Base CalcJob for implementations for pw.x and cp.x of Quantum ESPRESSO. |
Functions#
|
Convert a key and a value, from an input parameters dictionary for a namelist calculation. |
|
|
|
|
|
|
|
Delete any parser options from the settings dictionary. |
Attributes#
- class aiida_quantumespresso.calculations.HubbardStructureData(cell: List[List[float]], sites: List[Tuple[str, str, Tuple[float, float, float]]], pbc: Tuple[bool, bool, bool] = (True, True, True), hubbard: aiida_quantumespresso.common.hubbard.Hubbard = None, **kwargs)[source]#
Bases:
aiida.orm.StructureData
Structure data containing code agnostic info on Hubbard parameters.
- property hubbard: aiida_quantumespresso.common.hubbard.Hubbard#
Get the Hubbard instance.
- Returns:
a
Hubbard
instance.
- _hubbard_filename = 'hubbard.json'#
- static from_structure(structure: aiida.orm.StructureData, hubbard: aiida_quantumespresso.common.hubbard.Hubbard | None = None)[source]#
Return an instance of
HubbardStructureData
from aStructureData
node.- Parameters:
structure –
aiida.orm.StructureData
instancehubbard –
Hubbard
instance
- Returns:
HubbardStructureData
instance
- append_hubbard_parameter(atom_index: int, atom_manifold: str, neighbour_index: int, neighbour_manifold: str, value: float, translation: Tuple[int, int, int] = None, hubbard_type: str = 'Ueff')[source]#
Append a
HubbardParameters
.- Parameters:
atom_index – atom index in unitcell
atom_manifold – atomic manifold (e.g. 3d, 3d-2p)
neighbour_index – neighbouring atom index in unitcell
neighbour_manifold – neighbour manifold (e.g. 3d, 3d-2p)
value – value of the Hubbard parameter, in eV
translation – (3,) list of ints, describing the translation vector associated with the neighbour atom, defaults to None
hubbard_type – hubbard type (U, V, J, …), defaults to ‘Ueff’ (see
Hubbard
for full allowed values)
- pop_hubbard_parameters(index: int)[source]#
Pop Hubbard parameters in the list.
- Parameters:
index – index of the Hubbard parameters to pop
- initialize_intersites_hubbard(atom_name: str, atom_manifold: str, neighbour_name: str, neighbour_manifold: str, value: float = 1e-08, hubbard_type: str = 'V', use_kinds: bool = True)[source]#
Initialize and append intersite Hubbard values between an atom and its neighbour(s).
Note
this only initialize the value between the first neighbour. In case use_kinds is False, all the possible combination of couples having kind name equal to symbol are initialized.
- Parameters:
atom_name – atom name in unitcell
atom_manifold – atomic manifold (e.g. 3d, 3d-2p)
neighbour_index – neighbouring atom name in unitcell
neighbour_manifold – neighbour manifold (e.g. 3d, 3d-2p)
value – value of the Hubbard parameter, in eV
hubbard_type – hubbard type (U, V, J, …), defaults to ‘V’ (see
Hubbard
for full allowed values)use_kinds – whether to use kinds for initializing the parameters; when False, it initializes all the
Kinds
matching theatom_name
- initialize_onsites_hubbard(atom_name: str, atom_manifold: str, value: float = 1e-08, hubbard_type: str = 'Ueff', use_kinds: bool = True)[source]#
Initialize and append onsite Hubbard values of atoms with specific name.
- Parameters:
atom_name – atom name in unitcell
atom_manifold – atomic manifold (e.g. 3d, 3d-2p)
value – value of the Hubbard parameter, in eV
hubbard_type – hubbard type (U, J, …), defaults to ‘Ueff’ (see
Hubbard
for full allowed values)use_kinds – whether to use kinds for initializing the parameters; when False, it initializes all the
Kinds
matching theatom_name
- aiida_quantumespresso.calculations.convert_input_to_namelist_entry(key, val, mapping=None)[source]#
Convert a key and a value, from an input parameters dictionary for a namelist calculation.
Map it to the appropriate string format for the namelist input file. For single values it will return a single string, but for values that are a dictionary, list or tuple, the returned string may be multiline.
- Parameters:
key – the namelist keyword name
val –
the namelist keyword value The value can be either a single value, list/tuple, a double nested list or a dictionary. Depending on the type of the value the resulting string differs vastly
- single list:
A list of keywords will be generated, where the index of the value in the list will be used as the index in the keyword and the value itself will be converted using conv_to_fortran. For example:
'efield': [4, 5, 6]
will result in:
efield(1) = 4 efield(1) = 5 efield(1) = 6
- double nested list:
This format can be used for keywords that require one or more indices that do not necessarily follow a sequential number, but take specific values that need to be defined by the user. For example:
'starting_ns_eigenvalue': [ [1, 1, 3, 3.5], [2, 1, 1, 2.8] ]
will be formatted as:
starting_ns_eigenvalue(1,1,3) = 3.5 starting_ns_eigenvalue(2,1,1) = 2.8
Note that if the mapping argument is provided in the input, any value in sub lists that matches a key in the mapping dictionary (that is to say it is a string that matches one of the kinds), it will be replaced with the index of the corresponding atomic species. For example:
hubbard_j: [ [2, 'Ni', 3.5], [2, 'Fe', 7.4], ]
would be formatted as:
hubbard_j(2, 1) = 3.5 hubbard_j(2, 3) = 7.4
Assuming the mapping dictionary contained the kinds ‘Ni’ and ‘Fe’, with the indices 1 and 3, respectively
- dictionary:
The keys of this dictionary should correspond to keys in the mapping input argument and will be replaced with the corresponding value. This can be used for keywords that take a single index that needs to conform to the index of the atomic species to which the keyword value should apply. For example:
hubbard_u: { 'Co': 3.5, 'O': 7.4, }
will be formatted as:
hubbard_u(1) = 3.5 hubbard_u(3) = 7.4
assuming that the kinds ‘Co’ and ‘O’ would have atomic species indices 1 and 3, respectively. This mapping from kind name to atomic species index should be defined by the mapping argument.
mapping –
optional parameter, that must be provided if val is a dictionary or a double nested list where the sub lists contain string values. The keys of the mapping dictionary should be the atomic species names that will be encountered in the value, and the corresponding value should be the index of that atomic species. Example:
mapping = { 'Fe': 1, 'O': 2, }
This will map every occurrence of ‘Fe’ and ‘O’ in the values to the corresponding integer.
- class aiida_quantumespresso.calculations.HubbardUtils(hubbard_structure: aiida_quantumespresso.data.hubbard_structure.HubbardStructureData)[source]#
Utility class for handling HubbardStructureData for QuantumESPRESSO.
- property hubbard_structure: aiida_quantumespresso.data.hubbard_structure.HubbardStructureData#
Return the HubbardStructureData.
- parse_hubbard_dat(filepath: str | os.PathLike)[source]#
Parse the HUBBARD.dat of QuantumESPRESSO file associated to the current structure.
This function is needed for parsing the HUBBARD.dat file generated in a hp.x calculation.
Note
overrides current Hubbard information.
- Parameters:
filepath – the filepath of the HUBBARD.dat to parse
- reorder_atoms()[source]#
Reorder the atoms with with the kinds in the right order necessary for an
hp.x
calculation.An
HpCalculation
which restarts from a completedPwCalculation
, requires that the all Hubbard atoms appear first in the atomic positions card of thePwCalculation
input file. This order is based on the order of the kinds in the structure. So a suitable structure has all Hubbard kinds in the begining of kinds list.Note
overrides current
HubbardStructureData
- is_to_reorder() bool [source]#
Return whether the atoms should be reordered for an
hp.x
calculation.
- get_hubbard_for_supercell(supercell: aiida.orm.StructureData, thr: float = 0.001) aiida_quantumespresso.data.hubbard_structure.HubbardStructureData [source]#
Return the
HubbbardStructureData
for a supercell.Note
the two structure need to be commensurate (no rigid rotations)
Warning
always check that the energy calculation of a pristine supercell structure obtained through this method is the same as the unitcell (within numerical noise)
- Returns:
a new
HubbbardStructureData
with all the mapped Hubbard parameters
- get_interacting_pairs() Dict[str, List[str]] [source]#
Return tuple of kind name interaction pairs.
- Returns:
dictionary of onsite kinds with a list of V kinds
- get_pairs_radius(onsite_index: int, neighbours_names: List[str], number_of_neighbours: int, radius_max: float = 7.0, thr: float = 0.01) Tuple[float, float] [source]#
Return the minimum and maximum radius of the first neighbours of the onsite site.
- Parameters:
onsite_index – index in the structure of the onsite Hubbard atom
neighbours_names – kind names of the neighbours
number_of_neighbours – number of neighbours coming to select
radius_max – maximum radius (in Angstrom) to use for looking for neighbours
thr – threshold (in Angstrom) for defining the shells
- Returns:
(radius min +thr, radius max -thr) defining the shells containing only the first neighbours
- get_intersites_radius(nn_finder: str = 'crystal', nn_inputs: Dict | None = None, radius_max: float = 7.0, thr: float = 0.01, **_) float [source]#
Return the radius (in Angstrom) for intersites from nearest neighbour finders.
It peforms a nearest neighbour analysis (via pymatgen modules) to find the first inersite neighbours for all the onsite atoms. A radius is returned which can be used to run an
hp.x
calculation. Such radius defines a shell including only the first neighbours of each onsite Hubbard atom.- Parameters:
nn_finder – string defining the nearest neighbour finder; options are: * crystal: use
pymatgen.analysis.local_env.CrystalNN
* voronoi: usepymatgen.analysis.local_env.VoronoiNN
nn_inputs – inputs for the nearest neighbours finder; when None, standard inputs are used to find geometric first neighbours (recommended)
radius_max – max radius where to look for neighbouring atoms, in Angstrom
thr – threshold (in Angstrom) for defining the shells
- Returns:
radius defining the shell containing only the first neighbours
- get_intersites_list(nn_finder: str = 'crystal', nn_inputs: Dict | None = None, radius_max: float = 7.0, **_) List[Tuple[int, int, Tuple[int, int, int]]] [source]#
Return the list of intersites from nearest neighbour finders.
It peforms a nearest neighbour analysis (via pymatgen modules) to find the first inersite neighbours for all the onsite atoms. A list is returned with all the nearest neighbours providing all the information about the couples indices and the associated trasnaltion vector. Also on-site information is included.
- Parameters:
nn_finder – string defining the nearest neighbour finder; options are: * crystal: use
pymatgen.analysis.local_env.CrystalNN
* voronoi: usepymatgen.analysis.local_env.VoronoiNN
nn_inputs – inputs for the nearest neighbours finder; when None, standard inputs are used to find geometric first neighbours (recommended)
radius_max – max radius where to look for neighbouring atoms, in Angstrom
thr – threshold (in Angstrom) for defining the shells
- Returns:
list of lists, each having (atom index, neighbouring index, translation vector)
- get_max_number_of_neighbours(nn_finder: str = 'crystal', nn_inputs: Dict | None = None, radius_max: float = 7.0, **_) list [source]#
Return the maximum number of nearest neighbours, aslo counting the non-interacting ones.
It peforms a nearest neighbour analysis (via pymatgen modules) to find the first inersite neighbours for all the onsite atoms. A list is returned with all the nearest neighbours providing all the information about the couples indices and the associated trasnaltion vector. Also on-site information is included.
- Parameters:
nn_finder – string defining the nearest neighbour finder; options are: * crystal: use
pymatgen.analysis.local_env.CrystalNN
* voronoi: usepymatgen.analysis.local_env.VoronoiNN
nn_inputs – inputs for the nearest neighbours finder; when None, standard inputs are used to find geometric first neighbours (recommended)
radius_max – max radius where to look for neighbouring atoms, in Angstrom
thr – threshold (in Angstrom) for defining the shells
- Returns:
list of lists, each having (atom index, neighbouring index, translation vector)
- class aiida_quantumespresso.calculations.CalcJob(*args, **kwargs)[source]#
Bases:
aiida.engine.CalcJob
Custom CalcJob class for aiida-quantumespresso calculations.
- _spec_class#
- exception aiida_quantumespresso.calculations.QEInputValidationError[source]#
Bases:
aiida.common.InputValidationError
Raise when the parser encounters an error while creating the input file of Quantum ESPRESSO.
- class aiida_quantumespresso.calculations.BasePwCpInputGenerator(*args, **kwargs)[source]#
Bases:
base.CalcJob
Base CalcJob for implementations for pw.x and cp.x of Quantum ESPRESSO.
- xml_filenames()[source]#
Return a list of XML output filenames that can be written by a calculation.
Note that this includes all potential filenames across all known versions of Quantum ESPRESSO
- abstract xml_filepaths()[source]#
Return a list of XML output filepaths relative to the remote working directory that should be retrieved.
- prepare_for_submission(folder)[source]#
Create the input files from the input nodes passed to this instance of the CalcJob.
- Parameters:
folder – an aiida.common.folders.Folder to temporarily write files on disk
- Returns:
aiida.common.datastructures.CalcInfo instance
- _add_parallelization_flags_to_cmdline_params(cmdline_params)[source]#
Get the command line parameters with added parallelization flags.
Adds the parallelization flags to the given cmdline_params and returns the updated list.
Raises an InputValidationError if multiple aliases to the same flag are given in cmdline_params, or the same flag is given both in cmdline_params and the explicit parallelization input.