Excitation energies (linear-response TDDFT)

In this tutorial

You compute the lowest singlet excitations of formaldehyde with linear-response TDDFT (the Casida equations), read the table of roots, assign them with orbital pictures and plot an absorption spectrum. You check the results against PySCF and experiment, and see why the functional matters much more for some states than for others. Time: about 1 s for the main run and a few seconds per exercise (16 cores). Files: h2co_tddft.yaml, h2co_tddft.out (reference output), exercise inputs files/h2co_{pbe,lcwpbe,tda,triplet,finegrid}.yaml, run.sh.

The input file

system:
  charge: 0
  unpaired_electrons: 0
  units: angstrom

functional:
  backend: libxc
  exchange: HYB_GGA_XC_PBEH
  correlation: none

basis:
  name: aug-pc-1
  file: basis/aug-pc-1.nw

scf:
  conv_tol: 1.0e-9

coulomb:
  method: density_fitting
  aux_basis_file: basis/def2-universal-JKFIT.nw

tddft:
  nroots: 10
  method: casida
  solver: davidson

cube:
  prefix: h2co
  spacing: 0.25
  margin: 6.0
  quantities: mo_alpha:5-9

atoms:
  - element: C
    position: [0.000000, 0.000000, 0.000000]
  - element: O
    position: [0.000000, 0.000000, 1.205000]
  - element: H
    position: [0.000000, 0.942695, -0.587918]
  - element: H
    position: [0.000000, -0.942695, -0.587918]

The geometry is the experimental one (C=O 1.205 Å, C–H 1.111 Å, H–C–H 116.1°). The molecule lies in the \(yz\) plane with the C=O bond along \(z\).

functional

PBE0 from libxc. A combined hybrid goes in exchange with correlation: none. TDDFT works with LDA, GGA, global hybrids and range-separated hybrids. Meta-GGAs are refused.

basis: aug-pc-1

Excited states, Rydberg states in particular, need diffuse functions.

coulomb: density_fitting with a JK-fitting basis

The production setting for hybrids. The SCF and the response use RI for both the Coulomb and the exact-exchange parts. The fitting error in the excitation energies is about \(10^{-4}\) Ha.

tddft

Any key switches TDDFT on after the SCF. nroots is the number of lowest roots. method: casida solves the full linear-response (RPA) problem, and tda the Tamm–Dancoff approximation. solver: davidson is iterative and matrix-free; dense diagonalizes the whole matrix, which is fine for tiny systems. The singlets of a closed-shell molecule are the default (multiplicity: triplet for triplets).

cube

Orbitals 5–9 to identify the transitions.

Running

$ OMP_NUM_THREADS=8 ./run_dft tutorials/05_tddft/files/h2co_tddft.yaml > h2co_tddft.out

Reading the output

After the SCF:

 TDDFT (Casida) singlets: no = 8, nv = 60, pairs = 480
 xc kernel (GGA): 58392 grid points, 193 screened (rho < rho_min)
 Coulomb: RI-J, n_aux = 222(MO basis)
 hybrid: exact-exchange fraction cx =  0.2500, exchange: RI-MO

  iter  subspace  max residual   max |d omega| (Ha)  converged   [hybrid RPA, (A+B)/(A-B) form]
     1        20      1.673E-01                  -       0
     ...
     6       128      6.187E-06          2.801E-10      10

There are 8 occupied and 60 virtual orbitals, so 480 single excitations; the Davidson solver needs a subspace of only 128 vectors to converge 10 roots. Then the main result:

  state    omega (Ha)     omega (eV)   f (length)   dominant transition (weight)
    1    0.14627344       3.98030      0.00000   occ 8 -> virt 1 (  0.918)
    2    0.24587508       6.69060      0.02721   occ 8 -> virt 2 (  0.982)
    3    0.27675123       7.53078      0.04062   occ 8 -> virt 3 (  0.981)
    4    0.28033727       7.62837      0.02846   occ 8 -> virt 4 (  0.980)
    5    0.29821585       8.11487      0.00000   occ 8 -> virt 5 (  0.990)
    6    0.33698980       9.16996      0.00012   occ 6 -> virt 1 (  0.929)
    7    0.33799741       9.19738      0.03556   occ 8 -> virt 6 (  0.948)
    8    0.34155202       9.29410      0.07084   occ 8 -> virt 7 (  0.687)
    9    0.35172278       9.57086      0.02786   occ 7 -> virt 1 (  0.443)
   10    0.35724406       9.72111      0.03057   occ 8 -> virt 8 (  0.960)
  • omega is the vertical excitation energy.

  • f is the oscillator strength (length gauge). It is zero for transitions forbidden by symmetry.

  • The dominant transition is written occ i -> virt a. Occupied orbitals are numbered from the bottom, so occ 8 is the HOMO. Virtual orbitals are numbered from the LUMO, so virt 1 is MO 9.

  • The weight is the share of that single excitation in the state. A weight well below 1 (state 9) means a mixed state. For full RPA with hybrids it is computed from the \(X+Y\) amplitudes and can exceed 1 (see the triplets below).

../../_images/mo8_n.png

Fig. 17 MO 8 (HOMO): the in-plane oxygen lone pair \(n\).

