Tensor Hypercontraction (THC)
Tensor hypercontraction (THC) is the most aggressive of TeraChem's ERI-compression schemes. Where density fitting factorizes the four-center integral into two three-center tensors, THC goes one step further and factorizes it into a product of five two-index matrices, fully unpinning all four atomic orbital indices:
Here the \(\mathbf{X}\) factors are collocation matrices — basis functions evaluated on a real-space quadrature grid, \(X^P_\mu = (\omega_P)^{1/4}\phi_\mu(\mathbf{r}_P)\) — and \(\mathbf{Z}\) is a small central "core" matrix that carries the electron–electron interaction. Because every AO index now appears in a separate 2-index factor, the ERI storage drops to \(O(N^2)\) and individual indices can be contracted independently, which lets the formal scaling of many steps fall from \(O(N^4)\) to \(O(N^3)\) while preserving the permutational symmetry of the ERIs.
How the factors are built (LS-THC)
TeraChem uses least-squares tensor hypercontraction (LS-THC). The grid points
and the collocation matrices \(\mathbf{X}\) are defined on an atom-centered,
Becke-type quadrature grid (pruned, with weights folded into the collocation
factors) — either a dedicated THC grid or the same molecular
DFT integration grid used for the XC
quadrature, selected with thcfitbox_grid. The central matrix \(\mathbf{Z}\) is then obtained by an analytical
least-squares formula that renormalizes the spatial quadrature against the singular
\(1/r_{12}\) operator — there is no iterative fitting, which is what makes analytic
gradients and response properties tractable.
Constructing \(\mathbf{Z}\) by the standard LS-THC route scales as \(O(N^5)\) from exact integrals, or \(O(N^4)\) from density-fitted integrals — i.e. more expensive than an SCF iteration, which would defeat the purpose. TeraChem's production implementation removes this bottleneck by instead fitting the central metric to two-center integrals in an auxiliary basis, giving an \(O(N^3)\) THC construction, and it uses a numerically stable linear solver (an LQ decomposition) in place of the pseudoinversion used in earlier LS-THC work. To preserve accuracy, the THC integrals are combined with a density-difference SCF ansatz: the SCF is started with a SAD guess and a few full-precision conventional iterations until the energy change falls below \(0.1\,E_h\), after which that density is taken as the reference and the THC integrals are used for the remaining iterations.
What THC accelerates in TeraChem
THC is used in two distinct contexts, each turned on differently:
- THC-SCF — accelerating the Hartree–Fock and DFT Fock build. Selected with the
SCF mode
scf thcsadscf. Both the THC-J and THC-K builds have \(O(N^3)\) formal scaling (empirically ~\(O(N^2)\)), giving 2–4× faster SCF iterations than the integral-direct scheme for large systems — the bulk of the speedup coming from the exchange (K) build, whose conventional GPU implementation is the bottleneck. Demonstrated on systems up to ~5000 basis functions on a single GPU, with relative energy errors below 1 kcal/mol. - THC-accelerated correlated methods — selected with
thc_method, which applies THC to post-SCF correlation:mp2,sosmp2,caspt2/mspt2/xmspt2,cc2,eom_cc2, and others. THC reduces the scaling of these methods (e.g. MP2 from \(O(N^5)\) to \(O(N^4)\), MP3 from \(O(N^6)\) to \(O(N^4)\)). The related THC-CCSD method is documented under Coupled Cluster.
Accuracy and cost trade-offs
THC is an approximation layered on the grid and the central-metric fit, so its error depends on the quadrature grid and the auxiliary basis used for the metric fit. In practice LS-THC achieves chemical accuracy with the standard grids, and the THC-SCF density-difference scheme keeps relative energies below 1 kcal/mol. As with density fitting, the current implementation uses dense linear algebra (it does not yet exploit integral screening, density sparsity, or mixed precision), so it is most beneficial in the medium-to-large regime where the lower scaling of the K build dominates; very large, sparse systems may still favor the integral-direct exact-ERI approach.
Keywords
Essential
| Keyword | Type | Default | Description |
|---|---|---|---|
scf |
string | diis |
Set to thcsadscf to run THC-accelerated SCF (THC J/K Fock builds). |
thc_method |
string | — | Apply THC to a correlated method: mp2, sosmp2, caspt2, mspt2, xmspt2, cc2, eom_cc2, … |
thc_grid |
string | internal | Name of the atom-centered quadrature grid used to build the collocation factors. |
thcgrid_format |
string | — | Grid file/format: handy, standard, rbf, or file. |
Fitting thresholds and resources (advanced)
| Keyword | Type | Default | Description |
|---|---|---|---|
thc_pqthre / thc_pq_inv_thre |
float | internal | Thresholds controlling the THC metric and its (pseudo)inversion. |
thc_df_inv_thre |
float | internal | Inversion threshold for the density-fitting step used in the metric fit. |
thc_gpumem_mb / thc_cpumem_gb |
int | internal | GPU/CPU memory budgets (MB/GB) for the THC tensors. |
thc_print_level |
int | internal | Verbosity of THC output. |
There is a larger family of thc_* keywords for fine control of the grid,
factorization, and memory layout; the defaults are appropriate for most use.
References
- E. G. Hohenstein, R. M. Parrish, and T. J. Martínez, "Tensor hypercontraction density fitting. I. Quartic scaling second- and third-order Møller–Plesset perturbation theory," J. Chem. Phys. 137, 044103 (2012). doi:10.1063/1.4732310
- R. M. Parrish, E. G. Hohenstein, T. J. Martínez, and C. D. Sherrill, "Tensor hypercontraction. II. Least-squares renormalization," J. Chem. Phys. 137, 224106 (2012). doi:10.1063/1.4768233
- A. E. Hillers-Bendtsen and T. J. Martínez, "Accelerating Hartree–Fock and Density Functional Theory Calculations Using Tensor Hypercontraction," J. Chem. Theory Comput. 21, 11595–11603 (2025). doi:10.1021/acs.jctc.5c01421