deepmd.common
Module Contents
Functions
| Specify data requirements for training. |
| Build map of indices for element supplied element types from all atoms list. |
| Make mesh. |
| Assert that supplied dictionary conaines specified key. |
| Load yaml or json settings file. |
| Recursively iterate over directories taking those that contain type.raw file. |
| Get numpy precision constant from string. |
Attributes
- deepmd.common.add_data_requirement(key: str, ndof: int, atomic: bool = False, must: bool = False, high_prec: bool = False, type_sel: bool | None = None, repeat: int = 1, default: float = 0.0, dtype: numpy.dtype | None = None, output_natoms_for_type_sel: bool = False)[source]
Specify data requirements for training.
- Parameters:
- key
str
type of data stored in corresponding *.npy file e.g. forces or energy
- ndof
int
number of the degrees of freedom, this is tied to atomic parameter e.g. forces have atomic=True and ndof=3
- atomicbool,
optional
specifies whwther the ndof keyworrd applies to per atom quantity or not, by default False
- mustbool,
optional
specifi if the *.npy data file must exist, by default False
- high_precbool,
optional
if true load data to np.float64 else np.float32, by default False
- type_selbool,
optional
select only certain type of atoms, by default None
- repeat
int
,optional
if specify repaeat data repeat times, by default 1
- default
float
,optional
, default=0. default value of data
- dtype
np.dtype
,optional
the dtype of data, overwrites high_prec if provided
- output_natoms_for_type_selbool,
optional
if True and type_sel is True, the atomic dimension will be natoms instead of nsel
- key
- 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_types
np.ndarray
array specifing type for each atoms as integer
- select_types
np.ndarray
types of atoms you want to find indices for
- atom_types
- 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:
- Returns:
np.ndarray
mesh
- deepmd.common.j_must_have(jdata: Dict[str, _DICT_VAL], key: str, deprecated_key: List[str] = []) _DICT_VAL [source]
Assert that supplied dictionary conaines specified key.
- Returns:
_DICT_VAL
value that was store unde supplied key
- Raises:
RuntimeError
if the key is not present
- deepmd.common.j_loader(filename: str | pathlib.Path) Dict[str, Any] [source]
Load yaml or json settings file.
- deepmd.common.expand_sys_str(root_dir: str | pathlib.Path) List[str] [source]
Recursively iterate over directories taking those that contain type.raw file.
- 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
- precision
- Returns:
np.dtype
numpy presicion constant
- Raises:
RuntimeError
if string is invalid