Structures and energetics

Equation of state and bulk modulus

Compute the total energy at several volumes and fit an equation of state to get the equilibrium volume and bulk modulus.

Category
Structures and energetics
APIs used
get_potential_energyase.eos.EquationOfState
Script
eos_bulk_modulus.py

The equilibrium lattice constant and bulk modulus are obtained from the energy-volume (E-V) curve. The total energy is computed for structures with slightly different lattice constants and fitted to an equation of state with ASE's EquationOfState.

eos_bulk_modulus.pyDownload
"""
Advance/OF-DFT example: energy-volume curve and bulk modulus.

Copyright (C) 2026 AdvanceSoft Corporation, All rights reserved.
"""

import numpy as np
from ase.build import bulk
from ase.eos import EquationOfState
from ase.units import GPa

from aofdft.calculator import AOFDFTCalculator

VPS_DIR = "path/to/DFT_DATA19_AS/VPS"  # edit these two paths for your environment
PAO_DIR = "path/to/DFT_DATA19_AS/PAO"

# fcc Al: 2x2x2 repetition of the primitive cell (8 atoms)
reference = bulk("Al", "fcc", a=4.05).repeat((2, 2, 2))

volumes, energies = [], []

for scale in np.linspace(0.94, 1.06, 7):  # scaling factor of the lattice constant
    atoms = reference.copy()
    atoms.set_cell(reference.cell * scale, scale_atoms=True)

    atoms.calc = AOFDFTCalculator(
        console      = False,
        logging_file = f"al_{scale:.2f}.log",
        kin_type     = "AS26",
        kin_model    = "Crystal26",
        vps_dir      = VPS_DIR,
        pao_dir      = PAO_DIR,
    )

    volumes.append(atoms.get_volume() / len(atoms))             # per atom
    energies.append(atoms.get_potential_energy() / len(atoms))  # per atom
    print(f"V = {volumes[-1]:7.3f} Angstrom^3/atom, E = {energies[-1]:.5f} eV/atom")

# fit the equation of state
eos = EquationOfState(volumes, energies, eos="birchmurnaghan")
v0, e0, B = eos.fit()

print(f"Equilibrium volume : {v0:.3f} Angstrom^3/atom")
print(f"Lattice constant   : {(4.0 * v0) ** (1.0 / 3.0):.3f} Angstrom")
print(f"Bulk modulus       : {B / GPa:.1f} GPa")

ax = eos.plot()
ax.set_xlabel("Volume (Angstrom^3/atom)")
ax.set_ylabel("Energy (eV/atom)")
ax.figure.tight_layout()
ax.figure.savefig("al_eos.png", dpi=150)
print("Saved al_eos.png")

Example output

Results with v1.0.0 (Crystal26).

text
V =  13.794 Angstrom^3/atom, E = -66.90710 eV/atom
V =  14.693 Angstrom^3/atom, E = -67.00041 eV/atom
V =  15.631 Angstrom^3/atom, E = -67.05413 eV/atom
V =  16.608 Angstrom^3/atom, E = -67.06755 eV/atom
V =  17.624 Angstrom^3/atom, E = -67.03859 eV/atom
V =  18.681 Angstrom^3/atom, E = -66.97178 eV/atom
V =  19.780 Angstrom^3/atom, E = -66.87157 eV/atom
Equilibrium volume : 16.408 Angstrom^3/atom
Lattice constant   : 4.034 Angstrom
Bulk modulus       : 108.7 GPa
Saved al_eos.png
E-V curve of fcc Al with the Birch-Murnaghan fit (v1.0.0, Crystal26).
E-V curve of fcc Al with the Birch-Murnaghan fit (v1.0.0, Crystal26).

Notes

  • The cell is a 2×2×2 repetition of the fcc primitive cell (8 atoms), and the volume and energy are fitted per atom. With v1.0.0 the results change when the cell has a short period, as the primitive cell (1 atom) does. For a new system, check that a larger cell gives the same result.
  • ase.eos.EquationOfState supports several equations of state, including Birch-Murnaghan. fit() returns the equilibrium volume (Angstrom³), minimum energy (eV) and bulk modulus (eV/Angstrom³); divide by ase.units.GPa to convert to GPa.
  • A typical scan covers a few percent around the equilibrium volume with 5 to 9 points.
  • A new calculator is created for each volume, so the FFT grid of each cell follows from the cutoff energy. Pass n_grids to use the same grid for all volumes.
  • Benchmarks of E-V curves and bulk moduli with the deep-learned kinetic energy functional (AdvanceSoft25) are published in the case study Energy-Volume Curves and Bulk Modulus.