Authoritative Conventions, Seven Principles & Triple-Stack Contract
Every C17 translation unit (include/QTAIM.h, modular src/*.c, and the drop-in single-file amalgamation QTAIM.c), Wolfram Language 15 reference module (QTAIM.wl), ForeignFunctionLoad C-ABI bridge (QTAIMC.wl), out-of-source evaluated Wolfram Notebook, QTAIM-WFX-3.0 parser, in-memory host bridges across DIRAC, Dalton, OpenMolcas, PySCF, and CP2K, and HTML article on this site consults the root CONVENTIONS.md specification. Automated CTest and site-build gates parse its embedded JSON contract on every build so architectural principles, units, signs, high-shell orderings, automatic -mesh rules, crystal topology, and parallel reductions never drift across layers.
- libqtaim 1.5.0 does not compute localization or delocalization indices: lambda_loc returns the atomic population and delta_pair_out is zero.
- libqtaim 1.5.0 per-atom IQA energies do not sum to the total energy (LiH is off by 0.2 to 0.4 hartree). Do not use them.
- Not every reported value is computed: the atom results return dV_surf, the interatomic Maxwell surface flux, as zero without computing it.
- QTAIM_HORIZON_AUTO records a Compton length; no basin, interaction-energy or field routine uses it.
- Densities described as strictly positive are only non-negative.
- The crystal statements refer to model densities, not ab initio lithium or LiH.
- The critical-point certified flag in libqtaim is a local sampled test, not a proof, and the search can miss points.
1. Triple-Stack Architecture, Single-File Amalgamation, & Three-Tier BLAS/LAPACK
Official library implementations, bindings, tests, and worked examples in QTAIM are organized as a strict Triple Stack:
Stack 1 · ISO C17 + Amalgamation
Modular src/*.c files compile under -std=c17 -Werror=vla (gcc, clang, AppleClang, icx) and /std:c17 (MSVC) across Windows, Linux, macOS, and the BSDs with zero VLAs, zero C99 _Complex, zero <threads.h>, and zero mutable globals. CMake also emits a drop-in two-file amalgamation build/amalgamation/{QTAIM.h,QTAIM.c} for one-file embedding in external quantum-chemistry codes.
Stack 2 · Wolfram Language 15 Native
wolfram/QTAIM.wl states every algorithm in side-effect-free mathematical expressions mirroring QTAIM.h function for function, serving simultaneously as the human- and LLM-readable reference specification and as a 50-digit arbitrary-precision (WorkingPrecision -> 50) oracle under CTest wolfram_seats scheduling.
Stack 3 · WL15 Calling C + Build Notebook
wolfram/QTAIMC.wl loads libqtaim directly via ForeignFunctionLoad against the unmodified C17 ABI and generates the pre-evaluated notebook build/notebooks/QTAIM_TripleStack.nb strictly in the out-of-source CMake build directory—never inside git source folders.
No other programming languages are introduced into library implementations, bindings, tests, or examples without explicit approval. External quantum-chemistry packages—DIRAC, Dalton, OpenMolcas, PySCF, and CP2K—embed the CMake-synchronized amalgamation (cmake --build build --target sync_host_amalgamation) directly via iso_c_binding or ctypes, calling qtaim_wfn_create_raw_prims, qtaim_wfn_set_active_2rdm, and qtaim_wfn_set_edf_primitives in memory without requiring intermediate disk .wfx files while preserving exact bit-parity with exported QTAIM-WFX-3.0 streams. Linear algebra inside Stack 1 resolves automatically across three preprocessor tiers in src/qtaim_linalg.c with universal 64-bit integer slot compatibility across both LP64 (OpenBLAS, Netlib) and ILP64 (MKL, 64-bit Fortran host runtimes): Tier 1 links host system BLAS/LAPACK; Tier 2 optionally fetches Reference-LAPACK via CMake (-DQTAIM_FETCH_LAPACK=ON); and Tier 3 provides a built-in pure-C17 mathlib (cache-tiled dgemm, Cholesky, Householder+QL dsyev, zero-_Complex real- Hermitian eigensolver, and real- quaternion Kramers eigensolver) tested on every build via -DQTAIM_FORCE_INTERNAL_MATHLIB=1.
2. The Seven Enshrined Architectural Principles
- Do not compute what you can project (maximal symmetry + explicit
C1+ full-orbit unfolding): by default (QTAIM_SYM_MAXIMAL), exploit the maximal molecular point group, Kramers time-reversal pair symmetry, or 3D crystallographic space group (1..230and Wyckoff site stabilizers) so only symmetry-inequivalent centers, shells, critical-point seeds, and basin rays are evaluated, reconstructing full molecular or unit-cell orbits algebraically when requested for human inspection while always supporting explicitQTAIM_SYM_C1("the dumb way") and verifyingSymmetry == C1in CTest. Off in 1.7.1: symmetry shortcuts are off until the symmetry can be proven for the whole wavefunction. For moleculesQTAIM_SYM_MAXIMALintegrates every atom, asQTAIM_SYM_C1does, no mirror plane is taken from a wavefunction (no attractor symmetrisation, no ascent guard, no mirror seeds in the critical-point search) and the zero-flux mirror disk of the surface solver (§6.5) is never taken; crystals keep the octant rule and the torus topology only where the cubic group maps the lattice, the atoms and the set (with its weights and occupations) onto themselves, and the crystal constructors refuse cells whose lattice sums would be cut short, and constants that are not positive finite numbers, with no default cell in their place. In 1.6.0 and 1.7.0 a symmetry was accepted after the density agreed at two points near the centre of the nuclei, which can copy one atom onto an inequivalent one. - Analytic derivatives and analytic integrals over finite differences and quadrature: evaluate spatial AO/spinor/Bloch jets, McMurchie–Davidson one- and two-electron Gaussian integrals (, Boys–Hermite ), Melnikov zero-flux transport derivatives, and
SA-GASSCFZ-vector response gradients analytically; reserve finite differences strictly for validation tests. - Pure functions with zero side effects: wavefunction, symmetry, and crystal handles are immutable after construction (
const qtaim_wfn *,const qtaim_crystal *), performing zero hidden I/O and mutating zero global state. - Bit-deterministic parallelism: serial (
0), OpenMP (1), native OS threads (2, Windows_WIN32and POSIXpthread), and custom host thread-pool callbacks (3) accumulate in fixed index order so thread count and backend never alter IEEE-754 results. - Unforced physical honesty: always report raw unforced , raw , raw , raw , and raw Euler characteristics ( for isolated molecules; for 3D periodic crystals).
- Scale-relative conditioning and analytical cliff regularizers: scale all rank, Löwdin canonical-orthogonality, and Sylvester-inertia tolerances with the spectral norm (, never unit floors), and apply analytical regularizers at physical singularities (Compton horizons, state-averaged conical intersections, and coordinate axes).
- Exact telescopic limit recovery: sending , , , and lattice period recovers clamped-nucleus Born–Oppenheimer QTAIM and 3D punctured-Maxwell
IQAcontinuously to machine precision.
3. Gaussian Atomic Units, Electromagnetic Coupling, & Punctured-Maxwell IQA
All equations, C17 APIs, Wolfram packages, and scene files use Gaussian Hartree atomic units (, , ; the library’s magnetic inputs, B_z_au in C and BzAU in Wolfram, are this divided by , in the unit ). For total charge density , electrostatic fields and local three-dimensional Interacting Quantum Atoms (IQA) potential energies satisfy:
with outward normal , regular field , and at every geometry.
4. Reduced Density Matrices, Kinetic Densities, & ℒ vs L
| Quantity | Definition & sign convention | Invariant / check |
|---|---|---|
| 1-RDM density | Spin-summed diagonal (+ optional <EDF> core ) |
|
| McWeeny 2-RDM | Spin-summed pair density with factor in | |
| XC cumulant | ||
| Kinetic densities | , | |
| Script vs upright | (, ) is a 3D/4D density; | Raw unforced always reported |
5. Spherical & Cartesian GTOs (, Keith 1..84), Kato Cusps, & Periodic Crystals
- Real Spherical Harmonics (
cart = 0, primary default through ): shells carry algebraic Schlegel–Frisch solid harmonics (Jensen GTO vs ETO Benchmark), while Cartesian shells (cart = 1) carry components mapped bijectively to Keith primitive types1..84in QTAIM-WFX-3.0. - Periodic crystal mirror zero-flux theorem, 3-torus topology (), & automatic -centered -selector: on any crystallographic mirror plane with normal (), space-group invariance forces pointwise to machine precision () before any numerical ODE surface tracing. In monoatomic
BCC Li(, #229), the six square Wigner–Seitz faces (Wyckoff6b, ) and diagonal planes satisfy pointwise everywhere, whereas at the eight hexagonal bond midpoints (Wyckoff8c, site symmetry lacking ), the three in-plane dyads and the inversion-antisymmetric net face integral vanish to while off-dyad points capture physical trigonal zero-flux surface puckering, with primitive-cell critical points and . In heteroatomicRock-Salt LiH(), the curved ionic zero-flux wall deforms toward () while meeting and symmetry planes orthogonally, checked in the wedge mode and in explicitC1mode, which agree to within the quadrature error. Since 1.7.1QTAIM_SYM_MAXIMAL(one octant times eight) and the cubic torus sites are used only where the cubic group maps the lattice, every atom and the set, with its weights and band occupations, onto themselves; otherwise the full sphere is integrated, is NaN, andqtaim_crystal_torus_topologyreturnsQTAIM_ERR_UNSUPPORTED. The constructors returnNULLwhere the lattice sums of the model would be cut short (BCC Liat , rock-saltLiHat ) and for a constant that is not a positive finite number. Still open in 1.7.1: rock-saltLiHabove gives wrong basin populations withQTAIM_OK, andqtaim_crystal_torus_topologyreturnsQTAIM_OKwith for large cells (constants tried from 18 bohr for rock-saltLiHand from 25.5 bohr forBCC Li). - Automatic -point selector (
QTAIM_KGRID_AUTO) & geometry-only ("caveman") entry points:qtaim_select_kgrid_autoinfers periodic dimensionality from lattice vectors and atomic coordinates (clamping vacuum slab/wire axes with vacuum gap to ), sets odd -centered counts () on non-orthogonal Bravais lattices so Nyquist boundary faces never break space-group zero-flux mirrors, and upgrades metallic gaps () automatically to with Fermi–Dirac smearing, whileqtaim_wfn_from_cavemanaccepts bare atomic numbers and coordinates.qtaim_crystal_from_cavemanreturns one of the two built-in models,BCC Lifor one atom and rock-saltLiHotherwise, with its lattice constant taken from the cell volume; the atoms and the shape of the cell are not used, and since 1.7.1 a cell that the model refuses, a slab or a wire included, givesNULL.
6. Schwinger–Bader Core, Isomorphic Gibbs/Dyadics, & Sector Plugins
Across C17 (src/qtaim_ga44_plugin.c) and Wolfram Language 15 (QTAIM.wl and QTAIMC.wl), QTAIM pairs classic 3D Gibbs vectors and dyadics side-by-side with the non-degenerate split super-Clifford algebra :
- Fixed 256-blade West-Coast & exact dyadic bijection: generators with squares carry spacetime spinors (, zero
_Complex), conformal null vectors (), Bader's virial bivector (), origin-covariant charged-basin dipoles , Faraday Maxwell stress sandwiches , and the lossless Grade-2 Witt bivector isomorphism () bridging density Hessians, Bader stress dyadics, and atomic quadrupoles to . - Positive osmotic horizon & auto-telescoping Compton POVM (): Madelung–Takabayasi–Hestenes polar spinor decomposition proves even at the Klein horizon where , while
QTAIM_HORIZON_AUTOuses sharp Heaviside zero-flux boundaries () on inputs and activates Furry Compton POVM +Erf-Maxwell () on relativistic or non-BO runs. - Polynomial-scaling 3-tier sector plugins (
qtaim_sector_plugin): rather than materializing Fock blades, native and host solvers register statically in-process or load dynamically viadlopen/LoadLibraryA(qtaim_plugin_init_v1), streaming compressed moments tagged explicitly asEXACT_2RDM,LOWRANK_MODES(reporting raw truncation residual), orKS_DFT. - Priority first-class beyond-dyadic observables: five subsystem invariants structurally inaccessible to spatial dyadics—signed Pontryagin chirality , relativistic MTH pseudoscalar and Klein angle , double-cover conical-intersection holonomy, origin-invariant conformal ion bundles , and vibronic/polaritonic cumulants—are prioritized across the Triple Stack.
- Variational interatomic-surface solver and the compatibility basin entry (
v1.4.0): alongside steepest-ascent ray bisection,qtaim_ias_gauss_maxwell_zero_ode(qtaimIASGaussMaxwellZeroODE) solves algebraically on via analytical-Hessian Chebyshev–Fourier collocation plus an exact spherical cap to obtain from 2D Boys–Hermite electric flux with zero ODEs and zero 3D grid points (H₂O LCAO-MO & Solvers for the Water Molecule), whileqtaim_integrate_basins_zero_ode(qtaimIntegrateBasinsZeroODE) keeps its name for compatibility but is not trajectory-free: atomic properties come from the ray integrator and theIQApotential energy from a Becke grid assigned by steepest ascent. Its earlier one-neighbour density-ordered sweep did not converge atom by atom and was removed. Since 1.7.1 the surface solver never takes the mirror disk (mirror_exactis 0) and solves symmetric diatomics by collocation like any other pair; a pair whose bond path does not join its two atoms (a density maximum between the nuclei, or a third atom on the segment) is refused withQTAIM_ERR_UNSUPPORTED, and where the search for a bond saddle runs and finds none, as for the para carbons of benzene, the status isQTAIM_ERR_CONVERGE(−6). - Schwinger–Bader osmotic density (), polymomentum flux-traction matrix (), & three-tier horizon taxonomy: scalar denotes the non-negative mass-weighted body-frame osmotic density ( in ), whereas / denotes the Schwinger–Noether polymomentum flux-traction matrix () in which indexes the symmetry generator / field channel ( scale; momentum; screw, virial, or Witt mode) and / ( time delivering Reynolds advection ) indexes the normal-contraction direction, with orbital 1-RDM elements denoted . The scale row: for one non-relativistic particle (real potential, no vector potential) it is , and for non-relativistic multicomponent matter, integrated over the other coordinates and summed over species at a common body-frame point, it is (derived; the common region and frame are choices); for the first-order Dirac density it vanishes identically (derived), so zero flux of the whole of is a proposed wall rule. The momentum entry is chosen as (proposed), with the Maxwell stress and : momentum conservation requires the quantum stress and the Maxwell stress to enter with the same sign (derived), and for an electron in a vector potential is built with . The entry is not the translation row, whose space components for one non-relativistic particle (real potential, no vector potential) are (derived) (Dirac–Maxwell Subsystem Horizons).
7. Automated Enforcement across C17, WL15, Notebooks, & HTML
Between sentinel markers at the bottom of CONVENTIONS.md sits the machine-readable qtaim.conventions.v1 JSON block, verified on every build by five automated gates:
- C17 contract & determinism gate (
test_conventions_c): parsesCONVENTIONS.mddirectly in C17, asserting version, constants, shell countsl = 0..6, Keith1..84bijection, zero source.nbfiles, and bit-for-bit equality across 1-thread serial, OpenMP, native OS threads, and custom executor callbacks. - C17 algorithms, WFX-3.0, & crystal gate (
test_qtaim_c&test_amalg_internal_c): verifies Boys–Hermite 3DIQA, McMurchie–Davidson 1e/2e integrals, classic.wfn/Wide-WFN/QTAIM-WFX-3.0round-trips, third-party permutation auto-repair, andBCC Li/Rock-Salt LiHcrystal topology under both Tier 1 BLAS/LAPACK and forced Tier 3 internal C17 mathlib on the single-file amalgamation. - Wolfram Language 15 native & FFI gates (
TestQTAIMNative.wls&TestQTAIMCallingC.wls): verify 50-digit Boys functions, exact symbolic solid-harmonic orthonormality across1s..13i, and cross-stack C17 parity to . - Out-of-source notebook replay gate (
VerifyEvaluatedNotebook.wls): importsbuild/notebooks/QTAIM_TripleStack.nbfrom$TemporaryDirectory, checks zeroErrorBoxorPrivate`leaks, and replays all paired Input/Output cells cleanly. - Site gate (
tools/build_site.py): parsesCONVENTIONS.mdon every HTML build, enforcing script, subscript, provenance, and terminology invariants across all published pages.
Provenance tags indicate whether the primary text ([read]) or bibliographic record ([record]) was checked directly during preparation.
- R. F. W. Bader, Atoms in Molecules: A Quantum Theory (Oxford University Press, 1990) [read]; J. Schwinger, Phys. Rev. 82, 914 (1951) [record].
- R. McWeeny, Rev. Mod. Phys. 32, 335 (1960) [record]; T. Kato, Commun. Pure Appl. Math. 10, 151 (1957) [record].
- H. B. Schlegel and M. J. Frisch, Int. J. Quantum Chem. 54, 83 (1995) [record]; L. E. McMurchie and E. R. Davidson, J. Comput. Phys. 26, 218 (1978) [record].
- F. Jensen, J. Chem. Theory Comput. 2, 1360 (2006) [record]; H. J. Monkhorst and J. D. Pack, Phys. Rev. B 13, 5188 (1976) [record].