I am interested in calculating the Fock matrix in the molecular orbital basis with PySCF, though I am not clear on the methodology behind this task.

In my attempt, I use the following script (for the example H$_{2}$ molecule):

from pyscf import gto, scf
geometry = '''
    H   0.000   0.000   0.000
    H   0.000   0.000   0.740
mol = gto.Mole()
mol.atom = geometry
mol.basis = '3-21g'
mf = scf.RHF(mol)
Fao = mf.get_fock()
Fmo = mf.mo_coeff.T @ Fao @ mf.mo_coeff

In this method, I first calculate the molecular mean-field. I then do matrix multiplication with the molecular coefficient transpose matrix (mf.mo_coeff.T), the Fock matrix in the atomic basis (Fao) and the molecular orbital coefficients (mf.mo_coeff).

The resulting off-diagonal matrix elements are essentially zero for the H$_{2}$ molecule and other larger systems taken to 10 decimal places (CH$_{4}$, NH$_{3}$, H$_{2}$O). This has confused me: I have seen other Fock matrices in the molecular orbital basis with off-diagonal elements present.

I am therefore looking for confirmation of my method, and if there is a better way of doing this task?

  • 6
    $\begingroup$ The fock matrix should be diagonal. The diagonal elements are the orbital energies, no? $\endgroup$
    – Cody Aldaz
    Jul 16, 2020 at 21:55
  • 4
    $\begingroup$ As Cody said, the MO Fock matrix is always diagonal. The MOs are the eigenvectors of the Fock matrix. $\endgroup$
    – Tyberius
    Jul 16, 2020 at 23:54
  • 1
    $\begingroup$ I think Cody or Tyberius can convert their comment into an answer and we can mark this question as "solved". Unless you want to show us the example to which you refer when you say: "I have seen other Fock matrices in the molecular orbital basis with off-diagonal elements present." $\endgroup$ Jul 17, 2020 at 3:47

1 Answer 1


For canonical MOs, it is expected that the off-diagonal elements of the described product with the Fock matrix are zero (within reasonable accuracy) because they are the result of the diagonalization of the Fock matrix.

However, canonical MOs are not the only possible choice. One can "rotate" the MOs to minimize certain metrics in order to obtain, for instance, localized MOs (LMO). Such rotations will keep the total energy and the electron density intact, but will disallow the interpretation of the diagonal values of the Fock matrix (represented in the LMO basis) as orbital energies.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .