aiida_atomistic.data.structure.site#
Attributes#
Classes#
A subclass of list that represents an immutable list. |
|
This class contains the core information about a given site of the system. |
|
This class contains the core information about a given site of the system. |
Functions#
Convert input to numpy array if it isn't already. |
|
Serialize numpy array to list. |
|
|
Recursively freezes a nested dictionary or list by converting it into an immutable object. |
Module Contents#
- aiida_atomistic.data.structure.site._validate_array(v)[source]#
Convert input to numpy array if it isn’t already.
- aiida_atomistic.data.structure.site.freeze_nested(obj)[source]#
Recursively freezes a nested dictionary or list by converting it into an immutable object.
- Args:
obj (dict or list): The nested dictionary or list to be frozen.
- Returns:
AttributesFrozendict or FrozenList: The frozen version of the input object.
- class aiida_atomistic.data.structure.site.FrozenList[source]#
Bases:
listA subclass of list that represents an immutable list.
This class overrides the __setitem__ method to raise a ValueError when attempting to modify the list.
Usage: >>> my_list = FrozenList([1, 2, 3]) >>> my_list[0] = 4 ValueError: This list is immutable…
- class aiida_atomistic.data.structure.site.Site(/, **data: Any)[source]#
Bases:
pydantic.BaseModelThis class contains the core information about a given site of the system.
It can be a single atom, or an alloy, or even contain vacancies.
- model_config[source]#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property is_alloy[source]#
Return whether the Site is an alloy, i.e. contains more than one element
- Returns:
boolean, True if the kind has more than one element, False otherwise.
- property alloy_list[source]#
Return the list of elements in the given site which is defined as an alloy
- property has_vacancies[source]#
Return whether the Structure contains vacancies, i.e. when the sum of the weight is less than one.
Note
the property uses the internal variable _SUM_THRESHOLD as a threshold.
- Returns:
boolean, True if the sum of the weight is less than one, False otherwise
- classmethod get_default_tolerances() dict[source]#
Extract default tolerances from field metadata.
Returns a dictionary mapping property names to their default tolerance values as defined in the json_schema_extra metadata of each field.
- Returns:
dictionary with property names as keys and tolerance values as floats
- Example:
>>> Site.get_default_tolerances() {'position': 1e-06, 'mass': 0.001, 'charge': 0.0001, 'magmom': 0.01, 'magnetization': 0.01, 'weight': 0.0001}
- classmethod from_ase_atom(aseatom: ase.Atom | None = None, **kwargs) dict[source]#
Convert an ASE atom or dictionary to a dictionary object which the correct format to describe a Site.
- update(**new_data)[source]#
Update the attributes of the SiteCore instance with new values.
- Parameters:
new_data – keyword arguments representing the attributes to be updated
- get_magmom_coord(coord='spherical')[source]#
Get magnetic moment in given coordinate.
- Returns:
spherical theta and phi in unit rad cartesian x y and z in unit ang
- set_automatic_kind_name(tag=None)[source]#
Set the type to a string obtained with the symbol appended one after the other, without spaces, in alphabetical order; if the site has a vacancy, a X is appended at the end too.
- Parameters:
tag – optional tag to be appended to the kind name
- to_ase()[source]#
Return a ase.Atom object for this site.
- Parameters:
kind_name – the list of kind_name from the StructureData object.
- Returns:
ase.Atom object representing this site
- Raises:
ValueError – if any site is an alloy or has vacancies