x + E x . In the ground state, only the secondorder exchange energy contributes to the total energy (i.e., only the DSE term) The electron-photon exchange energy E x = σ i (E x ) iσ can be written purely as a functional of the KS orbitals {ϕ iσ } and two orbital shifts {Φ (1) iσ } and {Φ (2) iσ } (to be interpreted as the KS orbital response to the cavity field) as,