Skip to main content

Crate sto_ns

Crate sto_ns 

Source
Expand description

A lightweight, no_std, pure Rust mathematical kernel for the exact evaluation of two-center Coulomb integrals over $ns$ Slater-Type Orbitals (STOs).

§STO-ns: Slater-Type Orbitals (s-orbitals)

This library implements the analytical expansion method using ellipsoidal coordinates, specifically optimized for spherically symmetric (l=0) orbitals. It serves as a high-performance primitive for semi-empirical methods (like QEq, EEM, ReaxFF) and ab initio calculations involving s-orbitals.

§Usage

Abstracting parameters into orbital objects for clear, semantic interactions.

use sto_ns::NsOrbital;

// Define orbital A: n=2, zeta=1.5
let orb_a = NsOrbital::new(2, 1.5).expect("Invalid parameters");

// Define orbital B: n=1, zeta=1.0
let orb_b = NsOrbital::new(1, 1.0).expect("Invalid parameters");

// Calculate the Coulomb integral J(A,B) at distance R=2.0
let integral = orb_a.repulsion(&orb_b, 2.0);

assert!(integral > 0.0);

§2. Direct Functional API

Low-level access to the mathematical kernel. Ideal for tight loops or mathematical backends where struct overhead is unnecessary.

use sto_ns::sto_coulomb_integral;

let r = 2.0;
// Calculate J(2s, 1s) with exponents 1.5 and 1.0
let result = sto_coulomb_integral(r, 2, 1.5, 1, 1.0);

§Features

  • Exact Arithmetic: Uses analytical formulas, not approximations.
  • Numerical Stability: Automatically handles singularities at short ranges.
  • High Performance:
    • Zero heap allocation (stack-only).
    • Compile-time computed factorial tables.
    • O(N) recursive algorithms for auxiliary functions with minimal overhead.
  • Portable: no_std compatible (via libm), runs on servers, WASM, and microcontrollers.

Structs§

NsOrbital
Represents a spherically symmetric ns Slater-Type Orbital (STO).

Functions§

sto_coulomb_integral
Computes the exact two-center Coulomb integral J_AB (Hartree).