Coulomb and Exchange Methods in cuEST#

The two-electron contributions to the Fock matrix, the Coulomb matrix \(J\) and the exchange matrix \(K\), and the nuclear gradients of the corresponding energies, dominate the cost of Hartree–Fock and hybrid-DFT calculations. cuEST offers more than one way to build them, each with its own accuracy, scaling, memory footprint and hardware profile. This page compares the methods so that an application can choose the right one for a given problem; each method is described in detail on its own page, linked from the overview below.

Overview#

  • Integral-direct 4-center J and K evaluate the exact electron repulsion integrals on the fly and contract them with the density immediately. No integrals are stored, and the only approximation is a user-controlled integral screening threshold.

  • Density fitting (DF) expands products of basis functions in an auxiliary basis and reduces the four-center integrals to two- and three-center quantities. Its plan stores the fitted three-index integrals on the GPU.

  • Direct DF J is the density-fitted Coulomb matrix with the three-center integrals recomputed on the fly instead of stored. It is selected by creating the DF plan with CUEST_DFINTPLAN_PARAMETERS_THREE_INDEX_INTEGRAL_DIRECT set. The plan then serves the Coulomb matrix and the Coulomb-only gradient; exchange requires the stored tensor. The parameter is documented with the DF plan.

  • Grid-based exchange (Grid-K) replaces one of the two integrations in the exchange integral by a quadrature on the DFT molecular grid, optionally with an overlap fit of the collocation. It builds exchange only; the Coulomb matrix comes from one of the other routes.

Recommendations#

The DF J/K methods are preferred for molecules with roughly 200 atoms or less in a double-zeta quality basis set (with larger basis sets, the system size recommendation becomes smaller). DF J/K provides high efficiency, highly accurate relative properties (reaction energies, barrier heights, etc.) and a smooth potential surface for geometry optimizations, transition state searches, etc. In cases where larger molecules are of interest or integral approximation error cannot be tolerated, consider switching to integral-direct J/K builds. This algorithm makes efficient use of sparsity in the AO basis and in the density matrix, so it will be most efficient in smaller, compact basis sets – roughly double-zeta quality or below. For larger molecules and larger basis sets (triple-zeta and above), Grid-K (including symmetric orthogonal overlap fitting) is recommended. This method must be paired with a Coulomb build. For higher accuracy, consider using integral-direct J builds; for improved efficiency under 1000 atoms (with some fitting error), consider direct DF J. Grid-K is less reliant on spatial sparsity for efficiency and the quality of the overlap fitting improves systematically with larger basis sets. We also recommend implementing the Compensated Grid-K algorithm described in the Grid-K page. Finally, we recommend Direct DF J for use with pure functionals where hybrid exchange is not required.

Comparison#

Integral-direct 4-center

Density fitting

Direct DF J

Grid-K

Approximation

None beyond integral screening; the density-weighted Schwarz threshold bounds each neglected contribution (default 10-13, 0 disables screening).

Auxiliary-basis fit of orbital products; error set by the auxiliary basis, typically 10-5 Eh per atom in total energies with standard fitting sets.

Same density-fitting approximation and accuracy as the stored-tensor DF plan, for the Coulomb matrix only.

Numerical quadrature of one electron coordinate, for the exchange matrix only; error set by the molecular grid, the optional collocation fit and analytic corrections applied by the user.

Formal scaling

\(O(N^4)\) without screening; asymptotically \(O(N^2)\) for large systems with screening.

\(J\): \(O(N^2 N_{\rm aux})\); \(K\): \(O(N^2 N_{\rm occ} N_{\rm aux})\). \(N_{\rm aux}\) is typically 3 to 5 times \(N\).

\(O(N^2 N_{\rm aux})\) per call, the three-center integrals being recomputed each time.

\(O(N^3)\) without screening. Asymptotically \(O(N^2)\) for large systems with sparsity.

GPU memory

Low: the plan holds per-pair screening data; the compute routines need the input and output matrices plus a temporary workspace.

