Skip to main content
v2026.11,858 entries · CC-BY 4.0

LAMMPS Molecular Dynamics: Install, Run, Read Output

Choose a LAMMPS install route, launch serial or MPI runs correctly and read the log output, based on the official documentation.

Written and maintained by CASRAI Editorial Board

Last updated

What LAMMPS is used for in research

LAMMPS is, in the words of its documentation, “a classical molecular dynamics (MD) code that models ensembles of particles in a liquid, solid, or gaseous state.” It is written in C++, runs in serial or on any parallel machine that supports MPI, and handles 2d or 3d systems from a few particles up to billions. The distribution carries a GNU GPL licence file, and the documentation is copyright Sandia Corporation. For related tools in the same workflow, see the CASRAI guides to NAMD, VMD and PyMOL.

Install or access (official source only)

The official Install page lists six routes: a Linux executable, a macOS executable, a Windows executable, Conda (Linux and macOS), a source tarball, and git source. The decision that matters is this: prebuilt executables contain only the optional packages their builders chose, so if you need a package that is not included, or want to modify or extend LAMMPS, the documentation says you must build from source (Build section). Optional packages are described in the Packages section of the manual.

You need Route the docs point to
To run standard examples quickly A prebuilt executable or Conda package
A package missing from the prebuilt binary Build from source with that package enabled
To modify or extend the code Source tarball or git source

Check what your executable includes with the -h switch, which lists the available styles.

Running an input script

LAMMPS reads commands from an input script. Scripts are conventionally named in.*, and you run from the directory containing the script. The documented launch lines are:

  1. Serial: lmp_serial -in in.file or lmp -in in.file
  2. Parallel with MPI: mpirun -np 4 lmp_mpi -in in.file or mpiexec -np 4 lmp -in in.file
  3. Always use -in under MPI: reading with the < redirect “will not always work” in parallel.

Command-line flags worth knowing

Flag What it does (per Run options page)
-in file Reads the named input script
-log file Sets the log file name (default log.lammps)
-screen file Sends screen output to a file; none disables it
-echo style none, screen, log or both (default log)
-sf style (suffix) Uses accelerated styles: gpu, intel, kk, omp, opt or hybrid
-var name value1 value2 ... Defines an index variable from the command line

Output and how to read it

LAMMPS prints setup information, then thermodynamic output periodically, and at the end the final thermo state, total run time and CPU and storage statistics. Output goes to the screen and to log.lammps.

  • Loop time: wall-clock time for the MD steps, excluding setup. The performance line next to it helps estimate how long a longer run will take.
  • CPU use: should be close to 100% times the number of OpenMP threads; noticeably lower suggests a delay such as I/O.
  • MPI breakdown: %varavg shows load imbalance (near 0 is ideal) and %total the share of loop time for each category.
  • Dangerous builds: a nonzero count means the neighbour-list delay setting should be reduced.
  • Minimization: output reports the stopping criterion, initial and final energy and force norms.

Troubleshooting

  • Invalid command or “Invalid style” error: either a typo, or the style belongs to an optional package not compiled into your executable. Run with -h to list available styles. To see which command failed, check log.lammps or use the echo command.
  • Different results on different processor counts: the documentation says this is typically not a bug. Round-off and different domain decompositions make trajectories diverge after a few hundred to a few thousand steps, while statistical properties such as average energy or temperature should still agree.
  • Velocities or atom IDs differ between runs: the velocity command can assign a particular atom a different velocity on a different processor count (see its loop option), and create_atoms may number atoms differently.
  • Physics mistakes: LAMMPS cannot detect too large a timestep, wrong force field coefficients or atoms placed on top of each other. Problems such as lost atoms may only appear mid-run.

Other molecular simulation tools

Tool Role relative to LAMMPS
NAMD Another molecular dynamics engine, covered in a CASRAI guide
VMD Visualisation and analysis of trajectories
PyMOL Molecular graphics

FAQ

Where do I download LAMMPS?

From the Install LAMMPS page of the official documentation, which lists prebuilt executables, Conda, the source tarball and the git repository.

Where is the documentation and are there tutorials?

The manual at docs.lammps.org includes sections on installation, building, running, errors, commands, accelerating performance, optional packages and howto discussions. Section 11 contains example scripts.

What licence does LAMMPS use?

The distribution contains a LICENSE file with the GNU GPL.

Sources (official docs, read 2026-11-07)

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about LAMMPS Molecular Dynamics: Install, Run, Read Output

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →