The short version
- MD is
IBRION = 0withNSWsteps ofPOTIMfs; POTIM has no default, and VASP stops without it. - Always set MDALGO and its coupling tag: every thermostat's coupling defaults to “off”, so a run that sets only MDALGO is silently NVE.
- The default MDALGO = 0 folds atoms back into the cell, which rules out a mean-squared displacement. Use MDALGO 1–5.
- Constant pressure (NpT) only works with Langevin:
MDALGO = 3,ISIF = 3. - Use
ISYM = 0, a time step of about 1 fs (0.5–0.7 fs with hydrogen), and check the drift of the conserved energy. - VASP's machine-learned force fields (6.3 and later) train on the fly during MD: train, refit, then run.
Thermostats and ensembles
| MDALGO | Thermostat | Ensembles | Coupling tag (default = off) |
|---|---|---|---|
| 0 | legacy Nosé (deprecated) | NVE, NVT | SMASS (−3 = NVE); wraps coordinates |
| 1 | Andersen | NVE, NVT | ANDERSEN_PROB (0) |
| 2 | Nosé–Hoover | NVE, NVT | SMASS (−3) |
| 3 | Langevin (+ Parrinello–Rahman cell) | NVT, NpT, NpH | LANGEVIN_GAMMA (0), LANGEVIN_GAMMA_L (0), PMASS |
| 4 | Nosé–Hoover chain (6.4.0) | NVE, NVT | NHC_NCHAINS (0), NHC_PERIOD |
| 5 | CSVR, stochastic velocity rescaling (6.4.3) | NVE, NVT | CSVR_PERIOD (0) |
NVE: MDALGO = 1 with ANDERSEN_PROB = 0 is the simplest. NVT: any MDALGO with its coupling switched on, ISIF = 2. NpT: Langevin with ISIF = 3 only, at a cutoff of about 1.3 × ENMAX (the cell changes). NpH: as NpT with both frictions 0.
INCAR recipes
Add your converged electronic settings (ENCUT, PREC, EDIFF, smearing) to each block.
IBRION = 0
MDALGO = 4
ISIF = 2
ISYM = 0
NSW = 10000
POTIM = 1.0 ! fs; 0.5-0.7 with hydrogen
TEBEG = 300 ; TEEND = 300
NHC_NCHAINS = 3 ! the default 0 means no thermostat
NHC_PERIOD = 40 ! in MD steps
RANDOM_SEED = 248489752 0 0IBRION = 0
MDALGO = 3
ISIF = 2
ISYM = 0
NSW = 10000
POTIM = 1.0
TEBEG = 300
LANGEVIN_GAMMA = 10.0 10.0 ! ps^-1, one value per speciesIBRION = 0
MDALGO = 3
ISIF = 3
ISYM = 0
NSW = 10000
POTIM = 1.0
TEBEG = 300
LANGEVIN_GAMMA = 10.0 10.0 10.0 ! three species
LANGEVIN_GAMMA_L = 10.0
PMASS = 1000
PSTRESS = 0 ! target pressure in kBIBRION = 0
MDALGO = 1
ANDERSEN_PROB = 0.0 ! Andersen switched off: plain NVE
ISIF = 2
ISYM = 0
NSW = 10000
POTIM = 1.0
TEBEG = 300PREC = Normal
EDIFF = 1E-5
ALGO = Fast
LREAL = Auto
MAXMIX = 40 ! reuse the mixer between steps (not when training force fields)
LWAVE = .FALSE. ; LCHARG = .FALSE.
NBLOCK = 10 ! one XDATCAR frame every 10 stepsWith a single Γ point, run vasp_gam. Split long simulations into runs of at most about 20000 steps.
The MD tags
| Tag | What it does | Default | What to use | Watch out |
|---|---|---|---|---|
MDALGO | Thermostat: 1 Andersen, 2 Nosé–Hoover, 3 Langevin, 4 Nosé–Hoover chain (6.4.0), 5 CSVR (6.4.3). | 0 (legacy Nosé) | Set it explicitly (1–5); only 3 (Langevin) with ISIF = 3 gives NpT. | MDALGO = 0 wraps the atoms back into the cell, which rules out a mean-squared displacement. |
TEBEG | Starting temperature (K); velocities are drawn from it if POSCAR has none. | 0 | The target temperature. | |
TEEND | Final temperature (K) of a linear ramp. | TEBEG | Larger than TEBEG to heat gradually, e.g. for force-field training. | |
SMASS | Nosé mass for MDALGO = 0 and 2 (−3 = NVE, −1 = velocity rescaling, ≥ 0 = Nosé thermostat); damping for IBRION = 3. | −3 | MDALGO = 2: 0 or a small positive value for NVT. | The default −3 means no thermostat (NVE). |
ANDERSEN_PROB | Andersen collision probability per atom per step (MDALGO = 1). | 0 | 0 for NVE; positive for NVT. | Rescale it if POTIM changes. |
LANGEVIN_GAMMA | Langevin friction per species in ps⁻¹ (MDALGO = 3). | 0 for each species | About 10 ps⁻¹ per species for NVT or NpT. | 0 means NVE; very large values overdamp the motion. |
LANGEVIN_GAMMA_L | Langevin friction of the lattice in ps⁻¹ (MDALGO = 3, ISIF = 3). | 0 | About 10 for NpT. | |
PMASS | Fictitious mass of the lattice for NpT (MDALGO = 3, ISIF = 3), in amu. | 1000 | Start at 1000 and test. | Too small: violent volume swings; too large: the cell barely responds. |
NHC_NCHAINS | Length of the Nosé–Hoover chain (MDALGO = 4). | 0 (= NVE) | 3 is a common choice. | The default gives NVE. |
NHC_PERIOD | Time scale of the Nosé–Hoover chain thermostat, in MD steps. | 40 | 20–200 steps. | |
CSVR_PERIOD 6.4.3+ | Time scale of the CSVR thermostat (MDALGO = 5). | 0 (= NVE) | Set it to get NVT. | The VASP Wiki gives its unit both as fs and as MD steps. |
NBLOCK | Every NBLOCK steps VASP writes an XDATCAR frame and updates averages. | 1 | 1 for short AIMD; 10–100 for long runs. | |
KBLOCK | Averages (PCDAT, DOSCAR) are written every KBLOCK × NBLOCK steps. | NSW | Leave the default. | |
POMASS | Atomic masses (amu) per species, overriding the POTCAR values. | from the POTCAR | A heavier H (e.g. 8) allows a longer time step when only equilibrium properties matter. | It changes the dynamics: avoid it when time-dependent or mass-dependent results matter. |
RANDOM_SEED | Seed of the random numbers (initial velocities, stochastic thermostats). | from the system clock | Set it to make a run reproducible. | |
VELOCITY | Write the velocities to vaspout.h5 (VASP 6.4 and later). | .FALSE. | .TRUE. for velocity autocorrelation and vibrational DOS. |
Restarting and changing ensemble
cp CONTCAR POSCARcontinues the trajectory: CONTCAR carries the velocities and the integrator's predictor–corrector data.- Switching ensemble (NVT to NpT, say): delete the predictor–corrector block at the end of the file, or the run crashes; keep the velocities.
- Equilibrate first, then count only the production part. Starting velocities come from TEBEG unless POSCAR has them; set RANDOM_SEED for reproducible runs.
Analysis
grep "T=" OSZICAR | awk '{print $1, $3, $5}' > T_E.dat # step, temperature, conserved energy E
tail -3 OSZICAR # the latest steps- OSZICAR's MD line:
T=temperature,E=total energy including kinetic and thermostat terms (the conserved quantity),F=andE0=as in relaxations,EK=kinetic energy,SP=andSK=thermostat energies. - In NVE and Nosé–Hoover runs, E must not drift systematically; drift means too large a time step or noisy forces (a poorly converged SCF). Stochastic thermostats do not conserve it exactly.
- XDATCAR holds a frame every NBLOCK steps; with MDALGO ≥ 1 the coordinates are not folded back into the cell. In ASE read all frames with
read("XDATCAR", index=":"); without the index you get only the last one. - Diffusion: D from the mean-squared displacement, ⟨|r(t) − r(0)|²⟩ = 2 n D t in n dimensions; pymatgen's DiffusionAnalyzer reads vasprun.xml files directly. Radial distribution: PCDAT (averaged) or ASE's get_rdf. Vibrational DOS: Fourier transform of the velocity autocorrelation (VELOCITY = .TRUE.).
- MDAnalysis has no VASP reader: convert with ASE first.
Machine-learned force fields in VASP
VASP can learn a force field during MD: it computes a step from first principles only when the model's estimated error is too large, and otherwise predicts.
ML_LMLFF = .TRUE.
ML_MODE = train ! continues from ML_AB if that file is present
IBRION = 0
MDALGO = 3
ISIF = 3
ISYM = 0
TEBEG = 200 ; TEEND = 500 ! heat to about 30% above the temperature you need
LANGEVIN_GAMMA = 10.0 10.0
LANGEVIN_GAMMA_L = 3.0
PMASS = 100
POTIM = 1.5
NSW = 20000cp ML_ABN ML_AB # continue training (ML_MODE = train) or refit (ML_MODE = refit)
cp ML_FFN ML_FF # then production: ML_MODE = run
grep ERR ML_LOGFILE | grep -v "#" | awk '{print $2, $4}' > ERR.dat # force error per step- Refit before production: without it the fast prediction mode, 20 to 100 times faster, is not available.
- Keep the INCAR and POTCAR of the first-principles part identical across training stages; no MAXMIX while training; never train in NVE.
- Aim for training errors below about 1 meV/atom in energy and 30–100 meV/Å in forces.
- Surfaces and molecules: a tiny stress weight,
ML_WTSIF = 1E-10. - A force field describes one potential-energy landscape: for a magnet, train on one consistent magnetic state.
- Since VASP 6.6.0 a run stops if the model's spilling factor becomes critically large (above 0.9).
| Tag | What it does | Default | What to use | Watch out |
|---|---|---|---|---|
ML_LMLFF 6.3.0+ | Switch on VASP's machine-learned force field (VASP 6.3.0 and later). | .FALSE. | .TRUE. together with ML_MODE. | |
ML_MODE 6.4.0+ | Force-field mode: train, select, refit, run, or delta (6.6.0). | none (with ML_LMLFF = .TRUE., VASP then trains) | train → refit → run; set it explicitly. | Without refit, the fast prediction mode is not available. |
ML_CTIFOR | Bayesian error threshold that decides when to compute a step from first principles. | 0.02 or 0.002, depending on ML_CALGO | Lower for stricter training. | |
ML_OUTBLOCK | How often a prediction run (ML_MODE = run) writes output. | 10 in most cases | 10–100 for long runs. | |
ML_WTSIF | Weight of the stress in the force-field fit. | 1.0 (5.0 with ML_IWEIGHT = 1) | A tiny value (1E-10) for surfaces and molecules, which have no meaningful stress. |
Common mistakes
- No POTIM: VASP stops at once. No coupling tag: a silent NVE run.
- MDALGO = 0, then a mean-squared displacement from wrapped coordinates.
- NpT with a thermostat other than Langevin.
- Too large a time step for hydrogen; or a heavier hydrogen mass (POMASS) when dynamics matter.
- Symmetry left on (ISYM).
- A CONTCAR from an NVT run reused for NpT without removing the predictor–corrector block.
- Reading XDATCAR with ASE without
index=":". - Spin-polarized r²SCAN MD or force-field training on VASP 6.6.0.
The physics behind this sheet
- Lecture 33: Ab initio molecular dynamics (in preparation)
- Lecture 34: Machine-learning interatomic potentials (in preparation)
Further reading
- VASP Wiki, “Molecular-dynamics calculations” (setup, ensembles, analysis). · www.vasp.at
- VASP Wiki, “MDALGO” (thermostats and ensembles). · www.vasp.at
- VASP Wiki, “Best practices for machine-learned force fields”. · www.vasp.at