deepmd.utils.env_mat_stat

Module Contents

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.

Attributes

log

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

A class to store the statistics of the environment matrix.

Parameters:
numberint

The total size of given array.

sumfloat

The sum value of the matrix.

squared_sumfloat

The sum squared value of the matrix.

__add__(other: StatItem) 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.

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.

abstract iter(data: List[Dict[str, numpy.ndarray]]) 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.