Pulay stress

From VASP Wiki
Revision as of 13:56, 9 July 2024 by Csheldon (talk | contribs)

Pulay stress is unphysical stress coming from unconverged calculations with respect to basis set. It distorts the cell structure, decreasing it from the equilibrium volume and resulting in jagged energy vs. volume curves, cf. Figures 1 and 2. In this article, the computational origin of this is briefly discussed, and then solutions for correcting the Pulay stress. It is important to note that problems due to the Pulay stress can often be neglected if only volume-conserving relaxations are performed. This is because the Pulay stress is, usually, nearly uniform and only changes the diagonal elements of the stress tensor by a constant amount.

Fig 1. Total energy vs. lattice parameter for converged and unconverged plane wave energy cutoffs. Diamond in a primitive cell - 2x2x2 k-point mesh.
Fig 2. Total energy vs. lattice parameter for converged and unconverged k-point meshes. Diamond in a primitive cell - 180 eV energy cutoff.

Introduction

The energy for a periodic system, e.g. band structures, is calculated using a finite number of plane waves and a finite number of k-points. A fixed number of plane waves or plane wave energy cutoff may be used to set a constant basis.[1] In VASP, a constant energy cutoff is used. All the initial G-vectors within a sphere are included in the basis. However, when comparing cells of different sizes, i.e. during a relaxation, the cell shape is relaxed, so the direct and reciprocal lattice vectors change. The number of reciprocal G-vectors in the basis is kept fixed but the length of the G-vectors changes, indirectly changing the energy cutoff. In other words, the shape of the cutoff region changes from a sphere to an ellipsoid. This can be solved by using an infinite number of k-points and plane waves. In practice, a large enough plane wave energy cutoff and number of k-points leads to converged energies.[2] All energy changes are strictly consistent with the stress tensor; however, when the basis set is too small, i.e. prematurely truncated, this results in discontinuities in the total energy between cells of varying volumes. These discontinuities between energy and volume create stress that decreases the equilibrium volume, due to the diagonal components of the stress tensor being incorrect. This is called the Pulay stress. Figures 1 and 2 show these discontinuities for diamond for prematurely truncated energy cutoffs and k-point meshes, respectively, in comparison to converged curves.

How to correct

The Pulay stress may be corrected in multiple ways. Generally, by calculating the relaxed structure with a larger basis set by increasing the ENCUT until convergence is reached:

  1. Set ENCUT to the default cutoff, or PREC=High in VASP.4.4. N.B. this is the lower recommended limit.
  2. Re-run VASP with the default cutoff to obtain the final relaxed positions and cell parameters.
  3. Further increase the ENCUT and repeat Steps 1 and 2, until the structure no longer changes, i.e. is converged.

If volume relaxations are necessary, the following two procedures may be followed:

1. Volume relaxation

One way is to very accurately relax the structure in a series of calculations on one structure:

Step 1.

Relax from the starting structure with Gaussian or Methfessel-Paxton smearing (ISMEAR = 0 or 1).

Step 2.

Copy the CONTCAR to POSCAR and relax the structure again.

Step 3.

Change the smearing method to the tetrahedron method (i.e. ISMEAR=-5) and perform a single point calculation, i.e. no relaxation of structure. These are will give highly accurate energies.

(Optional)

The previous steps should yield good energies. If there are still problems, such as the energy vs. volume curve remaining jagged, a few more additional steps may be tried:

Step 4a.

Try further increasing the ENCUT. Alternatively, improve the FFT grid by setting PREC=Accurate.

Step 4b.

To avoid additional computational cost due to increased cutoff energy, the STRESS output in VASP may be corrected using PSTRESS. The Pulay stress is only weakly dependent on volume and ionic configuration; it is mainly determined by the composition and basis set. A good estimation for it is given in the output, e.g.:

  external pressure =    -100.29567 kB

