deepmd.pt.model.descriptor.dpa2

Module Contents

Classes

DescrptDPA2

Base descriptor provides the interfaces of descriptor.

class deepmd.pt.model.descriptor.dpa2.DescrptDPA2(ntypes: int, repinit: deepmd.dpmodel.descriptor.dpa2.RepinitArgs | dict, repformer: deepmd.dpmodel.descriptor.dpa2.RepformerArgs | dict, concat_output_tebd: bool = True, precision: str = 'float64', smooth: bool = True, exclude_types: List[Tuple[int, int]] = [], env_protection: float = 0.0, trainable: bool = True, seed: int | None = None, add_tebd_to_repinit_out: bool = False, use_econf_tebd: bool = False, type_map: List[str] | None = None, old_impl: bool = False)[source]

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

Base descriptor provides the interfaces of descriptor.

property dim_out[source]
property dim_emb[source]

Returns the embedding dimension g2.

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

Returns the output dimension of this descriptor.

get_dim_emb() int[source]

Returns the embedding dimension of this descriptor.

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.

get_env_protection() float[source]

Returns the protection of building environment matrix.

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.

serialize() dict[source]

Serialize the obj to dict.

classmethod deserialize(data: dict) DescrptDPA2[source]

Deserialize the model.

Parameters:
datadict

The serialized data

Returns:
BD

The deserialized descriptor

forward(extended_coord: torch.Tensor, extended_atype: torch.Tensor, nlist: torch.Tensor, mapping: torch.Tensor | None = None, comm_dict: Dict[str, torch.Tensor] | None = None)[source]

Compute the descriptor.

Parameters:
extended_coord

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

extended_atype

The extended aotm types. shape: nf x nall

nlist

The neighbor list. shape: nf x nloc x nnei

mapping

The index mapping, mapps extended region index to local region.

comm_dict

The data needed for communication for parallel inference.

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. shape: nf x nloc x nnei x ng

h2

The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3

sw

The smooth switch function. shape: nf x nloc x nnei

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