xnn.common.data.neighborlist#

Periodic-boundary-aware neighbor list.

Produces, for a single structure, the edge list and the integer periodic image shift per edge within a cutoff. The same routine handles molecular systems (cell=None / no pbc) by simply skipping image enumeration.

The reference implementation here is a clear one (per-structure, brute force over the minimal set of image shifts), correct for both small molecules and dense crystals but quadratic in the number of atoms. When vesin is installed its cell list is used instead, which returns the same edges with the same conventions and is what makes this usable at system sizes where the brute force is not: on 5000 atoms with a 6 A cutoff, 1674 ms becomes 0.6 ms. vesin is optional – without it, or for the cases it cannot express (per-axis periodicity, self-edges), the reference implementation runs unchanged.

Functions

build_neighbor_list(pos, cutoff[, cell, ...])

Build a periodic-boundary-aware neighbor list for a single structure.