deepmd.dpmodel.utils.dist_check#

Minimum pairwise distance check for frame validity filtering.

Attributes#

Functions#

compute_min_pair_dist_single(→ float)

Compute the minimum pairwise atomic distance for a single frame.

Module Contents#

deepmd.dpmodel.utils.dist_check._MIN_PAIR_DIST_BLOCK_PAIRS = 262144[source]#
deepmd.dpmodel.utils.dist_check.compute_min_pair_dist_single(coord: numpy.ndarray, box: numpy.ndarray | None, atype: numpy.ndarray, stop_below: float | None = None) float[source]#

Compute the minimum pairwise atomic distance for a single frame.

Parameters:
coordnp.ndarray

Atomic coordinates, flattened with shape (natoms * 3,) or reshaped as (natoms, 3).

boxnp.ndarray or None

Box vectors with shape (9,) for PBC, or None for non-PBC.

atypenp.ndarray

Atom types with shape (natoms,). Virtual atoms (type < 0) are excluded from the distance check.

stop_belowfloat or None

Optional early-stop threshold. If a block has any pair closer than this value, the block minimum is returned immediately.

Returns:
float

Minimum pairwise distance. Returns inf if fewer than 2 real atoms exist.