#![forbid(unsafe_code)]
mod eri_builder;
mod grad;
mod integrals;
mod operator;
mod shell;
mod spherical;
use std::fmt;
pub use eri_builder::{BraPairFill, EriBuilder};
pub use grad::{Gradient1e, GradientEri, MAX_GRAD_L};
pub use integrals::{select_engine, Engine, ScreeningStats};
pub use operator::{Factor, Operator, OperatorMatrix, Term};
pub use shell::{Basis, Shell, ShellKind};
#[derive(Debug, Clone, PartialEq)]
pub enum IntegralError {
MismatchedContraction {
exponents: usize,
coefficients: usize,
},
AngularMomentumTooHigh { l: usize, max: usize },
EmptyContraction,
AngularMomentumTooHighForGradient { l: usize, max: usize },
ChargeNotOnAtom { center: [f64; 3] },
OperatorMomentumTooHigh { l: usize, degree: usize, max: usize },
}
impl fmt::Display for IntegralError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
IntegralError::MismatchedContraction {
exponents,
coefficients,
} => write!(
f,
"contraction length mismatch: {exponents} exponents but {coefficients} coefficients"
),
IntegralError::AngularMomentumTooHigh { l, max } => {
write!(f, "angular momentum l={l} exceeds supported maximum {max}")
}
IntegralError::EmptyContraction => write!(f, "shell has no primitives"),
IntegralError::AngularMomentumTooHighForGradient { l, max } => write!(
f,
"angular momentum l={l} exceeds the gradient maximum {max} \
(the derivative raises the shell to l+1)"
),
IntegralError::ChargeNotOnAtom { center } => write!(
f,
"nuclear-gradient point charge at {center:?} is not on a basis atom"
),
IntegralError::OperatorMomentumTooHigh { l, degree, max } => write!(
f,
"angular momentum l={l} is too high for a degree-{degree} operator \
(the operator raises the ket to l+{degree}, which must stay ≤ {max})"
),
}
}
}
impl std::error::Error for IntegralError {}