## Solving SCF The secular equal: $HC=ESC$ Do some transformation, it can be turned into $H'C'=EC'$ where $C' = S^{\frac{1}{2}}C$ , $H' = S^{-\frac{1}{2}} H S^{-\frac{1}{2}}$, this is an eigenvector equation, so we can use scheme for eigenfunction solving. 1. Traditional diagonalization ($O(N^{3})$) - Cholesky decomposition \- main idea is turn $S$ into $U$ and $U^{T}$, upper and lower triangle matrix. \- Libraries available in CP2K. >[!Note] > Use pseudo diagonalization: transfer only a small part of the orbital following $KS$ (Kohn-Sham matrix) to MO basis, based on the fact that only occupied orbitals account for energy. - Diagonalization of $S$ is expensive - Could combine with [DIIS](https://en.wikipedia.org/wiki/DIIS) (direct inversion in the iterative subspace), define an error matrix, $e=HPS-SPH$ $e$ would be $0$ only if converge. This may act as an indicator to obtain better convergence. - One problem is, no electron is confined in orbitals, namely this method cannon properly define how electrons occupy orbitals. For metal, one could fill the orbital using [[Orbital, Fermi-Dirac distribution, DOS|Fermi-Dirac distribution]] to make it reasonable. 2. Orbital transformation - Relies on a direct minimization of the electronic energy functional. - If the energy is reduced in each step, convergence would be guaranteed. - Replace diagonalization by having matrix multiplications. - Good for large systems, use preconditioner (like known landscapes) to shorten. We can't directly minimize the energy cause the constraint by Pauli principle => orbitals have to be orthogonal. ($C^{T}SC$ gets constraints) This turns the problem into the minimization on an $M$ dimensional hypersphere. - Now one may use DIIS or [[General algorithm for locating minima and optimization|Quasi-Newton]] as the minimizer. >[!Problem] > It (the energy) only depends on occupied orbitals. If I want to understand the unoccupied orbitals, I have to do diagonalization. This is a big problem when unoccupied orbitals get involved, e.g., optics, or have excited state involved. >[!Note]- >Purification method: use to ensure the density matrix $P$ maintains physical significance, i.e. all elements are positive, and trace is the number of electrons.