Skip to content

Coulomb backends¤

Two-electron strategies as values. Each knob lives on the backend it configures; inert combinations raise at the factory. Density fitting is the default (df() = def2-universal-jkfit with the chunk="auto", device-aware memory policy, auxiliary functions up to i, and a spherical auxiliary span on the materialized path; see df(spherical=...)); exact() is the O(N⁴) reference path. Range-separated hybrids run on every DF backend, materialized, streamed, or mesh-sharded. The Coulomb backends tutorial has the backend-choice table.

dftax.ks.terms.exact(*, screen: float | None = None, stream: bool = False) -> ExactSpec ¤

Exact 4-center ERI Coulomb/exchange (small systems; O(N⁴) memory).

Parameters:

Name Type Description Default
screen float | None

optional Cauchy-Schwarz threshold; negligible ERI quartets are skipped when materializing the tensor.

None
stream bool

contract J/K on the fly instead of materializing the ERI tensor (O(N²) memory, slower; incompatible with screen).

False

dftax.ks.terms.df(auxbasis: str | BasisData = 'def2-universal-jkfit', *, chunk: int | str | None = 'auto', screen: float | str | None = 'auto', spherical: bool | None = None, whiten: bool | None = None, packed: bool | str = 'auto') -> DFSpec ¤

Density-fitted (RI) Coulomb/exchange with the given auxiliary basis.

This is the KS default backend (O(N³) memory; RI error sub-mHa with a JK-fitting set); :func:exact remains available for small systems and reference comparisons.

Parameters:

Name Type Description Default
auxbasis str | BasisData

JK-fitting auxiliary basis name (default "def2-universal-jkfit", the universal set covering any orbital basis), or an already built BasisData.

'def2-universal-jkfit'
chunk int | str | None

RI memory strategy. "auto" (default) materializes the nao²×naux 3-center tensor when it fits a memory budget and otherwise streams RI-J/RI-K over budget-derived auxiliary chunks; None forces the materialized tensor; an int streams with exactly that chunk.

'auto'
screen float | str | None

relative Cauchy-Schwarz threshold dropping negligible bra pairs (survivors are O(N) for extended systems). On the materialized path it is a shell-pair compact gather that omits the screened shell-pairs from the 3-center build (they stay exactly zero); with an int chunk it restricts the streamed RI-J bra sum to the significant AO pairs. None keeps every pair, a bit-identical build. "auto" (default) screens at DF_SCREEN_AUTO_CUTOFF from DF_SCREEN_AUTO_MIN_ATOMS atoms up (the grid's gate) and keeps every pair below it; batched geometries (scf_batched) never screen.

'auto'
spherical bool | None

auxiliary basis span. None (default) uses spherical harmonics on the materialized paths, single-device and mesh-sharded alike (non-redundant fit, positive definite metric), and cartesian components on the streamed path (which contracts cartesian auxiliary elements on the fly). False forces cartesian everywhere, e.g. to compare a materialized result against a streamed one in the same fit space; True asserts the spherical span and raises where it is unsupported.

None
whiten bool | None

fold the metric into the materialized tensor once, B = Lᵀ T with L Lᵀ = V⁺ (:class:WhitenedDFCoulomb): the same energy to the density-fitting floor, no metric multiply per build, and an orbital-route exchange that never forms nao x nao kernels. None (default) whitens whenever the build is concrete and single-device materialized, and keeps :class:DFCoulomb where the geometry is traced (forces, Hessians, scf_batched), whose metric inverse carries the geometry derivative; False never whitens; True asserts it and raises where it cannot apply.

None
packed bool | str

store the whitened tensor packed over the kept bra shell pairs, (naux, npair) (:class:PackedDFCoulomb): about half the memory before screening and only the kept pairs with it, at the price of unpacking one aux block per exchange evaluation. "auto" (default) packs where that pays: when pair screening is on (screen) or when the square tensor would miss the device budget and the packed one fits; True / False force it. Traced builds (no whitening) stay square.

'auto'
Example
KS(mol, xc)                                    # same as coulomb=df()
KS(mol, xc, coulomb=df(chunk=None))            # force materialized
KS(mol, xc, coulomb=df("def2-universal-jkfit", chunk=64))  # streamed