LAMMPS Molecular Dynamics with MLIPs
Goal
Run GPU-accelerated LAMMPS molecular dynamics with MLIP backends using three isolated binaries (MACE, MatGL/CHGNet, FairChem) so Python embedding through ML-IAP/mliappy remains stable and reproducible.
Instructions
Select the MLIP backend and model family first using the foundation-potential guide:
- ml-foundation-potentials
- This determines which conda env and which LAMMPS binary you must use.
Check system prerequisites.
# Env: base-agent
nvidia-smi
nvcc --version
g++ --version
cmake --version
mpicxx --version
- Identify GPU compute capability and set Kokkos arch flag.
# Env: base-agent
nvidia-smi --query-gpu=name,compute_cap --format=csv,noheader
- Example mapping:
8.0->Kokkos_ARCH_AMPERE808.6->Kokkos_ARCH_AMPERE868.9->Kokkos_ARCH_ADA899.0->Kokkos_ARCH_HOPPER90
Build the environment-matched LAMMPS binary (choose one of the three paths below).
Path A: MACE
# Env: base-agent
bash conda-envs/mace-agent/install.sh
KOKKOS_ARCH_FLAG=Kokkos_ARCH_AMPERE86 \
LAMMPS_REF="stable_2Aug2023_update2" \
bash conda-envs/mace-agent/install_lammps.sh
- Binary:
./lammps/mace-agent/lmp - Runtime env:
mace-agent
Path B: MatGL/CHGNet
# Env: base-agent
bash conda-envs/matgl-agent/install.sh
KOKKOS_ARCH_FLAG=Kokkos_ARCH_AMPERE86 \
LAMMPS_REF="stable_2Aug2023_update2" \
bash conda-envs/matgl-agent/install_lammps.sh
- Binary:
./lammps/matgl-agent/lmp - Runtime env:
matgl-agent
Path C: FairChem
# Env: base-agent
bash conda-envs/fairchem-agent/install.sh
KOKKOS_ARCH_FLAG=Kokkos_ARCH_AMPERE86 \
LAMMPS_REF="stable_2Aug2023_update2" \
bash conda-envs/fairchem-agent/install_lammps.sh
- Binary:
./lammps/fairchem-agent/lmp - Runtime env:
fairchem-agent
- Run the selected binary with its matching conda environment.
# Env: mace-agent (example; switch env/binary pair as needed)
conda activate mace-agent
./lammps/mace-agent/lmp -h
- Launch MD with the same binary-env pair used during build; do not cross-run binaries between MLIP stacks.
Examples
See scripts/three-backends-build-check/README.md for a minimal build/verification matrix across MACE, MatGL, and FairChem. See the respective README.md files under examples/mace/, examples/matgl/, and examples/fairchem/ for model-specific run scripts.
Constraints
- Strict binary-env pairing: each LAMMPS binary must run only with its own conda env.
- No stack mixing: never run MACE binary in
matgl-agent/fairchem-agent, etc. - GPU arch alignment: choose
KOKKOS_ARCH_*from actualcompute_capoutput. - Python-coupled mode: this workflow targets
ML-IAP/mliappyusage.
References
- Thompson et al., "LAMMPS - A flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales", Computer Physics Communications, 2022. DOI
- LAMMPS Manual, ML-IAP package documentation. Link
- Batatia et al., "MACE: Higher Order Equivariant Message Passing Neural Networks for Fast and Accurate Force Fields". arXiv
- Deng et al., "CHGNet as a pretrained universal neural network potential for charge-informed atomistic modelling". arXiv
- FairChem documentation and model zoo. Link
Author: Jurģis Ruža Contact: GitHub @JurgisR