Skip to main content

Crate tpt_sci_dft_electronic

Crate tpt_sci_dft_electronic 

Source
Expand description

§tpt-sci-dft-electronic

Electronic-structure DFT for the tpt-science pillar — a deliberately simple, from-scratch 1-D Kohn–Sham solver (LDA exchange-correlation), scoped to 1-D model systems per the 2026-08 spec2.txt audit (tpt-sci-dft-electronic was flagged-needs-audit-first; no Rust prior art exists for Kohn–Sham LDA/GGA/band-structure, so this is treated as a multi-phase undertaking like tpt-sci-physics-rigid/tpt-sci-quantum).

v1 delivers:

  • A 1-D real-space grid (Grid1D) with a soft local external potential V_ext(x) (defines a confining well / 1-D “atom”).
  • The local-density approximation exchange-correlation energy density lda_xc (Slater exchange + a Perdew–Zunger-like correlation form).
  • A KohnSham solver that diagonalizes the Kohn–Sham Hamiltonian (−½ d²/dx² + V_eff) with a kinetic-energy finite-difference Laplacian and a charge self-consistency (Hartree + XC) loop, returning occupied orbitals and the total energy.

Multi-electron 3-D atoms, GGA/PBE, local pseudopotentials, and periodic band structures are now implemented alongside the original 1-D LDA solver (see KohnSham3D, XcFunctional, Pseudopotential, PeriodicPotential1D).

§Example

use tpt_sci_dft_electronic::{Grid1D, KohnSham, lda_xc};

let grid = Grid1D::new(101, -5.0, 5.0).unwrap();
// Harmonic-like external well.
let v_ext: Vec<f64> = grid.x().iter().map(|&x| 0.5 * x * x).collect();
let mut ks = KohnSham::new(grid, v_ext, 2).unwrap(); // 2 electrons
let res = ks.solve(50);
assert!(res.total_energy.is_finite());
// LDA XC energy density must be <= 0 (attractive exchange).
assert!(lda_xc(1.0) <= 0.0);

Structs§

Grid1D
A uniform 1-D real-space grid.
KohnSham
A 1-D Kohn–Sham self-consistent solver.
KohnSham3D
A 3-D real-space Kohn–Sham self-consistent solver.
KohnSham3DResult
Result of a 3-D Kohn–Sham solve.
KohnShamResult
Result of a Kohn–Sham solve.
Lda
Local-density-approximation functional wrapping crate::lda_xc.
Pbe
Perdew–Burke–Ernzerhof (PBE) generalized-gradient-approximation functional (unpolarized, ζ = 0).
PeriodicPotential1D
A 1-D periodic potential on a lattice of constant a, stored by its Fourier coefficients V_n in V(x) = Σ_n V_n·e^{i·2π·n·x/a}.
Pseudopotential
A softened local pseudopotential V_ps(r).

Enums§

DftError
Errors raised by the electronic-structure DFT solver.

Traits§

XcFunctional
A Kohn–Sham exchange-correlation functional.

Functions§

lda_xc
Local-density-approximation exchange-correlation energy density e_xc(ρ) (per electron, in Hartree units) for density rho (electrons per unit length).
pw_lda_xc
Per-electron Perdew–Wang local-density (LDA, ζ = 0) exchange-correlation energy density ε_xc^LSDA(ρ).