HUB
Sign inSign up
quantumchemistry-lab logo

credkellar/quantumchemistry-lab

By credkellar

β€’Updated 17 days ago

QuantumChemistry-Lab: H2 + HeH+ full CI, HF SCF loop, bond curves, correlation energy. Labelled toy!

Image
Machine learning & AI
Developer tools
Data science
1

112

credkellar/quantumchemistry-lab repository overview

⁠QuantumChemistry-Lab βš›οΈπŸ§ͺ

Quantum Chemistry Method Lab β€” by Darion Kellar

Educational quantum chemistry lab in ONE pure-Python file: small molecular Hamiltonians for H2 and HeH+ in a minimal basis, solved exactly by determinant full-CI diagonalization with a from-scratch Jacobi eigensolver (no numpy), a Hartree–Fock SCF loop that reaches the same HF energy by an independent AO-basis route, a bond-length curve with a golden-section minimum (R = 1.400 bohr = 0.741 Ang, E = -1.14014 Eh), the correlation energy defined and printed as E_exact βˆ’ E_HF, a basis-set honesty table with every row flagged LABELLED or COMPUTED, and a from-scratch kNN bond classifier whose labels come from the model itself.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: the integrals are LABELLED textbook-class parameters (minimal-basis / STO-3G ranges), NOT computed ab initio β€” every energy is exact for the toy Hamiltonian and approximate for the real molecule. HF is asserted exact only where that is true (one-electron H2+, to 1e-10); for H2 the lab prints the gap instead of hiding it, including the famous restricted-HF dissociation failure (exact βˆ’0.986 Eh vs RHF βˆ’0.686 Eh at 8 bohr). Every drug / materials discovery, weapons, explosives, synthesis, and production claim is a permanent HOLD gate (14 total).

⁠🐳 Quick start

docker pull credkellar/quantumchemistry-lab:latest
docker run --rm credkellar/quantumchemistry-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 57/57).

Run a specific command instead:

docker run --rm credkellar/quantumchemistry-lab:latest python3 main.py checks   # CHECKS 57/57
docker run --rm credkellar/quantumchemistry-lab:latest python3 main.py h2       # H2 anchor: HF vs exact vs correlation
docker run --rm credkellar/quantumchemistry-lab:latest python3 main.py curve    # bond curve + minimum + dissociation
docker run --rm credkellar/quantumchemistry-lab:latest python3 main.py scf      # SCF iteration trace (JSON)
docker run --rm credkellar/quantumchemistry-lab:latest python3 main.py basis    # basis-set honesty table
docker run --rm credkellar/quantumchemistry-lab:latest python3 main.py classify # kNN bond classifier report
docker run --rm credkellar/quantumchemistry-lab:latest python3 main.py holds    # 14 HOLD gates

β πŸ”¬ What's inside

  • Jacobi eigensolver, from scratch β€” cyclic rotations for every diagonalization in the lab; verified against known eigenvalues, orthonormality, and full reconstruction V Ξ› Vα΅€ = A.
  • Determinant full CI β€” all Ms = 0 determinants (4 for 2 orbitals, 9 for 3), Hamiltonian built by Slater–Condon rules; parity blocks and the pair-hopping = exchange identity are asserted, not assumed.
  • HF vs exact, priced β€” at R = 1.4 bohr: E_HF = βˆ’1.11630 Eh, E_exact = βˆ’1.14014 Eh, E_corr = βˆ’0.02385 Eh; ground state 97.8% ΟƒgΒ² determinant.
  • SCF loop, second route β€” AO integrals derived from the MO model by inverting the g/u transformation (round trip asserted to 1e-9); a Roothaan loop walks a skewed guess (1.0, 0.35) to the bonding orbital in 15 iterations and lands on the MO formula to <1e-9.
  • Bond curve + dissociation audit β€” golden-section minimum R = 1.400 bohr = 0.741 Ang, De = 0.14308 Eh; at 8 bohr the exact curve reaches βˆ’0.986 Eh (β†’ two H atoms) while restricted HF stalls at βˆ’0.686 Eh.
  • HeH+ β€” same machinery, heteronuclear ion: minimum R = 1.463 bohr = 0.774 Ang, E_exact = βˆ’2.94938 Eh, E_corr = βˆ’0.02058 Eh.
  • Bigger toy β€” a second virtual orbital deepens correlation βˆ’0.02385 β†’ βˆ’0.03385 Eh while HF does not move: the basis-set problem in miniature.
  • Basis-set honesty table β€” STO-3G class β†’ cc-pVTZ class β†’ HF limit (βˆ’1.1336) β†’ exact (βˆ’1.1745), every row LABELLED published-class, next to the toy's own COMPUTED row; monotonicity and the limits are asserted in the checks.
  • TinyML kNN classifier β€” bound / weak / dissociated from (R, energy above minimum, curvature); labels generated by the model itself.
  • Advisory seats β€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

β βœ… Verified

  • pytest: 43 passed
  • Built-in checks: CHECKS 57/57
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

⁠🏷️ Categories

Science Β· Developer tools Β· Machine learning & AI

  • License: MIT Β© 2026 Darion Kellar
  • Image: credkellar/quantumchemistry-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:d89e5d6b8…
Size
41.6 MB
Last updated
17 days ago
docker pull credkellar/quantumchemistry-lab:latest