deepmd.dpmodel.model.frozen#

Classes#

FrozenModel

Load model from a frozen model file, which cannot be trained.

Module Contents#

class deepmd.dpmodel.model.frozen.FrozenModel(model_file: str, **kwargs: Any)[source]#

Bases: deepmd.dpmodel.common.NativeOP, deepmd.dpmodel.model.base_model.BaseModel

Load model from a frozen model file, which cannot be trained.

The frozen model delegates all operations to the deserialized inner model. serialize() returns the inner model’s data, and deserialize() dispatches to the appropriate model class via BaseModel.deserialize.

Parameters:
model_filestr

The path to the frozen model file.

model_file[source]#
model[source]#
call(*args: Any, **kwargs: Any) Any[source]#

Forward pass.

fitting_output_def() deepmd.dpmodel.output_def.FittingOutputDef[source]#

Get the output def of developer implemented atomic models.

get_rcut() float[source]#

Get the cut-off radius.

get_type_map() list[str][source]#

Get the type map.

get_sel() list[int][source]#

Returns the number of selected atoms for each type.

get_dim_fparam() int[source]#

Get the number (dimension) of frame parameters of this atomic model.

get_dim_aparam() int[source]#

Get the number (dimension) of atomic parameters of this atomic model.

get_sel_type() list[int][source]#

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.

is_aparam_nall() bool[source]#

Check whether the shape of atomic parameters is (nframes, nall, ndim).

If False, the shape is (nframes, nloc, ndim).

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.

has_message_passing() bool[source]#

Returns whether the descriptor has message passing.

need_sorted_nlist_for_lower() bool[source]#

Returns whether the model needs sorted nlist when using forward_lower.

get_model_def_script() str[source]#

Get the model definition script.

get_min_nbor_dist() float | None[source]#

Get the minimum neighbor distance.

get_nnei() int[source]#

Returns the total number of selected neighboring atoms in the cut-off radius.

get_nsel() int[source]#

Returns the total number of selected neighboring atoms in the cut-off radius.

model_output_type() str[source]#

Get the output type for the model.

get_observed_type_list() list[str][source]#

Get observed types (elements) of the model during data statistics.

serialize() dict[source]#

Serialize the model.

Returns the inner model’s serialized data.

classmethod deserialize(data: dict) NoReturn[source]#

Deserialize the model.

Parameters:
datadict

The serialized data

Returns:
BaseModel

The deserialized model

classmethod update_sel(train_data: deepmd.utils.data_system.DeepmdDataSystem, type_map: list[str] | None, local_jdata: dict) tuple[dict, float | None][source]#

Update the selection and perform neighbor statistics.