The difference in this pressure (between the desired and a very large ENCUT) may then be used to correct for the Pulay stress. PSTRESS is set to this difference, then all volume relaxations will take PSTRESS into account. It is important keep in mind that PSTRESS should only be used if increasing the cutoff is not a viable option.

  1. Perform two single point calculations, one for the default and one for the higher ENCUT.
  2. Find the external pressure in the OUTCAR file, e.g.:
  external pressure =    -1311.32 kB
  
  external pressure =    -95.66 kB
  1. Find the difference between these external pressures. This is a good approximation of the Pulay stress. E.g.
  difference in pressure = -1215.66 kB
  1. Set PSTRESS equal to this difference in the OUTCAR file, i.e.:
  PSTRESS = -1215.66

This results in structures similar to the higher cutoff at the cost of the default cutoff. We reiterate that PSTRESS should only be used if the higher cutoff is not a viable option, as this only improves the structure and not the energy.

2. Equation of state fitting

An alternative way to avoid relaxing the volume is to relax the ionic positions and cell shape for a fixed set of volumes, i.e. multiple POSCAR files. These are then fitted to an equation of state, e.g. Murnaghan.[3] As the Pulay stress is almost isotropic, only a constant value is added to the diagonal elements of the stress tensor. Therefore, the relaxation for a fixed volume will yield highly accurate structures. This approach has the advantage of also providing the bulk modulus, and we have found it may be used safely with the default energy cutoff.

The procedure is similar to the previous section. In this case, one has to do the calculations for a set of fixed volumes. The following steps have to be done in these calculations:

Step 1.

Select one cell and relax it from the starting structure, keeping the volume fixed while the ionic positions and the cell shape are free to change (ISIF=4; ISMEAR=0 or 1).

Step 2.

Copy the CONTCAR to POSCAR and relax the structure again (if the initial cell shape was reasonable this step can be skipped if the cell shape is kept fixed, you never have run VASP twice).

Step 3.

Change the smearing method to the tetrahedron method (i.e. ISMEAR=-5) and perform a single point calculation, i.e. no relaxation of structure. These will give highly accurate energies.

Step 4.

Repeat Steps 1-3 for as many different volumes as desired and then fit the energy vs. volume curve to your chosen equation of state.

Possible issues and advice on how to address them

When producing energy vs. volume plots, improper settings may result in jagged curves, cf. Fig. 1 and 2. This is commonly due to two reasons:

  1. Basis set incompleteness

    The basis set is discrete and incomplete, so when the volume changes, additional plane waves are added. That causes small discontinuous changes in the energy.

    1. Use a larger plane wave cutoff, cf. Fig. 1. This is usually the preferred and simplest solution.
    2. Use more k-points, cf. Fig. 2.[4]
  2. Discontinuity of FFT grids

    Different precisions of the FFT grid defined by PREC may be used, e.g. Normal or Accurate.[5] This introduces small errors when the volume changes, as the FFT grids change discontinuously. In other words, at each volume a different FFT grid is used, causing the energy to jump discontinuously between different volumes. For more details on FFT grids, see [6].

    1. Use PREC=Accurate
    2. Increase the plane wave cutoff.
    3. Set your FFT grids manually, and choose the one that is used per default for the largest volume.

References

  1. P. Gomes Dacosta, O. Nielsen, and K. Kunc, Stress theorem in the determination of static equilibrium by the density functional method, J. Phys. C: Solid State Phys. 19, 3163 (1986).
  2. G. P. Francis and M. C. Payne, Finite basis set corrections to total energy pseudopotential calculations, J. Condens. Matter Phys. 2, 4395 (1990).
  3. Murnaghan Equation of State, www.wikipedia.org (2024)
  4. This solves the problem because the criterion for including a plane wave in the basis set is . This means at each k-point a different basis set is used, and additional plane waves are added at each k-point at different volumes. In turn, the energy vs. volume curve becomes smoother.
  5. For PREC=Accurate, the FFT grids are chosen such that is exactly evaluated. Whereas, for PREC=Normal the FFT grids are set to 3/4 of the value that is required for an exact evaluation of .
  6. Introduction to ab-initio simulation in VASP