Some checks failed
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 3s
no-vanity-metrics / WAI public text names no comparison (pull_request) Successful in 3s
no-vanity-metrics / WAI public text names no company or product (pull_request) Successful in 3s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m55s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m30s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m12s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m10s
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
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]>
33 lines
1.6 KiB
Rust
33 lines
1.6 KiB
Rust
//! A molecule's ground state by DMRG from its FCIDUMP integrals, against
|
||
//! Hartree–Fock and, where it fits, full configuration interaction.
|
||
//!
|
||
//! ```text
|
||
//! cargo run --release --example chem_dmrg --features quantum_chem -- FILE BOND SWEEPS [threads]
|
||
//! ```
|
||
use wai_quantum::quantum_chem::{fci, ground_state, hartree_fock_energy, molecular_mpo, read_fcidump, ChemConfig};
|
||
|
||
fn main() {
|
||
let a: Vec<String> = std::env::args().collect();
|
||
let fd = read_fcidump(&std::fs::read_to_string(&a[1]).expect("read the FCIDUMP")).expect("parse the FCIDUMP");
|
||
let bond: usize = a[2].parse().unwrap();
|
||
let sweeps: usize = a[3].parse().unwrap();
|
||
let mut cfg = ChemConfig { max_bond: bond, sweeps, ..ChemConfig::default() };
|
||
if let Some(t) = a.get(4) {
|
||
cfg.threads = t.parse().unwrap();
|
||
}
|
||
let mpo = molecular_mpo(&fd, &cfg);
|
||
println!("{}: {} orbitals, {} electrons, MPO bond {}", a[1], fd.norb, fd.nelec, mpo.max_bond());
|
||
println!("Hartree–Fock {:.10}", hartree_fock_energy(&fd));
|
||
let t0 = std::time::Instant::now();
|
||
let r = ground_state(&fd, &cfg);
|
||
let secs = t0.elapsed().as_secs_f64();
|
||
for (i, e) in r.sweep_energies.iter().enumerate() {
|
||
println!("sweep {:>2} {e:.10}", i + 1);
|
||
}
|
||
println!("discarded {:.1e} entropy, mid {:.4} {secs:.1}s", r.discarded, r.entropies[r.entropies.len() / 2]);
|
||
let t0 = std::time::Instant::now();
|
||
match fci(&fd) {
|
||
Some(f) => println!("full CI {:.10} ({} determinants, {:.1}s) DMRG − full CI {:.2e}", f.energy, f.dim, t0.elapsed().as_secs_f64(), r.energy - f.energy),
|
||
None => println!("full CI (too large)"),
|
||
}
|
||
}
|