deepmd.utils.env_mat_stat#

Attributes#

Classes#

StatItem

A class to store the statistics of the environment matrix.

EnvMatStat

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

Module Contents#

deepmd.utils.env_mat_stat.log[source]#
class deepmd.utils.env_mat_stat.StatItem(number: float = 0, sum: float = 0, squared_sum: float = 0)[source]#

A class to store the statistics of the environment matrix.

Parameters:
numberfloat

The total size of given array.

sumfloat

The sum value of the matrix.

squared_sumfloat

The sum squared value of the matrix.

number = 0[source]#
sum = 0[source]#
squared_sum = 0[source]#
__add__(other: StatItem) StatItem[source]#
__mul__(scalar: float) StatItem[source]#
compute_avg(default: float = 0) float[source]#

Compute the average of the environment matrix.

Parameters:
defaultfloat, optional

The default value of the average, by default 0.

Returns:
float

The average of the environment matrix.

compute_std(default: float = 0.1, protection: float = 0.01) float[source]#

Compute the standard deviation of the environment matrix.

Parameters:
defaultfloat, optional

The default value of the standard deviation, by default 1e-1.

protectionfloat, optional

The protection value for the standard deviation, by default 1e-2.

Returns:
float

The standard deviation of the environment matrix.

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

Bases: abc.ABC

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

stats[source]#
compute_stats(data: list[dict[str, numpy.ndarray]]) None[source]#

Compute the statistics of the environment matrix.

Parameters:
datalist[dict[str, np.ndarray]]

The environment matrix.

abstractmethod iter(data: list[dict[str, numpy.ndarray]]) collections.abc.Iterator[dict[str, StatItem]][source]#

Get the iterator of the environment matrix.

Parameters:
datalist[dict[str, np.ndarray]]

The environment matrix.

Yields:
dict[str, StatItem]

The statistics of the environment matrix.

save_stats(path: deepmd.utils.path.DPPath) None[source]#

Save the statistics of the environment matrix.

Parameters:
pathDPPath

The path to save the statistics of the environment matrix.

load_stats(path: deepmd.utils.path.DPPath) None[source]#

Load the statistics of the environment matrix.

Parameters:
pathDPPath

The path to load the statistics of the environment matrix.

load_or_compute_stats(data: list[dict[str, numpy.ndarray]], path: deepmd.utils.path.DPPath | None = None) None[source]#

Load the statistics of the environment matrix if it exists, otherwise compute and save it.

Parameters:
pathDPPath

The path to load the statistics of the environment matrix.

datalist[dict[str, np.ndarray]]

The environment matrix.

get_avg(default: float = 0) dict[str, float][source]#

Get the average of the environment matrix.

Parameters:
defaultfloat, optional

The default value of the average, by default 0.

Returns:
dict[str, float]

The average of the environment matrix.

get_std(default: float = 0.1, protection: float = 0.01) dict[str, float][source]#

Get the standard deviation of the environment matrix.

Parameters:
defaultfloat, optional

The default value of the standard deviation, by default 1e-1.

protectionfloat, optional

The protection value for the standard deviation, by default 1e-2.

Returns:
dict[str, float]

The standard deviation of the environment matrix.