Skip to main content

minimage

minimage

Minimum-image convention for a periodic parallelepiped.

linkcell walks k-nearest neighbours. vesin builds cutoff pair lists. Both need the same wrap: fold through H, pick one image, never the self image. This crate is that wrap. Cell holds the 3x3 lattice and a dump-cell origin. Constructors accept LAMMPS bounds plus xy, xz, yz tilts, a CON lattice or length-angle box, an ASE-style 3x3 cell, and a vesin box.

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.

Docs (orgmode first, HTML export): lode-org.github.io/minimage. Org catalog: lode-org.github.io.

Install

Rust:

cargo add minimage

C and C++ consumers take the staticlib (--features capi, on by default) plus include/minimage.h or include/minimage.hpp. Meson, CMake, and pkg-config all install that archive and those headers.

pip install minimage
import minimage

cell = minimage.Cell.ortho(10.0, 10.0, 10.0)
assert abs(cell.dist2([0.2, 0.0, 0.0], [9.4, 0.0, 0.0]) - 0.64) < 1e-12

Meson

meson setup build
meson compile -C build
meson install -C build

As a wrap, Meson exposes minimage_dep:

[wrap-git]
url = https://github.com/lode-org/minimage.git
revision = v0.2.0
depth = 1

[provide]
minimage = minimage_dep
minimage_dep = dependency('minimage', fallback: ['minimage', 'minimage_dep'])

CMake

cmake -B build -DCMAKE_INSTALL_PREFIX=$PREFIX
cmake --build build
cmake --install build
find_package(minimage 0.1 REQUIRED)
target_link_libraries(app PRIVATE minimage::minimage)

pkg-config

pkg-config --cflags --libs minimage

Rust

use minimage::{dist2_many, reduce_pairs, Cell};

let sim = Cell::ortho(10.0, 10.0, 10.0)?;
let sheared = Cell::from_lammps_bounds(
    15.0, 8.660254037844386, 10.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.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);

let qs = [[9.4, 0.0, 0.0], [1.0, 0.0, 0.0]];
let mut out = [0.0; 2];
dist2_many(&sim, left, &qs, &mut out)?;

let pairs = [[0, 1], [0, 0], [0, 1]];
let mut kept = Vec::new();
reduce_pairs(&pairs, &mut kept)?;
assert_eq!(kept, vec![[0, 1]]);

Cell::from_ase, Cell::from_con, Cell::from_con_box, and Cell::from_vesin take the same row-major 3x3 lattice. Displacement is the wrapped vector from p to q.

Batch kernels select AVX-512, AVX2, AVX, NEON, or scalar at run time. MINIMAGE_SIMD overrides that choice. simd_path() returns the name.

License

MIT. See LICENSE.

Metadata

Release files for minimage 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minimage 0.2.0
File Size Uploaded Provenance Actions
minimage-0.2.0.tar.gz 163.8 kB With provenance Details for minimage-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for minimage 0.2.0
File Interpreter ABI Platform Actions
minimage-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for minimage-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl

Total release size: 574.4 kB

Release files / minimage-0.2.0.tar.gz

Download URL minimage-0.2.0.tar.gz
Size 163.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9e3b4396978cfd35283d4b10787f9751c18bf50c5cecb638d1556346b2d7f3a0
BLAKE2b-256 checksum
How to use checksums
96a83720175e3a6b56780b717dc4d1e61e96ee396a68e4b6b80e6e67c5f95ee8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / minimage-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL minimage-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 410.6 kB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
8ad62a49a00cb660f1cedca0d5dc95078f6cd7b8151f525e8e19ba2cc67437e0
BLAKE2b-256 checksum
How to use checksums
7281823ee68428ce890754a50da8eaf420682290f019815501c05faba4ce83a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for minimage 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for minimage-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page