deepmd.tf.model.pairwise_dprc

Module Contents

Classes

PairwiseDPRc

Pairwise Deep Potential - Range Correction.

Functions

gather_placeholder(→ deepmd.tf.env.tf.Tensor)

Call tf.gather but allow indices to contain placeholders (-1).

class deepmd.tf.model.pairwise_dprc.PairwiseDPRc(qm_model: dict, qmmm_model: dict, type_embedding: dict | deepmd.tf.utils.type_embed.TypeEmbedNet, type_map: List[str], data_stat_nbatch: int = 10, data_stat_nsample: int = 10, data_stat_protect: float = 0.01, use_srtab: str | None = None, smin_alpha: float | None = None, sw_rmin: float | None = None, sw_rmax: float | None = None, spin: deepmd.tf.utils.spin.Spin | None = None, compress: dict | None = None, **kwargs)[source]

Bases: deepmd.tf.model.model.Model

Pairwise Deep Potential - Range Correction.

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=None, ckpt_meta: str | None = None, suffix: str = '', reuse: bool | 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

get_fitting() str | dict[source]

Get the fitting(s).

get_loss(loss: dict, lr) deepmd.tf.loss.loss.Loss | dict[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_feed_dict(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, **kwargs) Dict[str, deepmd.tf.env.tf.Tensor][source]

Generate the feed_dict for current descriptor.

Parameters:
coord_tf.Tensor

The coordinate of atoms

atype_tf.Tensor

The type of atoms

natomstf.Tensor

The number of atoms. This tensor has the length of Ntypes + 2 natoms[0]: number of local atoms natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms

boxtf.Tensor

The box. Can be generated by deepmd.tf.model.make_stat_input

meshtf.Tensor

For historical reasons, only the length of the Tensor matters. if size of mesh == 6, pbc is assumed. if size of mesh == 0, no-pbc is assumed.

aparamtf.Tensor

The parameters of the descriptor

**kwargsdict

The keyword arguments

Returns:
feed_dictdict[str, tf.Tensor]

The output feed_dict of current descriptor

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

deepmd.tf.model.pairwise_dprc.gather_placeholder(params: deepmd.tf.env.tf.Tensor, indices: deepmd.tf.env.tf.Tensor, placeholder: float = 0.0, **kwargs) deepmd.tf.env.tf.Tensor[source]

Call tf.gather but allow indices to contain placeholders (-1).