<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Minimum image and H</title>
<meta name="description" content="Fractional wrap, LAMMPS dump bounds, vesin pair reduction." />
<meta name="generator" content="Org Mode" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="assets/minimage-icon.svg" type="image/svg+xml" />
<link rel="stylesheet" href="css/site.css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=JetBrains+Mono:wght@500;700&display=swap" rel="stylesheet" />
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="index.html"> UP </a>
|
<a accesskey="H" href="index.html"> HOME </a>
</div><div id="content" class="content">
<nav class="top" aria-label="minimage">
<a class="brand" href="index.html">minimage</a>
<a href="getting-started.html">Install</a>
<a href="tutorial.html">Tutorial</a>
<a href="howto.html">How-to</a>
<a href="explanation.html">Explain</a>
<a href="reference.html">Reference</a>
<a href="https://lode-org.github.io/">LODE</a>
</nav>
<div class="rule" aria-hidden="true"></div>
<p>
A periodic dump is a parallelepiped whose edges are the columns of H.
Cartesian coordinates fold to fractional coordinates <code>s = Hinv (r -
origin)</code>, wrap each component into the central image, then map back
<code>r = H s</code>. Squared distance is <code>|H wrap(Hinv (q - p))|^2</code>.
</p>
<p>
Orthorhombic boxes are the diagonal case (Allen and Tildesley;
Frenkel and Smit). Each axis is <code>d - L floor(d/L + 1/2)</code>, every
image, not one subtraction. The tie keeps <code>-L/2</code> and maps <code>+L/2</code>
onto <code>-L/2</code>, matching dump <code>relDist</code>.
</p>
<p>
A restricted triclinic box (<code>a</code> along x, <code>b</code> in the xy plane) uses
the triangular lamda step of LAMMPS <code>Domain::minimum_image</code>, HOOMD
<code>BoxDim::minImage</code>, and GROMACS <code>pbc_dx</code> (Tuckerman; Wassenaar). A
general orientation is two products with <code>Hinv</code>. <code>Cell::reduce_tilts</code>
is GROMACS <code>correct_box</code>. <code>Cell::to_restricted</code> is the LAMMPS
general-to-restricted rotation.
</p>
<p>
The SoA orthorhombic kernel is Highway <code>BatchPeriodicDistSq</code>: one
reciprocal per axis, <code>abs</code>, then <code>round</code>. AVX issues four doubles
when the CPU has it.
</p>
<section id="outline-container-org0503cf2" class="outline-2">
<h2 id="org0503cf2">Nearest image</h2>
<div class="outline-text-2" id="text-org0503cf2">
<p>
Smith, CCP5 Newsletter 1989: the engine wrap is the Euclidean
nearest image when its length is strictly below half the smallest
face altitude. That is the cutoff regime. Linkcell k-NN has no
cutoff. A hex-prism body diagonal is an engine wrap that is longer
than another image.
</p>
<p>
Past that test the closest point is McKilliam, Grant, and Clarkson,
SIAM J. Discrete Math. 28, 1405 (2014), on the obtuse superbasis
every three-dimensional lattice has (Selling, 1874; Conway and
Sloane, Proc. R. Soc. Lond. A 436, 55, 1992). A near-parallel basis
makes the one-vector Delone step linear in the reciprocal of the
angle, so Lagrange's size reduction (1773; Gauss, 1801) shortens
the edges first. The superbasis is cached on the calling thread and built on the first query that fails the Smith test.
A tie keeps the engine vector.
Nguyen and Stehlé, ACM Trans. Algorithms 5, 46 (2009), still
Minkowski-reduces a basis; that reduction is not the closest-vector
certificate. The linked-cell pair itself is Rapaport's shift,
<code>|q + shift - p|^2</code>, exposed as <code>dist2_shifted_many</code>. A bin that
is an index list rather than a contiguous slice is
<code>dist2_shifted_indexed</code>: it gathers a chunk of those positions into
the same kernel. The gather copies every point first. On a long
index list that copy was slower than the inlined subtract, so the
production walk keeps the subtract.
</p>
</div>
</section>
<section id="outline-container-org2314b69" class="outline-2">
<h2 id="org2314b69">Dump bounds are not H</h2>
<div class="outline-text-2" id="text-org2314b69">
<p>
LAMMPS ITEM BOX BOUNDS stores bound spans plus tilt <code>xy, xz, yz</code>.
<code>Cell::from_lammps_bounds</code> recovers the restricted-triclinic H and
origin:
</p>
<div class="org-src-container">
<pre class="src src-text">xlo_bound = xlo + min(0, xy, xz, xy+xz)
</pre>
</div>
<p>
A CON header may already hold the 3x3 lattice, or lengths and angles
in the crystallographic convention. ASE and vesin pass rows <code>(a, b,
c)</code>.
</p>
</div>
</section>
<section id="outline-container-org133b30e" class="outline-2">
<h2 id="org133b30e">vesin images</h2>
<div class="outline-text-2" id="text-org133b30e">
<p>
vesin enumerates periodic images. A particle can appear as its own
neighbour through an image, and one neighbour can arrive through
several images. <code>reduce_pairs</code> keeps each ordered pair once and drops
the self image.
</p>
</div>
</section>
<section id="outline-container-org1efbdd7" class="outline-2">
<h2 id="org1efbdd7">Consumers</h2>
<div class="outline-text-2" id="text-org1efbdd7">
<p>
linkcell re-exports <code>minimage::Cell</code> for the fold and the lattice
shift. d-SEAMS calls the C ABI from <code>lammpsBoxToLcCell</code>,
<code>periodicDistSq</code> / <code>relDist</code>, the ortho batch kernel, and the vesin
pair collapse.
</p>
</div>
</section>
</div>
</body>
</html>