aiida_quantumespresso.utils.hubbard
#
Utility class for handling the aiida_quantumespresso.data.hubbard_structure.HubbardStructureData
.
Module Contents#
Classes#
Utility class for handling HubbardStructureData for QuantumESPRESSO. |
Functions#
Initialize the on-site and intersite parameters using nearest neighbour finders. |
|
|
Return the atomic index in 3x3x3 supercell. |
|
Return the atomic index in unitcell and the associated translation from a 3x3x3 QuantumESPRESSO supercell index. |
|
Return the set list of Hubbard indices. |
|
Return whether Hubbard contains intersite interactions (+V). |
|
Return the maximum number of neighbours found. |
- class aiida_quantumespresso.utils.hubbard.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[source]#
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)
- aiida_quantumespresso.utils.hubbard.initialize_hubbard_parameters(structure: aiida.orm.StructureData, pairs: Dict[str, Tuple[str, float, float, Dict[str, str]]], nn_finder: str = 'crystal', nn_inputs: Dict | None = None, fold: bool = True, standardize: bool = False, radius_max: float = 7.0, thr: float = 1e-05, use_kinds: bool = True, **_) aiida_quantumespresso.data.hubbard_structure.HubbardStructureData [source]#
Initialize the on-site and intersite parameters using nearest neighbour finders.
It peforms a nearest neighbour analysis (via pymatgen modules) to find the first inersite neighbours for all the onsite atoms. Only the atoms in the pair, and that are nearest neighbours from the analysis, are initialized.
- Parameters:
structure – a StructureData instance
pairs – dictionary of the kind {onsite name: [onsite manifold, onsite value, intersites value, {neighbour name: neighbour manifold}], …} For example: {‘Fe’: [‘3d’, 5.0, 1.0, {‘O’:’2p’, ‘O1’:’1s’, ‘Se’:’4p’}]}
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)
fold – whether to fold in within the cell the atoms
standardize – whether to standardize the atoms and the cell via spglib (symmetry analysis)
radius_max – max radius where to look for neighbouring atoms, in Angstrom
thr – threshold to refold the atoms with crystal coordinates close to 1.0
use_kinds – whether to use kinds for initializing the parameters; when False, it initializes all the
Kinds
matching the given specie
- Returns:
HubbardStructureData with initialized Hubbard parameters
- aiida_quantumespresso.utils.hubbard.get_supercell_atomic_index(index: int, num_sites: int, translation: List[Tuple[int, int, int]]) int [source]#
Return the atomic index in 3x3x3 supercell.
- Parameters:
index – atomic index in unit cell
num_sites – number of sites in structure
translation – (3,) shape list of int referring to the translated atom in the 3x3x3 supercell
- Returns:
atomic index in supercell standardized with the QuantumESPRESSO loop
- aiida_quantumespresso.utils.hubbard.get_index_and_translation(index: int, num_sites: int) Tuple[int, List[Tuple[int, int, int]]] [source]#
Return the atomic index in unitcell and the associated translation from a 3x3x3 QuantumESPRESSO supercell index.
- Parameters:
index – atomic index
num_sites – number of sites in structure
- Returns:
tuple (index, (3,) shape list of ints)
- aiida_quantumespresso.utils.hubbard.get_hubbard_indices(hubbard: aiida_quantumespresso.common.hubbard.Hubbard) List[int] [source]#
Return the set list of Hubbard indices.
- aiida_quantumespresso.utils.hubbard.is_intersite_hubbard(hubbard: aiida_quantumespresso.common.hubbard.Hubbard) bool [source]#
Return whether Hubbard contains intersite interactions (+V).
- aiida_quantumespresso.utils.hubbard.max_number_of_neighbours(intersites_list: List[Tuple[int, int]]) int [source]#
Return the maximum number of neighbours found.
Note
it assumes only one onsite parameter is defined per atom index, that means intra Hubbard interactions are not defined, such as V Fe 3d Fe 2p 1 1 1.0
- Parameters:
intersites_list – list of lists of shape (atom index, neigbours index)