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

Angular momentum, by McMurchie and Davidson

lib/gto does s functions, which is hydrogen. Oxygen has p functions, and handling them is the difference between a toy and something that can put water on the screen. This is that difference.

The idea is to stop integrating Cartesian Gaussians directly and expand their product in Hermite Gaussians instead, because a Hermite Gaussian integrates against 1/r in closed form. Two things carry the whole scheme:

The expansion coefficients E(i, j, t). A product of two one-dimensional Cartesian Gaussians of powers i and j is a sum of i + j + 1 Hermite Gaussians, and E says how much of each. E(0, 0, 0) is the Gaussian prefactor, and two recursions reach the rest: one lowers i, the other lowers j. Overlap is E(i, j, 0) times sqrt(pi/p), per dimension, and kinetic energy is three E values combined.

The Hermite Coulomb integrals R(t, u, v, n). These are what 1/r becomes. R(0, 0, 0, n) is (-2p)^n F_n(pR^2), where F_n is the Boys function, and raising any index costs one more recursion step. Nuclear attraction is a sum of Es against Rs; a two-electron integral is a sum of Es against Es against Rs, with a sign that alternates on the second pair.

So the Boys function is needed at every order up to the total angular momentum, rather than only at zero. It comes from its series for small arguments and its asymptotic form for large ones, and where to change over is a measured question. The largest relative gap between the two, over orders 0 to 5:

x       20      3.6e-5
x       30      9.3e-9
x       40      1.5e-12
x       50      1.2e-15

So the changeover is at 50, where they agree to the last bit. At 30, which is where this started, an integral with an argument near the join would have been wrong in the ninth digit and the energy would have followed.

Everything is held against PySCF through lib/qcref, one integral at a time and then the energy: the Hartree-Fock energies of water and of hydrogen fluoride land within 10−10 hartree of the ones PySCF printed there (WATER_ERHF and HF_ERHF).

Used with import gto_md.

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 47–750