Skip to main content

Basis

Struct Basis 

Source
pub struct Basis { /* private fields */ }
Expand description

An ordered collection of shells defining the atomic-orbital basis.

Implementations§

Source§

impl Basis

Source

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

Source

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.

Source

pub fn kinetic_grad(&self) -> Result<Gradient1e, IntegralError>

Per-atom gradient of the kinetic-energy matrix, ∂T/∂R_c.

§Errors

As Basis::overlap_grad.

Source

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.

Source

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.

Source

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

Source

pub fn overlap(&self) -> Vec<f64>

Overlap matrix S_{μν} = ⟨μ|ν⟩.

Source

pub fn kinetic(&self) -> Vec<f64>

Kinetic-energy matrix T_{μν} = ⟨μ| -½∇² |ν⟩.

Source

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)].

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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-101e-12.

Source

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

Source

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

Source

pub fn new(shells: Vec<Shell>) -> Self

Create a basis from a list of shells. AO ordering follows shell order.

Source

pub fn shells(&self) -> &[Shell]

The shells, in AO order.

Source

pub fn nao_cart(&self) -> usize

Total number of Cartesian atomic orbitals (counting every shell as Cartesian, regardless of ShellKind).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Basis

Source§

fn clone(&self) -> Basis

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Basis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Basis

Source§

fn default() -> Basis

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Basis

Source§

fn eq(&self, other: &Basis) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Basis

Auto Trait Implementations§

§

impl Freeze for Basis

§

impl RefUnwindSafe for Basis

§

impl Send for Basis

§

impl Sync for Basis

§

impl Unpin for Basis

§

impl UnsafeUnpin for Basis

§

impl UnwindSafe for Basis

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.