This is a follow-up question to this one I asked a few days ago. I in the meantime talked to my teacher and generate all the necessary integrals in PySCF. For the one electron integrals that isn't an issue since It's a simple $n^2$ matrix that's being returned. This is my code for the one electron integrals

from pyscf import gto

mol = gto.M(atom="Ne 0 0 0", basis="STO-3G")
S = mol.intor("int1e_ovlp", hermi=1)
T = mol.intor("int1e_nuc", hermi=1)
K = mol.intor("int1e_kin", hermi=1)

I calculate the two electron integrals this way

EE = mol.intor("int2e")

Here now comes the problem. I can't quite figure out how to retrieve the necessary integrals for a certain element in the fock matrix. While working on restricted hartree fock theory in my paper I defined one element of the fock matrix as $$F_{\mu \nu } = H_{\mu \nu }^{core} + \sum_{\lambda = 1}^{K} \sum_{\sigma = 1}^{K} P_{\lambda \sigma} \left( \left( \mu \sigma \mid \hat{h}_{2} \mid \nu \lambda \right) - \frac{1}{2} \left( \mu \sigma \mid \hat{h}_2 \mid \lambda \nu \right) \right),$$


$$ P_{\lambda \sigma} = 2 \sum_{c=1}^{N/2} C_{\lambda c} C_{\sigma c}^{*}. $$

The $H_{\mu \nu }^{core}$ part isn't an issue since that would just be a sum of my T- and K-matrix. But how do I find the right integrals to use as $\left( \mu \sigma \mid \hat{h}_{2} \mid \nu \lambda \right)$ and $\left( \mu \sigma \mid \hat{h}_2 \mid \lambda \nu \right)$ in the EE-matrix?

Can anyone explain the structure of the matrix to me that is returned by pyscf?

  • $\begingroup$ The integrals are prob. just what you expect. They have the dimension of (number_AOs, number_AOs, number_AOs, number_AOs). To get your two-electron contribution you do what your equation tells you to do. Multiply the integrals with the density matrix (P), which will then give you a new matrix that has the dimension (number_AOs, number_AOs). This is also what is called a tensor-contraction. $\endgroup$ Aug 22, 2022 at 22:45
  • $\begingroup$ I spend a little time looking around for resources that are very practical about how to do the implementation in Python. You should take a look at this link, pycrawfordprogproj.readthedocs.io/en/latest/Project_03/… $\endgroup$ Aug 22, 2022 at 22:47