../../_images/mo7_pi.png

Fig. 18 MO 7: the C=O \(\pi\) bond.

../../_images/mo9_pis.png

Fig. 19 MO 9 (LUMO): the C=O \(\pi^*\) orbital.

With the orbitals the roots can be assigned:

  • State 1 (3.98 eV) is \(n\to\pi^*\). It has \(A_2\) symmetry in \(C_{2v}\), which is dipole-forbidden, hence \(f=0\) exactly. This is the weak near-UV band of formaldehyde.

  • States 2–5, 7, 8 and 10 go from \(n\) to diffuse virtual orbitals. These are Rydberg states (\(n\to3s\), \(3p\), …). They are only present because the basis has diffuse functions.

  • States 6 and 9 are valence states: \(\sigma\to\pi^*\) (from MO 6) and the strongly mixed \(\pi\to\pi^*\) (from MO 7).

../../_images/uvvis.png

Fig. 20 The roots as sticks with 0.3 eV Gaussian broadening. Crosses mark dark states. Dotted lines are the experimental \(n\to\pi^*\), \(n\to3s\) and \(n\to3p\) energies. dftsw27plot.py uvvis h2co_tddft.out --exp 4.07 7.09 7.97

How good are the numbers?

Against PySCF. PySCF computes the same Cartesian basis, PBE0, RI-JK with the same auxiliary basis and full TDDFT, and gives the same \(n\to\pi^*\) energy to 0.02 meV (3.98028 against 3.98030 eV). The diffuse Rydberg states differ by up to 10 meV on the default grids. On fine grids on both sides (exercise 4; PySCF grid level 8) all ten roots agree to 1.5 meV. The default grid is fine for valence states, but converge it for Rydberg states.

Against experiment. PBE0 gets the valence \(n\to\pi^*\) state right (3.98 eV against about 4.07 eV). It puts the \(n\to3s\) Rydberg state at 6.69 eV, 0.4 eV below the experimental 7.09 eV. Exercise 1 shows why.

Things to try

1. The functional

Run files/h2co_pbe.yaml (PBE) and files/h2co_lcwpbe.yaml (the range-separated hybrid LC-\(\omega\)PBE, HYB_GGA_XC_LC_WPBE).

What you should find

\(n\to\pi^*\)

\(n\to 3s\)

PBE

3.84

5.79

PBE0

3.98

6.69

LC-\(\omega\)PBE

3.96

7.29

experiment

about 4.07

7.09

../../_images/uvvis_functionals.png

The valence \(n\to\pi^*\) state hardly depends on the functional. The Rydberg state moves by 1.5 eV. Rydberg states probe the potential far from the molecule. Semilocal functionals have a potential that decays exponentially instead of as \(-1/r\), which puts the diffuse orbitals much too low. 25 % exact exchange helps partly; full long-range exchange (LC-\(\omega\)PBE) fixes most of it. The same physics, the self-interaction error, is what the SIC tutorials correct. With LC-\(\omega\)PBE the virtual orbitals are reordered (virt 1 and virt 2 swap roles), so always assign by orbital character, not by number.

2. Tamm–Dancoff

method: tda (files/h2co_tda.yaml) drops the de-excitation block \(B\).

What you should find

TDA roots lie slightly higher: \(n\to\pi^*\) 4.007 eV against 3.980 eV, and the Rydberg states by 5–8 meV. The oscillator strengths change more. TDA is cheaper and more robust (no instabilities near triplet instabilities), and is often preferred for triplets and for excited-state surfaces.

3. Triplets

multiplicity: triplet (files/h2co_triplet.yaml).

What you should find
    1    0.11803114       3.21179      0.00000   occ 8 -> virt 1 (  1.128)
    2    0.19634453       5.34281      0.00000   occ 7 -> virt 1 (  1.400)

All triplets have \(f=0\). The \(n\to\pi^*\) triplet lies 0.8 eV below its singlet. The \(\pi\to\pi^*\) triplet, at 5.3 eV, lies more than 4 eV below its mixed singlet, because the exchange integral of two orbitals in the same region of space is large. Weights above 1 are the \(X+Y\) normalization of the RPA amplitudes mentioned above.

4. Grid convergence for Rydberg states

files/h2co_finegrid.yaml adds

mesh_default:
  lm: 35
  nrpt: 150
What you should find

The grid grows from 58 392 to 260 400 points. \(n\to\pi^*\) changes by 0.02 meV, the \(n\to3p\) state at 7.53 eV by 11 meV, and every root now agrees with PySCF on its finest grid to 1.5 meV.

Troubleshooting

  • The roots do not converge. Increase max_iter, or use solver: dense for small molecules.

  • Unexpected low roots in an open-shell molecule. A radical whose occupation breaks a spatial degeneracy has a soft mode, and its lowest RPA root is not meaningful (a warning is printed).

  • Not available. SIC, DFT+U, a level shift and meta-GGAs are refused.

  • Too many Rydberg states. If you want only valence states, use a basis without diffuse functions. You lose the Rydberg states, and with them the correct ordering of the spectrum above about 7 eV.

Next: Optical spectra from real-time TDDFT.