Skip to content

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 ​

ModuleStateWhat it does
Kernel Polynomial Methodcore (beta-kpm alias)Chebyshev density of states and stochastic Mulliken charges
Mobile Block Hessiangated (beta-mbh)Reduced vibrational analysis with rigid blocks
Randomized eigensolvercore (beta-randnla alias)Nyström sketch plus low-rank path for large EHT problems
Riemannian geometrycorePositive-semidefinite projection and manifold optimization
Constant Potential Methodcore (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.

ModuleCompared withMeasured separationConfidence regionMain limitation
Mobile Block Hessiananalytic diatomic stretches plus the full Hessianstretch 1.3e-5 SI; zero modes ≤5 cm⁻¹; benzene 24/36 degrees of freedomdiatomic and benzene-sized systemsexperimental reference is ±2 cm⁻¹ (Ghysels); global-minimum integration is not covered
Kernel Polynomial MethodNumPy eigh on GOE and gapped spectramoments 3.5e-15; DOS L2 1.7e-14; Mulliken 3.8e-5 gapped / 2.6e-2 finite-Tgapped spectra, sparse matrices up to 5000 sitesT=0 gapless spectra show Gibbs ringing; stochastic noise
Randomized eigensolverexact symmetric eigensolverrank-N/4 3.8e-4 with power iterations; N=600 low-rank 9.6e-4near-identity/gapped EHT, k ≥ N/4, lowest 4 statesfull-spectrum path uses the exact fallback; clustered spectra degrade
Riemannian geometryNumPy + SciPy L-BFGS-Bprojection 8.2e-12; Frobenius distance 2.2e-16small positive-semidefinite matricespsd_distance is a Frobenius proxy, not the affine-invariant geodesic; first-order retraction
Constant Potential MethodLAMMPS fix electrode/conpplate charge scale 1.76×; per-atom cosine 0.44graphene bilayer, 3×3 cells, V = ±0.5/1/2 Vpoint-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 old sci_form::beta::kpm path 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 O(N) cost for sparse systems.

Theory ​

ρ(E)≈2πa∑k=0Mgk(M)μkTk(E−ba)1−(E−ba)2

where μk=1nv∑vrvTTk(H~)rv are stochastic moments and gk(M) is the Jackson damping kernel.

Rust ​

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_electrons

WASM / TypeScript ​

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 ​

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 3N×3N Hessian.

Rust ​

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_energy

WASM / TypeScript ​

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 ​

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 N×N Hamiltonian onto a k-dimensional random subspace before computing eigenvalues. Cost drops from O(N3) (full diag) to O(Nk2) — enabling EHT for systems of thousands of atoms.

H≈Hsketch=(HΩ)(ΩTHΩ)−1(HΩ)T

where Ω∈RN×k is a random Gaussian sketch matrix.

Rust ​

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.info

The convenience wrapper eht::solve_eht_randnla(elements, positions, k, &config) assembles the EHT matrices and returns (EhtResult, RandNlaInfo).

WASM / TypeScript ​

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 ​

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 ​

FunctionDescription
psd_distance(A, B)Affine-invariant Riemannian distance d(A,B)=|log⁡(A−1/2BA−1/2)|F
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 ​

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 ≥ 0

WASM / TypeScript ​

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 ​

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 V0. Models electrodes and surfaces by constraining the total charge to match the applied potential, relevant for electrolyte-electrode simulations.

Qtotal=arg⁡minq[Eelectrostatic(q)−V0∑iqi]

Rust ​

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 ​

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 ​

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 ​

toml
[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 ​

bash
npm install sci-form-wasm
typescript
// 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 ​

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) ​

bash
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 the pnpm wasm:build* scripts). Calling wasm-pack by hand regenerates pkg/package.json from scratch and drops the snippets entry that wasm-bindgen-rayon needs at runtime, as well as the ./alpha and ./beta subpath 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 ​

PropertyGated researchValidated aliasStable
API stabilityMay breakHistorical alias onlyFully stable
Test coverageBasic integration testsRegression + reference validationComprehensive + benchmarks
DocumentationModule-levelFull API docsFull API + guides
Real-world validationNone requiredRecommendedRequired
Element coverageLimitedBroadComplete within scope
PerformanceNot yet optimizedBenchmarkedOptimized

Released under the MIT License.