deepmd.tf.model.linear

Module Contents

Classes

LinearModel

Linear model make linear combinations of several existing models.

LinearEnergyModel

Linear energy model make linear combinations of several existing energy models.

class deepmd.tf.model.linear.LinearModel(models: List[dict], weights: List[float], **kwargs)[source]

Bases: deepmd.tf.model.model.Model

Linear model make linear combinations of several existing models.

Parameters:
modelslist[dict]

A list of models to be combined.

weightslist[float] or str

If the type is list[float], a list of weights for each model. If “mean”, the weights are set to be 1 / len(models). If “sum”, the weights are set to be 1.

get_fitting() deepmd.tf.fit.fitting.Fitting | dict[source]

Get the fitting(s).

get_loss(loss: dict, lr) deepmd.tf.loss.loss.Loss | dict | None[source]

Get the loss function(s).

get_rcut()[source]

Get cutoff radius of the model.

get_ntypes() int[source]

Get the number of types.

data_stat(data)[source]

Data staticis.

init_variables(graph: deepmd.tf.env.tf.Graph, graph_def: deepmd.tf.env.tf.GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]

Init the embedding net variables with the given frozen model.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

model_typestr

the type of the model

suffixstr

suffix to name scope

enable_compression(suffix: str = '') None[source]

Enable compression.

Parameters:
suffixstr

suffix to name scope

get_type_map() list[source]

Get the type map.

classmethod update_sel(global_jdata: dict, local_jdata: dict)[source]

Update the selection and perform neighbor statistics.

Parameters:
global_jdatadict

The global data, containing the training section

local_jdatadict

The local data refer to the current class

class deepmd.tf.model.linear.LinearEnergyModel(models: List[dict], weights: List[float], **kwargs)[source]

Bases: LinearModel

Linear energy model make linear combinations of several existing energy models.

model_type = 'ener'[source]
build(coord_: deepmd.tf.env.tf.Tensor, atype_: deepmd.tf.env.tf.Tensor, natoms: deepmd.tf.env.tf.Tensor, box: deepmd.tf.env.tf.Tensor, mesh: deepmd.tf.env.tf.Tensor, input_dict: dict, frz_model: str | None = None, ckpt_meta: str | None = None, suffix: str = '', reuse: bool | enum.Enum | None = None) dict[source]

Build the model.

Parameters:
coord_tf.Tensor

The coordinates of atoms

atype_tf.Tensor

The atom types of atoms

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path prefix of the checkpoint and meta files

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
dict

The output dict