LAMMPS Builds with ML-IAP and KOKKOS packages

ML-IAP is an optional package to use machine-learned interatomic potentials. Suppose that you have C/C++ compiler, MPI libaries and CUDA Toolkit 12.x installed in your system. To build ML-IAP and KOKKOS, you can follow this cmake configuration:


    python3 -m venv mliap-env
    source mliap-env/bin/activate
    pip install torch==2.5.0+cu121 torchvision==0.20.0+cu121 torchaudio==2.5.0+cu121 --index-url https://download.pytorch.org/whl/cu121
    pip install "cuequivariance==0.4.0" "cuequivariance-ops-cu12==0.4.0" "cuequivariance-torch-cu12==0.4.0"
    pip install mace-torch
    pip install cupy-cuda12x
    pip install numpy Cython
    mkdir build
    cd build
    cmake -C ../cmake/presets/basic.cmake \
      -D BUILD_MPI=yes -D BUILD_OMP=ON -D BUILD_SHARED_LIBS=ON \
      -D PKG_ML-IAP=ON -D PKG_ML-SNAP=ON -D PKG_ML-PACE=ON -D MLIAP_ENABLE_PYTHON=on -D PKG_PYTHON=ON \
      -D PKG_KOKKOS=ON -D Kokkos_ARCH_PASCAL60=off -D Kokkos_ARCH_AMPERE80=ON -D Kokkos_ENABLE_CUDA=yes -D Kokkos_ENABLE_OPENMP=yes \
      -D CMAKE_CXX_STANDARD=17 -D CMAKE_CXX_STANDARD_REQUIRED=ON \
      -D CMAKE_CXX_COMPILER=`which mpicxx` -D MPI_C_COMPILER=`which mpicc`  ../cmake
    make -j4
    make install-python
    

Note that you need to install PyTorch and other Python packages in a virtual environment before building LAMMPS with ML-IAP. The above example uses CUDA 12.1, so make sure to adjust the versions according to your CUDA installation.