deepmd.dpmodel.descriptor.se_t_tebd

Contents

deepmd.dpmodel.descriptor.se_t_tebd#

Classes#

DescrptSeTTebd

Construct an embedding net that takes angles between two neighboring atoms and type embeddings as input.

DescrptBlockSeTTebd

The unit operation of a native model.

Module Contents#

class deepmd.dpmodel.descriptor.se_t_tebd.DescrptSeTTebd(rcut: float, rcut_smth: float, sel: list[int] | int, ntypes: int, neuron: list = [2, 4, 8], tebd_dim: int = 8, tebd_input_mode: str = 'concat', resnet_dt: bool = False, set_davg_zero: bool = True, activation_function: str = 'tanh', env_protection: float = 0.0, exclude_types: list[tuple[int, int]] = [], precision: str = 'float64', trainable: bool = True, seed: int | list[int] | None = None, type_map: list[str] | None = None, concat_output_tebd: bool = True, use_econf_tebd: bool = False, use_tebd_bias=False, smooth: bool = True)[source]#

Bases: deepmd.dpmodel.NativeOP, deepmd.dpmodel.descriptor.base_descriptor.BaseDescriptor

Construct an embedding net that takes angles between two neighboring atoms and type embeddings as input.

Parameters:
rcut

The cut-off radius

rcut_smth

From where the environment matrix should be smoothed

selUnion[list[int], int]

list[int]: sel[i] specifies the maxmum number of type i atoms in the cut-off radius int: the total maxmum number of atoms in the cut-off radius

ntypesint

Number of element types

neuronlist[int]

Number of neurons in each hidden layers of the embedding net

tebd_dimint

Dimension of the type embedding

tebd_input_modestr

The input mode of the type embedding. Supported modes are [“concat”, “strip”]. - “concat”: Concatenate the type embedding with the smoothed angular information as the union input for the embedding network. - “strip”: Use a separated embedding network for the type embedding and combine the output with the angular embedding network output.

resnet_dt

Time-step dt in the resnet construction: y = x + dt * phi (Wx + b)

set_davg_zero

Set the shift of embedding net input to zero.

activation_function

The activation function in the embedding net. Supported options are “linear”, “sigmoid”, “relu6”, “softplus”, “none”, “gelu_tf”, “tanh”, “gelu”, “relu”.

env_protection: float

Protection parameter to prevent division by zero errors during environment matrix calculations.

exclude_typeslist[tuple[int, int]]

The excluded pairs of types which have no interaction with each other. For example, [[0, 1]] means no interaction between type 0 and type 1.

precision

The precision of the embedding net parameters. Supported options are “float32”, “float16”, “default”, “float64”.

trainable

If the weights of embedding net are trainable.

seed

Random seed for initializing the network parameters.

type_map: list[str], Optional

A list of strings. Give the name to each type of atoms.

concat_output_tebd: bool

Whether to concat type embedding at the output of the descriptor.

use_econf_tebd: bool, Optional

Whether to use electronic configuration type embedding.

use_tebd_biasbool, Optional

Whether to use bias in the type embedding layer.

smooth: bool

Whether to use smooth process in calculation.

se_ttebd[source]#
use_econf_tebd[source]#
type_map[source]#
smooth[source]#
type_embedding[source]#
tebd_dim[source]#
concat_output_tebd[source]#
trainable[source]#
precision[source]#
get_rcut() float[source]#

Returns the cut-off radius.

get_rcut_smth() float[source]#

Returns the radius where the neighbor information starts to smoothly decay to 0.

get_nsel() int[source]#

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

get_sel() list[int][source]#

Returns the number of selected atoms for each type.

get_ntypes() int[source]#

Returns the number of element types.

get_type_map() list[str][source]#

Get the name to each type of atoms.

get_dim_out() int[source]#

Returns the output dimension.

get_dim_emb() int[source]#

Returns the embedding dimension of g2.

mixed_types() bool[source]#

If true, the descriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.

If false, the descriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires 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 descriptor needs sorted nlist when using forward_lower.

get_env_protection() float[source]#

Returns the protection of building environment matrix.

abstract share_params(base_class, shared_level, resume=False) NoReturn[source]#

Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some separated parameters (e.g. mean and stddev) will be re-calculated across different classes.

property dim_out[source]#
property dim_emb[source]#
abstract compute_input_stats(merged: list[dict], path: deepmd.utils.path.DPPath | None = None) NoReturn[source]#

Update mean and stddev for descriptor elements.

set_stat_mean_and_stddev(mean: numpy.ndarray, stddev: numpy.ndarray) None[source]#

Update mean and stddev for descriptor.

get_stat_mean_and_stddev() tuple[numpy.ndarray, numpy.ndarray][source]#