High: the plan holds the fitted three-index tensor, \(O(N_{\rm pair} N_{\rm aux})\).

Low: no three-index tensor; the plan holds the fitting metric, \(O(N_{\rm aux}^2)\).

Low (user specified): User specifies the amount of temporary space to use in the exchange build; performance may be affected if not enough memory is available.

Plan inputs

Primary basis, pair list.

Primary basis, auxiliary basis, pair list.

Primary basis, auxiliary basis, pair list; plan parameter THREE_INDEX_INTEGRAL_DIRECT set.

Molecular grid, one-electron integral plan (constructed from a primary basis and pair list).

Coulomb matrix

Yes.

Yes.

Yes.

No; use one of the other routes.

Exchange matrix

Symmetric densities.

Symmetric and nonsymmetric densities.

No; use one of the other routes.

Symmetric and nonsymmetric densities.

Range-separated exchange

Yes, full-range and long-range fractions with \(\omega\) on the plan.

Yes, full-range and long-range fractions with \(\omega\) on the plan.

Not applicable (Coulomb only).

Yes, full-range and long-range fractions with \(\omega\) on the plan.

Analytical nuclear gradients

Yes: separate \(J\) and \(K\) gradients, each for a batch of densities, plus the gradients of the bilinear forms in two densities.

Yes: one routine returns the combined \(J\)/\(K\) gradient of a symmetric density.

Yes: the Coulomb-only gradient (zero exchange fraction) through the same routine.

Yes: \(K\) gradient for symmetric densities.

Batched densities

A batch of numDensityMatrices densities per call.

One density matrix per call; the gradient routine accepts several coefficient matrices.

One density matrix per call.

A batch of numDensityMatrices densities per call.

JIT compilation

Yes: all routines are JIT-specialized to the basis set by default with CUDA 13; a precompiled path is the only option with CUDA 12. Compile times are tabulated on the integral-direct J/K page.

Optional: the Coulomb and gradient routines have JIT-specialized kernels (default on with CUDA 13).

Optional: the Coulomb and gradient routines have JIT-specialized kernels (default on with CUDA 13).

No JIT.

Emulation of FP64

Not for now; the kernels run in native FP64 and are recommended for GPUs with full-rate FP64.

Exchange: GEMM-based emulation (Ozaki scheme) on hardware with fast low-precision tensor cores. Coulomb and gradient: float-float scalar emulation.

Coulomb and gradient: float-float scalar emulation.

Not for now; the kernels run in native FP64 and are recommended for GPUs with full-rate FP64.

Strengths

Exact to the screening threshold; efficient for small basis sets; scales up to large systems.

Efficient for small molecules; well-characterized error; both small and large basis sets; analytical gradients; efficient on RTX cards through emulation.

Well-characterized error; scales up to medium-size molecules without the three-index tensor; efficient on RTX cards through emulation.

Efficient for large molecules and large basis sets; error systematically controlled by the molecular grid; symmetric orthogonalized overlap fit improves accuracy in large basis sets.

Limitations

Slow for large and diffuse basis sets; high overhead for small molecules; not yet emulated (native FP64).

Approximate, not exact: the fitting error is set by the auxiliary basis; the stored three-index tensor limits the molecule size.

Approximate, not exact: the same fitting error; the three-center integrals are recomputed on every call.

Approximate, not exact: the quadrature error is set by the grid; not yet emulated (native FP64).

API reference

Direct plan, Coulomb, Exchange, J/K gradient

DF plan, Coulomb, Exchange, J/K gradient, MO integrals

DF plan, Coulomb, J/K gradient

Grid-K plan, Exchange, J/K gradient

Together these routes provide a menu of options to mitigate the all-important cost of the J and K matrices and their gradients. They share the primary basis, pair list and density conventions, and all of them define range-separated exchange the same way, as a plan-level combination of full-range and long-range fractions, so an application can construct several plans and move between them without changing how it specifies the exchange operator or builds the Fock matrix. In particular, Grid-K can be combined with integral-direct J or with direct DF J to build the Coulomb matrix.