Skip to main content
  • Resources
    • Overview
    • Request Access
    • Manage Existing Project
    • HPC Resources
    • Compute Resources
    • Software Packages
    • Partner Program
  • Documentation
    • Get Started
    • Log In
    • Transfer Files
    • Storage
    • Compiling
    • Running Jobs
  • Support
    • Contact Us
    • Training and Events
    • Proposals and Publications
    • Links for Learning
  • Cluster Status
  1. OIT HPC
  2. Software
  3. LAMMPS (Slurm)

    LAMMPS

    LAMMPS stands for Large-scale Atomic/Molecular Massively Parallel Simulator and is copywrited by Sandia (DOE). See the On-line Manual for LAMMPS documentation, which is linked below. Here we give instructions how to run it on the CPUs and GPUs with the staff supported version on the Hazel HPC. Also given are instructions for users to install their own version.

    External Links:
    LAMMPS website
    LAMMPS Tutorials
    LAMMPS benchmarks

    Typically, it's not a good idea to run lammps from your /home directory, as its output can easily overflow your quota.

    The current staff-supported version is 22Jul2025 (stable_22Jul2025_update4), compiled with PrgEnv-intel/2025.3-slurm and cuda/12.0. The binary is named lmp_hazel, installed at /usr/local/apps/lammps/22Jul2025/intel/gpu/bin/lmp_hazel.
    The modulefiles are:

    module avail lammps/22Jul2025
    

    They are:
    lammps/22Jul2025/intel/gpu-slurm  (for GPU nodes)
    lammps/22Jul2025/intel/cpu-slurm  (for CPU nodes)

    Previous version (2024Aug29):
    CPU only, no GPU support. This version predates the Slurm-integrated compiler stack.

    Older versions (2022Jun23):
    These are the previous GPU-capable staff-supported builds. Prior to the 22Jul2025 build, these were the only staff-supported versions with GPU acceleration.
    Modulefiles:

    • lammps/2022Jun23/intel/gpu  (recommended — Intel compiler, GPU nodes)
    • lammps/2022Jun23/intel/cpu  (Intel compiler, CPU nodes)
    • lammps/2022Jun23/gnu/gpu   (GNU compiler, GPU nodes)
    • lammps/2022Jun23/gnu/cpu   (GNU compiler, CPU nodes)

    Earlier versions (29Sep21u3, 7Aug19, 22Aug2018) are no longer supported.

    Table of Contents - Select for a Particular Topic
  • LAMMPS with GPUS
  • LAMMPS with CPUS
  • LAMMPS Hazel benchmarks
  • How to install and maintain your own LAMMPS version.
  • List of LAMMPS packages in the staff supported version.
  • LAMMPS with NequIP and PyTorch

  • LAMMPS for GPUs
  • To test LAMMPS on the 22Jul2025 version for GPUs (interactively) do

    salloc --ntasks=16 --nodes=1 --time=00:05:00 -p gpu_partners --qos=short_gpu --gres=gpu:a10:1
    module load lammps/22Jul2025/intel/gpu-slurm
    srun lmp_hazel -sf gpu -in \
      /usr/local/apps/lammps/22Jul2025/intel/gpu/share/lammps/bench/in.lj
    

    To test LAMMPS 22Jul2025 for GPUs in batch mode, create "lammps_gpu_benchmark_slurm.sh" with the following lines:

    #!/bin/bash
    #SBATCH --ntasks=16
    #SBATCH --nodes=1
    #SBATCH --time=00:05:00
    #SBATCH --partition=gpu_partners
    #SBATCH --qos=short_gpu
    #SBATCH --gres=gpu:a10:1
    #SBATCH --output=out.%j
    #SBATCH --error=err.%j
    module load lammps/22Jul2025/intel/gpu-slurm
    srun lmp_hazel -sf gpu -in /usr/local/apps/lammps/22Jul2025/intel/gpu/share/lammps/bench/in.lj
    
    and run it with:
    sbatch lammps_gpu_benchmark_slurm.sh
    

    Available GPU types can be checked with:
    si --gpus --qos short_gpu
    # Note, GPUs in other QOS (e.g., the "gpu" QOS) can be checked too, but for short jobs (less than 2 hours) it is generally advisable to use the high priority short_gpu QOS.
    
    The above command shows the GPU type and availability. Example output:
    Partition     GPU           GrpTRES  Used  Avail  Alloc  Total
    gpu_partners  A10                 -     -      8      0      8
    gpu_partners  L40S               20     0      7     17     24
    gpu_partners  H200                4     0      4      4      8
    gpu_partners  RTX_6000_PRO        -     -     11     13     24
    
    Use the GPU type from the second column in your --gres flag. For example, to select the A10 GPU, use --gres=gpu:a10:1
  • LAMMPS for CPUs
  • To test LAMMPS version 22Jul2025 for CPUs (interactively) do
    salloc --ntasks=16 --nodes=1 --time=00:10:00 \
      --partition=compute_partners --qos=short --constraint=cascadelake
    module load lammps/22Jul2025/intel/cpu-slurm
    srun lmp_hazel -in \
      /usr/local/apps/lammps/22Jul2025/intel/gpu/share/lammps/bench/in.lj
    
    To do the same thing in batch mode, create "parallel_cpu_slurm.sh" with the following lines:
    #!/bin/bash
    #SBATCH --ntasks=16
    #SBATCH --nodes=1
    #SBATCH --time=00:10:00
    #SBATCH --partition=compute_partners
    #SBATCH --qos=short
    #SBATCH --constraint=cascadelake
    #SBATCH --output=out.%j
    #SBATCH --error=err.%j
    module load lammps/22Jul2025/intel/cpu-slurm
    srun lmp_hazel -in /usr/local/apps/lammps/22Jul2025/intel/gpu/share/lammps/bench/in.lj
    
    Run this batch job with:
    sbatch parallel_cpu_slurm.sh
    
  • LAMMPS Hazel benchmarks
  • Running the examples above on Hazel should give timings that meet or exceed the benchmarks shown on LAMMPS' website
    Here is the link to the Hazel benchmarks.
    lj model, cascadelake CPU node, 1 MPI rank (serial):
    Performance: 1809.691 tau/day, 4.189 timesteps/s
    lj model, cascadelake CPU node, 16 MPI ranks (parallel):
    Performance: 26643.269 tau/day, 61.674 timesteps/s
    lj model, A30 2x GPU node, 16 MPI ranks:
    Performance: 141252.926 tau/day, 326.974 timesteps/s
  • How to install and maintain your own LAMMPS version.
  • Users are encouraged to install and maintain their own version of LAMMPS in:

    /usr/local/usrapps/projectid
    
    Where "projectid" is a directory name given to the project by the HPC administrator (a request must be made). The following instructions describe how to compile LAMMPS from source using the stable branch. You can choose which packages to include at the CMake configuration step.

    Step 1 — Get the source

    git clone -b stable https://github.com/lammps/lammps.git src
    cd src && git describe --tags
    

    Step 2 — Load the build environment

    module purge
    module load PrgEnv-intel/2025.3-slurm
    module load cuda/12.0
    which mpiicx mpiicpx mpiifx nvcc g++   # all must resolve before continuing
    

    Step 3 — Configure with CMake

    Choose your packages with -D PKG_<NAME>=yes:
    mkdir build && cd build
    cmake \
      -D CMAKE_INSTALL_PREFIX=/usr/local/usrapps/[your_path]/lammps \
      -D CMAKE_BUILD_TYPE=Release \
      -D BUILD_MPI=yes -D BUILD_OMP=yes \
      -D CMAKE_C_COMPILER=$(which mpiicx) \
      -D CMAKE_CXX_COMPILER=$(which mpiicpx) \
      -D CMAKE_Fortran_COMPILER=$(which mpiifx) \
      -D CMAKE_CUDA_HOST_COMPILER=$(which g++) \
      -D CMAKE_CXX_FLAGS="-march=native" \
      -D CMAKE_C_FLAGS="-march=native" \
      -D LAMMPS_MACHINE=[your_machine_name] \
      -D FFT=MKL \
      -D PKG_GPU=yes -D GPU_API=cuda \
      -D GPU_ARCH="sm_61;sm_75;sm_80;sm_86;sm_89;sm_90" \
      -D GPU_PREC=mixed \
      -D PKG_INTEL=yes \
      -D PKG_OPENMP=yes \
      -D PKG_KSPACE=yes \
      -D PKG_MOLECULE=yes \
      -D PKG_MANYBODY=yes \
      -D PKG_RIGID=yes \
      # add or remove -D PKG_<NAME>=yes lines for any other packages you need
      # full list of available packages: https://docs.lammps.org/Packages_list.html
      ../cmake
    
    After cmake runs, check the summary output to confirm your packages are listed under "Enabled packages" before building.

    Step 4 — Build and install

    make -j 8
    make install
    

    Note: Build in /tmp rather than your install directory to avoid hitting inode quotas on /usr/local. Delete the build tree after installation with rm -rf /tmp/your-build-dir.

    The following alternative installation methods (conda and makefile) are preserved for reference and will be re-validated in a future update.

  • List of packages that are installed in the staff supported version.
  • As of 22Jul2025 (stable_22Jul2025_update4), compiled with PrgEnv-intel/2025.3-slurm and cuda/12.0:
    GPU, INTEL, KSPACE, MANYBODY, MOLECULE, OPENMP, RIGID

  • LAMMPS with NequIP and PyTorch
  • NequIP is a neural network interatomic potential that can be used as a LAMMPS pair style. It is built on PyTorch and runs on the GPU nodes. The workflow below installs PyTorch and NequIP with pip in a conda environment, builds LAMMPS with the NequIP pair style, trains a model, and runs an MD simulation with it.

    Step 1 — Create the conda environment

    Create "pyenv.yml" in /usr/local/usrapps/$GROUP/$USER with the following lines:
    name: test0
    dependencies:
      - python=3.12
      - pip
    
    Then create the environment and install PyTorch and NequIP with pip:
    conda env create -f pyenv.yml -p /usr/local/usrapps/$GROUP/$USER/python_base
    conda activate /usr/local/usrapps/$GROUP/$USER/python_base
    python -m pip install torch==2.6.0 torchvision
    python -m pip install nequip
    python -m pip install wandb
    

    Step 2 — Build LAMMPS with the NequIP pair style

    Load required modules and build LAMMPS in /usr/local/usrapps/$GROUP/$USER/build_lammps:
    module load cuda/12.0
    module load PrgEnv-intel/2025.3-slurm
    module load cmake/4.1.1
    module load mkl/2024.1
    conda activate /usr/local/usrapps/$GROUP/$USER/python_base
    
    mkdir /usr/local/usrapps/$GROUP/$USER/build_lammps
    cd /usr/local/usrapps/$GROUP/$USER/build_lammps
    git clone -b stable https://github.com/lammps/lammps.git
    git clone https://github.com/mir-group/pair_nequip_allegro.git
    
    Patch LAMMPS with the NequIP pair style:
    cd pair_nequip_allegro
    ./patch_lammps.sh ../lammps/
    cd ..
    
    Configure and build:
    cd lammps
    mkdir build && cd build
    cmake \
      -D CMAKE_PREFIX_PATH=$(python -c 'import torch; print(torch.utils.cmake_prefix_path)') \
      -D CMAKE_BUILD_TYPE=Release \
      -D CMAKE_CXX_STANDARD=17 \
      -D BUILD_MPI=yes -D BUILD_OMP=yes \
      -D CMAKE_C_COMPILER=$(which mpiicx) \
      -D CMAKE_CXX_COMPILER=$(which mpiicpx) \
      -D CMAKE_Fortran_COMPILER=$(which mpiifx) \
      -D CMAKE_CXX_FLAGS="-march=native" \
      -D CMAKE_C_FLAGS="-march=native" \
      -D FFT=MKL \
      -D PKG_INTEL=yes \
      -D PKG_OPENMP=yes \
      -D PKG_KSPACE=yes \
      -D PKG_MOLECULE=yes \
      -D PKG_MANYBODY=yes \
      -D PKG_RIGID=yes \
      ../cmake
    
    make -j 8
    

    Step 3 — Train the NequIP model

    Set up a working directory on /share and get the NequIP example configs:
    mkdir -p /share/$GROUP/$USER/lammps
    cd /share/$GROUP/$USER/lammps
    git clone https://github.com/mir-group/nequip.git nequip_source
    
    Download the training data on the login node — compute nodes have no internet access:
    conda activate /usr/local/usrapps/$GROUP/$USER/python_base
    cd /share/$GROUP/$USER/lammps/nequip_source/configs
    wget "https://archive.materialscloud.org/records/ycbvx-knj69/files/fcu.xyz?download=1" -O fcu.xyz
    
    Note: the MaterialsCloud server can be slow and this download may take 5-10 minutes.

    Check which GPUs are idle, then set --gres in the batch script to match. Recommended GPU for this task is H200.
    si --gpus --qos short_gpu
    # Note, GPUs in other QOS (e.g., the "gpu" QOS) can be checked too, but for short jobs (less than 2 hours) it is generally advisable to use the high priority short_gpu QOS.
    
    Create "submit.sh" in /share/$GROUP/$USER/lammps with the following lines:
    #!/bin/bash
    #SBATCH --job-name=nequip_train
    #SBATCH --partition=gpu_partners
    #SBATCH --gres=gpu:h200:1
    #SBATCH --qos=short_gpu
    #SBATCH --ntasks=1
    #SBATCH --cpus-per-task=4
    #SBATCH --time=02:00:00
    source ~/.bashrc
    module load cuda/12.0
    conda activate /usr/local/usrapps/$GROUP/$USER/python_base
    export WANDB_MODE=offline
    cd /share/$GROUP/$USER/lammps/nequip_source/configs
    nequip-train -cn tutorial.yaml
    
    Run this batch job with:
    sbatch submit.sh
    

    Step 4 — Compile the trained model

    Locate the checkpoint file in the outputs directory and compile it by running this on the login node after training finishes:
    conda activate /usr/local/usrapps/$GROUP/$USER/python_base
    cd /share/$GROUP/$USER/lammps/nequip_source/configs
    nequip-compile \
      outputs/<date>/<time>/best.ckpt \
      compiled_model.nequip.pth \
      --device cpu \
      --mode torchscript
    

    Step 5 — Prepare the LAMMPS input files

    Convert the training data to LAMMPS format:
    conda activate /usr/local/usrapps/$GROUP/$USER/python_base
    cd /share/$GROUP/$USER/lammps/nequip_source/configs
    python -c "
    from ase.io import read, write
    atoms = read('fcu.xyz', index=0)
    write('test.data', atoms, format='lammps-data', atom_style='atomic')
    print('Species:', set(atoms.get_chemical_symbols()))
    print('Num atoms:', len(atoms))
    "
    
    ASE maps the species alphabetically, so the atom types are 1=C, 2=Cu, 3=H, 4=O.

    Create the LAMMPS input file "in.test" in /share/$GROUP/$USER/lammps/nequip_source/configs
    units           metal
    atom_style      atomic
    boundary        p p p
    newton          off
    
    read_data       test.data
    
    mass            1 12.011
    mass            2 63.546
    mass            3 1.008
    mass            4 15.999
    
    pair_style      nequip
    pair_coeff      * * compiled_model.nequip.pth C Cu H O
    
    thermo          10
    thermo_style    custom step temp pe ke etotal press
    
    velocity        all create 300.0 12345
    fix             1 all nvt temp 300.0 300.0 0.1
    timestep        0.001
    
    dump            1 all xyz 100 trajectory.xyz
    
    run             1000
    

    Step 6 — Run the MD simulation

    Check the idle GPUs again and set --gres to match:
    si --gpus --qos short_gpu
    # Note, GPUs in other QOS (e.g., the "gpu" QOS) can be checked too, but for short jobs (less than 2 hours) it is generally advisable to use the high priority short_gpu QOS.
    
    Create "run_lammps.sh" in /share/$GROUP/$USER/lammps with the following lines:
    #!/bin/bash
    #SBATCH --job-name=lammps_nequip
    #SBATCH --partition=gpu_partners
    #SBATCH --gres=gpu:h200:1
    #SBATCH --qos=short_gpu
    #SBATCH --ntasks=1
    #SBATCH --cpus-per-task=4
    #SBATCH --time=00:10:00
    source ~/.bashrc
    module load PrgEnv-intel/2025.3-slurm
    module load cuda/12.0
    conda activate /usr/local/usrapps/$GROUP/$USER/python_base
    cd /share/$GROUP/$USER/lammps/nequip_source/configs
    srun /usr/local/usrapps/$GROUP/$USER/build_lammps/lammps/build/lmp -in in.test
    
    Run this batch job with:
    sbatch run_lammps.sh
    
    The job produces:
    • slurm-<jobid>.out  — thermo output and performance statistics
    • log.lammps  — the same thermo output
    • trajectory.xyz  — atom positions every 100 steps, for visualization

    Last modified: November 04 2026 12:29:47.

Copyright © 2026 · Office of Information Technology · NC State University · Raleigh, NC 27695
Accessibility · Privacy · University Policies
HPC Assistant
Hi! I can help answer questions about our HPC cluster. What would you like to know?