deepmd.dpmodel.atomic_model.base_atomic_model

Module Contents

Classes

BaseAtomicModel

Base Atomic Model provides the interfaces of an atomic model.

Attributes

BaseAtomicModel_

deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel_[source]
class deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel(type_map: List[str], atom_exclude_types: List[int] = [], pair_exclude_types: List[Tuple[int, int]] = [], rcond: float | None = None, preset_out_bias: Dict[str, numpy.ndarray] | None = None)[source]

Bases: BaseAtomicModel_

Base Atomic Model provides the interfaces of an atomic model.

init_out_stat()[source]

Initialize the output bias.

__setitem__(key, value)[source]
__getitem__(key)[source]
get_type_map() List[str][source]

Get the type map.

reinit_atom_exclude(exclude_types: List[int] = [])[source]
reinit_pair_exclude(exclude_types: List[Tuple[int, int]] = [])[source]
atomic_output_def() deepmd.dpmodel.output_def.FittingOutputDef[source]

Get the output def of the atomic model.

By default it is the same as FittingOutputDef, but it allows model level wrapper of the output defined by the developer.

forward_common_atomic(extended_coord: numpy.ndarray, extended_atype: numpy.ndarray, nlist: numpy.ndarray, mapping: numpy.ndarray | None = None, fparam: numpy.ndarray | None = None, aparam: numpy.ndarray | None = None) Dict[str, numpy.ndarray][source]

Common interface for atomic inference.

This method accept extended coordinates, extended atom typs, neighbor list, and predict the atomic contribution of the fit property.

Parameters:
extended_coord

extended coodinates, shape: nf x (nall x 3)

extended_atype

extended atom typs, shape: nf x nall for a type < 0 indicating the atomic is virtual.

nlist

neighbor list, shape: nf x nloc x nsel

mapping

extended to local index mapping, shape: nf x nall

fparam

frame parameters, shape: nf x dim_fparam

aparam

atomic parameter, shape: nf x nloc x dim_aparam

Returns:
ret_dict

dict of output atomic properties. should implement the definition of fitting_output_def. ret_dict[“mask”] of shape nf x nloc will be provided. ret_dict[“mask”][ff,ii] == 1 indicating the ii-th atom of the ff-th frame is real. ret_dict[“mask”][ff,ii] == 0 indicating the ii-th atom of the ff-th frame is virtual.

serialize() dict[source]
classmethod deserialize(data: dict) BaseAtomicModel[source]
apply_out_stat(ret: Dict[str, numpy.ndarray], atype: numpy.ndarray)[source]

Apply the stat to each atomic output. The developer may override the method to define how the bias is applied to the atomic output of the model.

Parameters:
ret

The returned dict by the forward_atomic method

atype

The atom types. nf x nloc

_varsize(shape: List[int]) int[source]
_get_bias_index(kk: str) int[source]
_fetch_out_stat(keys: List[str]) Tuple[Dict[str, numpy.ndarray], Dict[str, numpy.ndarray]][source]