deepmd.dpmodel.descriptor.se_t#

Classes#

DescrptSeT

DeepPot-SE constructed from all information (both angular and radial) of atomic

Module Contents#

class deepmd.dpmodel.descriptor.se_t.DescrptSeT(rcut: float, rcut_smth: float, sel: list[int], neuron: list[int] = [24, 48, 96], resnet_dt: bool = False, set_davg_zero: bool = False, activation_function: str = 'tanh', env_protection: float = 0.0, exclude_types: list[tuple[int, int]] = [], precision: str = DEFAULT_PRECISION, trainable: bool = True, seed: int | list[int] | None = None, type_map: list[str] | None = None, ntypes: int | None = None)[source]#

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

DeepPot-SE constructed from all information (both angular and radial) of atomic configurations.

The embedding takes angles between two neighboring atoms as input.

Parameters:
rcutfloat

The cut-off radius

rcut_smthfloat

From where the environment matrix should be smoothed

sellist[int]

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

neuronlist[int]

Number of neurons in each hidden layers of the embedding net

resnet_dtbool

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

set_davg_zerobool

Set the shift of embedding net input to zero.

activation_functionstr

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

env_protectionfloat

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

exclude_typeslist[list[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.

precisionstr

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

trainablebool

If the weights of embedding net are trainable.

seedint, Optional

Random seed for initializing the network parameters.

type_map: list[str], Optional

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

ntypesint

Number of element types. Not used in this descriptor, only to be compat with input.

rcut[source]#
rcut_smth[source]#
sel[source]#
neuron[source]#
filter_neuron[source]#
set_davg_zero[source]#
activation_function[source]#
precision[source]#
prec[source]#
resnet_dt[source]#
env_protection[source]#
ntypes[source]#
seed[source]#
type_map[source]#
trainable[source]#
sel_cumsum[source]#
embeddings[source]#
env_mat[source]#
nnei[source]#
davg[source]#
dstd[source]#
orig_sel[source]#
__setitem__(key, value) None[source]#
__getitem__(key)[source]#
property dim_out[source]#

Returns the output dimension of this descriptor.

abstract 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.

get_dim_out()[source]#

Returns the output dimension of this descriptor.

get_dim_emb()[source]#

Returns the embedding (g2) dimension of this descriptor.

get_rcut()[source]#

Returns cutoff radius.

get_rcut_smth() float[source]#

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

get_sel()[source]#

Returns cutoff radius.

mixed_types() bool[source]#

Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.

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.

get_ntypes() int[source]#

Returns the number of element types.

get_type_map() list[str][source]#

Get the name to each type of atoms.

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.

reinit_exclude(exclude_types: list[tuple[int, int]] = []) None[source]#
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

gr

The rotationally equivariant and permutationally invariant single particle representation. This descriptor returns None.

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