Basics · VASP · LAMMPS · 5 min read
What is molecular dynamics?
Checked against the docs · VASP wiki and LAMMPS manual, stable release 30 Sep 2026 · Last checked 11 November 2026 · Spot a mistake? Tell us
Short answer
Molecular dynamics (MD) is a simulation that follows how atoms move over time: it computes the force on every atom, moves all of them a tiny step forward with Newton's equations of motion, and repeats, often millions of times. The result is a trajectory, from which you measure things a single static structure cannot give, such as diffusion, melting or how a structure fluctuates at a temperature.
What does molecular dynamics do?
A static calculation tells you about one arrangement of atoms. Molecular dynamics lets them move. In the VASP wiki's words, MD is used to study the movement of atoms over time, which makes it useful whenever a static ground-state calculation is not enough: thermal disorder, diffusion, structural fluctuations, phase stability, melting, or how a system settles under realistic conditions.
The method is the same in every code. At each time step (a very short interval, typically around a femtosecond, 10⁻¹⁵ s), the program:
- computes the force on every atom from the current positions;
- moves every atom, and updates its velocity, using Newton's equations of motion;
- repeats.
The list of positions over time is the trajectory. How the moving is done is the subject of the companion page, "How does molecular dynamics move atoms?" (another page in this series).
Where do the forces come from?
This is the biggest choice in any MD study.
| Forces from | Example | What you gain and give up |
|---|---|---|
| The electrons, solved at every step (ab initio MD) | VASP with DFT | No fitted potential; the VASP wiki says an ab initio calculation at every step is frequently too expensive, so runs are short and cells small |
| A machine-learned force field trained on such calculations | VASP's own machine-learned force fields, or external models | Much longer runs on more atoms, once a reliable model exists for your system |
| A classical interatomic potential | LAMMPS with an EAM, Tersoff or similar potential | Very large and long runs; the physics is only as good as the potential |
What is an ensemble, and why does it matter?
An ensemble is the set of conditions held fixed: the number of atoms (N) and two of volume (V), pressure (p), energy (E) and temperature (T). The VASP wiki describes MD as generating the configurations of an ensemble by integrating Newton's equations of motion. The common ones:
- NVE (microcanonical): nothing touches the atoms but the forces, so the total energy should stay constant. The wiki recommends it for dynamical observables, such as vibrational spectra, and for testing the time step.
- NVT (canonical): a thermostat adds or removes energy to keep the temperature near a target.
- NpT (isothermal-isobaric): the cell is also allowed to change size and shape, so the pressure is held instead of the volume.
The wiki's advice for most workflows is to begin with NVT and then check the time step and the force quality in NVE, and to use NpT only when the cell should change.
What does it look like in practice?
In VASP, MD uses the same four input files as any calculation, with these INCAR tags:
IBRION = 0 ! molecular dynamics
NSW = 2000 ! number of time steps (an example)
POTIM = 1.0 ! time step in fs (an example; it must be set for MD)
TEBEG = 300 ! starting temperature in K (an example)
MDALGO = 2 ! the thermostat: 2 is Nosé-Hoover
ISIF = 2 ! keep the cell fixed
ISYM = 0 ! no symmetry: thermal motion breaks itIf POSCAR holds no velocities, VASP draws random ones at the start. The trajectory goes to XDATCAR, with the energies and temperature step by step in OSZICAR and OUTCAR.
In LAMMPS, the input script sets the time step (timestep) and how atoms are moved (fix nve, fix nvt or fix npt), then run with the number of steps. The thermo command prints temperature, energy and pressure every N steps to log.lammps, and dump writes the trajectory.
What do people mix up?
| The mix-up | What is true |
|---|---|
| "MD finds the lowest-energy structure." | MD samples the structures a system visits at a temperature. To find a minimum you relax the structure instead (VASP's IBRION = 1 or 2, LAMMPS's minimize). |
| "The temperature should be exactly the target." | The instantaneous temperature fluctuates, more in a small cell; a thermostat holds its average. |
| "A longer time step gives a longer simulation for free." | The step must be short enough to follow the fastest motion; too long a step makes the energy drift or the atoms fly apart. |
| "The first steps are the result." | A run first has to settle from its starting point; only the stretch after that is used for averages. |
Which value should I use?
- The time step: How do I choose a time step?
- When to start measuring: How do I know when dynamics is equilibrated?
- What to watch while it runs: How do I spot an MD run gone wrong?
- Which potential, in LAMMPS: How do I choose an interatomic potential?
Verlet sets up MD runs with VASP or LAMMPS and plots their temperature and energy as they go; everything on this page works without it.