Expand description
Minimum-image convention for a periodic parallelepiped.
Cell holds the 3x3 lattice H and a dump-cell origin. Constructors
accept a LAMMPS bound box plus tilts, a CON lattice or
length-angle box, an ASE-style 3x3 cell, and a vesin box. Distances
are the fractional wrap ds = wrap(Hinv (q - p)), then dr = H ds.
That is the LAMMPS lamda / eOn / HOOMD engine convention.
Orthorhombic boxes use d - L floor(d/L + 1/2) on every image.
A restricted triclinic box uses the triangular lamda step.
Cell::reduce_tilts is GROMACS correct_box;
Cell::to_restricted is the LAMMPS general-to-restricted rotation.
Cell::displacement_euclidean is Smith’s half-altitude test, then
Babai’s rounding and the Sommer–Feder–Shalvi slicer on the Selling
superbasis cached on the calling thread. Lagrange size reduction runs before
that Delone step. dist2_many, dist2_pairs, wrap_many, and
dist2_ortho_diffs batch the engine wrap. The orthorhombic SoA
kernel is AVX when the CPU has it. Cell::fixed stores a position
as 64-bit fixed-point fractions, and the wrap between two of them is
exact integer arithmetic (Cell::dist2_fixed, dist2_many_fixed,
dist2_pairs_fixed).
Cell::dist2_shifted_indexed gathers a linked-cell bin’s index
list into that shifted kernel. reduce_pairs turns
a vesin image pair list into one minimum-image pair and drops the
self image.
It is a LODE library. The Rust crate is the implementation. The C
ABI (mi_*) is the hourglass waist, the same shape as
linkcell and
readcon-core. C++ is a
RAII header over that ABI.
use minimage::Cell;
let sim = Cell::ortho(10.0, 10.0, 10.0)?;
let left = [0.2, 0.0, 0.0];
let right = [9.4, 0.0, 0.0];
assert!((sim.dist2(left, right) - 0.64).abs() < 1e-12);Structs§
- Cell
- Periodic parallelepiped: columns of H, origin, and an ortho flag.
- mi_cell
- Periodic parallelepiped. Lattice vectors are a, b, c (same as vesin rows).
Enums§
- Error
- Why a cell or a distance call could not run.
Functions§
- dist2_
euclidean_ many Cell::dist2_euclideanfrompto each row ofqs, bit for bit. The superbasis is looked up once per call rather than once per pair.- dist2_
euclidean_ pairs Cell::dist2_euclideanfor paired rows, bit for bit, with one superbasis lookup per call.- dist2_
euclidean_ pairs_ warm - Euclidean nearest-image squared distances for pairs that persist across frames.
- dist2_
many - Squared MIC distances from
pto each packed candidate inqs. - dist2_
many_ fixed - Squared engine-wrap distances from fixed-point
pto each fixed-pointqs(Cell::fixed). Integer wrap, one product withH. - dist2_
many_ fixed32 Cell::dist2_fixed32frompto each row ofqs, bit for bit: sixteen rows per AVX-512 pass, eight per AVX2 pass.- dist2_
ortho_ diffs - Orthorhombic wrap of precomputed differences, one reciprocal per axis.
- dist2_
pairs - Squared MIC distances for packed pair lists
psandqs. - dist2_
pairs_ fixed - Squared engine-wrap distances for fixed-point pair lists.
- dist2_
pairs_ fixed32 Cell::dist2_fixed32for paired rows, bit for bit.- dump_
bounds_ to_ h - Recover restricted-triclinic H (columns a, b, c) and origin from a LAMMPS dump bound box.
- fixed32_
many Cell::fixed32for packed positions.- fixed_
many Cell::fixedfor packed positions: one AVX2 pass folds, floors, and takes the mantissa oft + 1for four rows at once.- is_
minkowski_ reduced - True when the three columns of H satisfy the 3D Minkowski inequalities (Jaber; Nguyen–Stehlé).
- mi_
cell_ ⚠from_ ase - Fill
outfrom an ASE-style row-major 3x3 cell.originmay be NULL (then zero). - mi_
cell_ ⚠from_ con - Fill
outfrom a CON 3x3 lattice (rows a, b, c). - mi_
cell_ ⚠from_ con_ box - Fill
outfrom CON lengths and angles in degrees. - mi_
cell_ from_ lammps - Fill
outfrom LAMMPSxlo xhi ylo yhi zlo zhiand tilts. - mi_
cell_ from_ lammps_ bounds - Fill
outfrom dump bound spans, tilts, and bound lo. - mi_
cell_ ⚠from_ vectors - Fill
outfrom lattice vectors a, b, c and an origin. - mi_
cell_ ⚠from_ vesin - Fill
outfrom a vesin 3x3 box (rows a, b, c). - mi_
displacement ⚠ - Minimum-image displacement from
ptoqintodr. - mi_
displacement_ ⚠euclidean - Euclidean MIC: Smith half-altitude test, else the slicer on the
Selling superbasis, into
dr. - mi_
dist2 ⚠ - Squared minimum-image distance from
ptoq. - mi_
dist2_ ⚠euclidean_ many - Euclidean nearest-image squared distances from
ptonpacked candidates:mi_displacement_euclideanper pair, bit for bit, with one superbasis lookup per call and eight pairs per slicer pass. - mi_
dist2_ ⚠euclidean_ pairs mi_dist2_euclidean_manyfor paired rows.- mi_
dist2_ ⚠euclidean_ pairs_ warm mi_dist2_euclidean_pairsfor pairs that persist across frames.imagesisnrows of threeint32_t: the cell-basis lattice shift of each pair’s image from the previous call, zeros to start, updated in place. A pair whose stored image still lies in the Voronoi cell skips the search; its distance equals the full search to rounding.- mi_
dist2_ ⚠fixed - Squared engine-wrap distance between two fixed-point positions.
- mi_
dist2_ ⚠fixed32 - Squared engine-wrap distance between two 32-bit fixed-point positions.
- mi_
dist2_ ⚠many - Squared MIC distances from
ptonpacked candidates inqs. - mi_
dist2_ ⚠many_ fixed - Squared engine-wrap distances from fixed-point
ptonpacked fixed-point candidates. - mi_
dist2_ ⚠many_ fixed32 - Squared engine-wrap distances from 32-bit fixed-point
ptonpacked fixed-point candidates. - mi_
dist2_ ⚠ortho_ diffs - Orthorhombic wrap of precomputed differences (Highway kernel).
- mi_
dist2_ ⚠pairs - Squared MIC distances for
npacked pairs(ps[k], qs[k]). - mi_
dist2_ ⚠pairs_ fixed - Squared engine-wrap distances for
npacked fixed-point pairs. - mi_
dist2_ ⚠pairs_ fixed32 - Squared engine-wrap distances for
npacked 32-bit fixed-point pairs. - mi_
dist2_ ⚠shifted_ many - Squared distances from
ptonpoints inqs, plus one lattice shift(sx, sy, sz)on every candidate. Rapaport’s bin pair. - mi_
fixed32_ ⚠many - 32-bit fixed-point fractional coordinates of
npacked positions: threeuint32_tper position, each the 64-bit fraction ofmi_fixed_manyrounded to its top 32 bits. - mi_
fixed_ ⚠many - Fixed-point fractional coordinates of
npacked positions: threeuint64_tper position, each fraction asround(s * 2^52) * 2^12. - mi_
last_ error - Thread-local last-error string from this thread’s most recent
mi_*failure. - mi_
reduce_ ⚠pairs - Drop self images and collapse duplicate
(i, j)rows. - mi_
version - Library version string. Process-static, NUL-terminated. Do not free.
- mi_
wrap_ ⚠many - Engine wrap of
npacked difference vectors intoout. - minkowski_
reduce - Unimodular Minkowski reduction. Same Cartesian lattice, new basis
with
|a| <= |b| <= |c|. - reduce_
pairs - Drop self images and collapse duplicate
(i, j)rows. - reduce_
pairs_ packed - Same reduction over a packed
n * 2C buffer. - wrap_
many - Minimum-image wrap of packed difference vectors.