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/jk_direct

Direct J and K, from the basis instead of stored integrals

lib/hf/md_direct recomputes the electron repulsion integrals every time J and K are built and needs the basis, not a packed vector. The J/K members all take the same arguments (lib/hf/jk), and the SCF passes the same array in each of the three integral slots, so the direct members here read a flat basis blob from their second slot:

[natm, nsh, nprim, nao_cart, nao_sph (0 for Cartesian),
 the row widths of the three tables (4, 8, 2), npair,
 atoms (natm*4), shells (nsh*8), prims (nprim*2), M (nao_cart*nao_sph),
 Q (npair)]

int_basis_blob builds it, and int_blob_basis reads it back as an IntBasis record. Q holds the Schwarz factor of every shell pair over the run's functions (lib/hf/mdg_eri, mdg_schwarz_basis): it is a property of the basis, so it is computed once with the blob instead of at every J/K build.

Two members:

  • int_jk_direct (INT_JK_DIRECT, the production one): Schwarz and density screening on the generated kernels (mdg_jk_screened, lib/hf/mdg_eri), with the blob's Q, in the run's functions: a spherical basis gets spherical quartets and nothing is transformed.
  • int_jk_direct_full (INT_JK_DIRECT_FULL): Schwarz screening only, on lib/hf/md_eri's general kernels over Cartesian functions (mdjk_direct), every quartet the Schwarz test keeps. It checks the production member on small cases. For a spherical basis it moves the densities to Cartesian functions (M D M^T), builds J and K there, and moves them back (M^T J M).

ScfOptions.jk = INT_JK_DIRECT selects the production member (lib/hf/jk, jk_of).

Used with import hf.jk_direct.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

This program declares a record type (IntBasis), and records run only in compiled C for now, so the Run buttons here are off. Open it in the workbench and use its C tab to compile it.

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 40–225