Skip to content

Kernel Polynomial Method ​

Module: sci_form::kpm (core since 2026-11-07; F91 validated; sci_form::beta::kpm is an alias) Feature flag: none — promoted to core on 2026-11-07. beta-kpm and experimental-kpm are retained as compatibility aliases, and sci_form::beta::kpm re-exports sci_form::kpm.


Validation and limits ​

QuestionAnswer
Compared withNumPy eigh on GOE and gapped spectra
Measured separationmoments 3.5e-15; DOS L2 1.7e-14; Mulliken 3.8e-5 gapped, 2.6e-2 finite-T
Confidence regiongapped spectra, order 100–500, sparse matrices up to 5000 sites
Main limitationT=0 gapless spectra show Gibbs ringing; stochastic trace noise

The raw rows and the exact tolerances are in the full validation matrix.


Overview ​

Computes the density of states (DOS), density matrix, and Mulliken populations via Chebyshev polynomial expansion of the Hamiltonian, avoiding diagonalization entirely. Achieves O(N) scaling for sparse Hamiltonians, enabling electronic structure calculations on systems of thousands of atoms.


Theory ​

Chebyshev Expansion ​

Any function of a Hermitian matrix can be expanded in Chebyshev polynomials:

f(H)≈∑k=0MckTk(H~)

where H~=(H−bI)/a is rescaled to [−1,1].

Recursion ​

The Chebyshev polynomials are computed iteratively:

T0=I,T1=H~,Tk+1=2H~Tk−Tk−1

Each step costs O(nnz) (one sparse matrix-vector product).

Jackson Kernel ​

Gibbs oscillations are suppressed by the Jackson damping kernel:

gk(M)=(M−k+1)cos⁡πkM+1+sin⁡πkM+1cot⁡πM+1M+1

Stochastic Trace ​

The trace is estimated stochastically:

Tr[A]≈1nv∑i=1nvriTAri

using nv random probe vectors ri with entries ±1.


API ​

rust
use sci_form::kpm::*;

// Spectral bounds
let (e_min, e_max) = estimate_spectral_bounds(&hamiltonian);

// Rescale matrix to [-1, 1]
let h_scaled = rescale_matrix(&hamiltonian, e_min, e_max);

// Chebyshev expansion (exact trace for small systems)
let expansion = ChebyshevExpansion::from_matrix_exact(&h_scaled, 100);

// Jackson kernel damping
let kernel = jackson_kernel(100);

// DOS at a specific energy
let dos = expansion.dos_at_energy(0.0, &kernel);

// Full KPM DOS computation
let config = KpmConfig { order: 100, n_random: 20, ..Default::default() };
let dos_result = compute_kpm_dos(&hamiltonian, &config);
// dos_result.energies, dos_result.dos, dos_result.homo_lumo_gap

// KPM Mulliken charges
let mulliken = compute_kpm_mulliken(&hamiltonian, &overlap, n_electrons, &config);
// mulliken.charges, mulliken.total_electrons

Configuration ​

ParameterDefaultDescription
order100Number of Chebyshev moments
n_random20Random vectors for stochastic trace
temperature300.0Electronic temperature (K) for Fermi smearing

Scaling ​

System SizeExact Diag.KPM
N=100O(106)O(104)
N=1000O(109)O(105)
N=10000InfeasibleO(106)

Validation (F91, 2026-10-14) ​

External gate tests/beta_kpm_validation.rs vs scripts/validation/oracle_kpm.py (numpy eigh, GOE + gapped spectra): exact moments 3.5e-15, Jackson DOS L2 1.7e-14 (σ=πa/M with Gershgorin a; Gaussian shape 0.054 irreducible), Mulliken gapped 3.8e-5 / finite-T 2.6e-2. Fixes: spurious 2× on k≥1 FD terms, missing spin-2 in Mulliken. Gap: T=0 on gapless spectra (Gibbs); pybinding uninstallable.

Tests ​

bash
cargo test --test experimental_gates -- test_kpm

9 integration tests (tests/experimental/test_kpm.rs) covering: spectral bounds estimation, Chebyshev recursion stability, Jackson kernel positivity, DOS peak detection, band gap identification, and Mulliken charge conservation.

These tests live in the experimental_gates target — see Overview for the full command matrix.

Released under the MIT License.