Backends#
A backend turns a structure into energy, forces, and stress.
It is selected with --backend NAME and loads its model once, when the server starts.
Backend |
|
Needs |
Model selection |
|---|---|---|---|
Dummy |
|
none; returns random numbers |
|
Lennard-Jones |
|
|
|
MACE |
|
|
|
MACE-MP |
|
|
|
MACE-OFF |
|
|
|
MACE-POLAR |
|
|
|
UMA |
|
|
|
NequIP |
|
|
|
Allegro |
|
|
|
DeepMD |
|
|
|
SchNet |
|
|
|
OpenMM |
|
|
|
Custom |
|
|
|
Run fmlip-relay-check to see which of these are usable in the current environment.
Per-atom energies#
Every backend can return per-atom energies next to the total (see mlip_compute), and they always sum to the total energy.
What they mean depends on the model:
Backends |
Per-atom energies |
|---|---|
|
The model’s node energies |
|
Half of each pair energy per atom |
|
The calculator’s |
all others |
Total energy divided by the number of atoms |
Any ASE calculator that reports energies is picked up automatically.
If its values do not add up to the total, as with --dispersion for mace_mp, the difference is spread equally over the atoms.
Hessians#
Every backend can return a Hessian (see mlip_hessian), in eV/Ų and with the cell held fixed.
Backends |
Hessian |
|---|---|
|
Analytical, via automatic differentiation in the MACE calculator |
|
Analytical if the calculator has |
all others |
Central finite differences of the forces |
The finite-difference route costs 6N force evaluations for N atoms and uses a displacement of 0.005 Å.
Its accuracy is limited by the noise of the forces, which matters for models running in float32; use --dtype float64 where the backend offers it.
If an analytical Hessian fails, e.g. for a model type the calculator cannot differentiate, the server falls back to finite differences and logs that it did.
Test backends#
dummy#
Returns random energies, forces, and stresses of the right shape. It has no dependencies and exists to validate the plumbing between Fortran and Python.
lj#
A Lennard-Jones potential in pure NumPy with a force-shifted cutoff, so energy and force both go to zero continuously at the cutoff. Periodic systems are handled via the minimum-image convention. The stress follows the ASE sign convention (negative under compression), like all other backends. All atoms interact through the same parameters, regardless of element.
Flag |
Default |
Description |
|---|---|---|
|
|
Well depth ε (argon) |
|
|
Zero-crossing distance σ |
|
|
Cutoff radius, about 2.5 σ |
MACE family#
All four backends come with the mace extra.
mace#
A custom-trained model loaded from a .model file:
fmlip-relay-server --port 54321 --backend mace --model /path/to/model.model \
--device cuda --dtype float64
mace_mp#
The MACE-MP foundation models for materials (89 elements).
Checkpoints are downloaded on first use and cached in ~/.cache/mace.
Flag |
Default |
Description |
|---|---|---|
|
|
|
|
off |
Add a D3 dispersion correction (needs |
mace_off#
The MACE-OFF foundation force field for organic molecules (10 elements).
Flag |
Default |
Description |
|---|---|---|
|
|
|
--dispersion is not supported here.
mace_polar#
The electrostatic MACE-POLAR-1 models.
--model takes a model key such as polar-1-s, a local path, or a URL.
The model reads total charge and spin multiplicity, so the client should pass both to mlip_compute.
A zero external field is applied in every call.
The MACE-POLAR-1 foundation weights are distributed under the Academic Software Licence.
UMA#
Meta FAIR’s universal model from the fairchem package, installed with the uma extra.
One checkpoint covers several chemical domains, and the task head selects which one is active.
Flag |
Default |
Description |
|---|---|---|
|
|
|
|
|
Domain head, see below |
|
|
UMA runs best on |
Task |
Domain |
|---|---|
|
Molecules; uses charge and spin |
|
Inorganic bulk materials |
|
Molecular crystals |
|
Heterogeneous catalysis |
|
Metal-organic frameworks, direct air capture |
With omol, the total charge and spin multiplicity passed to mlip_compute travel through the protocol into the calculator.
The checkpoints are gated on the Hugging Face Hub: request access on the model page, then run huggingface-cli login or set HF_TOKEN.
Downloads are cached in ~/.cache/huggingface.
Other ML models#
nequip and allegro#
Models compiled with nequip-compile, passed via --model.
Both backends use the same loader.
PyTorch’s inductor cache is redirected to a private temporary directory under $TMPDIR, which is removed when the server shuts down.
deepmd#
A DeePMD-kit model file.
--device accepts cpu or cuda only, and --dtype is mapped to DP_INTERFACE_PREC (float64 to high, float32 to low).
schnet#
A SchNetPack model file. The neighbour-list cutoff is fixed at 5 Å.
OpenMM#
Classical force fields evaluated with OpenMM, from AMBER, GROMACS, CHARMM, or OpenCG inputs.
fmlip-relay-server --port 54321 --backend openmm --device cuda \
--omm-source AMBER --omm-coord system.inpcrd --omm-top system.prmtop
Flag |
Description |
|---|---|
|
Input format: |
|
Coordinate file (required); for OpenCG the start or restart PDB |
|
Topology file: prmtop, top, or psf (required); for OpenCG the fixed reference PDB |
|
CHARMM parameter, topology, or stream file; repeatable |
|
GROMACS include directory |
|
JSON or YAML file with |
|
Write an OpenCG start PDB to standard output and exit; needs |
YAML configuration files need pyyaml, and the OpenCG source needs the OpenCGChromatin package.
OpenMM’s native kJ/mol and bar are converted on the Python side, so the backend returns eV, eV/Å, and eV/ų like all others.
Custom ASE calculators#
The custom backend wraps any ASE calculator without touching the fmlip-relay sources.
Write a script that defines create_calculator():
# ase_custom.py
from ase.calculators.emt import EMT
def create_calculator():
return EMT()
and point the server at it:
fmlip-relay-server --port 54321 --backend custom --model /path/to/ase_custom.py
Without --model the script is looked up as ./ase_custom.py in the server’s working directory.
The function must return an ASE Calculator instance; it is called once at startup.
For a backend with its own command-line options, see Adding a backend.