deepmd.dpmodel.descriptor.descriptor#

Attributes#

Classes#

DescriptorBlock

The building block of descriptor.

Functions#

extend_descrpt_stat(→ None)

Extend the statistics of a descriptor block with types from newly provided type_map.

Module Contents#

deepmd.dpmodel.descriptor.descriptor.log[source]#
class deepmd.dpmodel.descriptor.descriptor.DescriptorBlock[source]#

Bases: abc.ABC, make_plugin_registry('DescriptorBlock')

The building block of descriptor. Given the input descriptor, provide with the atomic coordinates, atomic types and neighbor list, calculate the new descriptor.

local_cluster = False[source]#
abstract get_rcut() float[source]#

Returns the cut-off radius.

abstract get_nsel() int[source]#

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

abstract get_sel() list[int][source]#

Returns the number of selected atoms for each type.

abstract get_ntypes() int[source]#

Returns the number of element types.

abstract get_dim_out() int[source]#

Returns the output dimension.

abstract get_dim_in() int[source]#

Returns the input dimension.

abstract get_dim_emb() int[source]#

Returns the embedding dimension.

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.

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.

abstract get_stats() dict[str, deepmd.utils.env_mat_stat.StatItem][source]#

Get the statistics of the descriptor.

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.

abstract call(nlist: numpy.ndarray, extended_coord: numpy.ndarray, extended_atype: numpy.ndarray, extended_atype_embd: numpy.ndarray | None = None, mapping: numpy.ndarray | None = None, type_embedding: numpy.ndarray | None = None)[source]#

Calculate DescriptorBlock.

abstract has_message_passing() bool[source]#

Returns whether the descriptor block has message passing.

abstract need_sorted_nlist_for_lower() bool[source]#

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

deepmd.dpmodel.descriptor.descriptor.extend_descrpt_stat(des, type_map, des_with_stat=None) None[source]#

Extend the statistics of a descriptor block with types from newly provided type_map.

After extending, the type related dimension of the extended statistics will have a length of len(old_type_map) + len(type_map), where old_type_map represents the type map in des. The get_index_between_two_maps() function can then be used to correctly select statistics for types from old_type_map or type_map. Positive indices from 0 to len(old_type_map) - 1 will select old statistics of types in old_type_map, while negative indices from -len(type_map) to -1 will select new statistics of types in type_map.

Parameters:
desDescriptorBlock

The descriptor block to be extended.

type_maplist[str]

The name of each type of atoms to be extended.

des_with_statDescriptorBlock, Optional

The descriptor block has additional statistics of types from newly provided type_map. If None, the default statistics will be used. Otherwise, the statistics provided in this DescriptorBlock will be used.