Guide · VASP · 12 min read
How do I set up ab initio molecular dynamics in VASP?
Checked against the docs · VASP wiki · Last checked 12 November 2026 · Spot a mistake? Tell us
Short answer
Set IBRION = 0, a time step POTIM and a number of steps NSW, the temperature with TEBEG (and TEEND), and a thermostat with MDALGO plus its own tag, such as SMASS for Nosé-Hoover. Keep the cell fixed (ISIF = 2) unless you need constant pressure, switch symmetry off with ISYM = 0, and choose how often frames are written with NBLOCK. Test a short run before the long one.
What is ab initio molecular dynamics?
Molecular dynamics (MD) follows the atoms through time. In ab initio MD, VASP computes the forces on the atoms from DFT at every step, then moves the atoms with a classical equation of motion, one time step forward, and repeats. The VASP wiki puts it plainly: an MD run performs NSW steps of length POTIM.
Three choices decide what the run samples:
- The ensemble: which quantities stay fixed. In the NVT ensemble the number of atoms, the volume and the temperature are held; in NVE the energy is conserved instead of the temperature; in NpT the pressure is held and the cell can change.
- The thermostat: how VASP keeps the temperature near the target, chosen with
MDALGO. A thermostat that is selected but switched off gives NVE. - The cell: whether it may change, chosen with
ISIF. VASP sets the ensemble fromMDALGOandISIFtogether.
The wiki's MD page names the reasons to run MD at all: thermal disorder, diffusion, structural fluctuations, phase stability, melting, or how a system equilibrates under realistic conditions, wherever a static ground-state calculation is not enough.
When does the setup matter most?
Every step costs a full electronic minimization. Ab initio MD is expensive, so a setting that wastes steps (a strained start, an ensemble that cannot settle) costs real time. The wiki recommends splitting long ab initio runs into several jobs of NSW up to about 20000 steps.
The ensemble decides what you can measure. A fixed-cell run cannot fix a wrong volume or density; the wiki says so in its first step. Dynamical quantities, such as phonon spectra, want NVE, because there no thermostat changes the velocities. Constant pressure needs NpT.
Electronic accuracy becomes force accuracy. Poorly converged electrons give wrong forces, and wrong forces give a wrong trajectory. The wiki lists poor electronic convergence among the common pitfalls.
How do I prepare the structure?
The wiki's first step is a stable starting structure in a cell large enough to give meaningful statistics; a cell that is too small gives poor statistics and lets atoms interact with their periodic images.
- Relax first, with the same setup. If you start from a new structure guess, relax it with the same functional, POTCARs, cutoff and k-point strategy you will use for the dynamics. Changing any of them changes the energy surface the atoms move on. A strongly strained start spends the early part of the run removing the strain instead of sampling the temperature you want.
- Copy
CONTCARtoPOSCARwhen you continue from a relaxation or an earlier MD run. ACONTCARwritten by MD may also carry the velocities, so the trajectory continues smoothly. - Velocities. If
POSCARholds no velocities, VASP draws them at random from a Maxwell-Boltzmann distribution atTEBEG. SetRANDOM_SEEDif you need the same random start twice.
See Should I start fresh or continue? for restarts.
Which INCAR tags make it molecular dynamics?
The wiki's minimal fixed-cell NVT starting point, with what each line does:
IBRION = 0 ! molecular dynamics
NSW = 5000 ! number of MD steps
POTIM = 1.0 ! time step in fs
TEBEG = 300 ! starting temperature in K
TEEND = 300 ! final temperature in K
MDALGO = 2 ! Nosé-Hoover thermostat
SMASS = 0 ! Nosé mass: VASP picks one for a period of 40 steps
ISIF = 2 ! cell fixed, stress tensor still computed
ISYM = 0 ! symmetry offThe wiki calls these starting points for the MD part only: add the converged electronic settings (cutoff, smearing, k-points) from your relaxation. What each tag does:
IBRION = 0turns on molecular dynamics.NSWis the number of steps, so the length of the run isNSW×POTIM. For MD it has to be set, or VASP exits right after it starts.POTIMis the time step in femtoseconds. It has no default for MD and must be set. Choosing it is its own guide: What time step should I use?TEBEGis the starting temperature in kelvin; its default is 0.TEENDis the final temperature and defaults toTEBEG. The wiki describes how the temperature moves from one to the other only forSMASS = -1, where the velocities are rescaled everyNBLOCKsteps toward a temperature that changes linearly fromTEBEGtoTEEND; for the thermostats chosen withMDALGOit does not say, so for a run at one temperature leaveTEENDout or set it equal toTEBEG.MDALGOchooses the thermostat (next section). Most thermostats chosen withMDALGOneed VASP compiled with-Dtbdyn, which everymakefile.includetemplate has had by default since VASP 5.4.4.ISIFsays whether the cell can change. For MD its default is 0: forces only, no stress.ISIF = 2keeps the cell fixed but computes the full stress tensor, which the wiki calls a common choice for that reason.ISYM = 0switches symmetry off (next but one section).
For the electrons, the wiki's conservative start for ab initio MD is PREC = Accurate, EDIFF = 1E-6 and ALGO = Normal, combined with the converged ENCUT, smearing and k-point mesh from the preceding relaxation.
Which thermostat and ensemble should I use?
The wiki's advice for most work: begin in NVT, then check the time step and the quality of the forces with a short NVE segment. Use NpT only when the cell should fluctuate.
| You want | MDALGO | The tag it needs | ISIF |
|---|---|---|---|
| NVT, Nosé-Hoover | 2 | SMASS | below 3, usually 2 |
| NVT, Andersen | 1 | ANDERSEN_PROB (collision probability) | below 3 |
| NVT, Langevin | 3 | LANGEVIN_GAMMA, one friction per species | below 3 |
| NVT, Nosé-Hoover chain | 4 | NHC_NCHAINS, NHC_PERIOD | below 3 |
| NVT, CSVR (VASP 6.4.3 and later) | 5 | CSVR_PERIOD | below 3 |
| NVE | 1 with ANDERSEN_PROB = 0.0, or 2 with SMASS = -3 | as given | below 3 |
| NpT | 3 (Langevin is the only thermostat for it) | LANGEVIN_GAMMA, LANGEVIN_GAMMA_L, PMASS | 3 |
MDALGO = 0 is the default and is marked deprecated on the wiki: it is an older Nosé-Hoover implementation that always wraps atoms back into the box, which makes some analysis, such as the mean squared displacement, impossible. The wiki recommends MDALGO = 2 or 4 instead.
Choose yours:
| Your ensemble | Start with | Why |
|---|---|---|
| NVT: fixed cell, set temperature | MDALGO = 2, SMASS = 0, ISIF = 2 | The wiki's minimal NVT start: Nosé-Hoover with a Nosé mass VASP chooses for a 40-step period. Add your converged electronic settings and the time step that suits your system. |
| NVE: fixed cell, conserved energy | MDALGO = 1, ANDERSEN_PROB = 0.0, ISIF = 2 | The NVE page's recommended way: the Andersen thermostat with no collisions. TEBEG still sets the starting velocities when POSCAR has none; thermalize in NVT first, the wiki suggests, then continue from its CONTCAR. |
| NpT: set pressure, cell may change | MDALGO = 3, ISIF = 3, LANGEVIN_GAMMA, LANGEVIN_GAMMA_L, PMASS | The wiki's variable-cell start, written for two species (one LANGEVIN_GAMMA value each). Test PMASS and the frictions on a short run, and raise the cutoff: the basis is fixed when the cell changes. |
What it depends on:
- What you will measure. Averages at a temperature: NVT. Dynamics that a thermostat would disturb: NVE, after equilibrating. Volume or phase changes: NpT.
- Whether your volume is right. NVT and NVE keep the starting cell, so its pressure is whatever that cell gives. Relax the volume first, or equilibrate it in NpT.
- The thermostat's own setting. Each one needs its tag set; the NVT page says so for every column of its table.
How do I set the Nosé mass (SMASS)?
SMASS sets the Nosé mass, which controls how fast the temperature oscillates under the Nosé-Hoover thermostat.
SMASS = 0: VASP chooses a mass that gives a period of 40 time steps.- A positive value: your own mass. The wiki asks for temperature oscillations at roughly the frequencies of the system's typical vibrations; if the two differ by an order of magnitude, the thermostat and the atoms can decouple and the ensemble is no longer canonical. VASP writes the frequency of the thermostat's oscillation to
OUTCAR. SMASS = -3: no thermostat, constant energy (NVE). This is the default. WithMDALGO = 2and noSMASSline, you get NVE, not the NVT run you meant.SMASS = -1: the velocities are rescaled everyNBLOCKsteps toward a temperature that moves linearly fromTEBEGtoTEEND; between rescalings the run is NVE.
Why switch symmetry off?
Set ISYM = 0. The wiki gives the reason on its MD page: thermal motion generally breaks the symmetry of the relaxed structure. With symmetry on, VASP finds the symmetry of the starting positions (and starting velocities) and symmetrizes the charge density and the forces to it. The ISYM page says ISYM = 0 should be set for molecular dynamics.
How often should VASP write the trajectory?
NBLOCK sets how many steps pass between frames written to XDATCAR; the pair-correlation function and the density of states are accumulated at the same steps. Its default is 1, every step.
- Leave it at 1 for most runs; the wiki recommends this, because the cost of those quantities is minimal.
- Raise it to 10 or 100 for runs of many thousands of steps, the wiki suggests, so that
XDATCARdoes not grow too large. NBLOCK×KBLOCKmust not exceedNSW. AfterKBLOCK×NBLOCKsteps the averaged pair correlation and density of states go toPCDATandDOSCAR; if the product is larger thanNSW, VASP resetsKBLOCKto 1, thenNBLOCKtoNSW.NWRITE= 0 or 1 reduces what goes intoOUTCARat each step, theIBRIONpage notes.
How do I know the setup works?
Run a short test first. The wiki's fifth step: before a long run, look at the temperature, forces, stress and electronic convergence of a short trajectory. Each MD step in OSZICAR ends in a line like the wiki's example:
29 T= 339. E= -.40079922E+02 F= -.40328692E+02 E0= -.40329272E+02 EK= 0.30631E+00 SP= -.62E-01 SK= 0.41E-02T is the instantaneous temperature, E the total energy of the extended system (atoms plus thermostat), F the free energy of the electrons and ions, E0 the energy extrapolated to zero smearing, EK the kinetic energy of the ions, and SP and SK the thermostat's potential and kinetic energy. List them all with:
grep " T=" OSZICARWhat healthy looks like, from the wiki:
Tfluctuates around the target in a thermostatted run.Eshows no systematic drift in NVE and in Nosé-Hoover or Nosé-Hoover chain runs. With a stochastic thermostat (Andersen, Langevin, CSVR) it is not strictly conserved; look for unexplained long-term drift.EKchanges smoothly.
Warning signs, from the wiki: repeated electronic non-convergence, large force spikes, a temperature drifting steadily away from the target in NVT, strong energy drift in NVE, and cell distortions that keep growing in a variable-cell run. Its first fix is a smaller POTIM, then tighter electronic settings. See How do I spot an MD run gone wrong?
Check that VASP read what you wrote. OUTCAR opens with VASP's reading of your input:
grep -E "IBRION|POTIM|TEBEG|TEEND|SMASS|MDALGO|ISYM" OUTCARThen separate equilibration from production. The wiki's note: use the first part of the run to let temperature, pressure, volume and local structure relax, and take averages only once they fluctuate around a steady state. See How do I know when dynamics is equilibrated?
What goes wrong with an MD setup?
| Mistake | What you would see | What to do |
|---|---|---|
No POTIM | VASP crashes right after it starts. | Set POTIM; see the time-step guide. |
No NSW | VASP exits right after it starts. | Set NSW to the number of steps. |
MDALGO = 2 without SMASS | The default SMASS = -3 gives constant-energy dynamics: the temperature is not controlled. | Set SMASS (0 lets VASP choose). |
No TEBEG | The default is 0 K: the atoms start without thermal velocities. | Set TEBEG (and TEEND). |
ISIF = 3 with a thermostat other than Langevin | NpT is implemented only for MDALGO = 3; the wiki does not say what VASP does or prints with another thermostat. | MDALGO = 3 with its tags, or ISIF = 2 for a fixed cell. |
| Symmetry left on | The forces and density are symmetrized to the starting structure's symmetry, which thermal motion breaks. | ISYM = 0. |
MDALGO = 0 (the default) for diffusion | Coordinates are wrapped back into the box, so the mean squared displacement cannot be computed. | MDALGO = 2 or 4. |
| A wrong volume in NVT | A pressure far from zero that the run can never correct. | Relax the volume first, or equilibrate in NpT. |
| Changing cutoff, smearing or k-points between related runs | Runs that sample different energy surfaces. | Keep the electronic settings fixed across a series. |
| A new random start on every continuation | Each job starts from fresh random velocities. | Continue from CONTCAR with its velocities. |
NBLOCK × KBLOCK larger than NSW | VASP resets KBLOCK, then NBLOCK. | Keep the product at or below NSW. |
In Set up, the Molecular dynamics preset starts a fixed-cell run with a thermostat, symmetry off and frames written as it goes, and every tag stays editable, so set the precision, cutoff and k-points to match the advice above before a production run. Before you submit, pre-flight checks the dynamics settings. Monitor follows the temperature and energy step by step as the job runs, and Analyze plays the trajectory. Everything above works without it.