Skip to content

lammps

Summary

Source: https://lammps.sandia.gov/

License: GNU Public License Version 2 (GPLv2)

Path: see below

Documentation: https://lammps.sandia.gov/doc/Manual.html

LAMMPS is a classical molecular dynamics code, and an acronym for Large-scale Atomic/Molecular Massively Parallel Simulator.LAMMPS has potentials for solid-state materials (metals, semiconductors) and soft matter (biomolecules, polymers) and coarse-grained or mesoscopic systems. It can be used to model atoms or, more generically, as a parallel particle simulator at the atomic, meso, or continuum scale.

Using lammps

We provide two lammps installations:

  1. lammps v20190807 from the EPEL repository.

  2. lammps v2021-07 (and possibly newer) installed in /software/lammps

Local lammps

More recent version(s) of lammps are installed under /software/lammps. In this case, only a openmpi-4 compiled version is supplied. The configuration is explained further below

# initialize
[max]% module load maxwell lammps # or lammps/2021-07 for a specific version

# a sample run
mpirun -N $(( $(nproc) / 2)) -mca pml ucx lmp -in in.lj.hex > heat.log 2>&1

# for quick benchmarks see below

Note: only use physical cores ('(((proc)/2))'), using all cores will make runs slower.

EPEL lammps

The lammps installation available from the EPEL repository is a bit rusty and lacking a number of features, but might still be sufficient.

Essential variables like LAMMPS_POTENTIALS are defined in /etc/profile.d/lammps.©sh, which are usually sourced at login.

Currently, three variants of lammps are being installed, serial, openmpi, mpich:

# serial lammps does not need any setup:
[max]% which lmp
/usr/bin/lmp

# mpich compiled lammps
[max]%  xwhich lmp_mpich

 Provided by module(s)
   ... module load mpi/mpich-x86_64; which lmp_mpich: /usr/lib64/mpich/bin/lmp_mpich

# openmpi compiled lammps
[max]% xwhich lmp_openmpi

 Provided by module(s)
   ... module load mpi/openmpi-x86_64; which lmp_openmpi: /usr/lib64/openmpi/bin/lmp_openmpi

lammps in batch

A simple batch-script could look like this (using the heat sample coming with lammps):

#!/bin/bash
#SBATCH --partition=short
#SBATCH --time=0-04:00:00
#SBATCH --nodes=1
#SBATCH --job-name=lammps.heat
#SBATCH --output=heat.out
unset LD_PRELOAD
source /etc/profile.d/modules.sh
module purge
module load maxwell lammps

procs=$(( $(nproc) / 2 ))

mpirun -N $procs --mca pml ucx --mca opal_warn_on_missing_libcuda 0 /software/lammps/2021-07/bin/lmp -in in.lj.hex > heat.1.$procs.log 2>&1
el=$(grep "Total wall time" heat.$procs.log| awk '{print $4}')
echo "Number of cores used: $procs  Elapsed time: $el"