Skip to main content

pairs_open

Function pairs_open 

Source
pub fn pairs_open(
    xyz: &[[f64; 3]],
    cutoff: f64,
    cell_hint: Option<f64>,
) -> Result<Vec<Pair>, Error>
Expand description

Cartesian half pair list of an open cluster.

Every axis is open. Row (i, j, [0, 0, 0], dist2) has i < j and dist2 < cutoff². The atoms are binned on the occupied Cartesian cells. One partner stencil serves every call with the same cutoff and bin edge, so stencil_builds does not move when later frames occupy other bins. A reach past 16 bins can widen it when a frame spans more bins on y or z than it covers.

use linkcell::pairs_open;

let xyz = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [3.0, 0.0, 0.0]];
let rows = pairs_open(&xyz, 1.5, None).unwrap();
assert_eq!(rows.len(), 1);
assert_eq!((rows[0].i, rows[0].j, rows[0].shift), (0, 1, [0, 0, 0]));