deepmd.utils.out_stat

Output statistics.

Module Contents

Functions

compute_stats_from_redu(→ Tuple[numpy.ndarray, ...)

Compute the output statistics.

compute_stats_from_atomic(→ Tuple[numpy.ndarray, ...)

Compute the output statistics.

deepmd.utils.out_stat.compute_stats_from_redu(output_redu: numpy.ndarray, natoms: numpy.ndarray, assigned_bias: numpy.ndarray | None = None, rcond: float | None = None) Tuple[numpy.ndarray, numpy.ndarray][source]

Compute the output statistics.

Given the reduced output value and the number of atoms for each atom, compute the least-squares solution as the atomic output bais and std.

Parameters:
output_redu

The reduced output value, shape is [nframes, *(odim0, odim1, …)].

natoms

The number of atoms for each atom, shape is [nframes, ntypes].

assigned_bias

The assigned output bias, shape is [ntypes, *(odim0, odim1, …)]. Set to a tensor of shape (odim0, odim1, …) filled with nan if the bias of the type is not assigned.

rcond

Cut-off ratio for small singular values of a.

Returns:
np.ndarray

The computed output bias, shape is [ntypes, *(odim0, odim1, …)].

np.ndarray

The computed output std, shape is [*(odim0, odim1, …)].

deepmd.utils.out_stat.compute_stats_from_atomic(output: numpy.ndarray, atype: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray][source]

Compute the output statistics.

Given the output value and the type of atoms, compute the atomic output bais and std.

Parameters:
output

The output value, shape is [nframes, nloc, ndim].

atype

The type of atoms, shape is [nframes, nloc].

Returns:
np.ndarray

The computed output bias, shape is [ntypes, ndim].

np.ndarray

The computed output std, shape is [ntypes, ndim].