where |n⟩ = (â † ) n √ n! |0⟩ is the cavity Fock state. The HF equations can be solved through iterative diagonalization, and at each iteration the HF electronic molecular orbitals are updated and are used to evaluate the shift Z expressed in Eq. 121. The Fock matrix can be written explicitly as