Complex orbital optimization through real parameters
If we write the orbital rotation generator as \[\begin{equation} \require{physics} \hat{\kappa} = \sum_{P>Q}^M {}^{\text{R}}{ \kappa_{PQ} } \hat{E}^-_{PQ} + i \qty( \sum_{P}^M {}^{\text{I}} { \kappa_{PP} } \hat{N}_P + \sum_{P>Q}^M {}^{\text{I}}{ \kappa_{PQ} } \hat{E}^+_{PQ} ) \thinspace , \end{equation}\] using the unconstrained real parameters \(\{ {}^{\text{R}}{ \kappa_{PQ} }, {}^{\text{I}} { \kappa_{PP} }, {}^{\text{I}}{ \kappa_{PQ} }\}\), the energy expanded up to second order becomes: \[\begin{equation} \begin{split} & E(\boldsymbol{\kappa}) = \ev{ \hat{\mathcal{H}} }{\Psi} \\ & \hspace{3pt} + \sum_{P>Q}^M {}^{\text{R}}{ \kappa_{PQ} } \ev{ \comm*{ \hat{E}^-_{PQ} }{ \hat{\mathcal{H}} } }{\Psi} + i \sum_{P}^M {}^{\text{I}}{ \kappa_{PP} } \ev{ \comm*{ \hat{N}_P }{ \hat{\mathcal{H}} } }{\Psi} \\ & \hspace{3pt} + i \sum_{P>Q}^M {}^{\text{I}}{ \kappa_{PQ} } \ev{ \comm*{ \hat{E}^+_{PQ} }{ \hat{\mathcal{H}} } }{\Psi} \\ & \hspace{3pt} + \frac{1}{2} \sum_{P>Q}^M \sum_{R>S}^M {}^{\text{R}}{ \kappa_{PQ} } {}^{\text{R}}{ \kappa_{RS} } \ev{ \comm*{ \hat{E}^-_{PQ} }{ \comm*{ \hat{E}^-_{RS} }{ \hat{\mathcal{H}} } } }{\Psi} \\ & \hspace{3pt} + \frac{i}{2} \sum_{P>Q}^M \sum_{R}^M {}^{\text{R}}{ \kappa_{PQ} } {}^{\text{I}}{ \kappa_{RR} } \qty( \ev{ \comm*{ \hat{E}^-_{PQ} }{ \comm*{ \hat{N}_{R} }{ \hat{\mathcal{H}} } } }{\Psi} + \ev{ \comm*{ \hat{N}_{R} }{ \comm*{ \hat{E}^-_{PQ} }{ \hat{\mathcal{H}} } } }{\Psi} ) \\ & \hspace{3pt} + \frac{i}{2} \sum_{P>Q}^M \sum_{R>S}^M {}^{\text{R}}{ \kappa_{PQ} } {}^{\text{I}}{ \kappa_{RS} } \qty( \ev{ \comm*{ \hat{E}^-_{PQ} }{ \comm*{ \hat{E}^+_{RS} }{ \hat{\mathcal{H}} } } }{\Psi} + \ev{ \comm*{ \hat{E}^+_{RS} }{ \comm*{ \hat{E}^-_{PQ} }{ \hat{\mathcal{H}} } } }{\Psi} ) \\ & \hspace{3pt} - \frac{1}{2} \sum_{PQ}^M {}^{\text{I}}{ \kappa_{PP} } {}^{\text{I}}{ \kappa_{QQ} } \ev{ \comm*{ \hat{N}_P }{ \comm*{ \hat{N}_{Q} }{ \hat{\mathcal{H}} } } }{\Psi} \\ & \hspace{3pt} - \frac{1}{2} \sum_{P>Q}^M \sum_{R}^M {}^{\text{I}}{ \kappa_{PQ} } {}^{\text{I}}{ \kappa_{RR} } \qty( \ev{ \comm*{ \hat{E}^+_{PQ} }{ \comm*{ \hat{N}_{R} }{ \hat{\mathcal{H}} } } }{\Psi} + \ev{ \comm*{ \hat{N}_{R} }{ \comm*{ \hat{E}^+_{PQ} }{ \hat{\mathcal{H}} } } }{\Psi} ) \\ & \hspace{3pt} - \frac{1}{2} \sum_{P>Q}^M \sum_{R>S}^M {}^{\text{I}}{ \kappa_{PQ} } {}^{\text{I}}{ \kappa_{RS} } \ev{ \comm*{ \hat{E}^+_{PQ} }{ \comm*{ \hat{E}^+_{RS} }{ \hat{\mathcal{H}} } } }{\Psi} \thinspace . \end{split} \end{equation}\]
The orbital gradient is the vector of the first derivatives with respect to the orbital rotation generators. We will define it as: \[\begin{equation} \eval{ \pdv{ E(\boldsymbol{\kappa}) }{ \boldsymbol{\kappa} } }_{ \boldsymbol{\kappa}_0 } = \begin{pmatrix} \eval{ \displaystyle \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{R}}{\boldsymbol{\kappa}} } }_{ \boldsymbol{\kappa}_0 } \\ \eval{ \displaystyle \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\boldsymbol{\kappa}} } }_{ \boldsymbol{\kappa}_0 } \end{pmatrix} \thinspace , \end{equation}\] which is a vector of \(M^2\) entries. (As for the ordering of the elements of the orbital gradient, we usually construct the constituent elements related to \({}^{\text{R}}{\boldsymbol{\kappa}}\) and \({}^{\text{I}}{\boldsymbol{\kappa}}\) in column-major vectors and then concatenate them into the larger, full orbital gradient.) In order to calculate these derivatives, we may use the theory of Fockians. For the part of the orbital gradient related to \({}^{\text{R}}{\boldsymbol{\kappa}}\), we find (\(P>Q\)): \[\begin{equation} \eval{ \displaystyle \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{R}}{\kappa}_{PQ} } }_{ \boldsymbol{\kappa}_0 } = (1 - P_{PQ}) \qty[ \mathscr{F}_{PQ}( \hat{\mathcal{H}} ) - \mathscr{F}_{QP}^*( \hat{\mathcal{H}} ) ] \thinspace . \end{equation}\] For the part related to the diagonal elements of \({}^{\text{I}}{\boldsymbol{\kappa}}\) we have: \[\begin{equation} \eval{ \displaystyle \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\kappa}_{PP} } }_{ \boldsymbol{\kappa}_0 } = i \qty[ \mathscr{F}_{PP}( \hat{\mathcal{H}} ) - \mathscr{F}^*_{PP}( \hat{\mathcal{H}} ) ] \end{equation}\] and for those related to the strict lower triangle of \({}^{\text{I}}{\boldsymbol{\kappa}}\), we find \((P>Q)\): \[\begin{equation} \eval{ \displaystyle \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\kappa}_{PQ} } }_{ \boldsymbol{\kappa}_0 } = i (1 + P_{PQ}) \qty[ \mathscr{F}_{PQ}( \hat{\mathcal{H}} ) - \mathscr{F}_{QP}^*( \hat{\mathcal{H}} ) ] \thinspace . \end{equation}\] In general, we can see that the orbital gradient is related to the anti-Hermitian part of the Fock matrix, which means that the orbital gradient will vanish if the Fockian is Hermitian.
The orbital Hessian can be constructed as the matrix of the second-order derivatives with respect to the orbital rotation generators: \[\begin{equation} \eval{ \pdv[2]{ E(\boldsymbol{\kappa}) }{ \boldsymbol{\kappa} } }_{ \boldsymbol{\kappa}_0 } = \begin{pmatrix} \eval{ \displaystyle \pdv[2]{ E(\boldsymbol{\kappa}) }{ {}^{\text{R}}{\boldsymbol{\kappa}} } }_{ \boldsymbol{\kappa}_0 } & \eval{ \displaystyle \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{R}}{\boldsymbol{\kappa}} }{ {}^{\text{I}}{\boldsymbol{\kappa}} } }_{ \boldsymbol{\kappa}_0 } \\ \eval{ \displaystyle \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\boldsymbol{\kappa}} }{ {}^{\text{R}}{\boldsymbol{\kappa}} } }_{ \boldsymbol{\kappa}_0 } & \eval{ \displaystyle \pdv[2]{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\boldsymbol{\kappa}} } }_{ \boldsymbol{\kappa}_0 } \end{pmatrix} \thinspace , \end{equation}\] which is a matrix of \(M^4\) elements. The constituent matrix blocks can then be calculated using the following expressions. For the real part, we have (\(P>Q, R>S\)): \[\begin{equation} \eval{ \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{R}}{\kappa_{PQ}} }{ {}^{\text{R}}{\kappa_{RS}} } }_{ \boldsymbol{\kappa}_0 } = \frac{1}{2} (1 + P_{PQ,RS}) (1 - P_{PQ}) (1 - P_{RS}) \qty[ \mathscr{G}_{PQRS}(\hat{\mathcal{H}}) + \mathscr{G}^*_{QPSR}(\hat{\mathcal{H}}) ] \thinspace . \end{equation}\] For the real-diagonal (imaginary) part, we have (\(P>Q\)) \[\begin{equation} \eval{ \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{R}}{\kappa_{PQ}} }{ {}^{\text{I}}{\kappa_{RR}} } }_{ \boldsymbol{\kappa}_0 } \\ = \frac{i}{2} (1 + P_{PQ,RR}) (1 - P_{PQ}) \Big[ \mathscr{G}_{PQRR}(\hat{\mathcal{H}}) + \mathscr{G}^*_{QPRR}(\hat{\mathcal{H}}) \Big] \end{equation}\] and for the real-off-diagonal imaginary part (\(P>Q, R>S\)): \[\begin{equation} \eval{ \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{R}}{\kappa_{PQ}} }{ {}^{\text{I}}{\kappa_{RS}} } }_{ \boldsymbol{\kappa}_0 } = \frac{i}{2} (1 + P_{PQ,RS}) (1 - P_{PQ}) (1 + P_{RS}) \qty[ \mathscr{G}_{PQRS}(\hat{\mathcal{H}}) + \mathscr{G}^*_{QPSR}(\hat{\mathcal{H}}) ] \thinspace . \end{equation}\]
For the (imaginary) diagonal part, we find: \[\begin{equation} \eval{ \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\kappa_{PP}} }{ {}^{\text{I}}{\kappa_{QQ}} } }_{ \boldsymbol{\kappa}_0 } = - \frac{1}{2} (1 + P_{PQ}) \qty[ \mathscr{G}_{PPQQ}(\hat{\mathcal{H}}) + \mathscr{G}^*_{PPQQ}(\hat{\mathcal{H}}) ] \thinspace . \end{equation}\]
For the off-diagonal imaginary - (imaginary) diagonal part, we have (\(P>Q\)): \[\begin{equation} \eval{ \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\kappa_{PQ}} }{ {}^{\text{I}}{\kappa_{RR}} } }_{ \boldsymbol{\kappa}_0 } = - \frac{1}{2} (1 + P_{PQ,RR}) (1 + P_{PQ}) \qty[ \mathscr{G}_{PQRR}(\hat{\mathcal{H}}) + \mathscr{G}^*_{QPRR}(\hat{\mathcal{H}}) ] \end{equation}\] and, finally, for the off-diagonal imaginary part, we find (\(P>Q, R>S\)): \[\begin{equation} \eval{ \pdv{ E(\boldsymbol{\kappa}) }{ {}^{\text{I}}{\kappa_{PQ}} }{ {}^{\text{I}}{\kappa_{RS}} } }_{ \boldsymbol{\kappa}_0 } = - \frac{1}{2} (1 + P_{PQ,RS}) (1 + P_{PQ}) (1 + P_{RS}) \qty[ \mathscr{G}_{PQRS}(\hat{\mathcal{H}}) + \mathscr{G}^*_{QPSR}(\hat{\mathcal{H}}) ] \thinspace . \end{equation}\]
In the case of (G)HF, these formulas simplify considerably.