#[unsafe(no_mangle)]pub unsafe extern "C" fn lc_pairs_within(
xyz: *const f64,
n: usize,
simbox: *const lc_cell,
cutoff: f64,
mask: *const c_int,
cell_hint: f64,
half: c_int,
out_i: *mut c_int,
out_j: *mut c_int,
out_shift: *mut c_int,
out_d2: *mut f64,
cap: usize,
out_count: *mut usize,
) -> c_intExpand description
Cutoff pairs with the vesin / tonari shift S.
Each row is one atom-image: out_i[t], out_j[t],
out_shift[3*t + 0..3] = (na, nb, nc), and out_d2[t].
Displacement is r_j - r_i + S H in the caller’s basis.
dist2 is strictly below cutoff squared. half nonzero keeps
the canonical side of (i, j, S) versus (j, i, -S).
Pass null out_i, out_j, out_shift, and out_d2 to query.
*out_count receives the row count and the return is 0.
Otherwise all four buffers are required and cap is their row
capacity. A short buffer sets *out_count to the needed row count
and returns nonzero without writing.
A query, or a short buffer, keeps its search on the calling thread.
The next call on that thread takes it when every input is the same
bit for bit (xyz, the box, cutoff, mask, cell_hint, half)
and writes the rows without searching again. Any other call drops
it. A fill that writes does not keep anything.
§Safety
xyz is readable for n * 3 doubles. simbox points at one
lc_cell. mask, if non-null, is readable for n ints.
out_count is writable. On a fill, out_i and out_j are
writable for cap ints, out_shift for cap * 3 ints, and
out_d2 for cap doubles.