Skip to content
NAISS Logo
Allocations Support Training Software naiss.se

Lammps

Support tier: 3

Read information about support tiers.

Installed versions

Resource Version
Arrhenius 22Jul2025_update4, 2Sep2026
Dardel/cpe26.03 22Jul2025_update4

Read information about how to load this software in your environment by searching for Lmod module.

General information

LAMMPS is a molecular dynamics simulator which can model particles at various scales and is distributed by Sandia National Laboratories. For more information see the LAMMPS homepage.


How to use on Arrhenius

To activate one of the modules built for CPU nodes

ml LAMMPS/22Jul2025_update4

Below follows an example job script for LAMMPS, to run on 64 cores on a CPU node.

#!/bin/bash
#SBATCH -A <your-project-account>
#SBATCH -J abinit-job
#SBATCH -p cpu
#SBATCH -t 02:00:00
#SBATCH -n 64

ml LAMMPS/22Jul2025_update4

srun lmp_mpi -i <input file>

Assuming the script is named jobscriptlammps.sh, it can be submitted using:

sbatch jobscriptlammps.sh

To activate one of the modules built for GPU nodes

ml use /software/sse2/el9_gh200/easybuild/scripted/modules/all/Core
ml LAMMPS/2Sep2026-mpi-cuda
Below follows an example job script for LAMMPS, to run on a Grace Hopper node, running 1 MPI rank, using 72 Grace CPU cores, and 1 Hopper GPU. In general, 1 MPI rank per GPU is advised as a starting point. The ideal number of OpenMP threads will depend on the use case.

#SBATCH -A <project number>
#SBATCH -p gpu
#SBATCH -t 01:00:00
#SBATCH -n 1
#SBATCH -c 72
#SBATCH --gpus=1
#SBATCH -J lammps
export SRUN_CPUS_PER_TASK=$SLURM_CPUS_PER_TASK
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export NTASKS=$SLURM_NTASKS
export NGPUS=$SLURM_GPUS

echo SRUN_CPUS_PER_TASK $SRUN_CPUS_PER_TASK
echo OMP_NUM_THREADS $OMP_NUM_THREADS
echo NTASKS $NTASKS
echo NGPUS $NGPUS

# Load the LAMMPS module
ml use /software/sse2/el9_gh200/easybuild/scripted/modules/all/Core
ml LAMMPS/2Sep2026-mpi-cuda

# Launch the executable
srun --mem=0 -n $NTASKS lmp -k on g $NGPUS t $OMP_NUM_THREADS -sf kk -in in.melt

How to use on Dardel

The LAMMPS module can be loaded with

ml PDC/<version>
ml lammps/22Jul2025_update4-cpeGNU-26.03

This will add the LAMMPS bin directory to your PATH, so that LAMMPS can be started with the command lmp_mpi or lmp_omp. Below is an example batch script for a LAMMPS job:

#!/bin/bash

# time allocation
#SBATCH -A snicYYYY-X-XX
# name of this job
#SBATCH -J lammps
# wall time for this job
#SBATCH -t 01:00:00
# partition for this job
#SBATCH -p main

# number of nodes
#SBATCH --nodes=2
# number of MPI processes per node
#SBATCH --ntasks-per-node=128

ml PDC/<version>
ml lammps/22Jul2025_update4-cpeGNU-26.03

# Run with the file infile as input and write to outfile
srun lmp < infile > outfile

This will run LAMMPS (lmp) with 256 cores (2 nodes), and will read the input specified in infile and write to outfile in the directory the job was submitted. Submit the batch script with the sbatch command, see also the How to run jobs.

How to build LAMMPS

The program was installed using EasyBuild. A build in your local file space can be done with

ml PDC/26.03
ml easybuild-user/5.3.0
eb lammps-22Jul2025_update4-cpeGNU-26.03.eb --robot