deepmd.dpmodel.model
The model that takes the coordinates, cell and atom types as input and predicts some property. The models are automatically generated from atomic models by the deepmd.dpmodel.make_model method.
The make_model method does the reduction, auto-differentiation (dummy for dpmodels) and communication of the atomic properties according to output variable definition deepmd.dpmodel.OutputVariableDef.
All models should be inherited from A spin model wrapper, with spin input preprocess and output split. Make a model as a derived class of an atomic model. Make a model as a derived class of an atomic model. The model provide two interfaces. 1. the call_lower, that takes extended coordinates, atyps and neighbor list, and outputs the atomic and property and derivatives (if required) on the extended region. 2. the call, that takes coordinates, atypes and cell and predicts the atomic and reduced property, and derivatives (if required) on the local region. The atomic model. The model. A spin model wrapper, with spin input preprocess and output split. Generate virtual coordinates and types, concat into the input. Add extended_spin into extended_coord to generate virtual atoms, and extend nlist and mapping. Note that the final extended_coord_updated with shape [nframes, nall + nall, 3] has the following order: - [:, :nloc]: original nloc real atoms. - [:, nloc: nloc + nloc]: virtual atoms corresponding to nloc real atoms. - [:, nloc + nloc: nloc + nall]: ghost real atoms. - [:, nloc + nall: nall + nall]: virtual atoms corresponding to ghost real atoms. Split the output both real and virtual atoms, and scale the latter. Split the extended output of both real and virtual atoms with switch, and scale the latter. Get the selected atom types of this model. Only atoms with selected atom types have atomic contribution to the result of the model. If returning an empty list, all atom types are selected. Check whether the shape of atomic parameters is (nframes, nall, ndim). If False, the shape is (nframes, nloc, ndim). Returns the total number of selected neighboring atoms in the cut-off radius. Returns the total number of selected neighboring atoms in the cut-off radius. Return model prediction. The coordinates of the atoms. shape: nf x (nloc x 3) The type of atoms. shape: nf x nloc The spins of the atoms. shape: nf x (nloc x 3) The simulation box. shape: nf x 9 frame parameter. nf x ndf atomic parameter. nf x nloc x nda If calculate the atomic virial. The result dict of type Dict[str,np.ndarray]. The keys are defined by the ModelOutputDef. Return model prediction. Lower interface that takes extended atomic coordinates, types and spins, nlist, and mapping as input, and returns the predictions on the extended region. The predictions are not reduced. coordinates in extended region. nf x (nall x 3). atomic type in extended region. nf x nall. spins in extended region. nf x (nall x 3). neighbor list. nf x nloc x nsel. maps the extended indices to local indices. nf x nall. frame parameter. nf x ndf atomic parameter. nf x nloc x nda whether calculate atomic virial the result dict, defined by the FittingOutputDef.deepmd.dpmodel.model.base_model.BaseModel
. Models generated by make_model have already done it.Submodules
Package Contents
Classes
Functions
make_model
(T_AtomicModel)CM
ret_dict
result_dict