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 Coulomb and exchange integrals, for small systems.

Memory grows as O(N⁴); see :func:df for larger systems.

Parameters:

Name Type Description Default
screen float | None

Cauchy-Schwarz threshold; integral quartets whose bound is below it are skipped. None keeps every quartet.

None
stream bool

contract Coulomb and exchange on the fly instead of storing the integrals: O(N²) memory, slower.

False

Raises:

Type Description
ValueError

screen together with stream=True.

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 and exact exchange, the default backend.

Memory grows as O(N³) instead of the O(N⁴) of :func:exact; with a JK-fitting auxiliary basis the fitting error is well below 1 mHa.

Parameters:

Name Type Description Default
auxbasis str | BasisData

auxiliary basis name, or a built BasisData. The default, "def2-universal-jkfit", fits any orbital basis.

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

memory strategy. "auto" stores the 3-center tensor when it fits the device memory budget and otherwise streams it in auxiliary chunks; None always stores it; an int streams in chunks of that many auxiliary functions.

'auto'
screen float | str | None

relative Cauchy-Schwarz threshold below which AO pairs are dropped from the fit. "auto" screens at 1e-10 from 50 atoms up and keeps every pair below that; None keeps every pair. Batched solves (scf_batched) never screen.

'auto'
spherical bool | None

True fits with spherical auxiliary functions, False with cartesian ones. None uses spherical functions when the tensor is stored and cartesian ones when it is streamed.

None
whiten bool | None

store the tensor with the inverse metric folded in, which saves one contraction per Fock build. None does so when the geometry is not being differentiated and the tensor is stored on one device.

None
packed bool | str

store only the kept AO pairs, (naux, npair), about half the memory of the square tensor. "auto" packs when pairs are screened or when only the packed tensor fits the memory budget. Applies to the whitened tensor only.

'auto'

Raises:

Type Description
ValueError

spherical=True or whiten=True with an int chunk (streaming is cartesian and unwhitened), or packed=True with whiten=False or an int chunk.

Example
KS(mol, xc)                                    # same as coulomb=df()
KS(mol, xc, coulomb=df(chunk=None))            # always store the tensor
KS(mol, xc, coulomb=df(chunk=64))              # stream in chunks of 64