deepmd.dpmodel.descriptor package

class deepmd.dpmodel.descriptor.DescrptHybrid(*args, **kwargs)[source]

Bases: BD, NativeOP

Concate a list of descriptors to form a new descriptor.

Parameters
listlistList[Union[BaseDescriptor, Dict[str, Any]]]

Build a descriptor from the concatenation of the list of descriptors. The descriptor can be either an object or a dictionary.

Methods

__call__(*args, **kwargs)

Forward pass in NumPy implementation.

call(coord_ext, atype_ext, nlist[, mapping])

Compute the descriptor.

compute_input_stats(merged[, path])

Update mean and stddev for descriptor elements.

deserialize(data)

Deserialize the model.

get_class_by_type(class_type)

Get the class by the plugin type.

get_dim_emb()

Returns the output dimension.

get_dim_out()

Returns the output dimension.

get_nnei()

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

get_nsel()

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

get_ntypes()

Returns the number of element types.

get_plugins()

Get all the registered plugins.

get_rcut()

Returns the cut-off radius.

get_sel()

Returns the number of selected atoms for each type.

mixed_types()

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

register(key)

Register a descriptor plugin.

serialize()

Serialize the obj to dict.

share_params(base_class, shared_level[, resume])

Share the parameters of self to the base_class with shared_level during multitask training.

update_sel(global_jdata, local_jdata)

Update the selection and perform neighbor statistics.

call(coord_ext, atype_ext, nlist, mapping: Optional[ndarray] = 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, not required 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.

h2

The rotationally equivariant pair-partical representation.

sw

The smooth switch function.

compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]

Update mean and stddev for descriptor elements.

classmethod deserialize(data: dict) DescrptHybrid[source]

Deserialize the model.

Parameters
datadict

The serialized data

Returns
BD

The deserialized descriptor

get_dim_emb() int[source]

Returns the output dimension.

get_dim_out() int[source]

Returns the output dimension.

get_ntypes() int[source]

Returns the number of element types.

get_rcut() float[source]

Returns the cut-off radius.

get_sel() List[int][source]

Returns the number of selected atoms for each type.

mixed_types()[source]

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

serialize() dict[source]

Serialize the obj to dict.

