Hi,
I have a question regarding the eigendecomposition used in the psi4 code, and the resulting order of the eigenvectors. I would like to present my understanding of the code, and would very much appreciate it, if someone could correct my mistakes.

Psi4 constructs the Overlap matrix S, the one electron Matrix H, and the remaining parts needed for the Kohn-Sham Matrix/Fock-Matrix F.
Using S, F is converted to F_prime. The eigenvalues of F_prime are my orbital energies, and the eigenvectors form my C_prime matrix, which is converted to C using S^{-1/2}. The vectors in C are sorted according to their orbital energies, such that the density matrix is easily constructed considering the first N/2 entries. Now, using the new density matrix, the algorithm is repeated until convergence. The matrices C_prime, F, F_prime, S and H are never sorted. When C is printed to file, psi4 prints the sorted C matrix. Is that correct?

Do you care about the case of matrices with point group symmetry? The case of symmetry is a bit more complicated, and I’d like to know how much I need to check before I go looking at the code myself.

Hello jmisiewicz,
I would care for matrices with point group symmetry. However, I would already be very grateful, if you could hint me to the cc files I would need to check.

From my perspective, it looks like that most of the matrix multiplications and diagonalizations are handled by the BLAS library, and I actually did not find any code in psi4 which sorts the eigenvectors (but this might just be me, who has very little experience with the Psi4 source code). If I can recall correctly, BLAS does not guarantee any order. Hence, I would assume that psi4 takes over this policy. However, the case of the density matrix makes me a little bit suspicious.

Moreover, I just checked numpy today for the eigendecomposition, and I was almost certain that numpy does not order the eigenvectors according to the eigenvalues. Still, for my simple testcases, the eigh routine actually provided me sorted eigenvectors.

For symmetric matrices we use Lapack’s DSYEV that gives eigenvectors in ascending orders. Psi4 can swap it internally to descending order if needed.
It’s in sq_rsp.cc