pub struct Basis { /* private fields */ }Expand description
An ordered collection of shells defining the atomic-orbital basis.
Implementations§
Source§impl Basis
impl Basis
Sourcepub fn eri_builder(&self) -> EriBuilder<'_>
pub fn eri_builder(&self) -> EriBuilder<'_>
Create a parallel-ready EriBuilder for this basis (default
Engine::Auto dispatch). Equivalent to EriBuilder::new.
Source§impl Basis
impl Basis
Sourcepub fn overlap_grad(&self) -> Result<Gradient1e, IntegralError>
pub fn overlap_grad(&self) -> Result<Gradient1e, IntegralError>
Per-atom gradient of the overlap matrix, ∂S/∂R_c.
§Errors
IntegralError::AngularMomentumTooHighForGradient if any shell has
l > MAX_GRAD_L.
Sourcepub fn kinetic_grad(&self) -> Result<Gradient1e, IntegralError>
pub fn kinetic_grad(&self) -> Result<Gradient1e, IntegralError>
Sourcepub fn nuclear_grad(
&self,
charges: &[(Vec3, f64)],
) -> Result<Gradient1e, IntegralError>
pub fn nuclear_grad( &self, charges: &[(Vec3, f64)], ) -> Result<Gradient1e, IntegralError>
Per-atom gradient of the nuclear-attraction matrix, ∂V/∂R_c, for the
point charges charges = [(center, Z)].
Includes both the basis-function derivatives and the operator
(Hellmann–Feynman) term: the 1/|r−C| operator depends on the charge
position C, so moving the atom carrying charge C contributes
∂_C ⟨a|V_C|b⟩. By the exact single-charge translational identity
∂_C = −(∂_A + ∂_B), this term is assembled from the same basis-center
derivatives, placed on the charge’s atom.
§Errors
IntegralError::AngularMomentumTooHighForGradient as above, or
IntegralError::ChargeNotOnAtom if a charge center is not a basis atom.
Sourcepub fn eri_grad(&self) -> Result<GradientEri, IntegralError>
pub fn eri_grad(&self) -> Result<GradientEri, IntegralError>
Per-atom gradient of the electron-repulsion tensor, ∂(ij|kl)/∂R_c.
Uses the dispatch policy (Engine::Auto); see Basis::eri_grad_with
to force an engine.
§Errors
IntegralError::AngularMomentumTooHighForGradient if any shell has
l > MAX_GRAD_L.
Sourcepub fn eri_grad_with(
&self,
engine: Engine,
) -> Result<GradientEri, IntegralError>
pub fn eri_grad_with( &self, engine: Engine, ) -> Result<GradientEri, IntegralError>
Like Basis::eri_grad but forces a specific Engine. Both engines
produce the same gradient to tolerance; forcing exists so tests exercise
each derivative path on the same quartets.
§Errors
As Basis::eri_grad.
Source§impl Basis
impl Basis
Sourcepub fn nuclear(&self, charges: &[([f64; 3], f64)]) -> Vec<f64>
pub fn nuclear(&self, charges: &[([f64; 3], f64)]) -> Vec<f64>
Nuclear-attraction matrix V_{μν} = Σ_C ⟨μ| −Z_C/|r−C| |ν⟩ for the given
point charges charges = [(center, Z)].
Sourcepub fn dipole(&self, o: [f64; 3]) -> [Vec<f64>; 3]
pub fn dipole(&self, o: [f64; 3]) -> [Vec<f64>; 3]
Cartesian dipole matrices [D_x, D_y, D_z], D_k = ⟨μ| (r−O)_k |ν⟩,
about the origin o.
Sourcepub fn eri_block(&self, i: usize, j: usize, k: usize, l: usize) -> Vec<f64>
pub fn eri_block(&self, i: usize, j: usize, k: usize, l: usize) -> Vec<f64>
Contracted Cartesian ERI block for the four shells (i, j, k, l) in
chemists’ notation (ij|kl) = ∫∫ φ_i(1)φ_j(1) r₁₂⁻¹ φ_k(2)φ_l(2) d1 d2.
The returned block is row-major over the four Cartesian component
indices (a, b, c, d) of shells (i, j, k, l):
block[((a · n_j + b) · n_k + c) · n_l + d]with n_x = self.shells()[x].n_func() (n_cart for a Cartesian shell,
2l+1 for a spherical one) and the Cartesian component order of
integral_math::am (or the integral_math::solid_harmonics::m_order spherical
order for spherical shells) — the
fastest-varying index is d, slowest is a. The block length is
n_i · n_j · n_k · n_l.
Sourcepub fn eri_block_with(
&self,
engine: Engine,
i: usize,
j: usize,
k: usize,
l: usize,
) -> Vec<f64>
pub fn eri_block_with( &self, engine: Engine, i: usize, j: usize, k: usize, l: usize, ) -> Vec<f64>
Like Basis::eri_block but forces a specific Engine (or Engine::Auto
for the dispatch policy). Both engines produce the same block to tolerance;
forcing exists so tests/CI exercise each path on the same quartets.
Sourcepub fn eri(&self) -> Vec<f64>
pub fn eri(&self) -> Vec<f64>
Dense electron-repulsion tensor (ij|kl) over the whole basis, in
chemists’ notation. Shells declared crate::ShellKind::Spherical
contribute their 2l+1 spherical components; Cartesian shells their
n_cart.
Shape [nao, nao, nao, nao] flattened row-major:
eri[((i · nao + j) · nao + k) · nao + l] = (ij|kl)where nao = self.nao() and i, j, k, l are global AO indices (shell
blocks placed at the offsets from offsets()). The tensor obeys the
8-fold permutational symmetry (ij|kl) = (ji|kl) = (ij|lk) = (kl|ij) = ….
The build exploits that symmetry: only the canonical shell quartets
(i ≥ j, k ≥ l, pair index ij ≥ kl) are evaluated, and each computed
block is scattered to every distinct permutation-equivalent position. Slots
related by a shell-level permutation are therefore bitwise-equal copies of
one evaluation; within a block whose bra (or ket) shells coincide, the usual
round-off-level (~1e-16 relative) asymmetry of one kernel evaluation
remains, exactly as for an unsymmetrized build.
Sourcepub fn eri_with(&self, engine: Engine) -> Vec<f64>
pub fn eri_with(&self, engine: Engine) -> Vec<f64>
Like Basis::eri but forces a specific Engine (or Engine::Auto).
Both engines produce the same tensor to tolerance.
Sourcepub fn schwarz_bounds(&self) -> Vec<f64>
pub fn schwarz_bounds(&self) -> Vec<f64>
Cauchy–Schwarz shell-pair bound matrix Q (Häser–Ahlrichs 1989), row-major
n_shells × n_shells:
Q[i, j] = sqrt( max_{μ∈i, ν∈j} (μν|μν) ).Each diagonal self-repulsion (μν|μν) ≥ 0 is read from the (ij|ij) shell
block, so Q bounds every ERI by |(μν|λσ)| ≤ Q[i,j]·Q[k,l] for μν in
shell pair (i,j) and λσ in (k,l). Kind-aware: spherical shells use
their 2l+1 components, so Q bounds the spherical integrals directly.
Sourcepub fn schwarz_bounds_with(&self, engine: Engine) -> Vec<f64>
pub fn schwarz_bounds_with(&self, engine: Engine) -> Vec<f64>
Like Basis::schwarz_bounds but with a forced Engine (the diagonal
blocks are evaluated with it). The bound is engine-independent to tolerance.
Sourcepub fn eri_screened(&self, tau: f64) -> (Vec<f64>, ScreeningStats)
pub fn eri_screened(&self, tau: f64) -> (Vec<f64>, ScreeningStats)
Schwarz-screened dense ERI tensor: identical to Basis::eri except a
shell quartet (ij|kl) is skipped (left zero) when its Cauchy–Schwarz
bound Q[i,j]·Q[k,l] < τ (tau). Because every element of a skipped block
satisfies |(μν|λσ)| ≤ Q[i,j]·Q[k,l] < τ, screening introduces no error
above τ. Returns the tensor and ScreeningStats.
tau is the documented screening threshold; smaller τ retains more
quartets (more accurate, slower). A typical production value is 1e-10–
1e-12.
Sourcepub fn eri_screened_with(
&self,
engine: Engine,
tau: f64,
) -> (Vec<f64>, ScreeningStats)
pub fn eri_screened_with( &self, engine: Engine, tau: f64, ) -> (Vec<f64>, ScreeningStats)
Like Basis::eri_screened but with a forced Engine.
Source§impl Basis
impl Basis
Sourcepub fn int1e(&self, op: &Operator) -> Result<OperatorMatrix, IntegralError>
pub fn int1e(&self, op: &Operator) -> Result<OperatorMatrix, IntegralError>
Evaluate a one-electron Operator over the basis, returning its complex
matrix as real + imaginary parts (OperatorMatrix).
The operator is decomposed into base overlap integrals
(integral_core::operator); spherical shells are transformed to their
2l+1 components (the transform is applied to each part). This is the
generic operator-DSL path; the bespoke Basis::overlap /
Basis::kinetic / Basis::dipole builders remain the fast paths.
§Errors
IntegralError::OperatorMomentumTooHigh if any shell has
l + op.degree() > MAX_L (the DSL raises the ket to l + degree).
Source§impl Basis
impl Basis
Sourcepub fn new(shells: Vec<Shell>) -> Self
pub fn new(shells: Vec<Shell>) -> Self
Create a basis from a list of shells. AO ordering follows shell order.
Sourcepub fn nao_cart(&self) -> usize
pub fn nao_cart(&self) -> usize
Total number of Cartesian atomic orbitals (counting every shell as
Cartesian, regardless of ShellKind).
Sourcepub fn nao(&self) -> usize
pub fn nao(&self) -> usize
Total number of output atomic orbitals: the sum of each shell’s
Shell::n_func (n_cart for Cartesian shells, 2l+1 for spherical).
This is the dimension of the matrices/tensors the builders return.
Sourcepub fn atoms(&self) -> Vec<[f64; 3]>
pub fn atoms(&self) -> Vec<[f64; 3]>
Distinct shell centers (“atoms”), in order of first appearance.
Two shells belong to the same atom iff their centers are bitwise equal
([f64; 3] equality). This is the natural grouping when shells on one
nucleus share the same center value, and it defines the per-atom ordering
of the geometric-derivative (gradient) builders.