Beta Modules
The beta tier now contains one gated research line, the Mobile Block Hessian, plus compatibility aliases for methods that have moved to core. The old beta::* paths still compile; the implementations live at the top-level modules.
Module map
| Module | State | What it does |
|---|---|---|
| Kernel Polynomial Method | core (beta-kpm alias) | Chebyshev density of states and stochastic Mulliken charges |
| Mobile Block Hessian | gated (beta-mbh) | Reduced vibrational analysis with rigid blocks |
| Randomized eigensolver | core (beta-randnla alias) | Nyström sketch plus low-rank path for large EHT problems |
| Riemannian geometry | core | Positive-semidefinite projection and manifold optimization |
| Constant Potential Method | core (beta-cpm alias) | Charge equilibration at a fixed electrode potential |
Validation at a glance
The full report, including the confidence region of every method, is in Scientific validation.
| Module | Compared with | Measured separation | Confidence region | Main limitation |
|---|---|---|---|---|
| Mobile Block Hessian | analytic diatomic stretches plus the full Hessian | stretch 1.3e-5 SI; zero modes ≤5 cm⁻¹; benzene 24/36 degrees of freedom | diatomic and benzene-sized systems | experimental reference is ±2 cm⁻¹ (Ghysels); global-minimum integration is not covered |
| Kernel Polynomial Method | NumPy eigh on GOE and gapped spectra | moments 3.5e-15; DOS L2 1.7e-14; Mulliken 3.8e-5 gapped / 2.6e-2 finite-T | gapped spectra, sparse matrices up to 5000 sites | T=0 gapless spectra show Gibbs ringing; stochastic noise |
| Randomized eigensolver | exact symmetric eigensolver | rank-N/4 3.8e-4 with power iterations; N=600 low-rank 9.6e-4 | near-identity/gapped EHT, k ≥ N/4, lowest 4 states | full-spectrum path uses the exact fallback; clustered spectra degrade |
| Riemannian geometry | NumPy + SciPy L-BFGS-B | projection 8.2e-12; Frobenius distance 2.2e-16 | small positive-semidefinite matrices | psd_distance is a Frobenius proxy, not the affine-invariant geodesic; first-order retraction |
| Constant Potential Method | LAMMPS fix electrode/conp | plate charge scale 1.76×; per-atom cosine 0.44 | graphene bilayer, 3×3 cells, V = ±0.5/1/2 V | point-charge hardness 5 eV vs ~22 eV Gaussian self-energy; over-polarizes dense conductors |
Kernel Polynomial Method (core, beta-kpm alias)
Promoted to core on 2026-11-07. Use
sci_form::kpm; the oldsci_form::beta::kpmpath remains as an alias.
Module: sci_form::kpm (core since 2026-11-07; F91 validated: moments 3.5e-15, DOS 1.7e-14, Mulliken; sparse CSR 5000 sites)
Computes the density of states (DOS) and stochastic Mulliken charges using a Chebyshev polynomial expansion of the Hamiltonian. Avoids diagonalization entirely, achieving
Theory
where
Rust
use sci_form::kpm::{compute_kpm_dos, compute_kpm_mulliken, KpmConfig};
let config = KpmConfig {
order: 200,
n_random: 30,
e_min: -25.0,
e_max: 5.0,
n_points: 500,
..Default::default()
};
// DOS from geometry (builds EHT Hamiltonian internally)
let dos = compute_kpm_dos(&elements, &positions, &config)?;
// dos.energies, dos.dos, dos.homo_lumo_gap
// Stochastic Mulliken charges
let mulliken = compute_kpm_mulliken(&elements, &positions)?;
// mulliken.charges, mulliken.total_electronsWASM / TypeScript
import { beta_compute_kpm_dos, beta_compute_kpm_mulliken } from 'sci-form-wasm/beta';
const dosResult = JSON.parse(beta_compute_kpm_dos(elements_json, coords_json, config_json));
// { energies, dos, homo_lumo_gap, gap }
const mullikenResult = JSON.parse(beta_compute_kpm_mulliken(elements_json, coords_json));
// { charges, total_electrons }Python
from sci_form.beta import kpm_dos, kpm_mulliken
dos = kpm_dos(elements, coords)
print(f"KPM gap: {dos.gap:.3f} eV")
mulliken = kpm_mulliken(elements, coords)
print(f"charges: {mulliken.charges}")Parallelization
The stochastic trace estimation (ChebyshevExpansion::from_matrix) generates all probe vectors upfront for determinism, then processes each vector independently via rayon::par_iter under features = ["parallel"]. Speedup is linear with core count up to n_vectors.
Mobile Block Hessian (beta-mbh, gated)
Module: sci_form::beta::mbh (gated; F92 validated 2026-10-14: stretch 1.3e-5 SI; Ghysels gap)
Computes vibrational frequencies for large molecules by partitioning atoms into mobile blocks and computing a reduced-dimension Hessian. Dramatically reduces the cost of normal-mode analysis versus the full
Rust
use sci_form::beta::mbh::{compute_mbh_frequencies, MbhConfig};
// Blocks: each Vec<usize> is a set of atom indices treated as a rigid unit
let blocks: Vec<Vec<usize>> = vec![
vec![0, 1, 2], // block 0 — e.g. CH3
vec![3, 4, 5, 6], // block 1
];
let config = MbhConfig { max_blocks: 20, ..Default::default() };
let result = compute_mbh_frequencies("CCO", &coords_flat, Some(blocks), &config)?;
// result.frequencies_cm1, result.n_modes, result.zero_point_energyWASM / TypeScript
import { beta_compute_mbh_frequencies } from 'sci-form-wasm/beta';
const result = JSON.parse(beta_compute_mbh_frequencies(elements_json, coords_json, smiles));
// { frequencies_cm1, n_modes, zero_point_energy_hartree, converged }Python
from sci_form.beta import mbh_frequencies
result = mbh_frequencies(elements, coords, smiles="CCO")
print(f"lowest mode: {result.frequencies_cm1[0]:.1f} cm⁻¹")
print(f"ZPE: {result.zero_point_energy:.4f} Ha")Randomized eigensolver (core, beta-randnla alias)
Module: sci_form::rand_nla (core since 2026-11-08; F93 validated; low-rank N>500 path added 2026-11-08)
Approximates the EHT eigenvalue problem using a randomized Nyström sketch: projects the
where
Rust
use sci_form::rand_nla::{
solve_eht_randnla, solve_eht_randnla_lowrank, RandNlaConfig,
};
let config = RandNlaConfig {
sketch_size: Some(50), // k; None = 50 + ceil(log2 N)
seed: 42,
max_error: 1e-3,
fallback_enabled: true,
power_iterations: 2,
};
// Full spectrum (N × N generalized eigensolver).
let (energies, c, info) = solve_eht_randnla(&h, &s, &config);
// info.k, info.residual_error, info.used_fallback
// N > 500: lowest states only, no N × N diagonalization.
let low = solve_eht_randnla_lowrank(&h, &s, &config, 4);
// low.eigenvalues, low.eigenvectors, low.infoThe convenience wrapper eht::solve_eht_randnla(elements, positions, k, &config) assembles the EHT matrices and returns (EhtResult, RandNlaInfo).
WASM / TypeScript
import { beta_solve_eht_randnla } from 'sci-form-wasm/beta';
const result = JSON.parse(beta_solve_eht_randnla(elements_json, coords_json, config_json));
// { orbital_energies, homo_index, homo_energy, lumo_energy, gap, k, residual_error, used_fallback }Python
from sci_form.beta import beta_solve_eht_randnla
result = beta_solve_eht_randnla(elements, coords, sketch_size=50)
print(f"RandNLA gap: {result.gap:.3f} eV (k={result.k})")Riemannian positive-semidefinite geometry (core)
Module: sci_form::riemannian (core since 2026-10-14, F94: projection 8.2e-12, optimizer like scipy; Frobenius proxy)
Operations on the manifold of positive semidefinite (PSD) matrices, used by the SDR embedding (alpha-sdr) and Riemannian L-BFGS optimizer. Provides geodesic distance, projections onto the PSD cone, and Riemannian gradient maps.
Key operations
| Function | Description |
|---|---|
psd_distance(A, B) | Affine-invariant Riemannian distance |
psd_projection(M) | Project a symmetric matrix onto the PSD cone (clamp negative eigenvalues) |
riemannian_gradient(G, X) | Map Euclidean gradient G at point X to the Riemannian gradient |
Rust
use sci_form::riemannian::{psd_distance, psd_projection};
use nalgebra::DMatrix;
let a = DMatrix::identity(4, 4);
let b = DMatrix::from_fn(4, 4, |i, j| if i == j { 2.0 } else { 0.1 });
let dist = psd_distance(&a, &b, 4)?;
println!("geodesic distance: {dist:.6}");
let m = DMatrix::from_fn(3, 3, |i, j| if i == j { -0.5 } else { 0.1 });
let proj = psd_projection(&m, 3);
// All eigenvalues of proj are ≥ 0WASM / TypeScript
import { beta_psd_distance, beta_psd_projection } from 'sci-form-wasm/beta';
const dist = JSON.parse(beta_psd_distance(matrix_a_row_major_json, matrix_b_row_major_json, dim)).distance;
const proj = JSON.parse(beta_psd_projection(matrix_row_major_json, dim)).matrix;Python
from sci_form.beta import beta_psd_distance, beta_psd_projection
dist = beta_psd_distance(a_flat, b_flat, dim=4)
proj = beta_psd_projection(m_flat, dim=3)Constant Potential Method (core, beta-cpm alias)
Module: sci_form::cpm (core since 2026-10-13, F95 vs LAMMPS electrode/conp)
Electrochemical charge equilibration at a fixed external electrostatic potential
Rust
use sci_form::cpm::{compute_cpm_charges, CpmConfig};
let config = CpmConfig { potential: -0.5, ..Default::default() }; // V vs vacuum
let result = compute_cpm_charges(&elements, &positions, &config)?;
// result.charges, result.total_charge, result.energy
println!("total charge: {:.4} e (target potential: {} V)", result.total_charge, config.potential);WASM / TypeScript
import { beta_compute_cpm_charges } from 'sci-form-wasm/beta';
const result = JSON.parse(beta_compute_cpm_charges(elements_json, coords_json, -0.5));
// { charges, total_charge, energy, converged }Python
from sci_form.beta import cpm_charges
result = cpm_charges(elements, coords, potential=-0.5)
print(f"CPM charges: {result.charges}")
print(f"total charge: {result.total_charge:.4f} e")Enabling beta features
Rust
[dependencies]
# The only still-gated beta module:
sci-form = { version = "2.0", features = ["beta-mbh"] }
# Beta + parallelization:
sci-form = { version = "2.0", features = ["beta-mbh", "parallel"] }KPM, CPM, RandNLA and Riemannian are core and need no flag. The historical beta-kpm, beta-cpm, beta-randnla and beta-riemannian names are no-op aliases.
WASM / npm
npm install sci-form-wasm// Subpath import — beta functions only
import { beta_compute_kpm_dos, beta_solve_eht_randnla } from 'sci-form-wasm/beta';
// Mixed stable + beta
import init, * as sf from 'sci-form-wasm';
await init();
sf.beta_compute_kpm_dos(elements_json, coords_json, config_json);Python
# Beta submodule
from sci_form.beta import kpm_dos, eht_randnla, cpm_charges
# Or import the whole beta namespace
import sci_form.beta as beta
result = beta.kpm_dos(elements, coords)Build with all beta features (WASM)
pnpm wasm:build:all-beta
# Equivalent to:
bash crates/wasm/build.sh --web-only --web-features "beta-mbh"Always build through
crates/wasm/build.sh(directly or through thepnpm wasm:build*scripts). Callingwasm-packby hand regeneratespkg/package.jsonfrom scratch and drops thesnippetsentry thatwasm-bindgen-rayonneeds at runtime, as well as the./alphaand./betasubpath exports.
Stability Contract
- Beta modules have stable API shapes — breaking changes require a minor-version bump.
- Beta modules are covered by regression tests and compared against reference implementations.
- Each beta module documents its known limitations (e.g., element coverage, system-size constraints).
- Graduating to stable requires: 2+ validated real-world cases, benchmarks, no known edge-case failures, and a deprecation cycle for any API changes.
Comparison: research tiers vs stable
| Property | Gated research | Validated alias | Stable |
|---|---|---|---|
| API stability | May break | Historical alias only | Fully stable |
| Test coverage | Basic integration tests | Regression + reference validation | Comprehensive + benchmarks |
| Documentation | Module-level | Full API docs | Full API + guides |
| Real-world validation | None required | Recommended | Required |
| Element coverage | Limited | Broad | Complete within scope |
| Performance | Not yet optimized | Benchmarked | Optimized |