Guide · VASP · 18 min read

How do I fix a VASP relaxation that won't converge?

Checked against the docs · VASP wiki and SLURM 26.05 · Last checked 12 November 2026 · Spot a mistake? Tell us

Short answer

First find out which loop failed. If the electronic steps inside an ionic step run all the way to NELM, fix the electronic loop first (ALGO, the mixing, the smearing, NBANDS); raising NELM rarely helps. If the electronic steps converge but the forces never fall below EDIFFG within NSW steps, copy CONTCAR to POSCAR and continue, tighten EDIFF toward 1E-6, and choose the IBRION that suits how far the structure is from its minimum.

What are the two loops in a relaxation?

A relaxation (also called a structure optimization) moves the atoms, and if you ask for it the cell, until the forces on them are small. VASP does this with two loops, one inside the other.

The ionic loop is the outer one. Each pass is an ionic step: VASP works out the forces on every atom (and the stress on the cell), then moves the atoms a little in the direction that lowers the energy. NSW is the most ionic steps VASP will take. IBRION chooses how it moves the atoms, and ISIF chooses what may move: the positions only, or the cell's shape and volume too. The loop stops when EDIFFG is met:

  • a negative EDIFFG is a force threshold in eV/Å: the relaxation stops when every atom's force is smaller than its absolute value. The wiki calls this "usually a more convenient setting".
  • a positive EDIFFG is an energy threshold in eV: the relaxation stops when the energy changes by less than that between two ionic steps. If you leave EDIFFG out, VASP uses this kind, at 10 × EDIFF.

The electronic loop is the inner one. Before VASP can compute forces for a given arrangement of atoms, it has to find that arrangement's electronic ground state, the lowest-energy state of the electrons. It does this iteratively: guess a charge density, solve for the electrons in it, build a new density, mix it with the old one, repeat. Each pass is an electronic step (or self-consistency step). The loop stops when both the total energy and the band-structure energy change by less than EDIFF between two steps, or after NELM steps, whichever comes first. NELM defaults to 60.

Every ionic step runs a full electronic loop. So a relaxation can fail in two different ways: the electrons never settle in one ionic step, or the electrons settle every time but the atoms never reach small enough forces before NSW runs out. They have different fixes.

How do I tell which loop failed?

