deepmd.dpmodel.descriptor.descriptor#
Attributes#
Classes#
The building block of descriptor. |
Functions#
| Extend the statistics of a descriptor block with types from newly provided type_map. |
Module Contents#
- 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.
- 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:
- merged
Union
[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.
- path
Optional
[DPPath
] The path to the stat file.
- merged
- abstract get_stats() dict[str, deepmd.utils.env_mat_stat.StatItem] [source]#
Get the statistics of the descriptor.
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.
- 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:
- des
DescriptorBlock
The descriptor block to be extended.
- type_map
list
[str
] The name of each type of atoms to be extended.
- des_with_stat
DescriptorBlock
,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.
- des