wai-quantum 0.3.36: molecules and neural quantum states, held to exact answers #164

Merged
dcharlot merged 3 commits from wai-quantum-nqs into main 2026-10-05 21:08:04 -04:00
Owner

What this adds

Two ground-state solvers, each held to an exact referee, and the engine work they share.

The engine

  • MPOs with a tensor per site, held sparse. Each site's operators are stored as their non-zero entries, in the order the dense loops visited them. The uniform chains keep their bits.
  • OpSum. Any sum of products of one-site operators compiles into an exact MPO by the bipartite-graph construction. At each bond, a minimum vertex cover (Hopcroft–Karp matching plus König's theorem) sets the bond, and every coefficient is placed once. There is no numerical compression.
    • Random long-range sums match their dense matrices to 10⁻¹².
    • The Heisenberg chain rebuilt from its terms gets the hand-built bond of 5.
  • dmrg_mpo runs DMRG on any MPO from any start; expectation gives ⟨ψ|H|ψ⟩ for any MPS.
  • DMRG's Lanczos now stops on the Ritz residual estimate. That re-pins DMRG; the energies are unchanged within tolerance.

quantum_chem: molecules by DMRG

  • An FCIDUMP reader (8-fold symmetry).
  • The Hamiltonian on spin orbitals: alpha and beta side by side, Jordan–Wigner, compiled by OpSum.
  • A penalty on the wrong electron count or spin. It costs no bond, because its terms merge with the Coulomb ones.
  • Full CI (direct CI over alpha/beta strings) as the referee. It reproduces an independent program's energies to 10⁻⁹ for H₂, LiH, H₂O and H₆.
  • DMRG starts from Hartree–Fock with complete bases and keeps them complete (cutoff 0).
molecule spin orbitals MPO bond DMRG bond DMRG − full CI
LiH 12 74 16 3·10⁻¹⁴
H₂O 14 138 64 3·10⁻¹³
N₂ 20 278 64 3.6·10⁻⁴

Measured, and fixed. With a positive cutoff, DMRG from Hartree–Fock did not move at all. A product state's bases confine two-site updates to excitations within the pair, and by Brillouin's theorem those do not lower the energy. Completing the bases freed the first sweep, but the cutoff then shrank them back to the state's rank, which stalled it again. Keeping them complete reached full CI.

quantum_nqs: neural quantum states

  • Spin models on any graph, with exact diagonalisation (≤ 22 spins) and an OpSum form for DMRG.
  • A real RBM with Marshall's sign on bipartite lattices.
  • VMC by deterministic Metropolis chains (single flips or antiparallel swaps), or by exact enumeration.
  • Stochastic reconfiguration, solved in parameter or sample space, which are shown to take the same step.
model lattice reference α relative error
Heisenberg chain of 12 exact diagonalisation 2 7.7·10⁻⁵ ± 7·10⁻⁵
Heisenberg 4 × 4 open exact diagonalisation 2 4.6·10⁻⁴ ± 2·10⁻⁴
Ising, h = 3.044 4 × 4 open exact diagonalisation 1 −3·10⁻⁶ ± 1·10⁻⁵
Heisenberg 6 × 6 open DMRG, bond 256 2 3.6·10⁻³ ± 3·10⁻⁴ (still descending)

Checked

  • New pins chemistry_by_dmrg and neural_quantum_states, and the re-taken DMRG pin. All 22 pins pass natively and under wasm32-wasip2.
  • The full suite passes in debug as CI runs it: 441 library tests.
  • The CLI gains chem and nqs. Their output is byte-identical natively and under WASI, sampled NQS runs included.
  • Prose and vanity-metric checks pass.

Shipped as one PR rather than two, to keep CI load down while the fleet's arm64 and macOS runners share one host.

🤖 Generated with Claude Code

## What this adds Two ground-state solvers, each held to an exact referee, and the engine work they share. ### The engine - **MPOs with a tensor per site, held sparse.** Each site's operators are stored as their non-zero entries, in the order the dense loops visited them. The uniform chains keep their bits. - **`OpSum`.** Any sum of products of one-site operators compiles into an exact MPO by the bipartite-graph construction. At each bond, a minimum vertex cover (Hopcroft–Karp matching plus König's theorem) sets the bond, and every coefficient is placed once. There is no numerical compression. - Random long-range sums match their dense matrices to `10⁻¹²`. - The Heisenberg chain rebuilt from its terms gets the hand-built bond of 5. - `dmrg_mpo` runs DMRG on any MPO from any start; `expectation` gives `⟨ψ|H|ψ⟩` for any MPS. - DMRG's Lanczos now stops on the Ritz residual estimate. That re-pins DMRG; the energies are unchanged within tolerance. ### `quantum_chem`: molecules by DMRG - An FCIDUMP reader (8-fold symmetry). - The Hamiltonian on spin orbitals: alpha and beta side by side, Jordan–Wigner, compiled by `OpSum`. - A penalty on the wrong electron count or spin. It costs no bond, because its terms merge with the Coulomb ones. - **Full CI** (direct CI over alpha/beta strings) as the referee. It reproduces an independent program's energies to `10⁻⁹` for H₂, LiH, H₂O and H₆. - DMRG starts from Hartree–Fock with complete bases and keeps them complete (cutoff 0). | molecule | spin orbitals | MPO bond | DMRG bond | DMRG − full CI | |---|---|---|---|---| | LiH | 12 | 74 | 16 | 3·10⁻¹⁴ | | H₂O | 14 | 138 | 64 | 3·10⁻¹³ | | N₂ | 20 | 278 | 64 | 3.6·10⁻⁴ | **Measured, and fixed.** With a positive cutoff, DMRG from Hartree–Fock did not move at all. A product state's bases confine two-site updates to excitations within the pair, and by Brillouin's theorem those do not lower the energy. Completing the bases freed the first sweep, but the cutoff then shrank them back to the state's rank, which stalled it again. Keeping them complete reached full CI. ### `quantum_nqs`: neural quantum states - Spin models on any graph, with exact diagonalisation (≤ 22 spins) and an `OpSum` form for DMRG. - A real RBM with Marshall's sign on bipartite lattices. - VMC by deterministic Metropolis chains (single flips or antiparallel swaps), or by exact enumeration. - Stochastic reconfiguration, solved in parameter or sample space, which are shown to take the same step. | model | lattice | reference | α | relative error | |---|---|---|---|---| | Heisenberg | chain of 12 | exact diagonalisation | 2 | 7.7·10⁻⁵ ± 7·10⁻⁵ | | Heisenberg | 4 × 4 open | exact diagonalisation | 2 | 4.6·10⁻⁴ ± 2·10⁻⁴ | | Ising, h = 3.044 | 4 × 4 open | exact diagonalisation | 1 | −3·10⁻⁶ ± 1·10⁻⁵ | | Heisenberg | 6 × 6 open | DMRG, bond 256 | 2 | 3.6·10⁻³ ± 3·10⁻⁴ (still descending) | ## Checked - New pins `chemistry_by_dmrg` and `neural_quantum_states`, and the re-taken DMRG pin. All 22 pins pass natively and under `wasm32-wasip2`. - The full suite passes in debug as CI runs it: 441 library tests. - The CLI gains `chem` and `nqs`. Their output is byte-identical natively and under WASI, sampled NQS runs included. - Prose and vanity-metric checks pass. Shipped as one PR rather than two, to keep CI load down while the fleet's arm64 and macOS runners share one host. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Each site carries its own operators between MPO bonds of their own size,
stored as its non-zero entries in the order the dense loops visited them, so
the uniform chains keep their bits (every pin unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
OpSum compiles a sum of products of one-site operators into an MPO by the
bipartite-graph construction: a minimum vertex cover per bond (Hopcroft-Karp
matching, König's theorem) sets the bond, and every coefficient is placed
once, so the MPO is exact. dmrg_mpo runs DMRG on any MPO from any start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum 0.3.36: molecules and neural quantum states, held to exact answers
Some checks failed
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 9m3s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m40s
standards workspaces build + test / aac-rs (pull_request) Successful in 6m3s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 4m30s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 12s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m12s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 23s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 45s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m35s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 6m41s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m30s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m1s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 1m32s
standards workspaces build + test / map-rs (pull_request) Successful in 2m0s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m57s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m51s
standards workspaces build + test / mesh-rs (pull_request) Failing after 14m1s
standards workspaces build + test / openpay (pull_request) Successful in 15m42s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Failing after 10m13s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 2m30s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Failing after 19m32s
standards workspaces build + test / arl-rs (pull_request) Successful in 3m48s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 3m53s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 3m59s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 3m48s
standards workspaces build + test / sense-rs (pull_request) Successful in 3m49s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 5m47s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 7m45s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 34s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 3m4s
90a490b9e7
quantum_chem: a molecule's ground state by DMRG from its FCIDUMP integrals.
- The second-quantised Hamiltonian lives on spin-orbital sites (alpha and
  beta side by side) via Jordan-Wigner, and compiles exactly into an MPO
  through OpSum. A sector penalty costs no bond, because its terms merge with
  the Coulomb ones.
- DMRG starts from Hartree-Fock with complete bases and keeps them complete
  (cutoff 0). With a positive cutoff it stalled at Hartree-Fock (Brillouin)
  or at the state's own rank.
- Full CI by direct CI over alpha/beta strings is the referee; it matches an
  independent program to 1e-9.
- Results: LiH and H2O reach full CI to 1e-13 in one sweep. N2 (20 spin
  orbitals) at bond 64 comes within 3.6e-4.

quantum_nqs: neural quantum states.
- Spin models on any graph, with exact diagonalisation and an OpSum form for
  DMRG.
- A real RBM with Marshall's sign; variational Monte Carlo by Metropolis
  chains or exact enumeration.
- Stochastic reconfiguration, solved in parameter or sample space, which
  give the same step.
- Results: 4x4 Heisenberg comes within 4.6e-4 of exact diagonalisation, and
  the critical 4x4 Ising model within its error bar. On 6x6 it meets DMRG
  at 3.6e-3, still descending.

DMRG's Lanczos now stops on the Ritz residual estimate, which re-pinned
DMRG. New pins chemistry_by_dmrg and neural_quantum_states pass natively and
under wasm32-wasip2. The CLI gains chem and nqs, byte-identical under WASI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!164
No description provided.