aiida_atomistic.data.structure.site#

Classes#

FrozenList

A subclass of list that represents an immutable list.

Site

This class contains the core information about a given site of the system.

FrozenSite

This class contains the core information about a given site of the system.

Functions#

freeze_nested(obj)

Recursively freezes a nested dictionary or list by converting it into an immutable object.

Module Contents#

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: list

A 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…

__setitem__(index, value)[source]#

Set self[key] to value.

class aiida_atomistic.data.structure.site.Site(/, **data: Any)[source]#

Bases: pydantic.BaseModel

This 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.

_mutable: ClassVar[bool] = True[source]#
model_config[source]#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

symbol: str | List[str][source]#
position: numpy.ndarray[float] = None[source]#
mass: float | None = None[source]#
charge: float | None = None[source]#
magmom: numpy.ndarray[float] | None = None[source]#
magnetization: float | None = None[source]#
weight: Tuple[float, Ellipsis] | None = None[source]#
kind_name: str | None = None[source]#
classmethod ensure_numpy_array(v)[source]#

We want to ensure that the input is a numpy array.

check_minimal_requirements(data)[source]#
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 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

class aiida_atomistic.data.structure.site.FrozenSite(/, **data: Any)[source]#

Bases: Site

This 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.

_mutable: ClassVar[bool] = False[source]#
model_config[source]#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].