deepmd.dpmodel.atomic_model.linear_atomic_model#
Classes#
Linear model make linear combinations of several existing models. | |
Model linearly combine a list of AtomicModels. |
Module Contents#
- class deepmd.dpmodel.atomic_model.linear_atomic_model.LinearEnergyAtomicModel(models: list[deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel], type_map: list[str], **kwargs)[source]#
Bases:
deepmd.dpmodel.atomic_model.base_atomic_model.BaseAtomicModel
Linear model make linear combinations of several existing models.
- Parameters:
- mixed_types() bool [source]#
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.
- need_sorted_nlist_for_lower() bool [source]#
Returns whether the atomic model needs sorted nlist when using forward_lower.
- change_type_map(type_map: list[str], model_with_new_type_stat=None) None [source]#
Change the type related params to new ones, according to type_map and the original one in the model. If there are new types in type_map, statistics will be updated accordingly to model_with_new_type_stat for these new types.
- get_model_nsels() list[int] [source]#
Get the processed sels for each individual models. Not distinguishing types.
- enable_compression(min_nbor_dist: float, table_extrapolate: float = 5, table_stride_1: float = 0.01, table_stride_2: float = 0.1, check_frequency: int = -1) None [source]#
Compress model.
- Parameters:
- min_nbor_dist
The nearest distance between atoms
- table_extrapolate
The scale of model extrapolation
- table_stride_1
The uniform stride of the first table
- table_stride_2
The uniform stride of the second table
- check_frequency
The overflow check frequency
- forward_atomic(extended_coord, extended_atype, nlist, mapping: numpy.ndarray | None = None, fparam: numpy.ndarray | None = None, aparam: numpy.ndarray | None = None) dict[str, numpy.ndarray] [source]#
Return atomic prediction.
- Parameters:
- extended_coord
coordinates in extended region, (nframes, nall * 3)
- extended_atype
atomic type in extended region, (nframes, nall)
- nlist
neighbor list, (nframes, nloc, nsel).
- mapping
mapps the extended indices to local indices.
- fparam
frame parameter. (nframes, ndf)
- aparam
atomic parameter. (nframes, nloc, nda)
- Returns:
result_dict
the result dict, defined by the fitting net output def.
- static remap_atype(ori_map: list[str], new_map: list[str]) numpy.ndarray [source]#
This method is used to map the atype from the common type_map to the original type_map of indivial AtomicModels.
- Parameters:
- Returns:
- fitting_output_def() deepmd.dpmodel.output_def.FittingOutputDef [source]#
Get the output def of developer implemented atomic models.
- classmethod deserialize(data: dict) LinearEnergyAtomicModel [source]#
- _compute_weight(extended_coord: numpy.ndarray, extended_atype: numpy.ndarray, nlists_: list[numpy.ndarray]) list[numpy.ndarray] [source]#
This should be a list of user defined weights that matches the number of models to be combined.
- class deepmd.dpmodel.atomic_model.linear_atomic_model.DPZBLLinearEnergyAtomicModel(dp_model: deepmd.dpmodel.atomic_model.dp_atomic_model.DPAtomicModel, zbl_model: deepmd.dpmodel.atomic_model.pairtab_atomic_model.PairTabAtomicModel, sw_rmin: float, sw_rmax: float, type_map: list[str], smin_alpha: float | None = 0.1, **kwargs)[source]#
Bases:
LinearEnergyAtomicModel
Model linearly combine a list of AtomicModels.
- Parameters:
- dp_model
The DPAtomicModel being combined.
- zbl_model
The PairTable model being combined.
- sw_rmin
The lower boundary of the interpolation between short-range tabulated interaction and DP.
- sw_rmax
The upper boundary of the interpolation between short-range tabulated interaction and DP.
- type_map
Mapping atom type to the name (str) of the type. For example type_map[1] gives the name of the type 1.
- smin_alpha
The short-range tabulated interaction will be switched according to the distance of the nearest neighbor. This distance is calculated by softmin.
- classmethod deserialize(data) DPZBLLinearEnergyAtomicModel [source]#
- _compute_weight(extended_coord: numpy.ndarray, extended_atype: numpy.ndarray, nlists_: list[numpy.ndarray]) list[numpy.ndarray] [source]#
ZBL weight.
- Returns:
list
[np.ndarray
]the atomic ZBL weight for interpolation. (nframes, nloc, 1)