3.20 Grand-Canonical DFT

In a conventional Kohn–Sham calculation the number of electrons N is fixed and the chemical potential μ≡εF is read off from the converged occupations. In a real electrochemical cell the electrode is connected to a potentiostat that fixes the electronic chemical potential and the natural ensemble is grand canonical, with grand potential

Ω⁢[ρ;μ]=EKS⁢[ρ]−μ⁢N⁢[ρ], (3.60)

whose gradients with respect to nuclear coordinates and lattice vectors are the forces and stresses experienced by the system at fixed potential.

In FHI-aims’s grand-canonical SCF the user prescribes μ and the electron number N floats as a self-consistent output. At each SCF iteration the canonical Fermi level εF of the current spectrum is located, mixed toward the target,

μapply=β⁢μtarget+(1−β)⁢εF, (3.61)

and the configured smearing function (Gaussian, Fermi, Methfessel–Paxton, cubic or cold) is evaluated at every Kohn–Sham eigenvalue with μapply held fixed. The new electron count

N=∑i,𝐤w𝐤⁢fi⁢(εi;μapply) (3.62)

is read off and the density is rebuilt. The SCF is declared converged when the canonical density-residual and energy criteria are satisfied and |εF−μ|< gcdft_mu_tolerance.

A non-zero net charge q=Ztot−N in a periodic cell diverges the long-range Hartree term unless a compensating charge is supplied. The recommended path is to enable the modified Poisson–Boltzmann solver (solvent mpb) or an Environ embedding (solvent Environ), whose counter-ion density automatically integrates to −q. As a development fallback (cell-volume-dependent results, not for production use) the implicit uniform background carried by the periodic Hartree solver may be enabled through gcdft_allow_jellium.

The algorithmic blueprint for this implementation is the constant-μ SCF method of Sundararaman, Goddard and Arias [305].

Basis-set considerations.

The default confined numeric atom-centered basis sets are constructed for neutral systems. At potentials below the potential of zero charge the added electrons occupy increasingly diffuse states above the electrode surface, which a confined basis cannot represent: the computed charge then saturates and the capacitance is underestimated, increasingly so at more negative potentials. The light species defaults are not sufficient for charged electrodes; tight settings track plane-wave reference results for the Fermi-level shift εF⁢(q)−εF⁢(0) of charged Li(100) slabs to within 0.03 eV up to moderate charging (±0.04 electrons per surface atom), where light deviates by several 0.1 eV on the electron-gain branch. For strong negative potentials, additionally uncomment (or add) the very diffuse “fill space” functions listed at the end of the species defaults (e.g. hydro 3 p 0.1, hydro 4 f 0.1, hydro 5 g 0.1 for Li), set basis_dep_cutoff to 0 and enable override_illconditioning: with these functions the same benchmarks agree with the plane-wave reference to a few 0.01 eV over the full tested window of ±0.08 electrons per surface atom, at roughly three to four times the cost of a light calculation. Diffuse tails can push the charge-integration error of the standard grids slightly past the built-in 10−5 stop; if an otherwise healthy run aborts on that check, set override_error_charge_integration .true. and verify the reported error stays close to the threshold rather than growing with charge.

Spin treatment.

Collinear spin-polarized calculations (spin collinear) are supported with a single common chemical potential for both spin channels. fixed_spin_moment is rejected: distinct μ↑, μ↓ would correspond to two separate reservoirs and is out of scope for this version.

Initial electron count.

The charge keyword, if present, sets the starting electron number for the SCF and is therefore honored by GC-DFT as an initial guess. It is overwritten in the course of the SCF by the value of N that the target μ implies; a well-chosen charge can shorten the path to convergence in systems where the canonical starting density is far from the target electrochemical state.

Tags for general section of control.in:

 

Tag: gcdft(control.in)

