deepmd.dpmodel.model.make_model#
Functions#
| Return model prediction from lower interface. |
| Make a model as a derived class of an atomic model. |
Module Contents#
- deepmd.dpmodel.model.make_model.model_call_from_call_lower(*, call_lower: collections.abc.Callable[[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray | None, numpy.ndarray | None, bool], dict[str, deepmd.dpmodel.array_api.Array]], rcut: float, sel: list[int], mixed_types: bool, model_output_def: deepmd.dpmodel.output_def.ModelOutputDef, coord: deepmd.dpmodel.array_api.Array, atype: deepmd.dpmodel.array_api.Array, box: deepmd.dpmodel.array_api.Array | None = None, fparam: deepmd.dpmodel.array_api.Array | None = None, aparam: deepmd.dpmodel.array_api.Array | None = None, do_atomic_virial: bool = False, coord_corr_for_virial: deepmd.dpmodel.array_api.Array | None = None, charge_spin: deepmd.dpmodel.array_api.Array | None = None, neighbor_list: deepmd.dpmodel.utils.NeighborList | None = None) dict[str, deepmd.dpmodel.array_api.Array][source]#
Return model prediction from lower interface.
- Parameters:
- coord
The coordinates of the atoms. shape: nf x (nloc x 3)
- atype
The type of atoms. shape: nf x nloc
- box
The simulation box. shape: nf x 9
- fparam
frame parameter. nf x ndf
- aparam
atomic parameter. nf x nloc x nda
- do_atomic_virial
If calculate the atomic virial.
- neighbor_list
The neighbor-list construction strategy.
Noneuses the default all-pairs builder (DefaultNeighborList), reproducing the historical behavior. An alternative strategy (e.g. an O(N) cell list) may be injected to speed up neighbor-list construction; it returns the same extended representation, so model outputs are unchanged.
- Returns:
ret_dictThe result dict of type dict[str,np.ndarray]. The keys are defined by the ModelOutputDef.
- deepmd.dpmodel.model.make_model.make_model(T_AtomicModel: type[deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel], T_Bases: tuple[type, Ellipsis] = ()) type[source]#
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.
- Parameters:
- T_AtomicModel
The atomic model.
- T_Bases
Additional base classes for the returned model class. Defaults to
(). For example, dpmodel passes(NativeOP,).
- Returns:
CMThe model.