6. Excited-State Gradients and Geometry Optimization¶
VOTCA-XTP computes analytic nuclear gradients of BSE excitation energies, and from them the forces on the atoms in an excited state. One force evaluation costs about two GW-BSE calculations, independent of the number of atoms, instead of \(6N\) for the finite differences used in earlier excited-state optimizations with VOTCA-XTP [Caylak:2021]. Together with an optimizer (through XTP ASE Interface and ASE) this gives excited-state geometries, Stokes shifts and adiabatic excitation energies with GW-BSE.
The gradient includes the response of the Kohn-Sham orbitals, of the screening, of all integrals and, for G0W0 and evGW, of the quasiparticle (QP) corrections themselves. The latter follows Holzer [Holzer:2026]; neglecting it shortens excited-state bonds systematically (by about 0.003–0.006 Å for the C–C bond of acetylene in its \(^1\Sigma_u^-\) state, and by up to 0.03 Å for the C=O bond of formaldehyde in S1).
6.1. Theory¶
The total energy of BSE state \(n\) is the ground-state DFT energy plus the excitation energy,
and its gradient is that of the ground state (available with
dftpackage.xtpdft.compute_forces) plus that of \(\Omega_n\).
6.1.1. Excitation energy and its partial derivatives¶
In the resolution-of-identity (RI) representation the BSE Hamiltonian is built from the three-index quantities \(B^P_{pq} = \sum_R L_{RP} (R|pq)\), with \((R|pq)\) the three-centre Coulomb integrals in the molecular orbital (MO) basis and \(L = V^{-1/2}\) the inverse square root of the auxiliary Coulomb metric, and from the QP energies \(E_p\) (BSE) and the energies \(\varepsilon'_p\) in the RPA screening. For the full BSE, with amplitudes \(X, Y\) normalized as \(X^TX - Y^TY = 1\),
so that by the Hellmann-Feynman theorem only the explicit dependence of \(A\) and \(B\) on the geometry contributes:
\(g^P = \partial\Omega/\partial B^P\) collects the exchange, the direct (screened) term and the response of the static RPA screening \(\epsilon^{-1}\) through the RPA transitions; \(w\) and \(w'\) are the diagonal elements of the BSE difference density and of the screening response density.
The change of \(B^P\) has an integral part, the derivatives of the three-centre integrals and of the metric at fixed MO coefficients (both contracted directly, without storing derivative tensors), and an orbital part from the response of the MO coefficients.
6.1.2. Orbital response: the Z-vector¶
The orbital part is handled as for TDDFT gradients [Furche:2002]. The quantity \(Q_{rp} = \sum_{P,q} B^P_{rq} (g^P_{pq} + g^P_{qp})\) determines the rotations within the occupied and within the virtual space directly; the occupied-virtual rotations follow from one coupled-perturbed Kohn-Sham (Z-vector) equation
with the orbital Hessian of the ground state, i.e. the response of the Coulomb, exact-exchange and exchange-correlation potentials. The relaxed difference density \(\tilde{P}\) and the energy-weighted density \(\tilde{W}\) then give
where the Fock-matrix derivative at fixed density is split into the one-electron part, RI-J, RI-K and the exchange-correlation part. The latter is evaluated analytically on the grid, including the moving basis functions and integration grid (second functional derivatives of the functional; no third derivatives are needed because the BSE kernel contains no exchange-correlation kernel).
6.1.3. Response of the QP corrections¶
The QP energies solve
with \(a_x\) the exact-exchange fraction of the functional. They depend on the geometry through the KS energies, the integrals in \(\Sigma^x\), \(v^{xc}\) and \(\Sigma^c\), and, in evGW, through the QP energies in the screening and in the poles of \(G\). The weights \(w_p\) of \(\mathrm{d}\Omega\) on the QP energies are turned into weights on these quantities by an adjoint equation:
G0W0: \(v_p = w_p / (1 - \Sigma^{c\prime}_{pp}(E_p))\), the renormalization factor.
evGW: a linear system of the size of the GW window, \((1 - J)^T v = \bar{w}\), with \(J\) the derivative of the self-energies with respect to the QP energies, through the poles of \(G\) and through the screening. The levels outside the GW window enter through the out-of-window shift (
gw.out_of_window_shift). The system is solved with GMRES, preconditioned with the part of \(J\) that comes from the poles of \(G\) alone.
A reverse pass of \(\sum_p v_p \Sigma^c_{pp}\) then gives the contributions to \(g^P\), to the KS energies and to the RPA energies:
Plasmon-pole model (
sigma_integratorppm): through the pole sums, the PPM parameters, and the eigen-decomposition of \(\epsilon(0)\) (eigenvalue and eigenvector derivatives) to \(\epsilon(0)\) and \(\epsilon(i\nu)\).Exact self-energy (
sigma_integratorexact): \(\Sigma^c\) is written as a matrix function of the RPA matrix \(C = \Delta^{1/2}(\Delta + 4bb^T)\Delta^{1/2}\) and differentiated with divided differences in its eigenbasis (Daleckii-Krein).
The contour-deformation integrator (cda) is not covered; with it the
QP corrections are kept fixed.
6.1.4. Gradients of quasiparticle energies¶
The same machinery gives the nuclear gradient of the energy of a single QP
level \(E_p\): the “excitation energy” is then \(E_p\) itself, so
the partial derivatives \(g^P\) of the BSE part vanish and the weight
on the QP energies is one for level \(p\). The adjoint of the QP
equation (with the evGW self-consistency, if used), the Z-vector and the
integral derivatives are unchanged. dftgwbse computes these gradients
with the option qp_gradients, a list of levels or ranges such as
homo-5:lumo+5, homo,lumo or 30:40 (absolute, 0-based MO
indices); no BSE is needed. The three-index integrals and the self-energy
model are set up once, each level then needs its own Z-vector. The result
is stored in the orb file (qp_gradients, one block of
\(N_\mathrm{atoms}\) rows per level in Hartree/bohr, and
qp_gradient_levels).
The gradients are those of the perturbative QP energies (diagonal of the QP Hamiltonian); the levels must lie in the QP window.
For KS-degenerate levels only the gradient of the mean energy is defined; each partner gets this gradient (logged).
The restrictions of the excited-state forces apply (closed shell, RI, no embedding, G0W0 or evGW with
ppmorexact; otherwise the gradient of the KS energy with fixed corrections is returned).
Gradients can be added to an existing orb file without repeating DFT and
GW-BSE, which matters for large molecules: dftgwbse with
tasks=gradients (and the options of the run that wrote
job_name.orb) reads the file, computes what qp_gradients and/or
excited_state_forces ask for and writes it back. QP levels whose
gradients are already stored are not recomputed, so a range can be
extended later; the forces of another excited state replace the stored
ones. Basis sets and functional are compared with the file, and the QP and
excitation energies rebuilt for the gradient reveal a different GW-BSE
setup. From Python: pyxtp.vibronic.add_gradients; on the command line
xtp_vibronic gradients.
Validation against finite differences of the QP energies (GW recomputed at displaced geometries; water, PBE0/def2-SVP, QP window 0-9, levels HOMO-2 to LUMO+2): relative errors below \(10^{-6}\) for G0W0 and evGW with both self-energy models.
The main use is the vibronic structure of photoemission and inverse photoemission spectra, see Vibronic Spectra.
6.1.5. Root following¶
Excited states change order along an optimization. With root following, the state at a new geometry is the one of the same spin with the largest overlap with the state of the previous geometry,
with the excitons in their atomic-orbital representation and the overlap of the basis functions at the two geometries (so the moving basis is accounted for). \(O_i\) drops for any displacement and is meant for consecutive optimization steps.
6.2. Usage¶
6.2.1. From Python (ASE)¶
The usual way is the ASE calculator, see XTP ASE Interface:
from ase.io import read
from pyxtp import xtp
from sella import Sella
atoms = read('molecule.xyz')
calc = xtp(nthreads=8, excited_state='s1', follow_root=True)
calc.set(**{'dftpackage/basisset': 'def2-tzvpp',
'dftpackage/auxbasisset': 'aux-def2-tzvpp',
'gwbse/gw/mode': 'evGW',
'gwbse/gw/sigma_integrator': 'exact',
'gwbse/gw/out_of_window_shift': 'nearest'})
atoms.calc = calc
Sella(atoms, order=0, internal=True).run(fmax=0.01)
get_potential_energy returns the total energy of the state and
get_forces its analytic forces; with follow_root=True,
calc.tracked_state is the label of the followed state at the current
geometry.
6.2.2. With dftgwbse¶
The forces are computed at the end of a dftgwbse run with
Option |
Meaning |
|---|---|
|
BSE state, e.g. |
|
Include the response of the QP corrections (default |
|
Orb file of an earlier geometry: compute the forces for the state with the largest overlap with the state stored there (root following). |
The forces (Hartree/Bohr) and the state are stored in the orb file
(dataset excited_state_forces, attribute
excited_state_forces_state) and printed in the log. The log also
reports three checks:
the excitation energy rebuilt for the gradient against the BSE eigenvalue (a warning above 1e-6 Ha means a loosely converged Davidson solution; pyxtp sets
bse.davidson.tolerancetostrict; above 1e-4 Ha the run stops, since the GW-BSE setup is then not covered by the gradient);the QP energies rebuilt from the self-energy against the GW ones (stop above 1e-4 Ha, e.g. for an evGW run that has not converged);
for evGW, the RPA energies rebuilt with the out-of-window shift.
6.3. Recommended settings¶
evGW with the exact self-energy for geometries. evGW solves the QP equations iteratively and gives smooth energy surfaces; G0W0 surfaces can be rough where a QP solution lies close to a pole of the self-energy, and the plasmon-pole model changes bond lengths by up to about 0.006 Å relative to the exact self-energy.
out_of_window_shift nearest with evGW. The default
maxshifts the levels outside the GW window by the largest correction in the window; the energy then has kinks where that level changes, and optimizations can stall there (dftgwbse warns).A GW window without problematic levels. If evGW does not converge because a core or high virtual level has two QP solutions of similar weight (the log lists these), restrict the window with
ranges explicitandqpmin/qpmax; the gradient refuses QP energies that do not solve the QP equations.An optimizer in internal coordinates, e.g. Sella, rather than BFGS in Cartesian coordinates: Cartesian BFGS cannot break the symmetry of the starting geometry, and its fixed step size overshoots near state crossings.
Root following whenever states are close at the starting geometry.
Stop near S1/S0 crossings. GW-BSE describes excitations as linear response from the ground state; when the excitation energy drops to about 1 eV or below, or the ground-state energy jumps between steps, the description breaks down and the geometry is no longer meaningful.
6.4. Validation¶
The analytic gradients agree with finite differences of the full GW-BSE energy (GW recomputed at every displaced geometry) to about \(2\times10^{-5}\) relative (water, PBE0/def2-SVP: G0W0 and evGW with the plasmon-pole model, evGW with the exact self-energy).
S1 geometries of ten molecules of the 0–0 benchmark set of Loos and Jacquemin [Loos:2019], optimized from the (EOM-)CCSD/def2-TZVPP excited-state minima (PBE0, def2-TZVPP, full BSE, exact self-energy, GW window of all occupied and the lowest ten virtual orbitals). Mean absolute deviation of the heavy-atom bond lengths from the reference, in Å, compared with the Turbomole implementation of Holzer [Holzer:2026]:
State |
evGW (XTP) |
evGW (Holzer) |
G0W0 (XTP) |
G0W0 (Holzer) |
|---|---|---|---|---|
formaldehyde |
0.013 |
0.014 |
0.006 |
0.001 |
acetaldehyde |
0.007 |
0.006 |
0.013 |
0.018 |
acetylene |
0.009 |
0.008 |
0.005 |
0.002 |
HCN |
0.006 |
0.006 |
0.002 |
0.006 |
thioformaldehyde |
0.007 |
0.007 |
0.010 |
0.014 |
CF2 |
0.002 |
0.001 |
– |
0.001 |
cyanogen |
0.013 |
0.013 |
0.009 |
0.008 |
glyoxal |
0.004 |
0.004 |
0.013 |
0.016 |
acrolein |
0.008 |
0.008 |
0.020 |
0.007 |
pyrazine |
0.002 |
0.002 |
0.002 |
0.002 |
The evGW values agree to 0.001 Å for every state. G0W0 differs more because the QP equations are solved in full here and linearized in the Turbomole implementation; for CF2 the G0W0 optimization opens the F–C–F angle until S1 nearly meets S0. Bonds to hydrogen come out about 0.006 Å too long, as also reported by Holzer. For acetylene in its \(^1\Sigma_u^-\) state (def2-TZVPP) the QP response moves the C–C minimum by +0.003 Å (G0W0) and +0.006 Å (evGW) with the exact self-energy, in agreement with [Holzer:2026].
6.5. Limitations¶
Closed-shell ground states; singlet and triplet BSE states.
Only the xtp DFT package, with an auxiliary basis (RI).
No embedding or environment screening (QM/MM), no truncated bases.
No off-diagonal QP Hamiltonian in the BSE (
use_Hqp_offdiag), no QSGW, no contour deformation (QP corrections are then kept fixed), no dynamical screening of the BSE kernel.No effective core potentials.
Degenerate KS levels are assumed to be symmetry partners.