Get mean and stddev for descriptor.

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.

call(coord_ext, atype_ext, nlist, mapping: numpy.ndarray | None = None)[source]#

Compute the descriptor.

Parameters:
coord_ext

The extended coordinates of atoms. shape: nf x (nallx3)

atype_ext

The extended aotm types. shape: nf x nall

nlist

The neighbor list. shape: nf x nloc x nnei

mapping

The index mapping from extended to local region. not used by this descriptor.

Returns:
descriptor

The descriptor. shape: nf x nloc x (ng x axis_neuron)

gr

The rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3

g2

The rotationally invariant pair-partical representation. this descriptor returns None

h2

The rotationally equivariant pair-partical representation. this descriptor returns None

sw

The smooth switch function.

serialize() dict[source]#

Serialize the descriptor to dict.

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

Deserialize from dict.

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.

Parameters:
train_dataDeepmdDataSystem

data used to do neighbor statistics

type_maplist[str], optional

The name of each type of atoms

local_jdatadict

The local data refer to the current class

Returns:
dict

The updated local data

float

The minimum distance between two atoms

class deepmd.dpmodel.descriptor.se_t_tebd.DescrptBlockSeTTebd(rcut: float, rcut_smth: float, sel: list[int] | int, ntypes: int, neuron: list = [25, 50, 100], tebd_dim: int = 8, tebd_input_mode: str = 'concat', set_davg_zero: bool = True, activation_function='tanh', precision: str = 'float64', resnet_dt: bool = False, exclude_types: list[tuple[int, int]] = [], env_protection: float = 0.0, smooth: bool = True, seed: int | list[int] | None = None)[source]#

Bases: deepmd.dpmodel.NativeOP, deepmd.dpmodel.descriptor.descriptor.DescriptorBlock

The unit operation of a native model.

rcut[source]#
rcut_smth[source]#
neuron[source]#
filter_neuron[source]#
tebd_dim[source]#
tebd_input_mode[source]#
set_davg_zero[source]#
activation_function[source]#
precision[source]#
resnet_dt[source]#
env_protection[source]#
seed[source]#
smooth[source]#
ntypes[source]#
sel[source]#
sec[source]#
split_sel[source]#
nnei[source]#
ndescrpt[source]#
tebd_dim_input[source]#
embeddings[source]#
env_mat[source]#
mean[source]#
stddev[source]#
orig_sel[source]#
get_rcut() float[source]#

Returns the cut-off radius.

get_rcut_smth() float[source]#

Returns the radius where the neighbor information starts to smoothly decay to 0.

get_nsel() int[source]#

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

get_sel() list[int][source]#

Returns the number of selected atoms for each type.

get_ntypes() int[source]#

Returns the number of element types.

get_dim_in() int[source]#

Returns the input dimension.

get_dim_out() int[source]#

Returns the output dimension.

get_dim_emb() int[source]#

Returns the output dimension of embedding.

__setitem__(key, value) None[source]#
__getitem__(key)[source]#
mixed_types() bool[source]#

If true, the descriptor 1. assumes total number of atoms aligned across frames; 2. requires a neighbor list that does not distinguish different atomic types.

If false, the descriptor 1. assumes total number of atoms of each atom type aligned across frames; 2. requires a neighbor list that distinguishes different atomic types.

get_env_protection() float[source]#

Returns the protection of building environment matrix.

property dim_out[source]#

Returns the output dimension of this descriptor.

property dim_in[source]#

Returns the atomic input dimension of this descriptor.

property dim_emb[source]#

Returns the output dimension of embedding.

abstract compute_input_stats(merged: Callable[[], list[dict]] | list[dict], path: deepmd.utils.path.DPPath | None = None) NoReturn[source]#

Compute the input statistics (e.g. mean and stddev) for the descriptors from packed data.

abstract get_stats() NoReturn[source]#

Get the statistics of the descriptor.

reinit_exclude(exclude_types: list[tuple[int, int]] = []) None[source]#
cal_g(ss, embedding_idx)[source]#
cal_g_strip(ss, embedding_idx)[source]#
call(nlist: numpy.ndarray, coord_ext: numpy.ndarray, atype_ext: numpy.ndarray, atype_embd_ext: numpy.ndarray | None = None, mapping: numpy.ndarray | None = None, type_embedding: numpy.ndarray | None = None)[source]#

Forward pass in NumPy implementation.

has_message_passing() bool[source]#

Returns whether the descriptor block has message passing.

need_sorted_nlist_for_lower() bool[source]#

Returns whether the descriptor block needs sorted nlist when using forward_lower.

serialize() dict[source]#

Serialize the descriptor to dict.

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

Deserialize from dict.