Skip to content

E4: Kernel Polynomial Method (KPM)

Module: sci_form::experimental::kpmFeature flag: experimental-kpm


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~=(HbI)/a is rescaled to [1,1].

Recursion

The Chebyshev polynomials are computed iteratively:

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

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

Jackson Kernel

Gibbs oscillations are suppressed by the Jackson damping kernel:

gk(M)=(Mk+1)cosπkM+1+sinπkM+1cotπM+1M+1

Stochastic Trace

The trace is estimated stochastically:

Tr[A]1nvi=1nvriTAri

using nv random probe vectors ri with entries ±1.


API

rust
use sci_form::experimental::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)

Tests

bash
cargo test --features experimental-kpm --test regression -- test_kpm

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

Released under the MIT License.