Skip to content

Integrals

Almost every electronic-structure method in TeraChem — Hartree–Fock, DFT, CASSCF, coupled cluster — is dominated by the two-electron repulsion integrals (ERIs) over the atom-centered Gaussian basis functions,

\[ (\mu\nu|\lambda\sigma) = \iint \phi_\mu(\mathbf{r}_1)\phi_\nu(\mathbf{r}_1) \frac{1}{|\mathbf{r}_1-\mathbf{r}_2|} \phi_\lambda(\mathbf{r}_2)\phi_\sigma(\mathbf{r}_2)\, \mathrm{d}\mathbf{r}_1\,\mathrm{d}\mathbf{r}_2 . \]

There are formally \(O(N^4)\) of these for \(N\) basis functions, and forming the Coulomb (J) and exchange (K) matrices from them is the rate-limiting step of most calculations. TeraChem offers three strategies for handling the ERI tensor, each documented on its own page:

Strategy Page Idea Formal scaling When to use
Exact 4-center ERIs Exact 4-Center ERIs Recompute the exact integrals on the GPU every SCF iteration (integral-direct), with Schwarz screening and mixed precision \(O(N^4)\), empirically ~\(O(N^2)\) with screening The default; most robust and accurate. Best for very large systems where DF's dense linear algebra would dominate.
Density fitting (RI) Density Fitting (RI) Approximate the 4-center ERI as a product of 3-center tensors using an auxiliary basis unchanged asymptotically, much smaller prefactor Small-to-medium systems (~100 atoms / up to ~2000 basis functions) with large AO basis sets, where the prefactor reduction wins.
Tensor hypercontraction (THC) Tensor Hypercontraction (THC) Factorize the ERI into five 2-index matrices, fully unpinning the four AO indices reduces \(O(N^4)\to O(N^3)\) (empirically ~\(O(N^2)\) Fock builds) Accelerating SCF (scf thcsadscf) and correlated methods (thc_method) at lower scaling.

All three are implemented on the GPU and share the same underlying integral engine: two- and three-center integrals are evaluated with the McMurchie–Davidson algorithm in CUDA kernels that are generated from symbolic-mathematics meta-programming (the codegen/SymPy machinery), screened with the Schwarz inequality, and contracted into Fock-like matrices.

These approximations only change how the ERIs are handled; the resulting J and K matrices feed the same SCF, CASSCF, and coupled-cluster machinery regardless of which strategy is selected.