# PySCF: 2-index and 3-index matrix

The 4-index 2-electron integral can be obtained for the He atom with the following code:

import numpy as np
from pyscf import gto, scf, ao2mo

mol = gto.Mole()
mol.atom = """
He    0.    0.    0.
"""
mol.basis = "cc-pvdz"
mol.build()

# Run Hartree-Fock.
mf = scf.RHF(mol)
mf.kernel()

# Find electron-repulsion integrals (eri).
eri = ao2mo.kernel(mol, mf.mo_coeff)
eri = np.asarray(ao2mo.restore(1, eri, mol.nao))


I am interested in obtaining the 2-index (A) and 3-index (CIAB) matrices, which can be used to form the 4-index 2-electron (eri) integral. I have looked at the list of possible means by which this is accomplished in PySCF code; however, I am unsure of the correct answer.

• +1. "I have looked at the list of possible means by which this is accomplished in PySCF code" -- What are the possible means? Oct 2, 2020 at 18:04

## 1 Answer

In the density fitting / resolution-of-the-identity (RI) formalism, a two-electron integral $$(ij|kl)$$ in the atomic-orbital basis is approximated as $$(ij|kl) \approx \sum_{PQ} (ij|P) (P|Q)^{-1} (Q|kl)$$ where $$P$$ and $$Q$$ are auxiliary functions, and $$(P|Q)^{-1}$$ is the inverse Coulomb overlap matrix.

The RI expression can be written in a form that resembles the Cholesky expression $$(ij|kl) = \sum_P L_{ij}^P L_{kl}^P$$ by introducing the "B matrix" $$B_{ij}^Q = \sum_P (ij|P) (P|Q)^{-1/2}$$. With the B-matrix, you get the integral as $$(ij|kl) \approx \sum_Q B_{ij}^Q B_{kl}^Q$$. Using this form is convenient since you can use the same implementations for both Cholesky and RI.

The density fitting code in PySCF is documentated: https://pyscf.org/user/df.html

The pyscf.df.incore.cholesky_eri function returns 2D array of (naux,nao*(nao+1)/2) in C-contiguous. This is the $$B$$ matrix.

• Seems like the link provided above is broken. Could you provide the correct link, please? May 13, 2023 at 15:58
• The link was correct at the time of writing the answer in late 2020. I have updated the link. May 15, 2023 at 7:25