Chemical System

class dipm.data.chemical_system.ChemicalSystem(*, atomic_numbers: ndarray, atomic_species: ndarray, positions: ndarray, energy: float | None = None, forces: ndarray | None = None, stress: ndarray | None = None, cell: ndarray | None = None, pbc: tuple[bool, bool, bool] | None = None, weight: float = 1.0, atomic_charges: ndarray | None = None, charge: int | None = None, spin: int | None = None, dipole: ndarray | None = None)

Pydantic dataclass for a chemical system.

The chemical system objects are returned by the chemical systems’ reader. This class also performs the validations listed below.

atomic_numbers

The atomic numbers of the system. This should be a 1-dimensional array of length “number of atoms”.

Type:

numpy.ndarray

atomic_species

The atomic species of the system, which are the features of each element (this can be a single value or an array itself). This array can be either one or two-dimensional, depending on the number of features per atom.

Type:

numpy.ndarray

positions

The array of positions for the system in Angstrom.

Type:

numpy.ndarray

energy

Optionally, a reference energy in eV.

Type:

float | None

forces

Optionally, reference forces in eV/Angstrom.

Type:

numpy.ndarray | None

stress

Optionally, the stress in eV/Angstrom^3.

Type:

numpy.ndarray | None

cell

Optionally, a unit cell, which is an array of shape (3, 3).

Type:

numpy.ndarray | None

pbc

Optionally, periodic boundary conditions, which is a tuple of three booleans, one for each dimension whether the unit cell is periodic in that dimension.

Type:

tuple[bool, bool, bool] | None

weight

A weighting factor for this configuration in the dataset, by default set to 1.0.

Type:

float

atomic_charges

Optionally, the atomic charges of the system.

Type:

numpy.ndarray | None

charge

Optionally, the total charge of the system.

Type:

int | None

spin

Optionally, the total spin of the system.

Type:

int | None

dipole

Optionally, the dipole moment of the system.

Type:

numpy.ndarray | None

__init__(**data: Any) None

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

validate_variable_shapes() Self

Validates that atomic species, positions, and forces have the correct shape.

classmethod validate_cell_shape(value: ndarray | None) ndarray | None

Validates that the cell has the correct shape.

classmethod validate_stress_shape(value: ndarray | None) ndarray | None

Validates that the stress has the correct shape.