deepmd.common#

Attributes#

Functions#

select_idx_map(→ numpy.ndarray)

Build map of indices for element supplied element types from all atoms list.

make_default_mesh(→ numpy.ndarray)

Make mesh.

j_loader(→ dict[str, Any])

Load yaml or json settings file.

expand_sys_str(→ list[str])

Recursively iterate over directories taking those that contain type.raw file.

get_np_precision(→ numpy.dtype)

Get numpy precision constant from string.

Module Contents#

deepmd.common.GLOBAL_NP_FLOAT_PRECISION[source]#
deepmd.common.VALID_PRECISION: set[_PRECISION][source]#
deepmd.common.VALID_ACTIVATION: set[_ACTIVATION][source]#
deepmd.common.select_idx_map(atom_types: numpy.ndarray, select_types: numpy.ndarray) → numpy.ndarray[source]#

Build map of indices for element supplied element types from all atoms list.

Parameters:
atom_typesnp.ndarray

array specifying type for each atoms as integer

select_typesnp.ndarray

types of atoms you want to find indices for

Returns:
np.ndarray

indices of types of atoms defined by select_types in atom_types array

Warning

select_types array will be sorted before finding indices in atom_types

deepmd.common.make_default_mesh(pbc: bool, mixed_type: bool) → numpy.ndarray[source]#

Make mesh.

Only the size of mesh matters, not the values: * 6 for PBC, no mixed types * 0 for no PBC, no mixed types * 7 for PBC, mixed types * 1 for no PBC, mixed types

Parameters:
pbcbool

if True, the mesh will be made for periodic boundary conditions

mixed_typebool

if True, the mesh will be made for mixed types

Returns:
np.ndarray

mesh

deepmd.common.j_loader(filename: str | pathlib.Path) → dict[str, Any][source]#

Load yaml or json settings file.

Parameters:
filenameUnion[str, Path]

path to file

Returns:
dict[str, Any]

loaded dictionary

Raises:
TypeError

if the supplied file is of unsupported type

deepmd.common.expand_sys_str(root_dir: str | pathlib.Path) → list[str][source]#

Recursively iterate over directories taking those that contain type.raw file.

Parameters:
root_dirUnion[str, Path]

starting directory

Returns:
list[str]

list of string pointing to system directories

deepmd.common.get_np_precision(precision: _PRECISION) → numpy.dtype[source]#

Get numpy precision constant from string.

Parameters:
precision_PRECISION

string name of numpy constant or default

Returns:
np.dtype

numpy precision constant

Raises:
RuntimeError

if string is invalid