Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

LAMMPS Integration

We provide an integration with the LAMMPS Molecular Simulator through the fix external command. This simple integration hands control of the neighborlist (graph) generation, parallelism, energy, force, and stress calculations all to UMA.

There is some Python overhead, but for very fast empirical force fields where Python would be a limiting factor, this is negligible at the speeds of current MLIPs (10s - 100s of ms per step). This is the same reason nearly all modern LLM inference uses Python engines. Additionally, to easily scale to multi-node parallelism regimes, we designed the architecture using a client-server interface so LAMMPS would only see the client and the server code running inference can be optimized completely independently later.

Since the fix external integration simply wraps the UMA predictor interface, the way inference is run is identical to using the MLIPPredictUnit, ASE Calculator or ParallelMLIPPredictUnit for Multi-GPU inference.

Usage Notes

Install and Run

Users can install LAMMPS however they like, but the simplest is to install via conda (https://docs.lammps.org/Install_conda.html) if you don’t need any bells and whistles.

For conda install, activate the conda env with LAMMPS and install fairchem into it. For manual LAMMPS installs, you need to provide python paths so LAMMPS can find fairchem.

# first install conda and lammps following the instructions above
# then activate the environment and install fairchem
conda activate lammps-env
pip install fairchem-core[extras]
pip install fairchem-lammps

Assuming you have a classic LAMMPS .in script, make the following changes:

  1. Remove all other forces from your LAMMPS script (e.g., pair_style, etc.)

  2. Make sure the units are in “metal”

  3. Make sure there is only 1 run command at the bottom of the script

To run, use the Python entrypoint lmp_fc (shortcut name for the python lammps_fc.py script):

lmp_fc lmp_in="lammps_in_example.file" task_name="omol"

Multi-GPU Parallelism

Our LAMMPS integration is fully compatible out of the box with our Multi-GPU inference API.

For example:

lmp_fc lmp_in="lammps_in_example.file" task_name="omol" predict_unit='${parallel_predict_unit}'