This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/hf/eri_store

Storing electron repulsion integrals once per symmetry class

The two-electron integral over real orbitals, in chemist's notation,

(ij|kl) = double integral phi_i(1) phi_j(1) (1/r12) phi_k(2) phi_l(2)

is unchanged when i and j swap (they sit in the same product), when k and l swap, and when the pair ij trades places with the pair kl (the Coulomb operator is symmetric in electrons 1 and 2). Those three swaps generate 8 index orders with one value, so a dense n^4 tensor stores most values 8 times.

Packed-8 storage keeps one copy. Number the pairs i >= j as

ij = i(i+1)/2 + j

and the pairs of pairs ij >= kl the same way:

ijkl = ij(ij+1)/2 + kl

With npair = n(n+1)/2 pairs there are npair(npair+1)/2 stored values: 18145 for water 6-31G* in Cartesian d (19 AOs) instead of 130321, and 4186 for water 6-31G (13 AOs) instead of 28561.

Reference data for bases larger than 19 AOs is too big to ship in full, so the generator emits two checksums and a set of seeded samples instead. The checksum weights and the sample indices come from the Park-Miller generator (x -> 16807 x mod 2147483647), which is exact in doubles and just as easy to reproduce in Python; the formula is frozen.

Used with import hf.eri_store.

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.

[1]lines 36–294