Usage: gcdft flag
Purpose: Master switch. When .true., the SCF runs in the grand-canonical ensemble; the electron number floats and the chemical potential is held fixed by the values of gcdft_target_potential and gcdft_reference_potential.
Restrictions: A smearing occupation scheme is required (occupation_type gaussian, fermi, methfessel-paxton, cubic or cold; integer is rejected). Incompatible with fixed_spin_moment, force_occupation_projector, static excitations and the X2C / Q4C relativistic paths. Periodic cells must additionally activate a compensating charge channel (see gcdft_allow_jellium). Default: .false.

 

Tag: gcdft_target_potential(control.in)

Usage: gcdft_target_potential value
Purpose: The electrode potential the experiment applies, in volts relative to the absolute reference defined by gcdft_reference_potential. Combined with the reference, this fully determines the absolute chemical potential

μ=−(Wref+e⁢Φ),

consistent with the FHI-aims convention that the Fermi level of a metal in vacuum is the negative of its work function on the absolute scale. Default: 0.0 V.

 

Tag: gcdft_reference_potential(control.in)

Usage: gcdft_reference_potential W_ref
Purpose: Depth of the reference electrode below the vacuum level, in eV, entered as a positive number. Default: 4.43 eV (the standard hydrogen electrode).
Sign convention: the chemical potential held by the SCF is μ=−(Wref+e⁢Φ), so both a deeper reference and a more positive electrode potential lower μ. Two worked examples:

 

Tag: gcdft_mu_tolerance(control.in)

Usage: gcdft_mu_tolerance tol_eV
Purpose: Convergence threshold on |εF−μ|, in eV. Applied in addition to the canonical density-residual and energy convergence criteria, so the SCF cannot declare convergence while the Fermi level is still drifting toward the target. Default: 0.01 eV.

 

Tag: gcdft_mu_damping(control.in)

Usage: gcdft_mu_damping beta
Purpose: Mixing coefficient β∈[0,1] for the working chemical potential of Eq. 3.61: β=1 pins the occupations to μtarget from the first iteration, small β walks the Fermi level toward the target a fraction β per iteration. Metallic electrodes with a large density of states at the Fermi level exchange many electrons per eV of potential step and generally need a small β for a stable approach. Default: 0.05.

 

Tag: gcdft_allow_jellium(control.in)

Usage: gcdft_allow_jellium flag
Purpose: In a periodic cell, permit the implicit uniform background that the Hartree solver already carries through its 𝐆=𝟎 term to act as the compensating charge. For development and testing only: the grand potential reported under this fallback depends on the simulation-cell volume, so converged numbers are not physically meaningful. Production runs should instead enable a real counter-charge via solvent mpb or solvent Environ. Default: .false.

 

Tag: gcdft_omit_mu_n_term(control.in)

Usage: gcdft_omit_mu_n_term flag
Purpose: Diagnostic. When .true., the global total_energy variable is left as EKS rather than overwritten with Ω, while Ω is still computed and reported in the final-output block. Intended for cross-mode comparisons between canonical and grand-canonical runs at fixed geometry. Default: .false.

Example:

The following control.in fragment runs an SCF at an electrode potential of −0.5 V vs the standard hydrogen electrode, with the modified Poisson–Boltzmann solver providing the compensating counter-ion density.

  xc                          pbe
  occupation_type             gaussian 0.05
  k_grid                      4 4 1

  solvent                     mpb

  gcdft                       .true.
  gcdft_target_potential      -0.5
  gcdft_reference_potential   4.43
  gcdft_mu_damping            0.05

At convergence the run prints, alongside the canonical SCF output,

  | Kohn-Sham total energy, E_KS               : <value> eV
  | Grand potential, Omega = E_KS - mu N       : <value> eV
  | Electron number, N                         : <value> e
  | Compensating charge, q = Z_tot - N         : <value> e

The grand potential, not the Kohn–Sham total energy, is the quantity whose gradients are the thermodynamically consistent forces and stresses at fixed potential.