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¶
We currently only support
metalunits, i.e., energy ineVand forces ineV/AUsers can write LAMMPS scripts in the usual way (see lammps_in_example.file)
Users should NOT define other types of forces such as “pair_style”, “bond_style” in their scripts. These forces will get added together with UMA forces and most likely produce false results
UMA uses atomic numbers so we try to guess the atomic number from the provided atomic masses in your LAMMPS scripts. Just make sure you provide the right masses for your atom types - this makes it easy so that you don’t need to redefine atomic element mappings with LAMMPS
Install and Run¶
Users can install LAMMPS however they like, but the simplest is to install via conda (https://
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-lammpsAssuming you have a classic LAMMPS .in script, make the following changes:
Remove all other forces from your LAMMPS script (e.g., pair_style, etc.)
Make sure the units are in “metal”
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}'