LAMMPS from scratch · 20 min
Reading the log and the error messages
Everything LAMMPS prints after a run, explained and recomputed by hand from the loop time and the neighbour count; then eleven common mistakes in the melt script, each run live with its real error message, what it means and how to fix it.
- The parts of a log: echo, setup, thermo table, timing summary, neighbour statistics
- Recompute the performance line, the timing percentages and the average neighbour count by hand
- Recognise the most common errors and warnings and know what each one means
1 · Understand: what the log contains
Everything LAMMPS prints goes to the screen and to log.lammps in the directory where it ran. In order:
| Part | What it shows | Page |
|---|---|---|
| banner | the version: LAMMPS (22 Jul 2025 - Update 6) | 0.3 |
| echo of commands | what each command created: lattice spacing, box, "Created 4000 atoms" | A.5 |
| setup | neighbour list settings, units, timestep, memory | A.7 |
| thermo table | one line every thermo N steps | A.3 |
Loop time | wall-clock seconds for the run, and speed | below |
| timing breakdown | where the time went: Pair, Neigh, Comm, Output, Modify, Other | C.8 |
| neighbour statistics | owned atoms, ghost atoms, pairs in the list, rebuilds | A.7, D.3 |
2 · Observe: run melt and read the end of the log
The times are measured on your device, so your numbers will differ from anyone else's. The hand checks use your numbers.
3 · Match: every derived number, by hand
Only three things are measured: the loop time, the time in each section, and the number of pairs. Everything else is arithmetic.
| Printed | Formula |
|---|---|
| timesteps/s | steps ÷ loop time |
| tau/day | timesteps/s × timestep × 86400 (seconds in a day). In real units: ns/day, with dt in fs |
| Matom-step/s | timesteps/s × atoms ÷ 10⁶ |
| %total | 100 × section time ÷ loop time |
| Ave neighs/atom | Neighs ÷ Nlocal |
Run melt above to fill in this table.
Ave neighs/atom is 37.9, not the 39 counted around a perfect lattice on page A.7: the list was built at the last rebuild, when the crystal had already melted. Nghost (5506) is the number of copies of atoms near the box faces that this processor keeps so that every atom sees all its neighbours across the periodic boundary (page D.2).
4 · Modify: eleven mistakes, run live
Each changes one line of in.melt. Predict what LAMMPS says, then run it.
A typo in a command name
What it means. LAMMPS looked the first word up in its list of commands and did not find it. The message repeats the whole line, so the typo is easy to see.
Fix. Correct the spelling.
A style from a package that is not built in
What it means. The style exists, but in the MANYBODY package, which this binary was compiled without (page 0.4).
Fix. Use a LAMMPS built with that package (cmake -D PKG_MANYBODY=on), or a different style.
A timestep 10 times too large
What it means. Atoms move so far in one step that two of them overlap, the LJ repulsion throws them across the box, and they leave the region this processor tracks. LAMMPS counts the atoms and finds most missing.
Fix. Reduce the timestep. "Lost atoms" almost always means the dynamics blew up: too large dt, overlapping atoms, or a wrong force field.
pair_coeff missing
What it means. Nothing is wrong when the line is read. Only at run, when the pair style checks its table of ε and σ, does it find an empty entry. The line after it adds a status note; the message itself, "All pair coeffs are not set", is the clue.
Fix. Give a pair_coeff for every pair of types (or for i i, and let mixing fill i j).
A word where a number is expected
What it means. The 4th word must be σ, a number. The message names the file and line of the C++ code that checked it.
Fix. Write the number.
A command with too few arguments
What it means. fix nvt needs a target temperature and a damping time (page D.10); nve needs nothing. "Illegal … command" means the arguments do not match the documentation page of that command.
Fix. fix 1 all nvt temp 3.0 3.0 0.5
A file that is not there
What it means. LAMMPS looks for the file in the directory where it was started. On a real computer this is the commonest error of all: running lmp from the wrong folder.
Fix. cd into the folder that holds the file (page 0.2), or give the full path.
A warning, not an error
What it means. The run finishes. But at the end, every rebuild of the neighbour list was "dangerous": an atom had already moved more than half the skin before the list was rebuilt, so some pairs may have been missed (page A.7). LAMMPS does not stop you; you must read it.
Fix. every 1 delay 0 check yes (the safe default) or a larger skin.
Commands in the wrong order
What it means. Atoms can only be placed in a box that exists (block 2 of page A.3 has an order).
Fix. Put create_box first.
A type that does not exist
What it means. create_box 1 made one atom type, so the only valid type number is 1.
Fix. Use type numbers between 1 and the number given to create_box (or in the data file header).
A mass missing
What it means. Without a mass, F = ma cannot give an acceleration, and velocity create cannot compute a kinetic energy. So the error comes at the velocity line, the first command that needs masses.
Fix. Give a mass for every type (or a Masses section in the data file).
How to read any error
- Read the first ERROR line, not the last line. It names the command, and often the C++ file and line that raised it, e.g.
(src/fix_nh.cpp:61). That file is where the check lives (page B.8). - Look at "Last input line". It is the command LAMMPS was executing, which may be later than the line you changed: a missing mass is only noticed at the velocity line.
- Some errors appear only at
run. Missing pair coefficients are checked when the run starts, not when the script is read. - Warnings do not stop the run. Search the log for
WARNINGand for "Dangerous builds" after every new script. - Follow the link. Common errors end with "For more information see https://docs.lammps.org/err…", a manual page that explains that exact message. For the rest, search the message in the manual and the LAMMPS forum.
Your turn
1. A run of 1000 steps with 32000 atoms and timestep 0.005 takes 40 s. What does the Performance line say?
2. Pair takes 85 % of the time in melt. If you change the cutoff from 2.5 to 5.0, roughly how much longer does the run take?
3. A run stops with "Lost atoms" at step 3000, after running fine. What do you check first?