>[!Note] Preliminaries >* All references to VASP source code in this document are based on version 6.4.2. >* All references to QE source code are based on version 7.2. >* Credit goes to Bernard Field (LBL) for alerting me that `EDIFFG` also controls the stress convergence threshold in VASP, even though it's undocumented. I chased it down in the code and there's an explanation of how it works [[#Stress/pressure convergence (`press_conv_thr`/`EDIFFG<0`)|below]]. > This note discusses the various iterative convergence criteria (thresholds) that DFT calculations must satisfy for their electronic and ionic loops to break. It does not deal with converging other input parameters such as k-points, energy/charge density cutoffs, etc. The recommendations in these notes are based on my experience, but ultimately, how tightly you need to converge a calculation depends entirely on what quantity you care about. I hope these recommendations are generally reasonable for accurate calculations, even if they're slightly conservative. Fiddle with these input variables and ensure you understand them well. Quantum ESPRESSO is a suite of codes, this note is specifically concerned with the standard plane-wave DFT module, PWscf (`pw.x`). # Electronic Convergence The electronic convergence criteria apply to self-consistent field (SCF) calculations and any other calculations that perform multiple SCF electronic loops (relaxation, DFPT, etc.). The eigenvalue convergence criterion is also used in non-self-consistent field (NSCF) calculations. ## SCF convergence (`conv_thr`/`EDIFF`) | | QE | VASP | | ------------- | ------------------------------------------------------------------- | ------------------------------------------------ | | Tag | `conv_thr` | `EDIFF` | | Default | `1e-6` | `1e-4` | | | | Unit | Ry | eV | | Documentation | [Docs](https://www.quantum-espresso.org/Doc/INPUT_PW.html#conv_thr) | [Wiki](https://www.vasp.at/wiki/index.php/EDIFF) | | Conversion | Ry $\times$ 13.6057 $\rightarrow$ eV | eV $\times$ 0.07350 $\rightarrow$ Ry | Technically, `EDIFF` in VASP and `conv_thr` in QE don't do precisely the same thing, but they're similar. In the simplest sense, this SCF convergence criterion is met when the energy difference between the two steps is below the criterion. I believe this is how VASP uses `EDIFF`, but I haven't dug into it as much as QE. QE does this slightly differently. It estimates a variational upper bound on the accuracy of the SCF loop, given by Eq. (A7) in the [QE implementation paper](https://iopscience.iop.org/article/10.1088/0953-8984/21/39/395502), which is equivalent to the easier-to-understand Eq. (A6). Note that Eq. (A7) in the paper is incorrect; it needs to be multiplied by $\Omega^2/2$ where $\Omega$ is the volume of the cell. The implementation in the code is (of course) correct (`PW/src/scf_mod.f90`, function `rho_ddot`, line 651). See the discussion [here](https://www.mail-archive.com/[email protected]/msg36646.html) for more details. Within each electronic loop, QE will print the current upper bound. ``` estimated scf accuracy < 0.00049366 Ry ``` Different implementations aside, the ideas are similar. It is essential to understand that the SCF energy convergence criteria, like the total energy itself, is an extensive quantity (with respect to the number of electrons). For example, converging a given unit cell to within $1 \times 10^{-7} \, \text{Ry}$ is equivalent to converging an otherwise identical $2\times2\times2$ supercell (8 times as many electrons) to within $8 \times 10^{-7} \, \text{Ry}$. As a result, it is reasonable to use looser convergence thresholds in supercell or slab calculations. >[!Hint] Recommended Values >SCF convergence is often exponential, so reducing the convergence threshold should be relatively inexpensive if things are going well and your system is not too large. QE's default for `conv_thr` is $10^{-6}\,\text{Ry} \approx 1.36 \times 10^{-5} \text{eV}$ by default, while VASP's default for `EDIFF` is $10^{-4} \,\text{eV} \approx 7.35 \times 10^{-6} \,\text{Ry}$, a little larger. > >I usually use $10^{-7} \, \text{Ry} \approx 1.36 \times 10^{-6} \text{eV}$ or $10^{-8} \, \text{Ry} \approx 1.36 \times 10^{-7} \, \text{eV}$ for very accurate calculations, but see the notes above about the extensiveness of this quantity. > >Note that this convergence criterion affects the noise in your forces, so you might have to reduce it if you need accurate forces (e.g., for phonons). Quantum ESPRESSO warns about this explicitly, and the BFGS algorithm will sometimes fail (see [[DFT Error Compendium#bfgs curvature|here]]). I don't know what VASP does in such situations. For a few systems, especially those involving vacuum, inhomogeneities, or other weirdness, I've used absurd criteria as low as $10^{-11} \, \text{Ry} \approx 1.36 \times 10^{-10} \, \text{eV}$. > > Note that QE decreases `conv_thr` between ionic steps when doing fixed or variable cell relaxations, but it never drops to values below `conv_thr/upsacle` (where `upscale = 100` by default). This is extremely handy since you need higher electronic convergence thresholds to minimize the noise as the forces get smaller. > > The VASP wiki recommends $10^{-6} \, \text{eV} \approx 7.35 10^{-8} \, \text{Ry}$ for really accurate calculations and $10^{-7} \, \text{eV} \approx 7.35 10^{-9} \, \text{Ry}$ for very accurate results for, e.g., phonons. My recommendations are slightly more conservative, and I've had to use `EDIFF = 1e-8` for phonons in VASP before. ## Iterative Diagonalization Convergence (`diago_thr_init`/`EBREAK`) | | QE | VASP | | ------------- | ------------------------------------------------------------------- | ------------------------------------------------ | | Tag | `diago_thr_init` | `EBREAK` | | Default | Depends, see below | `EDIFF/NBANDS/4` | | Unit | Ry | eV | | Documentation | [Docs](https://www.quantum-espresso.org/Doc/INPUT_PW.html#diago_thr_init) | [Wiki](https://www.vasp.at/wiki/index.php/EBREAK) | | Conversion | Ry $\times$ 13.6057 $\rightarrow$ eV | eV $\times$ 0.07350 $\rightarrow$ Ry | In QE, the eigenvalues ("band energies") computed via iterative diagonalization are converged to within `diago_thr_init` within a given electronic step. By default, for SCF calculations, this value is $10^{-2} \, \text{Ry}$ if starting from atomic orbitals and $10^{-5} \, \text{Ry}$ if starting from a charge density. It decreases as the SCF cycle progresses but never drops below $10^{-13} \, \text{Ry}$. For NSCF calculations, it's set to `conv_thr/nelec/10`. By default, QE uses a lower accuracy (I'm not sure how much lower) for empty states to save computer time. This is controlled via the `diago_full_acc` tag. For VASP, `EBREAK`, together with `DEPER` and `WEIMIN`, allows you to fine-tune the iterative diagonalization, and `EBREAK` is set to `ABS(EDIFFG)/NBANDS/4` or `EDIFF/NBANDS/4` by default, whichever is smaller. (Note: the setting based on `EDIFFG` is undocumented; it can be found on line 1352 of `main.F`. ) >[!Hint] Recommended Values >There is generally no need to change this, except maybe for NSCF calculations of very large systems where it might become tiny due to the factor `nelec`/`NBANDS` in the denominator. However, it's just easier to change `EDIFF` or `conv_thr` in those cases, since there are no SCF loops anyway. # Ionic Convergence In fixed-cell (`ISIF=0-2` or `calculation='relax'`) and variable-cell (`ISIF=3-8` or `calculation='vc-relax'`) relaxation calculations, one can apply convergence criteria to the total energy difference between ionic steps, the forces on the atoms, and even the pressure on the cell. VASP can only do stress+force or energy convergence, not both. In the first case, both criteria (based on `EDIFFG`) must be satisfied simultaneously, but there's no limitation on energy convergence, and vice versa. Quantum ESPRESSO only reaches ionic convergence when all three criteria are simultaneously satisfied (total energy convergence, force convergence, pressure convergence). Generally, many systems will converge their total energies before forces and stress/pressure come last. However, forces will usually converge before stress if your system is highly symmetric, with many or all atoms pinned to symmetric positions by the space group. (Think of a cubic perovskite; for example, the forces are all 0 by symmetry and perfectly converged from step one, and you only need to converge the stress.) ## Total Energy Convergence (`etot_conv_thr`/`EDIFFG`>0) | | QE | VASP | | ------------- | ------------------------------------------------------------------- | ------------------------------------------------ | | Tag | `etot_conv_thr` | `EDIFFG` > 0 | | Unit | Ry | eV | | Documentation | [Docs](https://www.quantum-espresso.org/Doc/INPUT_PW.html#etot_conv_thr) | [Wiki](https://www.vasp.at/wiki/index.php/EDIFFG) | | Conversion | Ry $\times$ 13.6057 $\rightarrow$ eV | eV $\times$ 0.07350 $\rightarrow$ Ry | This criterion is met when the total energy difference between ionic iterations is less than `EDIFFG` or `etot_conv_thr`. You can only use VASP in this mode if you set `EDIFFG` > 0 For reasons unknown to me (probably an old design decision that has to be maintained for backward compatibility), this tag lives in the `&CONTROL` name list, not `&IONS`. >[!Hint] Recommended Values >The default in QE is $10^{-4} \, \text{Ry} \approx 1.36 \times 10^{-3} \, \text{eV}$. I often reduce this a bit to $10^{-5} \, \text{Ry} \approx 1.36 \times 10^{-4} \, \text{eV}$ or $10^{-6} \, \text{Ry} \approx 1.36 \times 10^{-5} \, \text{eV}$, depending on what I'm doing. In most cases, however, you will hit energy convergence before your forces converge, so you'll be converged below it anyway. I often don't spend too much time worrying about this flag. Still, I carefully monitor the energy convergence between ionic steps in case something weird happens. > >There isn't much to say here in comparison to VASP since you can't have both a total energy (`EDIFFG > 0`) and force criterion (`EDIFFG < 0`) in VASP. The default value is `EDIFF * 10`, so $10^{-3} \, \text{eV}$ if `EDIFF` is unchanged. People generally seem to use the force convergence criterion instead. I have yet to test this, but my intuition tells me that relaxing purely based on energy convergence is ill-advised. The total energy difference between ionic steps can depend on the algorithm used, and if the algorithm takes small steps, then the energy difference could be quite small. This would not be a problem if we also had a force convergence threshold, as in QE, but VASP doesn't allow that. This may lead to incorrect, irreproducible results. In fact, my intuition seems to be correct. VASP has a second (undocumented) convergence criterion when `EDIFFG` > 0 to address this issue (lines 4178-4186) by performing a small step and an extra check. I need to dig more into how good that implementation is. > ## Force Convergence (`forc_conv_thr`/`EDIFFG`<0) | | QE | VASP | | | ------------- | ------------------------------------------------------------------------ | ------------------------------------------------- | --- | | Tag | `forc_conv_thr` | `EDIFFG` < 0 | | | Default | `1e-3` | - (see below) | | | Unit | Ry/$a_0$ | eV/$\mathring{A}$ | | | Documentation | [Docs](https://www.quantum-espresso.org/Doc/INPUT_PW.html#forc_conv_thr) | [Wiki](https://www.vasp.at/wiki/index.php/EDIFFG) | | | Conversion | Ry/$a_0$ $\times$ 25.7110 $\rightarrow$ eV/$\mathring{A}$ | eV/$\mathring{A}$ $\times$ 0.03889 $\rightarrow$ Ry/$a_0$ | | QE checks this criterion against each *component* (not the magnitude) of the force on each atom, while VASP checks against the magnitude of the forces. Thus, if your atoms can move in more than one direction, VASP is technically stricter than QE. In QE, like `etot_conv_thr`, `forc_conv_thr` also lives in `&CONTROL` instead of `&IONS`. >[!Hint] Recommended Values >The default in QE of $10^{-3} \, \text{Ry}/a_0 \approx 0.0257 \, \text{eV}/\mathring{A}$ is fine in many cases. VASP uses an energy criterion by default; see above. > >The general rule of thumb you'll often hear is to never go below $0.05\, \text{eV}/\mathring{A} \approx 2 \times 10^{-3}\, \text{Ry}/a_0$, but I find that a bit too large in most cases, and I usually use $0.025 \, \text{eV}/\mathring{A} \approx 10^{-3} \,\text{Ry}/a_0$ or lower. $0.01 \, \text{eV}/\mathring{A} \approx 3.9 \times 10^{-4} \,\text{Ry}/a_0$ is a commonly used value in the literature. > >There have been situations where I had to go even lower to $2.5 \times 10^{-3} \, \text{eV}/\mathring{A} \approx 10^{-4} \,\text{Ry}/a_0$, and for super accurate forces in problematic structures (e.g., slabs), I once had to use $2.5\times 10^{-4} \, \text{eV}/\mathring{A} \approx 10^{-5} \,\text{Ry}/a_0$, but it's usually extremely tricky to relax anything beyond the most straightforward structures to such small forces. > >There are special applications (e.g., phonons in ferroelectric slabs) that require convergence criteria as low as $10^{-5} \,\text{eV}/\mathring{A}$, which is rarely attainable with the usual BFGS algorithm. [Special algorithms](https://iopscience.iop.org/article/10.1088/1361-648X/aacd79) have been developed for such situations. ## Stress/pressure convergence (`press_conv_thr`/`EDIFFG<0`) | | QE | VASP | | | ------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | --- | | Tag | `press_conv_thr` | `EDIFFG` < 0 | | | Default | 0.5 | - (see below) | | | Unit | kBar | eV/($\Omega$/$N_{\text{atoms}}$), $\Omega$ is the cell volume in $\mathring{A}^3$ | | | Documentation | [Docs](https://www.quantum-espresso.org/Doc/INPUT_PW.html#press_conv_thr) | Undocumented | | | Conversion | kBar $\times$ $6.241\times 10^{-4}\times\Omega$/$N_{\text{atoms}}$ $\rightarrow$ eV/($\Omega$/$N_{\text{atoms}}$) | eV/($\Omega$/$N_{\text{atoms}}$) $\times$ $1602.17 \times (N_{\text{atoms}}/\Omega)$ $\rightarrow$ kBar | | | | Ry/$(a_0)^3$ $\times$ 91.815 $\rightarrow$ eV/$\mathring{A}^3$ | eV/$\mathring{A}^3$ $\times$ 0.0109 $\rightarrow$ Ry/$(a_0)^3$ | | The calculation stops when the absolute value of every stress tensor component is smaller than this threshold. In the case of QE, the diagonal components are compared to the external hydrostatic pressure (input variable `press`, default 0), and the off-diagonal components are compared to 0 (lines 200-209 in `PW/src/vcsmd.f90`). If you do constrained relaxation (`cell_dofree`), only the stress tensor components corresponding to the unfixed lattice constants are converged. In VASP, the threshold is given by `|EDIFFG| * NIONS/VOL` eV/$\mathring{A}^3$, and is only used when `EDIFFG < 0`. The stress tensor is converged to within `|EDIFFG|` eV per "volume per atom." The stress tensor values in the `OUTCAR` are in units of eV per unit cell volume (values in kBar are also shown ), so they must be divided by the number of atoms and compared to `|EDIFFG|` to check convergence. `PSTRESS` seems to be dealt with differently compared to QE, and it depends on the value of `IBRION`, but it's likely a similar situation to QE (see lines 4126-4150 of `main.F) Stress convergence in VASP is an undocumented feature, you can find it in the source code at line 4132 of `main.F`. (`FACTSI = 0.19297062E-01 * POTIM` is the conversion factor from Ry/$a_0^3$ to eV/$\mathring{A}^3$ when `POTIM = 1`. It's defined in an extremely convoluted way, and I don't know why `POTIM` comes into it when it isn't used for the MD time step, i.e., `IBRION` > 0. The unit conversion is "brain-damaging", according to the VASP developers, line 3749.) %%See this https://www.vasp.at/forum/viewtopic.php?t=16781%% >[!Hint] Recommended Values > The QE default (0.5 kBar) is usually fine. I'll sometimes reduce it to lower values depending on what I'm doing (phonons, studying systems under hydrostatic pressure, etc.) > > There isn't a good way to use `EDIFFG` as an actual stress convergence criterion since it's tied to the number of atoms and cell volume. Unless your cell is relatively small/cheap, it's likely too expensive to set `EDIFFG` small enough to target specific pressures. Using the same variable to converge two physical quantities is somewhat arbitrary. However, it should be trivial to add a new INCAR tag to control pressure convergence (2-3 lines of code). Ultimately, the default is reasonable enough for many systems. For example, for the average cubic perovskite and `EDIFGG = -0.01`, you converge the stress to within 0.4-0.6 kBar. # Others There's a convergence threshold for vdW forces and energies, `ts_vdw_econv_thr`, but according to the [documentation](https://www.quantum-espresso.org/Doc/INPUT_PW.html#ts_vdw_econv_thr), the default value is safe (too safe) and typically doesn't need to be changed. I don't quite understand how one variable can control both forces and energies; I guess energies are converged to within `ts_vdw_econv_thr` Ry and forces to within `ts_vdw_econv_thr` Ry/$a_0$. There are also convergence criteria for RISM, FCP, and GC calculations, but I haven't done these calculations before. VASP's "mega executable" can do many different calculations (NEB, DFPT, GW, etc.), so there are probably a few relevant tags that I don't know.