LAMMPS from scratch · 15 min

Getting LAMMPS without compiling

Ready-made LAMMPS programs exist for Windows, macOS and Linux. You install one, ask it which version and packages it has, run the melt example, and prove the installation works by matching its first line to the hand calculation.

1 · Understand: two ways to get LAMMPS

Someone has to compile LAMMPS (page 0.1). Either the LAMMPS developers do it and you download the program (this page), or you compile it yourself (page 0.4). Downloading is quicker; compiling lets you choose the version and packages, and is the only way to change the code.

Download a programCompile it yourself
time to first runminutes15–30 minutes the first time, including installing the tools
versionwhatever was packagedany release, including the newest
packageschosen by the packagerexactly the ones you need
change the C++ codenot possibleyes (Part E)

No installation at all is also possible: the Start page runs LAMMPS inside your browser.

2 · Install for your system

Steps follow the official LAMMPS installation pages (sources at the end). The program may be called lmp, lmp_serial, lmp_mpi or lmp.exe depending on the installer; use your name wherever this course writes lmp.

3 · Observe: ask LAMMPS about itself

lmp -h prints help. Its first lines say which version you have, and further down it lists the installed packages. Here is the start of ours, on the 2-processor computer used for this course:

$ lmp -h Large-scale Atomic/Molecular Massively Parallel Simulator - 22 Jul 2025 - Update 6 Git info (HEAD / stable_22Jul2025_update6) … Installed packages: KSPACE MOLECULE RIGID
Version line saysWhat it means
30 Sep 2026the newest stable release (the one running in your browser on these pages)
22 Jul 2025the previous stable release (the source code quoted in this course)
a date with no "stable" taga feature release: newer features, less tested

A command from a package that is not installed stops LAMMPS with a clear message. Ours, asked for pair_style tersoff:

ERROR: Unrecognized pair style 'tersoff' is part of the MANYBODY package which is not enabled in this LAMMPS binary.

4 · Match: prove your installation works

Run the melt example (it comes with every installer, in examples/melt/, or copy it from the Start page):

lmp -in in.melt

Its first thermo line is fixed by the crystal and the starting temperature, so every correct installation of every version must print exactly the numbers we computed by hand on the Start page. Paste your line below.

(the box holds our own line; replace it with yours)

Later lines (step 50, 100, …) may differ slightly between versions, compilers and numbers of processors: tiny rounding differences grow in a chaotic liquid. Step 0 has no such freedom.

Your turn

1. Your lmp -h lists KSPACE MANYBODY MOLECULE RIGID. Can you use pair_style tersoff? And pair_style reaxff?

2. A student's hand calculation gives TotEng = −2.2733681 instead of −2.2744931. What did they forget?

3. Two correct installations print the same step 0 but different numbers at step 250. Is one of them broken?

Sources