share_params(base_class, shared_level, resume=False)[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 seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.

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

class deepmd.dpmodel.descriptor.DescrptSeA(*args, **kwargs)[source]

Bases: NativeOP, BD

DeepPot-SE constructed from all information (both angular and radial) of atomic configurations. The embedding takes the distance between atoms as input.

The descriptor \(\mathcal{D}^i \in \mathcal{R}^{M_1 \times M_2}\) is given by [1]

\[\mathcal{D}^i = (\mathcal{G}^i)^T \mathcal{R}^i (\mathcal{R}^i)^T \mathcal{G}^i_<\]

where \(\mathcal{R}^i \in \mathbb{R}^{N \times 4}\) is the coordinate matrix, and each row of \(\mathcal{R}^i\) can be constructed as follows

\[(\mathcal{R}^i)_j = [ \begin{array}{c} s(r_{ji}) & \frac{s(r_{ji})x_{ji}}{r_{ji}} & \frac{s(r_{ji})y_{ji}}{r_{ji}} & \frac{s(r_{ji})z_{ji}}{r_{ji}} \end{array} ]\]

where \(\mathbf{R}_{ji}=\mathbf{R}_j-\mathbf{R}_i = (x_{ji}, y_{ji}, z_{ji})\) is the relative coordinate and \(r_{ji}=\lVert \mathbf{R}_{ji} \lVert\) is its norm. The switching function \(s(r)\) is defined as:

\[\begin{split}s(r)= \begin{cases} \frac{1}{r}, & r<r_s \\ \frac{1}{r} \{ {(\frac{r - r_s}{ r_c - r_s})}^3 (-6 {(\frac{r - r_s}{ r_c - r_s})}^2 +15 \frac{r - r_s}{ r_c - r_s} -10) +1 \}, & r_s \leq r<r_c \\ 0, & r \geq r_c \end{cases}\end{split}\]

Each row of the embedding matrix \(\mathcal{G}^i \in \mathbb{R}^{N \times M_1}\) consists of outputs of a embedding network \(\mathcal{N}\) of \(s(r_{ji})\):

\[(\mathcal{G}^i)_j = \mathcal{N}(s(r_{ji}))\]

\(\mathcal{G}^i_< \in \mathbb{R}^{N \times M_2}\) takes first \(M_2\) columns of \(\mathcal{G}^i\). The equation of embedding network \(\mathcal{N}\) can be found at deepmd.tf.utils.network.embedding_net().

Parameters
rcut

The cut-off radius \(r_c\)

rcut_smth

From where the environment matrix should be smoothed \(r_s\)

sellist[str]

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 \(\mathcal{N}\)

axis_neuron

Number of the axis neuron \(M_2\) (number of columns of the sub-matrix of the embedding matrix)

resnet_dt

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

trainable

If the weights of embedding net are trainable.

type_one_side

Try to build N_types embedding nets. Otherwise, building N_types^2 embedding nets

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.

set_davg_zero

Set the shift of embedding net input to zero.

activation_function

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

precision

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

multi_task

If the model has multi fitting nets to train.

spin

The deepspin object.

References

1

Linfeng Zhang, Jiequn Han, Han Wang, Wissam A. Saidi, Roberto Car, and E. Weinan. 2018. End-to-end symmetry preserving inter-atomic potential energy model for finite and extended systems. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (NIPS’18). Curran Associates Inc., Red Hook, NY, USA, 4441-4451.

Attributes
dim_out

Returns the output dimension of this descriptor.

Methods

__call__(*args, **kwargs)

Forward pass in NumPy implementation.

call(coord_ext, atype_ext, nlist[, mapping])

Compute the descriptor.

compute_input_stats(merged[, path])

Update mean and stddev for descriptor elements.

deserialize(data)

Deserialize from dict.

get_class_by_type(class_type)

Get the class by the plugin type.

get_dim_emb()

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()

Returns the output dimension of this descriptor.

get_nnei()

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

get_nsel()

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

get_ntypes()

Returns the number of element types.

get_plugins()

Get all the registered plugins.

get_rcut()

Returns cutoff radius.

get_sel()

Returns cutoff radius.

mixed_types()

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

register(key)

Register a descriptor plugin.

serialize()

Serialize the descriptor to dict.

share_params(base_class, shared_level[, resume])

Share the parameters of self to the base_class with shared_level during multitask training.

update_sel(global_jdata, local_jdata)

Update the selection and perform neighbor statistics.

cal_g

reinit_exclude

cal_g(ss, embedding_idx)[source]
call(coord_ext, atype_ext, nlist, mapping: Optional[ndarray] = 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 lcoal 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.

compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]

Update mean and stddev for descriptor elements.

classmethod deserialize(data: dict) DescrptSeA[source]

Deserialize from dict.

property dim_out

Returns the output dimension of this descriptor.

get_dim_emb()[source]

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()[source]

Returns the output dimension of this descriptor.

get_ntypes() int[source]

Returns the number of element types.

get_rcut()[source]

Returns cutoff radius.

get_sel()[source]

Returns cutoff radius.

mixed_types()[source]

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

reinit_exclude(exclude_types: List[Tuple[int, int]] = [])[source]
serialize() dict[source]

Serialize the descriptor to dict.

share_params(base_class, shared_level, resume=False)[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 seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.

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.dpmodel.descriptor.DescrptSeR(*args, **kwargs)[source]

Bases: NativeOP, BD

DeepPot-SE_R constructed from only the radial imformation of atomic configurations.

Parameters
rcut

The cut-off radius \(r_c\)

rcut_smth

From where the environment matrix should be smoothed \(r_s\)

sellist[str]

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 \(\mathcal{N}\)

resnet_dt

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

trainable

If the weights of embedding net are trainable.

type_one_side

Try to build N_types embedding nets. Otherwise, building N_types^2 embedding nets

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.

set_davg_zero

Set the shift of embedding net input to zero.

activation_function

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

precision

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

multi_task

If the model has multi fitting nets to train.

spin

The deepspin object.

References

1

Linfeng Zhang, Jiequn Han, Han Wang, Wissam A. Saidi, Roberto Car, and E. Weinan. 2018. End-to-end symmetry preserving inter-atomic potential energy model for finite and extended systems. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (NIPS’18). Curran Associates Inc., Red Hook, NY, USA, 4441-4451.

Attributes
dim_out

Returns the output dimension of this descriptor.

Methods

__call__(*args, **kwargs)

Forward pass in NumPy implementation.

call(coord_ext, atype_ext, nlist[, mapping])

Compute the descriptor.

compute_input_stats(merged[, path])

Update mean and stddev for descriptor elements.

deserialize(data)

Deserialize from dict.

get_class_by_type(class_type)

Get the class by the plugin type.

get_dim_emb()

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()

Returns the output dimension of this descriptor.

get_nnei()

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

get_nsel()

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

get_ntypes()

Returns the number of element types.

get_plugins()

Get all the registered plugins.

get_rcut()

Returns cutoff radius.

get_sel()

Returns cutoff radius.

mixed_types()

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

register(key)

Register a descriptor plugin.

serialize()

Serialize the descriptor to dict.

share_params(base_class, shared_level[, resume])

Share the parameters of self to the base_class with shared_level during multitask training.

update_sel(global_jdata, local_jdata)

Update the selection and perform neighbor statistics.

cal_g

cal_g(ss, ll)[source]
call(coord_ext, atype_ext, nlist, mapping: Optional[ndarray] = 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 lcoal 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.

compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]

Update mean and stddev for descriptor elements.

classmethod deserialize(data: dict) DescrptSeR[source]

Deserialize from dict.

property dim_out

Returns the output dimension of this descriptor.

get_dim_emb()[source]

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()[source]

Returns the output dimension of this descriptor.

get_ntypes() int[source]

Returns the number of element types.

get_rcut()[source]

Returns cutoff radius.

get_sel()[source]

Returns cutoff radius.

mixed_types()[source]

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

serialize() dict[source]

Serialize the descriptor to dict.

share_params(base_class, shared_level, resume=False)[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 seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.

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.dpmodel.descriptor.make_base_descriptor(t_tensor, fwd_method_name: str = 'forward')[source]

Make the base class for the descriptor.

Parameters
t_tensor

The type of the tensor. used in the type hint.

fwd_method_name

Name of the forward method. For dpmodels, it should be “call”. For torch models, it should be “forward”.

Submodules

deepmd.dpmodel.descriptor.base_descriptor module

deepmd.dpmodel.descriptor.hybrid module

class deepmd.dpmodel.descriptor.hybrid.DescrptHybrid(*args, **kwargs)[source]

Bases: BD, NativeOP

Concate a list of descriptors to form a new descriptor.

Parameters
listlistList[Union[BaseDescriptor, Dict[str, Any]]]

Build a descriptor from the concatenation of the list of descriptors. The descriptor can be either an object or a dictionary.

Methods

__call__(*args, **kwargs)

Forward pass in NumPy implementation.

call(coord_ext, atype_ext, nlist[, mapping])

Compute the descriptor.

compute_input_stats(merged[, path])

Update mean and stddev for descriptor elements.

deserialize(data)

Deserialize the model.

get_class_by_type(class_type)

Get the class by the plugin type.

get_dim_emb()

Returns the output dimension.

get_dim_out()

Returns the output dimension.

get_nnei()

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

get_nsel()

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

get_ntypes()

Returns the number of element types.

get_plugins()

Get all the registered plugins.

get_rcut()

Returns the cut-off radius.

get_sel()

Returns the number of selected atoms for each type.

mixed_types()

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

register(key)

Register a descriptor plugin.

serialize()

Serialize the obj to dict.

share_params(base_class, shared_level[, resume])

Share the parameters of self to the base_class with shared_level during multitask training.

update_sel(global_jdata, local_jdata)

Update the selection and perform neighbor statistics.

call(coord_ext, atype_ext, nlist, mapping: Optional[ndarray] = 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, not required 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.

h2

The rotationally equivariant pair-partical representation.

sw

The smooth switch function.

compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]

Update mean and stddev for descriptor elements.

classmethod deserialize(data: dict) DescrptHybrid[source]

Deserialize the model.

Parameters
datadict

The serialized data

Returns
BD

The deserialized descriptor

get_dim_emb() int[source]

Returns the output dimension.

get_dim_out() int[source]

Returns the output dimension.

get_ntypes() int[source]

Returns the number of element types.

get_rcut() float[source]

Returns the cut-off radius.

get_sel() List[int][source]

Returns the number of selected atoms for each type.

mixed_types()[source]

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

serialize() dict[source]

Serialize the obj to dict.

share_params(base_class, shared_level, resume=False)[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 seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.

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

deepmd.dpmodel.descriptor.make_base_descriptor module

deepmd.dpmodel.descriptor.make_base_descriptor.make_base_descriptor(t_tensor, fwd_method_name: str = 'forward')[source]

Make the base class for the descriptor.

Parameters
t_tensor

The type of the tensor. used in the type hint.

fwd_method_name

Name of the forward method. For dpmodels, it should be “call”. For torch models, it should be “forward”.

deepmd.dpmodel.descriptor.se_e2_a module

class deepmd.dpmodel.descriptor.se_e2_a.DescrptSeA(*args, **kwargs)[source]

Bases: NativeOP, BD

DeepPot-SE constructed from all information (both angular and radial) of atomic configurations. The embedding takes the distance between atoms as input.

The descriptor \(\mathcal{D}^i \in \mathcal{R}^{M_1 \times M_2}\) is given by [1]

\[\mathcal{D}^i = (\mathcal{G}^i)^T \mathcal{R}^i (\mathcal{R}^i)^T \mathcal{G}^i_<\]

where \(\mathcal{R}^i \in \mathbb{R}^{N \times 4}\) is the coordinate matrix, and each row of \(\mathcal{R}^i\) can be constructed as follows

\[(\mathcal{R}^i)_j = [ \begin{array}{c} s(r_{ji}) & \frac{s(r_{ji})x_{ji}}{r_{ji}} & \frac{s(r_{ji})y_{ji}}{r_{ji}} & \frac{s(r_{ji})z_{ji}}{r_{ji}} \end{array} ]\]

where \(\mathbf{R}_{ji}=\mathbf{R}_j-\mathbf{R}_i = (x_{ji}, y_{ji}, z_{ji})\) is the relative coordinate and \(r_{ji}=\lVert \mathbf{R}_{ji} \lVert\) is its norm. The switching function \(s(r)\) is defined as:

\[\begin{split}s(r)= \begin{cases} \frac{1}{r}, & r<r_s \\ \frac{1}{r} \{ {(\frac{r - r_s}{ r_c - r_s})}^3 (-6 {(\frac{r - r_s}{ r_c - r_s})}^2 +15 \frac{r - r_s}{ r_c - r_s} -10) +1 \}, & r_s \leq r<r_c \\ 0, & r \geq r_c \end{cases}\end{split}\]

Each row of the embedding matrix \(\mathcal{G}^i \in \mathbb{R}^{N \times M_1}\) consists of outputs of a embedding network \(\mathcal{N}\) of \(s(r_{ji})\):

\[(\mathcal{G}^i)_j = \mathcal{N}(s(r_{ji}))\]

\(\mathcal{G}^i_< \in \mathbb{R}^{N \times M_2}\) takes first \(M_2\) columns of \(\mathcal{G}^i\). The equation of embedding network \(\mathcal{N}\) can be found at deepmd.tf.utils.network.embedding_net().

Parameters
rcut

The cut-off radius \(r_c\)

rcut_smth

From where the environment matrix should be smoothed \(r_s\)

sellist[str]

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 \(\mathcal{N}\)

axis_neuron

Number of the axis neuron \(M_2\) (number of columns of the sub-matrix of the embedding matrix)

resnet_dt

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

trainable

If the weights of embedding net are trainable.

type_one_side

Try to build N_types embedding nets. Otherwise, building N_types^2 embedding nets

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.

set_davg_zero

Set the shift of embedding net input to zero.

activation_function

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

precision

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

multi_task

If the model has multi fitting nets to train.

spin

The deepspin object.

References

1

Linfeng Zhang, Jiequn Han, Han Wang, Wissam A. Saidi, Roberto Car, and E. Weinan. 2018. End-to-end symmetry preserving inter-atomic potential energy model for finite and extended systems. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (NIPS’18). Curran Associates Inc., Red Hook, NY, USA, 4441-4451.

Attributes
dim_out

Returns the output dimension of this descriptor.

Methods

__call__(*args, **kwargs)

Forward pass in NumPy implementation.

call(coord_ext, atype_ext, nlist[, mapping])

Compute the descriptor.

compute_input_stats(merged[, path])

Update mean and stddev for descriptor elements.

deserialize(data)

Deserialize from dict.

get_class_by_type(class_type)

Get the class by the plugin type.

get_dim_emb()

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()

Returns the output dimension of this descriptor.

get_nnei()

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

get_nsel()

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

get_ntypes()

Returns the number of element types.

get_plugins()

Get all the registered plugins.

get_rcut()

Returns cutoff radius.

get_sel()

Returns cutoff radius.

mixed_types()

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

register(key)

Register a descriptor plugin.

serialize()

Serialize the descriptor to dict.

share_params(base_class, shared_level[, resume])

Share the parameters of self to the base_class with shared_level during multitask training.

update_sel(global_jdata, local_jdata)

Update the selection and perform neighbor statistics.

cal_g

reinit_exclude

cal_g(ss, embedding_idx)[source]
call(coord_ext, atype_ext, nlist, mapping: Optional[ndarray] = 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 lcoal 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.

compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]

Update mean and stddev for descriptor elements.

classmethod deserialize(data: dict) DescrptSeA[source]

Deserialize from dict.

property dim_out

Returns the output dimension of this descriptor.

get_dim_emb()[source]

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()[source]

Returns the output dimension of this descriptor.

get_ntypes() int[source]

Returns the number of element types.

get_rcut()[source]

Returns cutoff radius.

get_sel()[source]

Returns cutoff radius.

mixed_types()[source]

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

reinit_exclude(exclude_types: List[Tuple[int, int]] = [])[source]
serialize() dict[source]

Serialize the descriptor to dict.

share_params(base_class, shared_level, resume=False)[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 seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.

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.dpmodel.descriptor.se_r module

class deepmd.dpmodel.descriptor.se_r.DescrptSeR(*args, **kwargs)[source]

Bases: NativeOP, BD

DeepPot-SE_R constructed from only the radial imformation of atomic configurations.

Parameters
rcut

The cut-off radius \(r_c\)

rcut_smth

From where the environment matrix should be smoothed \(r_s\)

sellist[str]

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 \(\mathcal{N}\)

resnet_dt

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

trainable

If the weights of embedding net are trainable.

type_one_side

Try to build N_types embedding nets. Otherwise, building N_types^2 embedding nets

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.

set_davg_zero

Set the shift of embedding net input to zero.

activation_function

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

precision

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

multi_task

If the model has multi fitting nets to train.

spin

The deepspin object.

References

1

Linfeng Zhang, Jiequn Han, Han Wang, Wissam A. Saidi, Roberto Car, and E. Weinan. 2018. End-to-end symmetry preserving inter-atomic potential energy model for finite and extended systems. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (NIPS’18). Curran Associates Inc., Red Hook, NY, USA, 4441-4451.

Attributes
dim_out

Returns the output dimension of this descriptor.

Methods

__call__(*args, **kwargs)

Forward pass in NumPy implementation.

call(coord_ext, atype_ext, nlist[, mapping])

Compute the descriptor.

compute_input_stats(merged[, path])

Update mean and stddev for descriptor elements.

deserialize(data)

Deserialize from dict.

get_class_by_type(class_type)

Get the class by the plugin type.

get_dim_emb()

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()

Returns the output dimension of this descriptor.

get_nnei()

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

get_nsel()

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

get_ntypes()

Returns the number of element types.

get_plugins()

Get all the registered plugins.

get_rcut()

Returns cutoff radius.

get_sel()

Returns cutoff radius.

mixed_types()

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

register(key)

Register a descriptor plugin.

serialize()

Serialize the descriptor to dict.

share_params(base_class, shared_level[, resume])

Share the parameters of self to the base_class with shared_level during multitask training.

update_sel(global_jdata, local_jdata)

Update the selection and perform neighbor statistics.

cal_g

cal_g(ss, ll)[source]
call(coord_ext, atype_ext, nlist, mapping: Optional[ndarray] = 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 lcoal 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.

compute_input_stats(merged: List[dict], path: Optional[DPPath] = None)[source]

Update mean and stddev for descriptor elements.

classmethod deserialize(data: dict) DescrptSeR[source]

Deserialize from dict.

property dim_out

Returns the output dimension of this descriptor.

get_dim_emb()[source]

Returns the embedding (g2) dimension of this descriptor.

get_dim_out()[source]

Returns the output dimension of this descriptor.

get_ntypes() int[source]

Returns the number of element types.

get_rcut()[source]

Returns cutoff radius.

get_sel()[source]

Returns cutoff radius.

mixed_types()[source]

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

serialize() dict[source]

Serialize the descriptor to dict.

share_params(base_class, shared_level, resume=False)[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 seperated parameters (e.g. mean and stddev) will be re-calculated across different classes.

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