Guide · VASP · 11 min read
How do I fit an equation of state for the lattice constant and bulk modulus in VASP?
Checked against the docs · VASP wiki · Last checked 12 November 2026 · Spot a mistake? Tell us
Short answer
Compute the energy at five or more lattice constants around your starting guess (the VASP wiki uses 0.90, 0.95, 1.00, 1.05 and 1.10 times it), with the same ENCUT and the same k-point mesh at every point, relaxing positions and shape at fixed volume (ISIF = 4) if the cell has any freedom left. Fit energy against volume with a Murnaghan or Birch-Murnaghan equation: its minimum gives the equilibrium volume and lattice constant, and its curvature the bulk modulus B0.
What is an equation of state?
An equation of state here is a smooth formula for a crystal's energy as a function of its volume, E(V). You compute the energy at several volumes, then fit the formula through the points. Two of the fitted numbers are what you want:
- V0, the volume at the minimum of the curve: the equilibrium volume, from which the equilibrium lattice constant follows.
- B0, the bulk modulus: how stiff the crystal is against a change of volume, from the curvature of the curve at its minimum.
The fit also gives E0, the energy at the minimum, and B0′ (written B0_prime in the wiki's script), how the bulk modulus changes with pressure. The VASP wiki's Volume relaxation page names two common formulas, the Murnaghan equation and the Birch-Murnaghan equation, and leaves the choice to you.
Why fit instead of relaxing the volume?
Relaxing the cell with ISIF = 3 changes the volume during the run, and that brings in Pulay stress. The wiki's Pulay stress page explains it: VASP keeps the set of plane waves fixed while the cell changes during a run, so the basis gets worse as the volume moves, and an unconverged basis gives an unphysical stress that pulls the cell to too small a volume.
The Volume relaxation page offers the equation of state as the alternative. You never change the volume within a run: each volume is its own calculation, with its own basis. The page makes three points for it:
- The Pulay stress is almost isotropic, so relaxing the atoms and the cell's shape at a fixed volume still gives accurate structures.
- The fit also gives the bulk modulus.
- The wiki has found it "may be used safely with the default energy cutoff", because calculations at a constant cutoff are less sensitive to basis-set incompleteness than those with a constant basis.
The two approaches give close answers when done carefully. For diamond-structure silicon, the wiki's tutorial reports a = 5.4687 Å from a volume scan with a Murnaghan fit at ENMAX = 400, and 5.4684 Å from an ISIF = 3 relaxation, and puts the difference down to Pulay stress.
Which volumes should I compute?
The Volume relaxation page's recipe, with diamond carbon as its example:
- Start from a cell and a guess for the lattice constant a, such as the experimental value if you know it.
- Make structures at 0.90a, 0.95a, 1.00a, 1.05a and 1.10a. For diamond (a = 3.567 Å), that is 3.210, 3.389, 3.567, 3.745 and 3.924 Å. The page says five points are an example and recommends more to improve the fit.
- Compute the energy of each with the same settings.
- Fit E against volume and read off the minimum.
The page adds a caution in a footnote: the volume changes must be fairly large, because for very small distortions the energy differences are equivalent to those from the stress tensor and are affected by the Pulay stress again. Only volume changes of the order of 5 to 10% are guaranteed to average out the errors from basis-set incompleteness.
Scale the cell with the POSCAR's scaling factor. The second line of POSCAR multiplies all three lattice vectors, so changing only that number scales the cell uniformly and keeps its shape. The wiki's silicon tutorials do exactly this, in a loop over the values. The POSCAR page adds that a negative number there is read as the cell volume, and VASP works out the scaling factor itself.
Keep these the same at every volume:
| Setting | Why |
|---|---|
ENCUT | Set it yourself. The ENCUT and PREC pages warn that energies from runs with different cutoffs cannot be compared. |
The k-point mesh, written out in KPOINTS | The KPOINTS page says that setting the subdivisions yourself "ensures that changes in the lattice vectors do not affect the k-point mesh". With KSPACING, the mesh is worked out from the cell, so it can change between volumes. |
| The smearing | The page's settings: ISMEAR = 0 with SIGMA = 0.05, or ISMEAR = 1 with SIGMA = 0.2 for metals; for extremely accurate energies, the tetrahedron method (ISMEAR = -5), which this page says not to use for metals. See Which smearing should I use? |
What runs at each volume. It depends on whether anything is free to move once the volume is fixed:
- Nothing is free, as in the wiki's fcc and diamond silicon tutorials: each volume is a single-point calculation, with no ionic steps.
- Something is free, such as a c/a ratio or internal atomic positions: relax the positions and the shape at the fixed volume. The wiki's silicon volume-relaxation summary suggests
IBRION = 2(conjugate gradient),ISIF = 4(positions and shape change, volume fixed) and about 10 ionic steps (NSW = 10) at each volume.
For a single point at each volume, you don't need IBRION or NSW.
What it depends on:
- The cell's freedom. A cubic cell with atoms on fixed sites needs single points; anything else needs a fixed-volume relaxation at each point.
- Your converged settings. Converge
ENCUTand the k-points first (see How do I test convergence?); the curve can only be as smooth as they allow. - How far your guess is from the answer. If the lowest energy falls at an end of the range, the minimum is outside it: add points beyond that end.
How do I collect the energies and fit them?
Run each volume in its own folder, so its OUTCAR is kept. A sketch, for a cubic cell whose POSCAR has the lattice constant as its scaling factor (an example, not a script from the wiki; it assumes INCAR, KPOINTS, POTCAR and a template POSCAR in the current folder):
a0=3.567
for f in 0.90 0.95 1.00 1.05 1.10; do
d=a_$f; mkdir -p $d
cp INCAR KPOINTS POTCAR $d/
a=$(echo "$a0 * $f" | bc -l)
awk -v a="$a" 'NR==2 {print a; next} {print}' POSCAR > $d/POSCAR
doneawk copies the template and replaces line 2, the scaling factor, with each lattice constant. Then submit the job in each folder as you usually do.
Read the results back. The Volume relaxation page's script takes the lattice parameter from the ALAT line of OUTCAR and the energy from the free energy TOTEN line, one line per folder:
rm -f loop_lattice_constant.dat
for a in */; do
latt=$(grep "ALAT" "$a"/OUT* | awk '{print $3}')
E=$(grep "free e" "$a"/OUTCAR | awk '{print $5}')
echo "$latt $E" >> loop_lattice_constant.dat
doneThis is the wiki's script as written; it fits the free energy (TOTEN), which is also what the silicon tutorials plot. With ionic steps at each volume, OUTCAR holds a free energy line for every step, so add | tail -1 to the energy line to keep only the last.
Fit energy against volume. The page's Python script fits a Murnaghan equation with scipy, prints E0, B0 and a0, and plots the curve; the page also points to pymatgen, which has equations of state already defined. Two things to know about that script before you rely on its B0:
- It fixes B0′ at 4.0 rather than fitting it.
- It takes the volume as V = a³, the volume of a cube of side a. The two-atom primitive cell of its own diamond example is not such a cube (its volume is a³/4), so the B0 it reports may not be the crystal's, while a0 is unaffected; the wiki does not comment on this. VASP prints the actual cell volume in
OUTCAR, as a line startingvolume of cell :; fitting energy against that volume avoids the question.
The script reports B0 in eV/ų. To convert to GPa, multiply by about 160.2: LAMMPS, in its metal units, converts an energy per volume in eV/ų to a pressure in bar with the factor 1.6021765 × 10⁶, and 1 GPa is 10⁴ bar.
How do I know the fit is right?
The curve is smooth. The Volume relaxation page lists the two usual causes of a jagged energy-volume curve and their fixes:
- Basis-set incompleteness. As the volume changes, plane waves enter the basis in steps. Raise
ENCUT(the page calls this usually the preferred and simplest fix), or use more k-points, which smooths the steps because each k-point has its own basis. - FFT grids that change with volume. Use
PREC = Accurate, raiseENCUT, or set the FFT grids yourself to the ones VASP picks for the largest volume.
The minimum is inside your range, not at either end.
The pressure agrees. OUTCAR prints an external pressure line. The Pulay stress page shows that with a converged basis, the volume where the pressure crosses zero and the volume at the energy minimum coincide; with an unconverged basis, the pressure's zero sits at a much smaller volume. Run a single point at your fitted volume and read the pressure: near zero is a good sign.
A cell relaxation agrees. As in the wiki's silicon example, a careful ISIF = 3 relaxation at a raised cutoff should land close to the fitted lattice constant (see How do I fix a relaxation that won't converge? for relaxing the volume carefully).
What goes wrong with an equation-of-state fit?
| Mistake | What you would see | What to do |
|---|---|---|
| Volumes too close together | A fit dominated by the Pulay stress, as the page's footnote warns | Span changes of the order of 5 to 10% in volume, as the recipe does. |
KSPACING instead of a fixed mesh | A mesh that can change from one volume to the next | Write the mesh in KPOINTS, the same at every volume. |
| The default cutoff, left to VASP | Energies that may not be comparable between runs | Set ENCUT yourself, the same everywhere. |
| A jagged curve | Steps from the basis or the FFT grids | Raise ENCUT, add k-points, or use PREC = Accurate. |
| Single points for a cell with internal freedom | A curve through unrelaxed structures; the wiki says such a cell "must be optimized" at each volume | Relax positions and shape at each fixed volume (ISIF = 4). |
ISIF = 3 at each "fixed" volume | The volume changes during each run, so the points are no longer at the volumes you chose | ISIF = 4 keeps the volume fixed. |
| The minimum at the edge of the range | An extrapolated minimum | Extend the range past that end. |
Several energies per folder in the grep | Several values per point in the data file | Keep the last free energy line with tail -1. |
Verlet does not fit an equation of state. It can run the points: duplicate a run once per volume from its "…" menu in the Runs panel, bring in each scaled POSCAR with Replace in Build, where the cell's volume is shown, and Compare runs lists the runs side by side with their last energies for you to fit. Everything above works without it.