GW API

This module provides classes and functions for GW calculations.

G0W0Driver

One-shot G0W0 quasiparticle calculations.

Class Reference

class G0W0Driver(mf, **kwargs)

One-shot G0W0 driver for quasiparticle calculations.

Parameters:
  • mf (pyscf.scf.hf.SCF) – PySCF mean-field object (RHF, RKS, UHF, UKS)

  • basis_aux (str or None) – Auxiliary basis for density fitting. If None, automatically selected based on the orbital basis.

  • n_freq (int) – Number of frequency grid points (default: 32)

  • freq_method (str) – Frequency integration method, ‘minimax’ or ‘gauss-legendre’ (default: ‘minimax’)

  • eta (float) – Broadening parameter in Hartree (default: 0.001)

  • frozen_core (int) – Number of frozen core orbitals (default: 0)

  • qp_solver (str) – QP equation solver, ‘linearized’ or ‘newton’ (default: ‘linearized’)

  • newton_tol (float) – Convergence tolerance for Newton solver (default: 1e-6)

kernel()

Run the G0W0 calculation.

Returns:

G0W0Result object containing quasiparticle energies and related quantities

Return type:

G0W0Result

Raises:
  • ConvergenceError – If the QP equation solver fails to converge

  • BasisError – If the auxiliary basis cannot be determined

Example Usage

Basic G0W0 calculation:

from quasix import G0W0Driver
from pyscf import gto, scf

# Set up molecule and run HF
mol = gto.M(atom='H 0 0 0; H 0 0 0.74', basis='def2-svp')
mf = scf.RHF(mol).run()

# Run G0W0
gw = G0W0Driver(mf)
result = gw.kernel()

# Access results
print(f"HOMO QP energy: {result.homo_qp:.4f} eV")
print(f"LUMO QP energy: {result.lumo_qp:.4f} eV")
print(f"QP gap: {result.gap_qp:.4f} eV")

With custom parameters:

gw = G0W0Driver(
    mf,
    n_freq=64,               # More frequency points
    freq_method='minimax',   # Minimax grid
    qp_solver='newton',      # Newton solver
    newton_tol=1e-7,         # Tight convergence
)
result = gw.kernel()

evGWDriver

Eigenvalue self-consistent GW calculations.

Class Reference

class evGWDriver(mf, **kwargs)

Eigenvalue self-consistent GW driver.

Inherits all parameters from G0W0Driver plus:

Parameters:
  • max_iter (int) – Maximum number of self-consistency iterations (default: 30)

  • conv_tol (float) – Convergence tolerance in eV (default: 1e-5)

  • mixing (float) – Mixing/damping parameter for eigenvalue updates (default: 0.5)

kernel()

Run the evGW calculation.

Returns:

evGWResult object with converged quasiparticle energies

Return type:

evGWResult

Example Usage

from quasix import evGWDriver
from pyscf import gto, dft

# Set up molecule and run DFT
mol = gto.M(atom='O 0 0 0; H 0 0.757 0.587; H 0 -0.757 0.587', basis='def2-tzvp')
mf = dft.RKS(mol)
mf.xc = 'pbe0'
mf.run()

# Run evGW
gw = evGWDriver(mf, max_iter=20, conv_tol=1e-4)
result = gw.kernel()

print(f"Converged in {result.n_iter} iterations")
print(f"evGW HOMO: {result.homo_qp:.4f} eV")

G0W0Result

Result object for G0W0 calculations.

class G0W0Result

Container for G0W0 calculation results.

qp_energies: numpy.ndarray

Quasiparticle energies for all orbitals (eV)

dft_energies: numpy.ndarray

Mean-field (DFT/HF) orbital energies (eV)

sigma_x: numpy.ndarray

Exchange self-energy diagonal elements (eV)

sigma_c: numpy.ndarray

Correlation self-energy at QP energy (eV)

z_factor: numpy.ndarray

Renormalization factors (dimensionless)

homo_idx: int

Index of the HOMO orbital

lumo_idx: int

Index of the LUMO orbital

homo_qp: float

HOMO quasiparticle energy (eV)

lumo_qp: float

LUMO quasiparticle energy (eV)

gap_qp: float

Quasiparticle HOMO-LUMO gap (eV)

homo_dft: float

HOMO mean-field energy (eV)

converged: bool

Whether the calculation converged

evGWResult

Result object for evGW calculations.

class evGWResult

Container for evGW calculation results. Extends G0W0Result.

n_iter: int

Number of self-consistency iterations

convergence_history: list

List of energy changes per iteration (eV)

Accessing Detailed Results

result = gw.kernel()

# All QP energies
for i, (e_dft, e_qp) in enumerate(zip(result.dft_energies, result.qp_energies)):
    correction = e_qp - e_dft
    print(f"Orbital {i:3d}: DFT={e_dft:8.4f} eV, QP={e_qp:8.4f} eV, "
          f"Correction={correction:+6.4f} eV")

# Self-energy analysis for HOMO
homo = result.homo_idx
print(f"\nHOMO Self-Energy Breakdown:")
print(f"  Sigma_x: {result.sigma_x[homo]:.4f} eV")
print(f"  Sigma_c: {result.sigma_c[homo]:.4f} eV")
print(f"  Z factor: {result.z_factor[homo]:.4f}")

# QP correction
vxc_homo = result.dft_energies[homo] - result.qp_energies[homo]  # Approximate
total_sigma = result.sigma_x[homo] + result.sigma_c[homo]
print(f"  Total self-energy: {total_sigma:.4f} eV")

See Also