The first term is the PT2 Lagrangian, which is explicitly dependent on MOs for state γ, whereas the second term, which is added only for XMS-, XDW-, and RMS-CASPT2 and -RASPT2, is the constraint condition for the rotation of reference states (Eq. ( )). The first term in Eq. ( ) is explicitly written as