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

The Hartree-Fock options, a record with defaults

Every choice a Hartree-Fock run makes lives in one record, ScfOptions. scf_defaults() returns the production choices, and a caller changes the ones it wants with a record update:

o = ScfOptions { guess: GS_CORE, max_iter: 200, ..scf_defaults() }

| Field | Default | Meaning | |---|---|---| | method | SCF_AUTO | SCF_RHF, SCF_UHF, SCF_ROHF; automatic is RHF for a closed shell and UHF otherwise | | guess | 0 | the starting density: a member of gs_methods() (lib/hf/guess) | | accelerator | 0 | a member of accel_methods(): DIIS, plain iteration, damping | | jk | 0 | a member of the J/K registry: packed, pair tables, dense, direct | | orthogonalizer | 0 | a member of orth_methods() | | eigensolver | 0 | a member of eig_methods() | | rohf_coupling | 0 | a member of rohf_couplings() (lib/hf/coupling) | | diis_size | 8 | Fock matrices DIIS mixes | | diis_start | 1 | iterations whose Fock matrix DIIS leaves out: 1 leaves out the guess's, as PySCF's diis_start_cycle = 1 does | | max_iter | 100 | the SCF iteration limit | | e_tol | 10−12 | the energy change that counts as converged | | grad_tol | 10−9 | the largest commutator element that counts as converged | | level_shift | 0 | raise the virtual orbitals by this much (Eh) | | damping | 0.3 | the damping factor of the damping accelerator | | lindep | 10−8 | canonical orthogonalization drops overlap eigenvalues at or below this | | screen_tol | 10−14 | Schwarz screening threshold of the integral builds, in core and direct | | direct_tol | 10−13 | the direct J/K build skips a shell quartet whose Schwarz bound times the largest density element it meets is at or below this (PySCF's direct_scf_tol) | | fock_rebuild | 8 | a direct run builds J and K from the change of density, and from the whole density every this many iterations and on every iteration once the convergence test first passes; 0 builds from the whole density every iteration | | eri_members | 0 | the ERI members the pipeline runs, a bit mask; 0 means MD (generated kernels) and HGP | | cross_check | 0 | 0: every integral stage runs its production member; 1: every member, asserting they agree | | stab_hessian | 0 | the Hessian member stability analysis uses (lib/hf/stab) |

Index 0 of every registry is its production member. scf_checked() is the defaults with cross_check on: the integrals computed by every member and held to agree within each stage's tolerance, which is how the lock ladder (scf/) and the library's own tests run. A cross-checked stage asserts agreement, and an assertion outside a test block prints its verdict, so a program that cross-checks at its top level prints one line per stage.

The column array. A registry member is called through apply, which passes numbers, functions and arrays, not records. So the members read their options from a plain array, opt_array(o, na, nb, enuc), one column per field plus the electron counts and the nuclear repulsion. The SCF driver builds it once per run; nothing above the registries builds one by hand, and the column numbers (OPT_* below) are named in this module only. opt_new() is the array of the defaults, for a member's own tests.

Used with import hf.opts.

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 (ScfOptions), 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 53–240