MLIP
MLIP runs machine-learned interatomic potentials through Atomli’s retained
native inference session. It is intended for systems and workflows where a
trained model covers the required elements and configurations.
Load a model
Section titled “Load a model”A catalog id downloads once, verifies its checksum, and then reuses the local cache:
from atomli.calculators.mlip import MLIP
atoms.calc = MLIP("nequix-mp-1")energy = atoms.get_potential_energy()forces = atoms.get_forces()Silicon: accuracy and cost
Section titled “Silicon: accuracy and cost”Diamond silicon with nequix-mp-1:
Cost first, because that is the reason to reach for a potential at all:
| Atoms | One energy | Per atom |
|---|---|---|
| 8 | 3.8 ms | 474 µs |
| 64 | 8.1 ms | 127 µs |
| 216 | 18.8 ms | 87 µs |
| 512 | 42.9 ms | 84 µs |
512 atoms in 43 ms, and the per-atom cost falls by 6× across that range as the fixed per-call overhead amortizes. Compare GFN2-xTB on the same lattice, where 64 atoms already costs 0.6 s. That gap is the whole argument for a potential, and it is why long trajectories and large cells are where these models belong.
The energy per atom is flat to 20 µeV across all four cell sizes, which is the correctness check that matters for a short-range model: a supercell of a periodic crystal must give the same energy per atom as the primitive cell, and a broken neighbour list or a cutoff larger than half the box would break exactly that.
Accuracy is the other half, and it is more nuanced. Fitting the energy against the lattice constant over 23 points puts the minimum at 5.504 Å with a minimum energy of -5.428 eV/atom:
| Quantity | nequix-mp-1 | Reference | Difference |
|---|---|---|---|
| lattice constant | 5.504 Å | 5.431 Å (experiment) | +1.34% |
| energy per atom | -5.417 eV | ≈-5.42 eV (GGA-PBE, Materials Project) | 0.003 eV |
The energy sits on its training label. The lattice constant does not sit on experiment, and it should not be expected to: this model was trained on GGA-PBE energies, PBE itself overestimates the silicon lattice constant, and the model then adds its own error on top. A potential cannot be more right than the labels it learned from. Judge one against its reference method first, and only then ask how far that method is from the measurement.
That whole scan took 15 ms. Construction, which is where the weights are resolved from cache or downloaded, took 1 ms here because the cache was already warm; the first run on a fresh machine pays a network fetch instead.
You can also supply a local model:
atoms.calc = MLIP("/models/custom.nqx")For local paths, Atomli infers NequIP packages from .zip, Equiformer
checkpoints from .pt, and HyFF from .safetensors (or a HyFF checkpoint
directory). Set runtime="nequix", "nequip", "equiformer", or "hyff"
explicitly when suffix inference is not enough.
Runtime families
Section titled “Runtime families”| Runtime | Typical file | Catalog examples |
|---|---|---|
| Nequix | .nqx | nequix-mp-1, nequix-oam-1, nequix-omat-1 |
| NequIP | .nequip.zip | nequip-s, nequip-l |
| Equiformer | .pt | equiformer, equiformer-gradient |
| HyFF | .safetensors + weights.json | hyff-presto, hyff-vivace, hyff-moderato |
Catalog ids pin their own runtime, so the file and runtime cannot drift apart. See MLIP models for the complete catalog and cache controls.
Energy, forces, and stress
Section titled “Energy, forces, and stress”The Python calculator exposes energy, forces, and stress. Periodic models
can drive fixed-cell dynamics and cell optimization:
atoms.calc = MLIP("nequix-mp-1")stress = atoms.get_stress()A stress request returns the full 3 × 3 tensor and requires periodic boundary conditions and a cell. The loaded model also validates the structure’s elements against its own species table before inference.
HyFF: charge and spin
Section titled “HyFF: charge and spin”HyFF is a molecular potential trained to track wB97M energies and forces. It
takes the total charge and spin multiplicity as inputs, so one model covers
cations, anions, and open-shell species. Three checkpoints are supported:
hyff-presto (9 MB, fastest), hyff-vivace (27 MB), and hyff-moderato
(139 MB, largest).
from atomli import Atomsfrom atomli.calculators.mlip import MLIP
atoms = Atoms("OH2", positions=[[0, 0, .1173], [0, .7572, -.4692], [0, -.7572, -.4692]])atoms.calc = MLIP("hyff-presto")energy = atoms.get_potential_energy()The default is the neutral singlet. Set another state on the calculator or on
the structure, as for QC and XTB:
atoms.calc = MLIP("hyff-presto", charge=1, unpaired=1) # cation, doubletatoms.calc = MLIP("hyff-presto", charge=0, multiplicity=3) # tripletatoms.info["charge"] = -1 # read from the structuremultiplicity is unpaired + 1. Charge must be an integer, and the electron
count must have the parity of unpaired; a mismatch raises. Passing charge
or unpaired to any other runtime raises.
Compare energies only between structures evaluated with the same model, charge,
and spin: they are on HyFF’s own energy scale. The andante and largo
checkpoints are not implemented and raise an error that names the supported
models.
HyFF covers H to Bi with a 4.5 Å cutoff. It runs on CPU and WGPU and returns energy and forces, plus stress for periodic cells. CPU and GPU both take the charge and spin. A periodic cell carries one charge and spin for the whole cell. Second derivatives are not implemented, so Hessians come from finite differences of forces.
Device modes
Section titled “Device modes”When device is omitted, MLIP uses the process default configured with
atomli.gpu.set_default_device(...), or probes for a hardware WebGPU adapter
and uses it automatically when present (falling back to CPU when no hardware
adapter is available).
Pass device="cpu" to pin host execution:
atoms.calc = MLIP("nequip-s", device="cpu")Pass device="gpu" (or "wgpu") to require GPU execution on Metal, Vulkan, or
DX12 through one portable path:
atoms.calc = MLIP("nequip-s", device="gpu")device="auto" measures both paths on the first inference in each system-size
bucket and keeps the winner, falling back to CPU when no adapter exists.
On a multi-GPU host, pin the adapter in the device string, by enumeration index or by a case-insensitive name substring:
atoms.calc = MLIP("nequix-mp-1", device="wgpu:1")atoms.calc = MLIP("nequix-mp-1", device="wgpu:a100")The pin is resolved at the first GPU initialization in the process and the context is kept, so choose one adapter per process. A selector that matches no adapter fails with the list of available adapters.
An explicit WGPU request fails when the wheel lacks GPU support or no adapter is available. Atomli never reports CPU timings after silently downgrading a GPU request.
CPU and GPU use the same model but are not bitwise identical because inference
crosses an f32 model boundary and reductions occur in a different order.
Select one device for a trajectory or relaxation and keep it fixed.
Model delivery and reproducibility
Section titled “Model delivery and reproducibility”Model weights are not stored in the wheel. Resolution follows this order:
- an existing local path or verified cache entry;
- the Tako-hosted default when the catalog provides one;
- the
mlip-modelsGitHub Release as the backup.
Every catalog file has a pinned byte size and SHA-256 digest. A bad cache entry
or mismatched download is rejected. Use ATOMLI_MODELS_DIR to pin the cache
location for managed environments.
State reuse
Section titled “State reuse”The native calculator retains its loaded runtime, exact-geometry calculation cache, device buffers, and neighbor-list state. A narrower property request at the same geometry can reuse an earlier inference, which matters in optimizers that ask for closely related values in succession.
NEB and displacement batches
Section titled “NEB and displacement batches”atomli.mep.NEB batches compatible native MLIP images automatically.
Images must use the same calculator type and parameters.
Each interior image keeps its position in the batch between band evaluations.
Unchanged endpoints reuse their previous results.
ForceSession also batches ordered displacement chunks for Nequix, NequIP,
and HyFF models on supported CPU and GPU routes:
from atomli.build import moleculefrom atomli.calculators.mlip import MLIPfrom atomli.displacements import ForceSession
atoms = molecule("H2O")atoms.calc = MLIP("nequix-oam-1", device="gpu")session = ForceSession(atoms)forces = session.evaluate_displacements( [[(1, 0, -0.01)], [(1, 0, 0.01)]], batch_size=2,)print(forces.shape)print(session.stats)Displacements use angstrom. Forces use eV/angstrom.
Each configuration starts from the original reference geometry.
batch_size bounds temporary geometry and force storage.
The complete returned array requires 24 * configurations * atoms host bytes.
NequIP GPU sessions keep their existing resident displacement path.
They retain nuclear arrays and accumulate force differences on the device.
Other supported MLIP sessions batch each two- or four-point numerical stencil.
Select numerical vibrations with method="resident_finite_difference".
Select numerical phonons with run_resident_finite_difference().
Analytical derivatives remain the default.
calculator.batch_stats reports work requested through native batch interfaces:
| Counter | Meaning |
|---|---|
native_batch_calls | Successful native model batch invocations |
native_batch_geometries | Geometries returned by those invocations |
serial_geometries | Geometries completed through the serial batch route |
batch_failures | Failed native batch attempts before serial evaluation |
Ordinary single-geometry calculator calls do not increment these counters.
Generic MLIP force sessions include these counters in session.stats.
They also report reference_evaluations and direct_geometries.
These fields account for initialization and single-row chunks outside batch requests.
NequIP GPU resident sessions report their own execution and transfer counters.
Use the calculator counters to verify actual model batching in NEB.
The NEB path="native-batch" value identifies the workflow interface.
It does not establish that every backend call used native model batching.
Python features
Section titled “Python features”- Nequix, NequIP, Equiformer, and HyFF runtimes (HyFF with charge and spin)
- Catalog ids and direct local paths
- CPU and optional WGPU devices
- Energy, forces, and periodic stress
- Periodic structures and cell optimization
- Native NEB batches and ordered finite-displacement force sets
- Model batch counters through
batch_stats - Download, checksum verification, and platform cache management
Native-only features
Section titled “Native-only features”The mlip.rs adapter additionally exposes inference counts, explicit cache reset, neighbor-list skin configuration, and neighbor-list rebuild/reuse statistics. Its GPU path installs a default neighbor skin to keep topology and device buffers stable during repeated evaluations.
Those tuning and diagnostic methods are native engine capabilities. They are
not yet public methods on the Python MLIP object.
Use cases
Section titled “Use cases”Choose MLIP for long trajectories, large periodic cells, screening, or repeated relaxations when a validated model covers the relevant chemistry. A model is not a universal replacement for electronic structure: check its training domain, supported elements, energy convention, and validation error for the target workflow.