Skip to content


LAMMPS is a "Molecular Dynamics Simulator" which supports a wide variety of different force fields. CSC does not have a general purpose installation of LAMMPS, as each user typically needs a little bit customised version. Please read below how to create yours.


  • Puhti: Instructions and Makefile available for building in /appl/soft/chem/lammps/
  • Mahti: Instructions and Makefile available for building in /appl/soft/chem/lammps/


LAMMPS is an open-source code, distributed freely under the terms of the GNU Public License (GPL).


Don't use prebuilt binaries, but take a look at the instructions for configuring and compiling LAMMPS on Puhti or Mahti for optimal performance.

  • Navigate to /appl/soft/chem/lammps/ on Puhti or Mahti
  • If you can't find a pre-downloaded source code (e.g. lammps-stable.tar.gz) or a suitable LAMMPS version, download it yourself from the LAMMPS home page.
  • Read the compilation instructions, e.g. lammps-puhti-instruction.txt
  • Configure the packages you want to include and compile the software

Please compile in $TMPDIR for faster performance and less load on the shared filesystem. After compiling, move your files to /projappl/<project code> (the local disk is cleaned frequently). Consult these pages on how to create batch jobs on Puhti and on Mahti.

If you encounter problems compiling LAMMPS, don't hesitate to contact CSC Service Desk.

High-throughput computing with LAMMPS

LAMMPS offers comprehensive support for executing loops and multiple independent simulations using a single input file. The -partition command-line switch enables running these concurrently within a single Slurm job step, thus accelerating the computations while keeping the load on the batch queue system minimal as excessive calls of srun or sbatch are avoided. An example LAMMPS batch script using the -partition option is provided below.

#SBATCH --account=<project>
#SBATCH --partition=large
#SBATCH --time=00:15:00
#SBATCH --nodes=3
#SBATCH --ntasks-per-node=40
#SBATCH --mem-per-cpu=100

export PATH=$PATH:/path/to/lmp_puhti

srun lmp_puhti -in loop.lammps -partition 24x5

The above example runs an umbrella sampling simulation of ethanol adsorption on a NaCl surface in accordance with this LAMMPS tutorial. The simulation consists of 24 iterations where the ethanol molecule is gradually pulled closer to the surface. These 24 iterations are all run concurrently using 5 MPI tasks each, which is specified in the batch script as -partition 24x5. The number of processors must add up to the amount requested, in this case 3 full Puhti nodes (120 cores). In general, the partitions do not have to be of equal size, but one could for example specify -partition 3x30 20 10 for 3 partitions of 30 cores, one of 20 cores and one of 10 cores (3 Puhti nodes). This does of course not make sense for jobs where the subtasks are virtually identical such as here.

If the -partition switch is used one needs to replace the usual index and loop variable styles used in the input of sequential simulations. The corresponding styles compatible with multi-partition jobs are world, universe and uloop. For further details, see the LAMMPS documentation on running multiple simulations from one input script, the partition switch and variable styles compatible with multi-partition jobs.


The following JCP paper is the canonical reference to use for citing LAMMPS. It describes the parallel spatial-decomposition, neighbor-finding, and communcation algorithms used in the code. Please also give the URL of the LAMMPS website in your paper, namely

  • S. Plimpton, Fast Parallel Algorithms for Short-Range Molecular Dynamics, J Comp Phys, 117, 1-19 (1995)

References to other methods used in LAMMPS can be found here

More information

Last edited Tue Mar 8 2022