deepmd.tf.model.pairtab

Module Contents

Classes

PairTabModel

Pairwise tabulation energy model.

class deepmd.tf.model.pairtab.PairTabModel(tab_file: str, rcut: float, sel: int | List[int], **kwargs)[source]

Bases: deepmd.tf.model.model.Model

Pairwise tabulation energy model.

This model can be used to tabulate the pairwise energy between atoms for either short-range or long-range interactions, such as D3, LJ, ZBL, etc. It should not be used alone, but rather as one submodel of a linear (sum) model, such as DP+D3.

Do not put the model on the first model of a linear model, since the linear model fetches the type map from the first model.

At this moment, the model does not smooth the energy at the cutoff radius, so one needs to make sure the energy has been smoothed to zero.

Parameters:
tab_filestr

The path to the tabulation file.

rcutfloat

The cutoff radius

selint or list[int]

The maxmum number of atoms in the cut-off radius

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)[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

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

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() float[source]

Get cutoff radius of the model.

get_ntypes() int[source]

Get the number of types.

data_stat(data: dict)[source]

Data staticis.

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

Enable compression.

Parameters:
suffixstr

suffix to name scope

classmethod update_sel(global_jdata: dict, local_jdata: dict) 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

Returns:
dict

The updated local data

Notes

Do not modify the input data without copying it.