The short version
- Relax with
IBRION = 2,ISIF = 3(bulk) orISIF = 2(slabs, defects), and a force criterion such asEDIFFG = -0.02. - When the cell changes, use ENCUT ≥ 1.3 × the largest ENMAX and relax again from CONTCAR until the volume stops changing (Pulay stress).
- Relax metals with
ISMEAR = 1 ; SIGMA = 0.2, insulators withISMEAR = 0 ; SIGMA = 0.05; keepISMEAR = -5for the final static run. - Take the energy you report from a static run at the relaxed geometry, not from the relaxation.
- A relaxation keeps the symmetry of its starting structure. To reach a lower-symmetry minimum, displace atoms in POSCAR.
The workflow, step by step
- Pre-relax (optional). A machine-learned potential (MACE, CHGNet, VASP's own MLFF) or a coarse VASP run (PREC = Normal, fewer k-points, EDIFFG = −0.1) gets the structure close cheaply.
- Relax atoms and cell with the INCAR below.
- Relax again from CONTCAR (
cp CONTCAR POSCAR), with a fresh basis set (a new run, or ISTART = 1), until the volume changes by less than about 1%. For magnets, seed MAGMOM with the final moments. - Static run at the final geometry: the energy you report, and CHGCAR for the next step.
- DOS and band structure from that CHGCAR (see the INCAR recipes and the KPOINTS sheet).
PREC = Accurate
ENCUT = 520 ! at least 1.3 x the largest ENMAX; keep it fixed for the whole project
EDIFF = 1E-6
IBRION = 2 ! conjugate gradient
ISIF = 3 ! atoms, cell shape and volume
NSW = 99
EDIFFG = -0.02 ! every force below 0.02 eV/A
NELMIN = 4
ISMEAR = 1 ; SIGMA = 0.2 ! metal; insulator: ISMEAR = 0 ; SIGMA = 0.05
ISPIN = 2 ; MAGMOM = 2*4.0 ; LORBIT = 11 ! magnets: high-spin start, one value per atom
LASPH = .TRUE. ; LMAXMIX = 4
LWAVE = .FALSE. ; LCHARG = .FALSE.PREC = Accurate
ENCUT = 520 ! the same as the relaxation
EDIFF = 1E-6
NSW = 0 ; IBRION = -1
ISMEAR = -5 ! tetrahedron: Gamma-centred mesh, at least 4 k-points
ISPIN = 2 ; MAGMOM = 2*2.2 ; LORBIT = 11 ! relaxed moments; keep MAGMOM in every later run
LASPH = .TRUE. ; LMAXMIX = 4
LCHARG = .TRUE. ! CHGCAR for the DOS and band runs
LWAVE = .FALSE.What moves: ISIF
| ISIF | Atoms | Cell shape | Volume | Use for |
|---|---|---|---|---|
| 0 | yes | no | no | No stress computed (the default for MD and hybrids). |
| 1 | yes | no | no | Only the pressure (trace of the stress) is valid. |
| 2 | yes | no | no | Slabs, defects, molecules: the default otherwise. |
| 3 | yes | yes | yes | Full relaxation of bulk crystals. |
| 4 | yes | yes | no | Fixed-volume points of an energy–volume curve. |
| 5 | no | yes | no | Cell shape only. |
| 6 | no | yes | yes | Cell only, atoms fixed in fractional coordinates. |
| 7 | no | no | yes | Volume only. |
| 8 | yes | no | yes | Atoms and volume, shape fixed (VASP 6.4.1 and later). |
The stress tensor is computed for ISIF 2 to 8. In OUTCAR a positive diagonal stress means the cell is compressed and wants to expand. VASP's own volume-relaxation guide recommends relaxing one degree of freedom at a time (its example uses ISIF = 7); ISIF = 3 in one go is the common practice.
Which optimizer
| IBRION | Method | When |
|---|---|---|
| 2 | Conjugate gradient | The robust default, also far from the minimum. Fine-tune the step: optimal POTIM ≈ POTIM × the trialstep printed in the output. VASP advice |
| 1 | RMM-DIIS (quasi-Newton) | Close to the minimum and with more than about 20 degrees of freedom; needs accurate forces (NELMIN 4 for bulk, 8 for surfaces) and is sensitive to POTIM. NFREE 10–20 for complex cases. VASP advice |
| 3 | Damped molecular dynamics | Far from the minimum or for soft systems; start with SMASS ≈ 0.4 and a POTIM about twice the smallest conjugate-gradient step. VASP advice |
Without IBRION, NSW > 0 runs molecular dynamics and stops at once (no default time step). With IBRION = −1 and NSW > 0 the same structure is computed NSW times.
When it stops: EDIFFG
- A negative EDIFFG stops when every force is below |EDIFFG| (eV/Å):
-0.02for most work,-0.01or tighter before phonons. - A positive value (and the default, 10 × EDIFF) stops on the energy change between ionic steps, which can leave large forces.
- For ISIF = 3, VASP's developers state that the test also includes the stress; the documentation does not spell this out.
- EDIFF must be much tighter than the forces you ask for: 1E-6 or smaller, otherwise the forces are noise.
- Hitting NSW is not convergence: OUTCAR must say
reached required accuracy.
Pulay stress and the cutoff
VASP keeps the number of plane waves fixed while the cell changes, so the effective cutoff drifts with the volume and the stress comes out too negative; volumes then end up too small. Two remedies:
- Use ENCUT ≥ 1.3 × the largest ENMAX for any relaxation that changes the cell; VASP calls this the lower recommended limit. VASP advice
- Restart from CONTCAR with a fresh basis set (a new run, or
ISTART = 1) until the cell stops changing.ISTART = 2keeps the old basis and therefore the error. VASP advice
An energy–volume curve at fixed volumes avoids the problem and works with the default cutoff. PSTRESS can absorb a measured Pulay stress, but VASP's PSTRESS and Volume-relaxation pages give opposite signs for that correction; a higher cutoff is the safer route.
Slabs, 2D sheets, E–V curves and magnets
| Case | How |
|---|---|
| Slab with vacuum | ISIF = 2 with the bottom layers fixed by selective dynamics (F F F). Never ISIF = 3: the vacuum collapses. |
| 2D sheet | ISIF = 3 with LATTICE_CONSTRAINTS = .TRUE. .TRUE. .FALSE., the vacuum along a3 parallel to z (VASP 6.5.0 or later in practice). |
| Energy–volume curve | 5–10 volumes spanning about ±5–10% in volume, each with ISIF = 4 (atoms and shape relax at fixed volume; a negative POSCAR scale sets the volume), then fit an equation of state. |
| Magnet | Start high-spin; reseed MAGMOM from the final moments for the next run, and keep MAGMOM in every restart so the magnetic symmetry is not lost. |
| r²SCAN | Pre-relax with PBE or PBEsol and start from its WAVECAR. Use VASP 6.6.1, not 6.6.0, for spin-polarized r²SCAN. |
Check it worked
grep -c "reached required accuracy" OUTCAR # 1 = EDIFFG met
grep -c " F= " OSZICAR # ionic steps used: must be below NSW
grep "volume of cell" OUTCAR | awk 'NR==1{v0=$5} END{printf "start %s end %s change %.2f %%\n", v0, $5, 100*($5-v0)/v0}'
grep "external pressure" OUTCAR | tail -1 # near 0 kB after a converged ISIF = 3 runAlso check that the last SCF converged, that the largest force is below |EDIFFG| (command), that the moments did not collapse, and that CONTCAR has the space group you expect (spglib or pymatgen).
How Materials Project does it
Materials Project relaxes every structure twice in a row (cell and atoms, starting high-spin ferromagnetic), then runs a static calculation on a finer mesh. Its newest r²SCAN workflow first relaxes with PBEsol, which gives a cheap starting structure and density, then relaxes with r²SCAN. Workflow packages such as atomate2 also offer a machine-learned pre-relaxation before the VASP relaxation.
The relaxation tags
| Tag | What it does | Default | What to use | Watch out |
|---|---|---|---|---|
IBRION | How the atoms move. | −1 if NSW = −1 or 0, otherwise 0 (molecular dynamics) | 2 (conjugate gradient) far from the minimum; 1 (RMM-DIIS) close to it; 0 for MD; 6 or 8 for phonons. | NSW > 0 without IBRION gives IBRION = 0, molecular dynamics with no time step, and VASP stops at once. |
ISIF | Which of atoms, cell shape and volume relax, and whether the stress is computed. | 0 for molecular dynamics (IBRION = 0) or hybrid functionals (LHFCALC = .TRUE.), otherwise 2 | 2: atoms only. 3: atoms, shape and volume. 4: atoms and shape at fixed volume. 7: volume only. 8: atoms and volume (VASP 6.4.1 and later). | Changing the cell gives Pulay stress: use ENCUT ≥ 1.3 × ENMAX and re-run from CONTCAR. Hybrids default to ISIF = 0, so no stress unless you set it. |
NSW | Maximum number of ionic steps. | 0 | 0 for static runs; about 100 for relaxations. | With NSW > 0, always set IBRION too. |
EDIFFG | When a relaxation stops. | EDIFF × 10 | Negative = force criterion in eV/Å: −0.02 is a common choice; tighten it before phonon calculations. | Positive values (including the default) stop on an energy change, not on the forces. |
POTIM | Step size: the time step in fs for MD, a step scaling for relaxations, the displacement in Å for finite differences. | 0.5 for IBRION = 1, 2 and 3; 0.015 Å for IBRION = 5 and 6; none for molecular dynamics (must be set) | Keep 0.5 for relaxations. MD: it must be set, and light atoms such as H need a smaller step. | IBRION = 1 is especially sensitive to POTIM. |
NFREE | IBRION = 1: how many previous steps the quasi-Newton optimizer remembers; IBRION = 5, 6: displacements per direction. | 2 for IBRION = 5 and 6, otherwise 0 | 10 to 20 for complex relaxations with IBRION = 1. | Very large values rarely help. |
PSTRESS | An external pressure in kB (1 kB = 0.1 GPa) that relaxations and NpT runs target. | 0 | Relax under pressure. It can also absorb the Pulay stress, but a higher ENCUT is the cleaner fix. | The VASP Wiki's PSTRESS and Volume relaxation pages give opposite signs for the Pulay correction: test it on your system. |
Common mistakes
- NSW set and IBRION forgotten: molecular dynamics, stopping at once.
- One ISIF = 3 run at the default ENCUT, and its energy reported.
- Restarting a cell relaxation with ISTART = 2.
- ISIF = 3 on a slab; ISMEAR = −5 in a metal relaxation; ISMEAR > 0 for an insulator.
- EDIFF too loose for the EDIFFG asked for.
- Expecting a symmetry-lowering distortion without breaking the symmetry in POSCAR.
- Dropping MAGMOM, or changing ENCUT, between the relaxation, static and DOS runs.
The physics behind this sheet
- Lecture 21: Forces, stress and structural relaxation (in preparation)
- Lecture 22: Equations of state and elastic constants (in preparation)
Further reading
- VASP Wiki, “Structure optimization” (choosing IBRION, POTIM and NELMIN, and the symmetry caveat). · vasp.at/wiki
- VASP Wiki, “ISIF” (which degrees of freedom relax, and the stress). · www.vasp.at
- VASP Wiki, “Volume relaxation” (Pulay stress, the 1.3 × cutoff rule and the restart protocol). · vasp.at/wiki
- VASP Wiki, “Pulay stress”. · www.vasp.at