Running LAMMPS on Grex

Introduction#


LAMMPS is a classical molecular dynamics code. The name stands for Large-scale Atomic / Molecular Massively Parallel Simulator.

Modules#


Multiple versions of LAMMPS were installed on Grex. To see all the available versions, use module spider lammps and follow the instructions.

Available CPU versions:#


VersionModule NameSupported Packages
29 Sep 21lammps/29Sep21*
05 Jun 19lammps/5Jun19*
11 Aug 17lammps/11Aug17*
05 Nov 16lammps/5Nov16*
30 Jul 16lammps/30jul16*

Available GPU versions:#


As for the time when writing this page, there is only one version of LAMMPS with GPU support. It can be loaded using:

module load intel/2020.4  ompi/4.1.2 lammps-gpu/24Mar22

The name of the binary is called lmp_gpu (see the example of script below).

VersionModule name
24 Mar 22lammps-gpu/24Mar22

Scripts examples#


Serial version#


Script example for LAMMPS: Serial version
run-lammps-serial.sh
#!/bin/bash

#SBATCH --ntasks=1 
#SBATCH --cpus-per-task=1
#SBATCH --mem=1500M
#SBATCH --time=0-3:00:00
#SBATCH --job-name=Lammps-Test

# Load the modules:

module load intel/2019.5 ompi/3.1.4 lammps/29Sep21

echo "Starting run at: `date`"

lmp_exec=lmp_grex
lmp_input="lammps.in"
lmp_output="lammps_lj_output.txt"

${lmp_exec} < ${lmp_input} > ${lmp_output}

echo "Program finished with exit code $? at: `date`"

MPI version#


Script example for LAMMPS: MPI version
run-lammps-mpi.sh
#!/bin/bash

#SBATCH --ntasks=16 
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=1500M
#SBATCH --time=0-3:00:00
#SBATCH --job-name=Lammps-Test

# Load the modules:

module load intel/2019.5 ompi/3.1.4 lammps/29Sep21

echo "Starting run at: `date`"

lmp_exec=lmp_grex
lmp_input="lammps.in"
lmp_output="lammps_lj_output.txt"

srun ${lmp_exec} < ${lmp_input} > ${lmp_output}

echo "Program finished with exit code $? at: `date`"

OpenMP version#


Hybrid version: MPI and OpenMP#


GPU version#


Script example for LAMMPS: GPU version
run-lammps-mpi-gpu.sh
#!/bin/bash

#SBATCH --gpus=1 
#SBATCH --partition=gpu
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=4000M
#SBATCH --time=0-3:00:00
#SBATCH --job-name=GPU-Test

# Load the modules:

module load intel/2020.4  ompi/4.1.2 lammps-gpu/24Mar22

echo "Starting run at: `date`"

ngpus=1
ncpus=1

lmp_exec=lmp_gpu
lmp_input="in.metal"
lmp_output="log-${ngpus}-gpus-${ncpus}-cpus.txt"

mpirun -np ${ncpus} lmp_gpu -sf gpu -pk gpu ${ngpus} -log ${lmp_output} -in ${lmp_input}

echo "Program finished with exit code $? at: `date`"

Performance#


Related links#