deepmd.dpmodel.atomic_model
The atomic model provides the prediction of some property on each atom. All the atomic models are not supposed to be directly accessed by users, but it provides a convenient interface for the implementation of models.
Taking the energy models for example, the developeres only needs to implement the atomic energy prediction via an atomic model, and the model can be automatically made by the deepmd.dpmodel.make_model method. The DPModel is made by Base Atomic Model provides the interfaces of an atomic model. Model give atomic prediction of some physical property. Model linearly combine a list of AtomicModels. Linear model make linear combinations of several existing models. Pairwise tabulation energy model. Make the base class for the atomic model. Bases: Base Atomic Model provides the interfaces of an atomic model. 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. Common interface for atomic inference. This method accept extended coordinates, extended atom typs, neighbor list, and predict the atomic contribution of the fit property. extended coodinates, shape: nf x (nall x 3) extended atom typs, shape: nf x nall for a type < 0 indicating the atomic is virtual. neighbor list, shape: nf x nloc x nsel extended to local index mapping, shape: nf x nall frame parameters, shape: nf x dim_fparam atomic parameter, shape: nf x nloc x dim_aparam 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. 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. The returned dict by the forward_atomic method The atom types. nf x nloc Bases: Model give atomic prediction of some physical property. Descriptor Fitting net Mapping atom type to the name (str) of the type. For example type_map[1] gives the name of the type 1. Get the output def of the fitting net. If true, the model 1. assumes total number of atoms aligned across frames; 2. uses a neighbor list that does not distinguish different atomic types. If false, the model 1. assumes total number of atoms of each atom type aligned across frames; 2. uses a neighbor list that distinguishes different atomic types. Models’ atomic predictions. coodinates in extended region atomic type in extended region neighbor list. nf x nloc x nsel mapps the extended indices to local indices. nf x nall frame parameter. nf x ndf atomic parameter. nf x nloc x nda the result dict, defined by the FittingOutputDef. Bases: Model linearly combine a list of AtomicModels. The DPAtomicModel being combined. The PairTable model being combined. The lower boundary of the interpolation between short-range tabulated interaction and DP. The upper boundary of the interpolation between short-range tabulated interaction and DP. Mapping atom type to the name (str) of the type. For example type_map[1] gives the name of the type 1. The short-range tabulated interaction will be swithed according to the distance of the nearest neighbor. This distance is calculated by softmin. ZBL weight. the atomic ZBL weight for interpolation. (nframes, nloc, 1) Bases: Linear model make linear combinations of several existing models. A list of models to be combined. PairTabAtomicModel must be used together with a DPAtomicModel. Mapping atom type to the name (str) of the type. For example type_map[1] gives the name of the type 1. If true, the model 1. assumes total number of atoms aligned across frames; 2. uses a neighbor list that does not distinguish different atomic types. If false, the model 1. assumes total number of atoms of each atom type aligned across frames; 2. uses a neighbor list that distinguishes different atomic types. Get the processed sels for each individual models. Not distinguishing types. Return atomic prediction. coodinates in extended region, (nframes, nall * 3) atomic type in extended region, (nframes, nall) neighbor list, (nframes, nloc, nsel). mapps the extended indices to local indices. frame parameter. (nframes, ndf) atomic parameter. (nframes, nloc, nda) the result dict, defined by the fitting net output def. This method is used to map the atype from the common type_map to the original type_map of indivial AtomicModels. Get the output def of developer implemented atomic models. This should be a list of user defined weights that matches the number of models to be combined. Make the base class for the atomic model. The type of the tensor. used in the type hint. Name of the forward method. For dpmodels, it should be “call”. For torch models, it should be “forward”. Bases: Pairwise tabulation energy model. This model can be used to tabulate the pairwise energy between atoms for either short-range or long-range interactions, such as D3, LJ, ZBL, etc. It should not be used alone, but rather as one submodel of a linear (sum) model, such as DP+D3. Do not put the model on the first model of a linear model, since the linear model fetches the type map from the first model. At this moment, the model does not smooth the energy at the cutoff radius, so one needs to make sure the energy has been smoothed to zero. Get the output def of developer implemented atomic models. Returns the total number of selected neighboring atoms in the cut-off radius. If true, the model 1. assumes total number of atoms aligned across frames; 2. uses a neighbor list that does not distinguish different atomic types. If false, the model 1. assumes total number of atoms of each atom type aligned across frames; 2. uses a neighbor list that distinguishes different atomic types. Pairwise tabulated energy. The unmasked neighbour list. (nframes, nloc) The integer representation of atom type for all local atoms for all frames. (nframes, nloc) The integer representation of atom type for all neighbour atoms of all local atoms for all frames. (nframes, nloc, nnei) The salar distance vector between two atoms. (nframes, nloc, nnei) The masked atomic energy for all local atoms for all frames. (nframes, nloc, nnei) If the distance is beyond the table. Notes This function is used to calculate the pairwise energy between two atoms. It uses a table containing cubic spline coefficients calculated in PairTab. Get pairwise distance dr. The coordinate of the atoms, shape of (nframes, nall, 3). The masked nlist, shape of (nframes, nloc, nnei). The pairwise distance between the atoms (nframes, nloc, nnei). Extract the spline coefficient from the table. The integer representation of atom type for all local atoms for all frames. (nframes, nloc) The integer representation of atom type for all neighbour atoms of all local atoms for all frames. (nframes, nloc, nnei) The index of the spline coefficient. (nframes, nloc, nnei) The table storing all the spline coefficient. (ntype, ntype, nspline, 4) The number of splines in the table. The spline coefficient. (nframes, nloc, nnei, 4), shape may be squeezed. Calculate energy using spline coeeficients. The spline coefficients. (nframes, nloc, nnei, 4) The atom displancemnt used in interpolation and extrapolation (nframes, nloc, nnei) The atomic energy for all local atoms for all frames. (nframes, nloc, nnei)`
DPModel = make_model(DPAtomicModel)
`
Submodules
Package Contents
Classes
Functions
make_base_atomic_model
(t_tensor[, fwd_method_name])BaseAtomicModel_
ret_dict
deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel
result_dict
LinearEnergyAtomicModel
List
[np.ndarray
]deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel
list
[DPAtomicModel
or PairTabAtomicModel
]list
[str
]result_dict
deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel
np.ndarray
np.ndarray
np.ndarray
np.ndarray
np.ndarray
Exception
np.ndarray
np.ndarray
np.ndarray
np.ndarray
np.ndarray
np.ndarray
int
np.ndarray
np.ndarray
np.ndarray
np.ndarray