Notebooks · lib/hf/iv_ints
Integrals with guaranteed bounds, two ways
lib/hf computes every integral by more than one algorithm and requires the results to agree. Agreement to 10−12 says the algorithms are probably right; it does not say the common answer is the integral. This module computes intervals that are guaranteed to contain the exact integral, given the basis as data (exponents, raw coefficients and centers, each an exact double), using only the outward-rounded arithmetic of lib/hf/interval and the Boys enclosures of lib/hf/iv_boys.
It does this for s and p primitives, by two algorithms that share only the Boys enclosure:
- McMurchie-Davidson (
iv_md_*): Hermite expansion coefficientsE(i, j, t)per axis and the Hermite Coulomb integralsR(t, u, v), as in lib/hf/hermite, lib/hf/md_onebody and lib/hf/md_eri. - Obara-Saika (
iv_os_*): one-dimensional overlap and kinetic recursions, the vertical recursion on auxiliary integrals[a|b]^(m)for nuclear attraction and[e0|f0]^(m)for electron repulsion, and the horizontal transfer(a, b+1_i| = (a+1_i, b| + (A - B)_i (a, b|, as in lib/hf/os_onebody and lib/hf/hgp_eri.
Two enclosures of the same number must overlap. If they do not, one of the two algorithms is wrong, or the arithmetic under them is. Where they overlap, the exact value is in the common part.
What is enclosed. The unit-normalized Cartesian integral of
lib/hf. The contracted coefficients are enclosed
too (iv_cn): Nr(a, l) = (2a/pi)^(3/4) (4a)^(l/2) from square roots, and
the unit-self-overlap rescale from the interval self-overlap. The point codes
round those coefficients once; this module does not.
Width. For water STO-3G, measured in the tests below and in scf/iv_bridge: most enclosures of S, T, V and the sampled ERIs are about 2 × 10−14 wide relative to their larger end, and the widest is 5.0 × 10−12, at the kinetic energy between O 1s and an H 1s (-0.00256), a sum whose terms cancel. An integral that is 0 by symmetry gets an enclosure around 0 at most 4 × 10−15 wide. Interval arithmetic treats a quantity used twice as two independent ones, and that costs little here because the recursions are short at l <= 1.
PySCF. The enclosures exclude some of PySCF's values: V between O pz and O 2s is 8.3 × 10−15 from the 40-digit value, which both enclosures hold and PySCF's does not. So PySCF 2.5.0 is off there by more than these widths.
Layout. An interval table is flat: entry k is [T[2k], T[2k+1]].
One-electron members return [n, n, 2]; ERI members return [m, 2] for a
list of packed-8 indices. The sampled members use IV_ERI_NSAMPLE distinct
indices drawn from IV_ERI_SEED.
Used with import hf.iv_ints.
Look inside this program
- Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.