deepmd.utils.spin

Module Contents

Classes

Spin

Class for spin, mainly processes the spin type-related information.

class deepmd.utils.spin.Spin(use_spin: List[bool], virtual_scale: List[float] | float)[source]

Class for spin, mainly processes the spin type-related information. Atom types can be split into three kinds: 1. Real types: real atom species, “Fe”, “H”, “O”, etc. 2. Spin types: atom species with spin, as virtual atoms in input, “Fe_spin”, etc. 3. Placeholder types: atom species without spin, as placeholders in input without contribution, also name “H_spin”, “O_spin”, etc. For any types in 2. or 3., the type index is ntypes plus index of its corresponding real type.

Parameters:
use_spin: List[bool]

A list of boolean values indicating whether to use atomic spin for each atom type. True for spin and False for not. List of bool values with shape of [ntypes].

virtual_scale: List[float], float

The scaling factor to determine the virtual distance between a virtual atom representing spin and its corresponding real atom for each atom type with spin. This factor is defined as the virtual distance divided by the magnitude of atomic spin for each atom type with spin. The virtual coordinate is defined as the real coordinate plus spin * virtual_scale. List of float values with shape of [ntypes] or [ntypes_spin] or one single float value for all types, only used when use_spin is True for each atom type.

get_ntypes_real() int[source]

Returns the number of real atom types.

get_ntypes_spin() int[source]

Returns the number of atom types which contain spin.

get_ntypes_real_and_spin() int[source]

Returns the number of real atom types and types which contain spin.

get_ntypes_input() int[source]

Returns the number of double real atom types for input placeholder.

get_use_spin() List[bool][source]

Returns the list of whether to use spin for each atom type.

get_virtual_scale() numpy.ndarray[source]

Returns the list of magnitude of atomic spin for each atom type.

init_pair_exclude_types_placeholder() None[source]

Initialize the pair-wise exclusion types for descriptor. The placeholder types for those without spin are excluded.

init_atom_exclude_types_placeholder_spin() None[source]

Initialize the atom-wise exclusion types for fitting. Both the placeholder types and spin types are excluded.

init_atom_exclude_types_placeholder() None[source]

Initialize the atom-wise exclusion types for fitting. The placeholder types for those without spin are excluded.

get_pair_exclude_types(exclude_types=None) List[Tuple[int, int]][source]

Return the pair-wise exclusion types for descriptor. The placeholder types for those without spin are excluded.

get_atom_exclude_types(exclude_types=None) List[int][source]

Return the atom-wise exclusion types for fitting before out_def. Both the placeholder types and spin types are excluded.

get_atom_exclude_types_placeholder(exclude_types=None) List[int][source]

Return the atom-wise exclusion types for fitting after out_def. The placeholder types for those without spin are excluded.

get_spin_mask()[source]

Return the spin mask of shape [ntypes], with spin types being 1, and non-spin types being 0.

get_virtual_scale_mask()[source]

Return the virtual scale mask of shape [ntypes], with spin types being its virtual scale, and non-spin types being 0.

serialize() dict[source]
classmethod deserialize(data: dict) Spin[source]