pairwise_distances¶
- jaxrens.backends.geometry.pairwise_distances(positions, cell)[source]¶
Full
(N, N)matrix of inter-atomic distances.Uses the minimum-image convention when
cellis a real (non-degenerate) lattice, so close contacts across a periodic boundary are measured correctly; for a non-periodic system (cellall zeros / singular) raw Cartesian distances are used. MIC is single-image (“111”, O(N^2), no supercell expansion) — exact as long as the relevant cutoff stays below half the shortest perpendicular cell width (the smallest face-to-face distance of the cell).The diagonal is the self-distance and is therefore exactly 0; callers that sum or threshold over pairs must mask it themselves. Gradients are finite everywhere (zero on the diagonal).
- Parameters:
positions (Array) –
(N, 3)atomic positions.cell (Array) –
(3, 3)lattice matrix (rows are lattice vectors); zeros for a non-periodic system.
- Returns:
(N, N)symmetric distance matrix.- Return type:
Array