linkcell/cell.rs
1//! Periodic cell: re-export of [`minimage::Cell`].
2//!
3//! Lattice vectors are the columns of H. Constructors, the fractional
4//! wrap, [`Cell::dist2`], [`Cell::lattice_shift`], and
5//! [`Cell::dist2_shifted`] live in minimage. This module keeps the
6//! linkcell names so the walk does not own a second H.
7//!
8//! [`dist2_ortho_diffs`] is the orthorhombic Highway kernel: packed
9//! `dx, dy, dz`, one reciprocal per axis, then
10//! `dr -= box * round(dr / box)` after `abs`. That is a minimum-image
11//! wrap of a raw difference. [`crate::pairs_within`] does not call it.
12//! The stencil has already chosen the image `S`, and the row distance
13//! is [`Cell::dist2_shifted`]. A second wrap pulls a far image back
14//! inside the cutoff and labels it with the wrong `S`.
15//! [`crate::knearest_brute`] does call it on an orthorhombic box,
16//! where that wrap is the whole distance.
17//!
18//! ```
19//! use linkcell::dist2_ortho_diffs;
20//!
21//! # fn main() -> Result<(), linkcell::Error> {
22//! let dx = [9.2];
23//! let dy = [0.0];
24//! let dz = [0.0];
25//! let mut out = [0.0];
26//! dist2_ortho_diffs(&dx, &dy, &dz, 10.0, 10.0, 10.0, &mut out)?;
27//! assert!((out[0] - 0.64).abs() < 1e-12);
28//! # Ok(())
29//! # }
30//! ```
31
32pub use minimage::Cell;
33pub use minimage::{
34 dist2_many, dist2_ortho_diffs, dist2_pairs, reduce_pairs, reduce_pairs_packed, wrap_many,
35};