deepmd.pt.model.descriptor.se_r

Module Contents

Classes

DescrptSeR

Base descriptor provides the interfaces of descriptor.

class deepmd.pt.model.descriptor.se_r.DescrptSeR(rcut, rcut_smth, sel, neuron=[25, 50, 100], set_davg_zero: bool = False, activation_function: str = 'tanh', precision: str = 'float64', resnet_dt: bool = False, exclude_types: List[Tuple[int, int]] = [], env_protection: float = 0.0, old_impl: bool = False, trainable: bool = True, **kwargs)[source]

Bases: deepmd.pt.model.descriptor.base_descriptor.BaseDescriptor, torch.nn.Module

Base descriptor provides the interfaces of descriptor.

get_rcut() float[source]

Returns the cut-off radius.

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

Returns the output dimension.

abstract get_dim_emb() int[source]

Returns the output dimension.

get_dim_in() int[source]

Returns the input dimension.

mixed_types() bool[source]

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

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

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.

compute_input_stats(merged: Callable[[], List[dict]] | List[dict], path: deepmd.utils.path.DPPath | None = None)[source]

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

Parameters:
mergedUnion[Callable[[], List[dict]], List[dict]]
  • List[dict]: A list of data samples from various data systems.

    Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.

  • Callable[[], List[dict]]: A lazy function that returns data samples in the above format

    only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.

pathOptional[DPPath]

The path to the stat file.

get_stats() Dict[str, deepmd.utils.env_mat_stat.StatItem][source]

Get the statistics of the descriptor.

__setitem__(key, value)[source]
__getitem__(key)[source]
reinit_exclude(exclude_types: List[Tuple[int, int]] = [])[source]
forward(coord_ext: torch.Tensor, atype_ext: torch.Tensor, nlist: torch.Tensor, mapping: torch.Tensor | 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, 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. this descriptor returns None

h2

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

sw

The smooth switch function.

set_stat_mean_and_stddev(mean: torch.Tensor, stddev: torch.Tensor) None[source]
serialize() dict[source]

Serialize the obj to dict.

classmethod deserialize(data: dict) DescrptSeR[source]

Deserialize the model.

Parameters:
datadict

The serialized data

Returns:
BD

The deserialized 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