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

Lammps

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