deepmd.dpmodel.utils.env_mat_stat#

Classes#

EnvMatStat

A base class to store and calculate the statistics of the environment matrix.

EnvMatStatSe

Environmental matrix statistics for the se_a/se_r environmental matrix.

Functions#

merge_env_stat(→ None)

Merge descriptor env mat stats from link_obj into base_obj.

Module Contents#

deepmd.dpmodel.utils.env_mat_stat.merge_env_stat(base_obj: deepmd.dpmodel.descriptor.Descriptor | deepmd.dpmodel.descriptor.DescriptorBlock, link_obj: deepmd.dpmodel.descriptor.Descriptor | deepmd.dpmodel.descriptor.DescriptorBlock, model_prob: float = 1.0) None[source]#

Merge descriptor env mat stats from link_obj into base_obj.

Uses probability-weighted merging: merged = base_stats + link_stats * model_prob, where model_prob = link_prob / base_prob. Mutates base_obj.stats for chaining (3+ models).

Parameters:
base_objDescriptor or DescriptorBlock

The base descriptor whose stats will be updated.

link_objDescriptor or DescriptorBlock

The linked descriptor whose stats will be merged in.

model_probfloat

The probability weight ratio (link_prob / base_prob).

class deepmd.dpmodel.utils.env_mat_stat.EnvMatStat[source]#

Bases: deepmd.utils.env_mat_stat.EnvMatStat

A base class to store and calculate the statistics of the environment matrix.

compute_stat(env_mat: dict[str, deepmd.dpmodel.array_api.Array]) dict[str, deepmd.utils.env_mat_stat.StatItem][source]#

Compute the statistics of the environment matrix for a single system.

Parameters:
env_matArray

The environment matrix.

Returns:
dict[str, StatItem]

The statistics of the environment matrix.

class deepmd.dpmodel.utils.env_mat_stat.EnvMatStatSe(descriptor: deepmd.dpmodel.descriptor.Descriptor | deepmd.dpmodel.descriptor.DescriptorBlock)[source]#

Bases: EnvMatStat

Environmental matrix statistics for the se_a/se_r environmental matrix.

Parameters:
descriptorDescriptor or DescriptorBlock

The descriptor of the model.

descriptor[source]#
last_dim[source]#
iter(data: list[dict[str, numpy.ndarray | list[tuple[int, int]]]]) collections.abc.Iterator[dict[str, deepmd.utils.env_mat_stat.StatItem]][source]#

Get the iterator of the environment matrix.

Parameters:
datalist[dict[str, Union[np.ndarray, list[tuple[int, int]]]]]

The data.

Yields:
dict[str, StatItem]

The statistics of the environment matrix.

get_hash() str[source]#

Get the hash of the environment matrix.

Returns:
str

The hash of the environment matrix.

__call__() tuple[deepmd.dpmodel.array_api.Array, deepmd.dpmodel.array_api.Array][source]#