Look at OSZICAR, the short log VASP writes beside OUTCAR (the same lines go to the job's standard output). Each electronic step is one line, starting with a label for the algorithm that made it (DAV: for the default blocked-Davidson algorithm, RMM: for RMM-DIIS, CGA: for the conjugate-gradient optimizer of ALGO = All). Each finished ionic step adds one line with F= (the free energy) and E0= (the energy extrapolated to zero smearing):

Example
DAV:  14    -0.985349953776E+01   -0.15177E-03   -0.57546E-06    64   0.125E-02    0.371E-03
DAV:  15    -0.985357023804E+01   -0.70700E-04   -0.22439E-06    64   0.741E-03
   1 F= -.98535702E+01 E0= -.98535702E+01  d E =-.985357E+01  mag=     2.0000

This is the first ionic step of the VASP wiki's O₂ dimer tutorial: 15 electronic steps, then the ionic step's energy. The columns are the step number, the energy, its change since the last step, the change in the band-structure energy, a count of how much work the step took, and two measures of how far the electrons are from settled (rms, and rms(c), the change in the charge density).

To list how many electronic steps each ionic step needed:

Terminal
awk '/^(DAV|RMM|CGA|SDA|DMP):/ {n=$2} / F= / {print "ionic step", $1 ":", n, "electronic steps"}' OSZICAR

The first pattern remembers the latest electronic step number; the second prints it each time an ionic step ends. Then read the result:

  • Any ionic step that reached NELM (60 unless you changed it) means the electronic loop stopped at its limit, not because it converged. The forces from that step come from a density that had not settled. Fix the electronic loop first; nothing in the ionic loop can make up for it. The wiki does not say plainly whether VASP goes on to the next ionic step after reaching NELM, or what it prints, so look for it in OSZICAR rather than waiting for a message.
  • Every ionic step converged well under NELM, but the number of ionic steps equals NSW means the ionic loop ran out of steps. Count them with grep -c " F= " OSZICAR.
  • The job stopped with an error message before either limit: read it first. ZBRENT, BRMIX and the other messages are explained in What do VASP's error messages mean?

A relaxation that did finish says so in the standard output (the job's output file on a cluster):

Example
 reached required accuracy - stopping structural energy minimisation
Terminal
grep "reached required accuracy" slurm-123456.out

(123456 stands for your job id; on SLURM the output goes to slurm-<jobid>.out unless your script names another file.) If the line is missing and the job ended on its own, the relaxation did not converge, whatever the energies look like.

When do relaxations struggle most?

When the starting structure is far from a minimum. The wiki's Structure optimization page is plain about it: VASP finds the closest local minimum to where you start, and the optimizers need the start to be close enough to work. A structure built by hand, with atoms much too close or far apart, makes both loops harder.

When there are many degrees of freedom. Every free coordinate of every atom, plus up to nine for the cell, is a direction the optimizer has to search. The wiki notes that the more degrees of freedom you relax, the harder the optimum is to find; relaxing the cell's shape and volume together with the positions (ISIF = 3) is harder than positions alone (ISIF = 2).

In metals, large cells, slabs and anything with vacuum. These are prone to charge sloshing: the electron density sloshes back and forth between regions from one electronic step to the next instead of settling. The wiki's Charge sloshing page explains that metals and small-gap systems are more prone to it than wide-gap insulators, and that the problem grows with the size of the cell.

In magnetic systems, with DFT+U, meta-GGA and hybrid functionals. For these the wiki recommends the direct optimizers (ALGO = All), which it calls more robust there. Magnetic systems have their own guide: How do I set up a magnetic calculation?

When the forces are noisy. The ionic optimizers decide where to move next from the forces. If the electronic loop stops too early (an EDIFF that is too loose), the forces carry errors, and an optimizer that relies on accurate forces (IBRION = 1) can wander instead of converging.

How do I fix the electronic loop?

The VASP wiki's Troubleshooting electronic convergence page gives the order to work in. Change one thing at a time, so you know which change helped.

  1. Simplify. Make a minimal INCAR with as few tags as possible. If it converges, add the tags back one by one until you find the one that breaks it. While testing, the wiki suggests making each run quicker: fewer k-points, a lower ENCUT, PREC = Normal.
  2. Check the smearing. If your material has partially filled states (a metal, or something that may be one), the wiki says to use ISMEAR = -1 or 1. See Which smearing should I use? The Setting up an electronic minimization page adds that a sparse k-point mesh may need a larger SIGMA to converge.
  3. Check there are enough bands. NBANDS sets how many electron states VASP computes. Look in OUTCAR that the highest bands are empty (zero occupation); if the last bands are partly filled, convergence is likely to fail. The wiki notes the default is often too few for systems with f electrons and for meta-GGA calculations.
  4. Switch ALGO. The default, ALGO = Normal (blocked Davidson), is the most robust. ALGO = Fast and VeryFast are quicker per step and less robust. ALGO = All (conjugate gradient on all bands at once) is the wiki's "appropriate choice for magnetic systems and systems where ALGO = Normal failed"; For metals and small-gap systems with hybrid or meta-GGA functionals, the wiki suggests trying ALGO = Damped if the others fail; it depends strongly on its TIME setting. For slabs, surfaces and cells with vacuum, the wiki prefers the mixing algorithms (Normal or Fast) and tuning the mixer.
  5. Tune the mixing. The ALGO page says charge sloshing can be reduced by fine-tuning the mixing tags (AMIX, BMIX and others). For a magnetic calculation that converges badly, the troubleshooting page's recipes include linear mixing (BMIX = 0.0001 and BMIX_MAG = 0.0001), mixing more slowly (a smaller AMIX and AMIX_MAG) and a smaller MAXMIX. VASP prints a guide to its own mixing in OUTCAR at every electronic step: search for eigenvalues of (default mixing * dielectric matrix). The AMIX and BMIX pages say the mixing is optimal when the mean of those eigenvalues is 1, and explain how to adjust toward it.

Raising NELM is rarely the fix. The NELM page says that if the loop does not converge within 40 steps it will probably not converge at all, and points you to ALGO and the mixing instead. The wiki does ask for a higher NELM where convergence is known to be slow but steady, such as MBJ meta-GGA calculations (the METAGGA page); a loop whose energy bounces instead of falling needs a different algorithm or mixing, not more steps.

Read the electronic steps, not only the last one. The ALGO page suggests plotting the energy minus its final value against the electronic step: the decay should be exponential. A noisy decay, or an rms(c) that stays large or jumps around, is charge sloshing.

How do I fix the ionic loop?

Continue from where it stopped. VASP writes the latest structure to CONTCAR after every ionic step. If the relaxation ran out of steps, copy CONTCAR to POSCAR and run again; the CONTCAR page says to do exactly this before continuing an unfinished relaxation:

Terminal
cp CONTCAR POSCAR

If the cell changed (ISIF = 3), relaxing again also rebuilds the basis set for the new cell, which reduces the Pulay stress (see What cutoff energy should I use?). If you also restart from the old wavefunctions, the wiki's Volume relaxation page says to use ISTART = 1, which keeps the cutoff and updates the basis; ISTART = 2 keeps the old basis and its Pulay stress. Restarting is covered fully in Should I start fresh or continue from a previous run?

Tighten EDIFF. The EDIFF page "strongly recommends" EDIFF = 1E-6 for well-converged calculations and calls it likely the best compromise; the default is 1E-4. The wiki's FAQ explains why the ionic loop cares: the optimizer builds up a picture of how the energy curves around the minimum, and if that curvature varies a lot between directions, the slowly varying directions can only be found from accurate forces. Its advice for a quasi-Newton relaxation that does not converge is to decrease EDIFF.

Choose an IBRION that suits your structure. The wiki's Structure optimization page compares the three relaxers:

IBRIONMethodUse it whenWatch for
2Conjugate gradientYou are not sure; the wiki's robust defaultMay need more steps than RMM-DIIS
1RMM-DIIS (a quasi-Newton method)The structure is reasonably close to its minimum, with more than about 20 degrees of freedomFails badly from a poor starting guess; needs accurate forces, so set NELMIN to 4 (simple bulk) to 8 (complex surfaces); sensitive to POTIM
3Damped molecular dynamicsA large system far from its minimum, to reach a better start for the other twoNeeds a sensible POTIM and SMASS; too large a POTIM diverges

Tune the step with POTIM. For relaxations, POTIM scales the step size (default 0.5, which the wiki says is near the optimum for many systems). With IBRION = 2, VASP prints a line like this after each corrector step:

Example
 trial: gam= 0.20820 g(F)= 0.494E+00 g(S)= 0.000E+00 ort = 0.728E-03 (trialstep = 0.881E+00)

Multiply your POTIM by trialstep to get the step size that would have been best; this is the wiki's way to find a good POTIM for IBRION = 1 or 3. g(F) and g(S) are the size of the remaining forces and stress, so you can watch them fall.

Relax fewer things at once. If positions, shape and volume together will not converge, relax them separately. The Volume relaxation page's careful procedure relaxes one degree of freedom at a time (for example ISIF = 7, the volume alone), copying CONTCAR to POSCAR between runs. Selective dynamics in POSCAR (a line Selective dynamics and a T or F flag per coordinate) fixes the atoms that should not move, such as the bottom layers of a slab.

If the relaxation keeps a symmetry it should break. With symmetry on (the default ISYM = 2), the relaxer cannot reach a structure of lower symmetry than the one you start from. The Structure optimization page says it is usually better to break the symmetry on purpose, by displacing atoms slightly in the starting structure, than to switch symmetry off with ISYM = 0.

If you see ZBRENT. ZBRENT lines in the output come from the line search of IBRION = 2, which uses a variant of Brent's algorithm. The Structure optimization page says occasional ZBRENT output means the corrector step's error was too large and the line search is being refined, which is not in itself a failure. When VASP stops with ZBRENT: fatal error, see What does the ZBRENT error mean?

What settings should I start a relaxation with?

Starting points from the VASP wiki's guidance, to adjust as the sections above describe. The wiki gives no number for two of them, the force threshold and the number of steps; those are yours to choose.

SettingStart withWhy
IBRION2The wiki's robust default; see the table above for 1 and 3.
EDIFF1E-6The wiki's recommended compromise; accurate forces help the ionic loop.
EDIFFGA negative value: a force threshold in eV/ÅThe wiki calls the force criterion "usually a more convenient setting" but gives no number; choose it for the accuracy your quantity needs, and check that tightening it does not change your result.
NSWEnough steps for your structureThe wiki gives no number; continue from CONTCAR if it runs out.
ISIF2 for positions only, 3 for positions, shape and volumeThe fewer degrees of freedom, the easier the optimum is to find.
NELMIN4 to 8 with IBRION = 1RMM-DIIS needs accurate forces; the default is 2.
ENCUT1.3 × the largest ENMAX when the volume changesKeeps the Pulay stress small; see What cutoff energy should I use?

Choose yours:

Your starting structureDegrees of freedomStart withWhy
Far from a minimum, or not sureAbout 20 or fewerIBRION = 2, EDIFF = 1E-6Conjugate gradient is the wiki's robust default when the structure may be far from its minimum. Set a negative EDIFFG for a force threshold; the wiki gives no number, so check that tightening it does not change your result.
Far from a minimum, or not sureMore than about 20IBRION = 2, or IBRION = 3 to get closer firstConjugate gradient is robust from a poor start. For a large system far from its minimum, the wiki suggests damped molecular dynamics (IBRION = 3) to reach a better starting point; it needs a POTIM you supply (the wiki: about twice the smallest step conjugate gradient takes) and SMASS, for which 0.4 is the wiki's usual first guess.
Close to a minimumAbout 20 or fewerIBRION = 2, EDIFF = 1E-6With few degrees of freedom conjugate gradient stays the safe choice; the wiki recommends RMM-DIIS for larger systems.
Close to a minimumMore than about 20IBRION = 1, NELMIN = 4 to 8RMM-DIIS is the wiki's method of choice for more than 20 degrees of freedom close to the minimum. It needs accurate forces: NELMIN = 4 for simple bulk, up to 8 for complex surfaces. Tune POTIM from the trialstep of a conjugate-gradient run.

What it depends on:

  • How far the structure is from its minimum. RMM-DIIS is fast close to it and fails badly far from it; conjugate gradient is slower and robust.
  • How many degrees of freedom move. Three per free atom, plus the cell's with ISIF 3 and above, fewer where symmetry and Selective dynamics constrain them.
  • The material. Metals, slabs and magnetic systems strain the electronic loop, so check it before blaming the ionic one.
  • What you will report. A lattice constant or stress needs the cell relaxation and the higher cutoff; a defect in a fixed cell may need neither.

How do I know the relaxation really converged?

Look for the line. reached required accuracy - stopping structural energy minimisation in the standard output means EDIFFG was met. Without it, the run stopped on NSW, the walltime or an error.

Check every ionic step's electronic loop. Run the awk line from above: no ionic step should have reached NELM. A relaxation that "converged" on forces from unconverged densities has not converged.

Check the forces yourself. OUTCAR lists the force on every atom at every ionic step. With a negative EDIFFG, every force in the last block should be below its absolute value. Each block starts with the heading POSITION TOTAL-FORCE (eV/Angst) and a line of dashes, then one line per atom: its position, then the three components of its force. For an eight-atom cell, grep -A 9 TOTAL-FORCE OUTCAR prints each heading, its dashes and the eight atom lines; use your number of atoms plus one. The block ends with a total drift line, which the wiki says should not exceed the size of the forces.

After a cell relaxation, relax once more. Copy CONTCAR to POSCAR and run again, with ISTART = 1 if you read the old wavefunctions, as the Volume relaxation page's procedure does, so the basis set matches the new cell. If the cell still moves noticeably on the second run, the first had not finished, or the cutoff is too low for the stress (see What cutoff energy should I use?).

What goes wrong with relaxations?

MistakeWhat you would seeWhat to do
Raising NELM when the electronic loop will not convergeThe same failure, more slowly; the energy bounces instead of fallingChange ALGO, the mixing or the smearing, in the wiki's order above.
NSW above 0 with IBRION = -1VASP computes the same structure NSW times; the IBRION page warns against exactly thisIBRION = 2 to relax, or NSW = 0 for a single point.
NSW above 0 and no IBRION at allVASP runs molecular dynamics, not a relaxation: the default is IBRION = 0 whenever NSW is above 0Set IBRION yourself.
EDIFF left at its default with IBRION = 1The relaxation wanders near the minimum and does not finishEDIFF = 1E-6, and NELMIN 4 to 8.
RMM-DIIS (IBRION = 1) from a rough structureThe energy rises or steps grow; the wiki says it "fails badly" from a bad guessIBRION = 2 until the structure is close, then 1 if you want the speed.
Starting over from POSCAR after the run ran out of stepsThe same steps repeated, the same time spentCopy CONTCAR to POSCAR and continue.
Relaxing positions, shape and volume at once when it will not convergeMany steps, the cell and positions trading offRelax one degree of freedom at a time, as the Volume relaxation page does.
Turning symmetry off to let the structure break symmetryA slower run that still sits near the symmetric structureDisplace atoms slightly in the starting structure instead, as the wiki recommends.

Try it

Try it: find the line that stops the relaxation

Each INCAR below relaxes the atoms of silicon and has one line the VASP wiki says works against that. Choose the line you think it is.

Script 1.

# relax the atoms of silicon
ISMEAR = 0
SIGMA  = 0.05
ISIF   = 2
IBRION = -1
NSW    = 20

The problem is line 5, IBRION = -1: IBRION = -1 means no update: the atoms never move. The wiki says to avoid it with NSW > 0, which only computes the same structure NSW times. IBRION = 2, conjugate gradient, which the wiki calls a robust default choice.

Script 2.

# relax until the forces are small
ISMEAR = 0
SIGMA  = 0.05
ISIF   = 2
IBRION = 2
NSW    = 20
EDIFFG = 0.02

The problem is line 7, EDIFFG = 0.02: A positive EDIFFG stops the relaxation when the total energy changes by less than EDIFFG between two ionic steps. To stop on the forces, EDIFFG must be negative: the relaxation then stops when the norms of all the forces are smaller than |EDIFFG|. EDIFFG = -0.02: the same number with a minus sign. How small it should be depends on your study.

Script 3.

# relax the atoms of silicon
ISMEAR = 0
SIGMA  = 0.05
ISIF   = 2
IBRION = 2
NSW    = 0

The problem is line 6, NSW = 0: For the relaxation algorithms, NSW is the maximum number of ionic steps, and its default is 0. With NSW = 0 the relaxation has no ionic steps to take, whatever IBRION says. A positive NSW, such as the 20 in the wiki's relaxation example on the Volume relaxation page.

Set up explains NSW, IBRION, EDIFF, EDIFFG, ISIF and POTIM beside their tags, and pre-flight checks your relaxation settings before you submit. Analyze charts the energy and the forces per ionic step, and names a recognized error from the output in plain words; Continue from here starts the next run from where this one ended.