aiida_atomistic.data.structure.getter_mixin#
Attributes#
Classes#
Module Contents#
- aiida_atomistic.data.structure.getter_mixin._DEFAULT_CELL = ((0, 0, 0), (0, 0, 0), (0, 0, 0))[source]#
- class aiida_atomistic.data.structure.getter_mixin.GetterMixin[source]#
Bases:
aiida_atomistic.data.structure.hubbard_mixin.HubbardGetterMixin
- static get_supported_properties()[source]#
Get a dictionary of global and site properties that can be set for this structure.
- get_defined_properties()[source]#
Retrieve the defined properties of the structure, categorized into direct, computed, and site-specific properties.
- Args:
exclude_computed (bool): If False, all properties will be returned, including those computed after the initialization (the pydantic computed fields). exclude_defaults (bool): If True, properties with default values will be excluded from the result.
- classmethod from_ase(aseatoms: ASE_ATOMS_TYPE, detect_kinds: bool = False)[source]#
Load the structure from a ASE object
- classmethod from_file(filename, format='cif', detect_kinds: bool = False, **kwargs)[source]#
Load the structure from a file.
- classmethod from_pymatgen(pymatgen_obj: PYMATGEN_MOLECULE | PYMATGEN_STRUCTURE, detect_kinds: bool = False, **kwargs)[source]#
Load the structure from a pymatgen object.
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors).
- classmethod _from_pymatgen_molecule(mol: PYMATGEN_MOLECULE, margin=5, detect_kinds: bool = False)[source]#
Load the structure from a pymatgen Molecule object.
- Parameters:
margin – the margin to be added in all directions of the bounding box of the molecule.
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors).
- classmethod _from_pymatgen_structure(struct: PYMATGEN_STRUCTURE, detect_kinds: bool = False)[source]#
Load the structure from a pymatgen Structure object.
Note
periodic boundary conditions are set to True in all three directions.
Note
Requires the pymatgen module (version >= 3.3.5, usage of earlier versions may cause errors).
- Raises:
ValueError – if there are partial occupancies together with spins.
- to_kinds_based(tolerance: dict | float = 0.001)[source]#
Convert the structure to a kinds-based representation.
- get_cif(converter='ase', store=False, **kwargs)[source]#
Creates
aiida.orm.nodes.data.cif.CifData
.- Parameters:
converter – specify the converter. Default ‘ase’.
store – If True, intermediate calculation gets stored in the AiiDA database for record. Default False.
- Returns:
- get_description()[source]#
Returns a string with infos retrieved from StructureData node’s properties
- Parameters:
self – the StructureData node
- Returns:
retsrt: the description string
- get_composition(mode='full')[source]#
Returns the chemical composition of this structure as a dictionary, where each key is the kind symbol (e.g. H, Li, Ba), and each value is the number of occurences of that element in this structure.
- Parameters:
mode – Specify the mode of the composition to return. Choose from
full
,reduced
orfractional
. For example, given the structure with formula Ba2Zr2O6, the various modes operate as follows.full
: The default, the counts are left unnnormalized.reduced
: The counts are renormalized to the greatest common denominator.fractional
: The counts are renormalized such that the sum equals 1.- Returns:
a dictionary with the composition
- to_ase()[source]#
Get the ASE object. Requires to be able to import ase.
- Returns:
an ASE object corresponding to this
StructureData
object.Note
If any site is an alloy or has vacancies, a ValueError is raised (from the site.to_ase() routine).
- to_pymatgen(**kwargs)[source]#
Get pymatgen object. Returns pymatgen Structure for structures with periodic boundary conditions (in 1D, 2D, 3D) and Molecule otherwise. :param add_spin: True to add the spins to the pymatgen structure. Default is False (no spin added).
Note
The spins are set according to the following rule:
if the kind name ends with 1 -> spin=+1
if the kind name ends with 2 -> spin=-1
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors).
- to_file(filename=None, format='cif')[source]#
Writes the structure to a file.
- Args:
filename (_type_, optional): defaults to None. format (str, optional): defaults to “cif”.
- Raises:
ValueError: should provide a filename different from None.
- get_pymatgen_structure(**kwargs)[source]#
Get the pymatgen Structure object with any PBC, provided the cell is not singular. :param add_spin: True to add the spins to the pymatgen structure. Default is False (no spin added).
Note
The spins are set according to the following rule:
if the kind name ends with 1 -> spin=+1
if the kind name ends with 2 -> spin=-1
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors).
- Returns:
a pymatgen Structure object corresponding to this
StructureData
object. :raise ValueError: if the cell is singular, e.g. when it has not been set.Use get_pymatgen_molecule instead, or set a proper cell.
- get_pymatgen_molecule()[source]#
Get the pymatgen Molecule object.
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors).
- Returns:
a pymatgen Molecule object corresponding to this
StructureData
object.
- _prepare_xsf(main_file_name='')[source]#
Write the given structure to a string of format XSF (for XCrySDen).
- _prepare_chemdoodle(main_file_name='')[source]#
Write the given structure to a string of format required by ChemDoodle.
- _adjust_default_cell(vacuum_factor=1.0, vacuum_addition=10.0, pbc=(False, False, False))[source]#
If the structure was imported from an xyz file, it lacks a cell. This method will adjust the cell
- _get_object_phonopyatoms()[source]#
Converts StructureData to PhonopyAtoms
- Returns:
a PhonopyAtoms object
- _get_object_ase()[source]#
Converts
StructureData
to ase.Atoms- Returns:
an ase.Atoms object
- _get_object_pymatgen(**kwargs)[source]#
Converts
StructureData
to pymatgen object- Returns:
a pymatgen Structure for structures with periodic boundary conditions (in three dimensions) and Molecule otherwise
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors).
- _get_object_pymatgen_structure(**kwargs)[source]#
Converts
StructureData
to pymatgen Structure object :param add_spin: True to add the spins to the pymatgen structure. Default is False (no spin added).Note
The spins are set according to the following rule:
if the kind name ends with 1 -> spin=+1
if the kind name ends with 2 -> spin=-1
- Returns:
a pymatgen Structure object corresponding to this
StructureData
object- Raises:
ValueError – if the cell is not set (i.e. is the default one); if there are partial occupancies together with spins (defined by kind names ending with ‘1’ or ‘2’).
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors)
- _get_object_pymatgen_molecule(**kwargs)[source]#
Converts
StructureData
to pymatgen Molecule object- Returns:
a pymatgen Molecule object corresponding to this
StructureData
object.
Note
Requires the pymatgen module (version >= 3.0.13, usage of earlier versions may cause errors)
- _get_dimensionality()[source]#
Return the dimensionality of the structure and its length/surface/volume.
Zero-dimensional structures are assigned “volume” 0.
- Returns:
returns a dictionary with keys “dim” (dimensionality integer), “label” (dimensionality label) and “value” (numerical length/surface/volume).