occ
Loading...
Searching...
No Matches
occ::qm::cc Namespace Reference

Classes

struct  CCIntegrals
 Restricted (closed-shell, spatial-MO) integral blocks in chemist notation (pq|rs), plus a vvvv-ladder callable. More...
 
struct  CCSDOptions
 
struct  CCSDResult
 
struct  LaplaceGrid
 Least-squares "Laplace" quadrature for the inverse function on a range: 1/x ~= sum_k weights(k) * exp(-x * points(k)) for x in [xmin, xmax]. More...
 
struct  ThcFactors
 THC factors for the spatial MOs: (pq|rs) ~ sum_PQ X(p,P) X(q,P) V(P,Q) X(r,Q) X(s,Q). More...
 
struct  ThcMP2Options
 
struct  ThcMP2Result
 
struct  ThcOptions
 
struct  UCCIntegrals
 Spin-blocked spatial MO integrals for spin-adapted unrestricted CCSD, in chemist notation, matching the PySCF UCCSD _ChemistsERIs block layout. More...
 
struct  UCCSDOptions
 
struct  UCCSDResult
 
struct  UThcFactors
 Cross-spin THC factors for unrestricted CCSD. More...
 

Enumerations

enum class  IsdfMethod { QR , Cholesky }
 Interpolation-point selection for ISDF. More...
 
enum class  ThcRegType { Eig , Tikhonov }
 Regularisation of the (ill-conditioned) LS-THC metric inverse. More...
 
enum class  ThcSelectBasis { AO , MO }
 Which functions' products the interpolation points must span. More...
 

Functions

CCSDResult ccsd (const CCIntegrals &eris, const CCSDOptions &opts={})
 Restricted (closed-shell, spin-adapted) CCSD against a canonical reference.
 
double ccsd_energy (const Eigen::Tensor< double, 2 > &t1, const Eigen::Tensor< double, 4 > &t2, const CCIntegrals &eris)
 CCSD correlation energy for given amplitudes (exposed for testing).
 
void pgemm (Eigen::Ref< occ::Mat > C, Eigen::Ref< const occ::Mat > A, Eigen::Ref< const occ::Mat > B, bool accumulate=false, bool transA=false)
 C(m x n) = A(m x k) * B(k x n).
 
Eigen::Map< const occ::Matmat_view (const Eigen::Tensor< double, 4 > &t, Eigen::Index r, Eigen::Index c)
 View a contiguous (column-major) 4-tensor's data as an (r x c) matrix.
 
template<int N>
void ppermute (double *out, const double *A, const Eigen::array< Eigen::Index, N > &Adims, const Eigen::array< int, N > &perm)
 Parallel tensor permute (transpose): writes contiguous out = A.shuffle(perm) – out has dims Odim[k] = Adims[perm[k]] and out(j...) = A(source).
 
Eigen::Tensor< double, 4 > pcon2 (const Eigen::Tensor< double, 4 > &A, int a0, int a1, const Eigen::Tensor< double, 4 > &B, int b0, int b1)
 Parallel two-index contraction of two 4-tensors – a drop-in, multithreaded replacement for A.contract(B, {(a0,b0),(a1,b1)}).
 
template<int RA, int RB, int NC>
Eigen::Tensor< double, RA+RB - 2 *NC > pcon (const Eigen::Tensor< double, RA > &A, const Eigen::Tensor< double, RB > &B, const std::array< Eigen::IndexPair< int >, NC > &pairs)
 General N-index parallel tensor contraction – a drop-in, multithreaded replacement for A.contract(B, pairs) that routes through pgemm (BLAS), so it parallelises where Eigen's tensor contract() (serial gebp_kernel) does not.
 
int num_frozen_core (const AOBasis &basis)
 Number of frozen-core spatial orbitals for basis (chemical core: 1s for Li-Ne, [Ne] for Na-Ar, [Ar] for Sc+), matching the standard CCSD(T) default.
 
CCIntegrals exact_eris (const AOBasis &basis, const MolecularOrbitals &mo, int n_frozen=0, size_t memory_budget=(size_t(1)<< 30))
 Exact backend: all blocks (incl.
 
CCIntegrals df_eris (const AOBasis &basis, const AOBasis &aux_basis, const MolecularOrbitals &mo, int n_frozen=0, size_t memory_budget=(size_t(1)<< 30))
 Density-fitted (RI) backend: every block from the metric-folded DF B-tensor; the ladder is contracted through B so (ac|bd) is never formed.
 
CCIntegrals thc_eris (const AOBasis &basis, const AOBasis &aux_basis, const MolecularOrbitals &mo, const ThcOptions &opts={}, int n_frozen=0, size_t memory_budget=(size_t(1)<< 30))
 THC backend: the <=2-virtual blocks come from DF (scalable); ovvv and the vvvv ladder are applied through the THC factors (X, V) – the ladder as three GEMMs, never forming vvvv.
 
LaplaceGrid laplace_grid (double xmin, double xmax, int n)
 Build an n-point Laplace grid approximating 1/x over [xmin, xmax] (require 0 < xmin <= xmax).
 
double laplace_max_rel_error (const LaplaceGrid &grid, double xmin, double xmax, int n_sample=64)
 Max relative error max_x |1 - x * sum_k w_k e^{-x t_k}| of grid, sampled on n_sample log-spaced x in [xmin, xmax] (testing / diagnostics).
 
ThcFactors build_thc (const AOBasis &basis, const AOBasis &aux_basis, const MolecularOrbitals &mo, const ThcOptions &opts={})
 Build THC factors (X, V) for the spatial MOs of mo.
 
ThcFactors build_thc_from_B (const AOBasis &basis, const MolecularOrbitals &mo, const ThcOptions &opts, const Mat &B)
 As build_thc, but using a precomputed metric-folded DF reference tensor B (nmo^2 x naux, row p*nmo+q).
 
UThcFactors build_uthc (const AOBasis &basis, const Mat &Ca, const Mat &Cb, const Mat &Ba, const Mat &Bb, const ThcOptions &opts)
 
std::vector< int > select_isdf_points (const Mat &coll, IsdfMethod method, int target, double tol)
 Indices of interpolation grid points spanning products of the columns of coll (npts x nfunc).
 
Mat thc_select_collocation (const AOBasis &basis, const MolecularOrbitals &mo, const ThcOptions &opts)
 Point-selection half of build_thc: select ISDF interpolation points (AO- or MO-based per opts.select_basis, geometry-only) and return the MO collocation X (nmo x n_isdf) = MO value at each selected point.
 
Mat fit_core (const Mat &X, const Mat &B, double reg, ThcRegType reg_type, double *condition_out=nullptr, int *n_kept_out=nullptr)
 Regularised least-squares THC core fit.
 
Mat fit_core_ov (const Mat &Xo, const Mat &Xv, const Mat &B_ov, double reg, ThcRegType reg_type, double *condition_out=nullptr, int *n_kept_out=nullptr)
 LS-THC core fit restricted to the occupied-virtual block – the only integrals MP2 needs.
 
Eigen::Tensor< double, 4 > reconstruct_eri (const Mat &X, const Mat &V)
 THC-reconstructed chemist integrals (pq|rs) as a dense nmo^4 tensor (testing).
 
Eigen::Tensor< double, 4 > mo_eri_general (const IntegralEngine &engine, const Mat &C_L, const Mat &C_q, const Mat &C_r, const Mat &C_s, size_t budget=(size_t(1)<< 28))
 Semidirect AO->MO transform (chemist (pq|rs)) for arbitrary MO coefficient blocks.
 
double reconstruction_error (const AOBasis &basis, const MolecularOrbitals &mo, const Mat &X, const Mat &V)
 Relative Frobenius error of the THC-reconstructed MO integrals vs exact.
 
ThcMP2Result thc_mp2 (const AOBasis &basis, const AOBasis &aux_basis, const MolecularOrbitals &mo, const ThcMP2Options &opts={})
 LS-THC-MP2 correlation energy (restricted or unrestricted, dispatched on mo.kind).
 
double ccsd_t (const Eigen::Tensor< double, 2 > &t1, const Eigen::Tensor< double, 4 > &t2, const CCIntegrals &eris)
 Restricted closed-shell perturbative triples (T) correction.
 
UCCSDResult uccsd (const AOBasis &basis, const MolecularOrbitals &mo, const UCCSDOptions &opts={})
 Spin-adapted unrestricted CCSD(T) for a UHF (or RHF) reference.
 
UCCSDResult uccsd (const AOBasis &basis, const AOBasis &aux_basis, const MolecularOrbitals &mo, const UCCSDOptions &opts={})
 df/thc backends need an auxiliary basis; "exact" is also accepted here.
 
UCCSDResult uccsd_so (const AOBasis &basis, const MolecularOrbitals &mo, int n_frozen=0, bool with_triples=true, int max_cycle=100, double tol=1e-9)
 Spin-orbital CCSD(T) for an open- or closed-shell reference.
 
double uccsd_t_via_so (const AOBasis &basis, const MolecularOrbitals &mo, int n_frozen, const Eigen::Tensor< double, 2 > &t1a, const Eigen::Tensor< double, 2 > &t1b, const Eigen::Tensor< double, 4 > &t2aa, const Eigen::Tensor< double, 4 > &t2ab, const Eigen::Tensor< double, 4 > &t2bb)
 Perturbative (T) correction for converged spin-adapted UCCSD amplitudes, evaluated through the validated spin-orbital triples kernel.
 
UCCIntegrals u_exact_eris (const AOBasis &basis, const MolecularOrbitals &mo, int n_frozen=0, std::size_t memory_budget=(std::size_t(1)<< 30))
 Exact (full AO->MO) spin-blocked integrals.
 
UCCIntegrals u_df_eris (const AOBasis &basis, const AOBasis &aux_basis, const MolecularOrbitals &mo, int n_frozen=0, std::size_t memory_budget=(std::size_t(1)<< 30))
 Density-fitted spin-blocked integrals.
 
UCCIntegrals u_thc_eris (const AOBasis &basis, const AOBasis &aux_basis, const MolecularOrbitals &mo, const ThcOptions &opts={}, int n_frozen=0, std::size_t memory_budget=(std::size_t(1)<< 30))
 THC spin-blocked integrals: cheap blocks (<= 2 virtuals + ovvv) come from DF, and the three vvvv ladders use cross-spin THC factors (one ISDF point set, per-spin X and three cores Vaa/Vbb/Vab).
 
double uccsd_t (const UCCIntegrals &e, const Eigen::Tensor< double, 2 > &t1a, const Eigen::Tensor< double, 2 > &t1b, const Eigen::Tensor< double, 4 > &t2aa, const Eigen::Tensor< double, 4 > &t2ab, const Eigen::Tensor< double, 4 > &t2bb)
 Perturbative (T) correction for spin-adapted unrestricted CCSD, evaluated natively from the spin-blocked UCCIntegrals (no spin-orbital integral build).
 

Enumeration Type Documentation

◆ IsdfMethod

enum class occ::qm::cc::IsdfMethod
strong

Interpolation-point selection for ISDF.

Enumerator
QR 

pivoted QR on the pair-density collocation (accurate, O(N^4))

Cholesky 

pivoted Cholesky of the grid Gram with lazy columns (cheaper)

◆ ThcRegType

enum class occ::qm::cc::ThcRegType
strong

Regularisation of the (ill-conditioned) LS-THC metric inverse.

Enumerator
Eig 

drop eigenvalues below reg*lambda_max (truncated pinv)

Tikhonov 

shift (S + reg*lambda_max I)^-1

◆ ThcSelectBasis

enum class occ::qm::cc::ThcSelectBasis
strong

Which functions' products the interpolation points must span.

Enumerator
AO 

AO pair products: geometry-only / SCF-free (default)

MO 

MO pair products (needs converged MOs for selection)

Function Documentation

◆ build_thc()

ThcFactors occ::qm::cc::build_thc ( const AOBasis basis,
const AOBasis aux_basis,
const MolecularOrbitals mo,
const ThcOptions opts = {} 
)

Build THC factors (X, V) for the spatial MOs of mo.

basis : AO basis of the molecule aux_basis : density-fitting auxiliary basis (the LS-THC reference)

◆ build_thc_from_B()

ThcFactors occ::qm::cc::build_thc_from_B ( const AOBasis basis,
const MolecularOrbitals mo,
const ThcOptions opts,
const Mat B 
)

As build_thc, but using a precomputed metric-folded DF reference tensor B (nmo^2 x naux, row p*nmo+q).

Lets a caller that already holds a DFIntegrals reuse it instead of rebuilding the 3-center store.

◆ build_uthc()

UThcFactors occ::qm::cc::build_uthc ( const AOBasis basis,
const Mat Ca,
const Mat Cb,
const Mat Ba,
const Mat Bb,
const ThcOptions opts 
)

◆ ccsd()

CCSDResult occ::qm::cc::ccsd ( const CCIntegrals eris,
const CCSDOptions opts = {} 
)

Restricted (closed-shell, spin-adapted) CCSD against a canonical reference.

Backend-agnostic: eris may be exact / DF / THC. Returns the correlation energy and converged t1/t2 amplitudes.

◆ ccsd_energy()

double occ::qm::cc::ccsd_energy ( const Eigen::Tensor< double, 2 > &  t1,
const Eigen::Tensor< double, 4 > &  t2,
const CCIntegrals eris 
)

CCSD correlation energy for given amplitudes (exposed for testing).

◆ ccsd_t()

double occ::qm::cc::ccsd_t ( const Eigen::Tensor< double, 2 > &  t1,
const Eigen::Tensor< double, 4 > &  t2,
const CCIntegrals eris 
)

Restricted closed-shell perturbative triples (T) correction.

Port of the thc_cct reference rtriples.py (PySCF ccsd_t_slow, JCP 94, 442 (1991)). Memory-frugal: it loops over virtual triples (a>=b>=c) and forms only O(nocc^3) intermediates per triple – the full O(o^3 v^3) triples array is never materialised. The only 3-virtual integral needed is ovvv, which is supplied by the (exact / DF / THC) backend, so (T) works for all three.

Returns the (T) energy correction for the given converged CCSD amplitudes.

◆ df_eris()

CCIntegrals occ::qm::cc::df_eris ( const AOBasis basis,
const AOBasis aux_basis,
const MolecularOrbitals mo,
int  n_frozen = 0,
size_t  memory_budget = (size_t(1)<< 30) 
)

Density-fitted (RI) backend: every block from the metric-folded DF B-tensor; the ladder is contracted through B so (ac|bd) is never formed.

◆ exact_eris()

CCIntegrals occ::qm::cc::exact_eris ( const AOBasis basis,
const MolecularOrbitals mo,
int  n_frozen = 0,
size_t  memory_budget = (size_t(1)<< 30) 
)

Exact backend: all blocks (incl.

ovvv and the dense vvvv ladder) from a semidirect AO->MO transform (no nao^4 tensor). Reference for the others. n_frozen lowest occupied orbitals are excluded from the correlation space.

◆ fit_core()

Mat occ::qm::cc::fit_core ( const Mat X,
const Mat B,
double  reg,
ThcRegType  reg_type,
double *  condition_out = nullptr,
int *  n_kept_out = nullptr 
)

Regularised least-squares THC core fit.

B is the metric-folded DF tensor (nmo^2 x naux) with row p*nmo+q, so (pq|rs) = sum_A B(p*nmo+q,A) B(r*nmo+s,A).

◆ fit_core_ov()

Mat occ::qm::cc::fit_core_ov ( const Mat Xo,
const Mat Xv,
const Mat B_ov,
double  reg,
ThcRegType  reg_type,
double *  condition_out = nullptr,
int *  n_kept_out = nullptr 
)

LS-THC core fit restricted to the occupied-virtual block – the only integrals MP2 needs.

Fits V so (ia|jb) ~ sum_PQ Xo(i,P)Xv(a,P) V(P,Q) Xo(j,Q)Xv(b,Q). Xo (o x P) / Xv (v x P) are the occ/virt rows of the THC collocation; B_ov is the metric-folded DF tensor for the ov pairs (o*v x naux, row i*v+a) = build_b_tilde(C_occ, C_virt). Metric is the ov Gram S = (Xo^T Xo) o (Xv^T Xv). Much cheaper (o*v << nmo^2) and more accurate for MP2 than the all-pairs fit_core.

◆ laplace_grid()

LaplaceGrid occ::qm::cc::laplace_grid ( double  xmin,
double  xmax,
int  n 
)

Build an n-point Laplace grid approximating 1/x over [xmin, xmax] (require 0 < xmin <= xmax).

Derivation: the canonical inverse on [1,R] with R=xmax/xmin satisfies 1/x' = \int_0^1 u^{x'-1} du; applying n-point Gauss-Legendre on [0,1] and undoing the x'=x/xmin scaling gives t_k = -ln(u_k)/xmin, w_k = omega_k/(u_k*xmin).

◆ laplace_max_rel_error()

double occ::qm::cc::laplace_max_rel_error ( const LaplaceGrid grid,
double  xmin,
double  xmax,
int  n_sample = 64 
)

Max relative error max_x |1 - x * sum_k w_k e^{-x t_k}| of grid, sampled on n_sample log-spaced x in [xmin, xmax] (testing / diagnostics).

◆ mat_view()

Eigen::Map< const occ::Mat > occ::qm::cc::mat_view ( const Eigen::Tensor< double, 4 > &  t,
Eigen::Index  r,
Eigen::Index  c 
)
inline

View a contiguous (column-major) 4-tensor's data as an (r x c) matrix.

r*c must equal the tensor size; the caller is responsible for having laid the tensor out (via .shuffle()) so that this flat reinterpretation is meaningful.

◆ mo_eri_general()

Eigen::Tensor< double, 4 > occ::qm::cc::mo_eri_general ( const IntegralEngine engine,
const Mat C_L,
const Mat C_q,
const Mat C_r,
const Mat C_s,
size_t  budget = (size_t(1)<< 28) 
)

Semidirect AO->MO transform (chemist (pq|rs)) for arbitrary MO coefficient blocks.

Blocks the left index by budget and uses IntegralEngine::ao_direct_half_transform, so the nao^4 AO tensor is never materialised. Returns G(L, q, r, s) with L over the columns of C_L.

◆ num_frozen_core()

int occ::qm::cc::num_frozen_core ( const AOBasis basis)

Number of frozen-core spatial orbitals for basis (chemical core: 1s for Li-Ne, [Ne] for Na-Ar, [Ar] for Sc+), matching the standard CCSD(T) default.

◆ pcon()

template<int RA, int RB, int NC>
Eigen::Tensor< double, RA+RB - 2 *NC > occ::qm::cc::pcon ( const Eigen::Tensor< double, RA > &  A,
const Eigen::Tensor< double, RB > &  B,
const std::array< Eigen::IndexPair< int >, NC > &  pairs 
)

General N-index parallel tensor contraction – a drop-in, multithreaded replacement for A.contract(B, pairs) that routes through pgemm (BLAS), so it parallelises where Eigen's tensor contract() (serial gebp_kernel) does not.

Each pair (a,b) contracts A axis a with B axis b. Result is returned in Eigen's contract output order (A free axes ascending, then B free axes ascending), so any existing trailing .shuffle() still applies.

◆ pcon2()

Eigen::Tensor< double, 4 > occ::qm::cc::pcon2 ( const Eigen::Tensor< double, 4 > &  A,
int  a0,
int  a1,
const Eigen::Tensor< double, 4 > &  B,
int  b0,
int  b1 
)
inline

Parallel two-index contraction of two 4-tensors – a drop-in, multithreaded replacement for A.contract(B, {(a0,b0),(a1,b1)}).

Pairs A axis a0 with B axis b0 and a1 with b1; returns the (A-free..., B-free...) tensor in Eigen's contract output order (so an existing trailing .shuffle() still applies). Reshapes each operand once (free indices grouped as the GEMM's outer dim, contracted indices as the shared dim) and dispatches to pgemm.

◆ pgemm()

void occ::qm::cc::pgemm ( Eigen::Ref< occ::Mat C,
Eigen::Ref< const occ::Mat A,
Eigen::Ref< const occ::Mat B,
bool  accumulate = false,
bool  transA = false 
)
inline

C(m x n) = A(m x k) * B(k x n).

With accumulate, C += A*B. With transA, A is passed as (k x m) and A^T*B is formed.

Whether to parallelise here depends on the GEMM backend:

  • On Apple with Accelerate, the GEMM runs on the AMX matrix co-processor, which is shared per CPU cluster: one dgemm already saturates it (measured: 8 concurrent dgemms = 1.2x one) and a single AMX call (~346 GFLOP/s) beats Eigen NEON on all 8 cores (~237). So issue exactly ONE call – TBB-blocking would only spawn contending AMX calls.
  • Everywhere else (Linux default has no system BLAS; we do not assume a Linux BLAS is threaded) the underlying GEMM is single-threaded (Eigen's own NEON/AVX, ~52 GFLOP/s), so we parallelise over output blocks of the larger dimension ourselves (measured ~4.6x on 8 cores).

◆ ppermute()

template<int N>
void occ::qm::cc::ppermute ( double *  out,
const double *  A,
const Eigen::array< Eigen::Index, N > &  Adims,
const Eigen::array< int, N > &  perm 
)
inline

Parallel tensor permute (transpose): writes contiguous out = A.shuffle(perm) – out has dims Odim[k] = Adims[perm[k]] and out(j...) = A(source).

The strided gather from A is split across TBB over contiguous output blocks. This replaces Eigen's serial .shuffle(): in a transpose-GEMM (TTGT) contraction the permutation is the bottleneck (Matthews, TBLIS, arXiv:1607.00291), so it must run on all cores even though the GEMM is handed to a black-box BLAS.

◆ reconstruct_eri()

Eigen::Tensor< double, 4 > occ::qm::cc::reconstruct_eri ( const Mat X,
const Mat V 
)

THC-reconstructed chemist integrals (pq|rs) as a dense nmo^4 tensor (testing).

◆ reconstruction_error()

double occ::qm::cc::reconstruction_error ( const AOBasis basis,
const MolecularOrbitals mo,
const Mat X,
const Mat V 
)

Relative Frobenius error of the THC-reconstructed MO integrals vs exact.

◆ select_isdf_points()

std::vector< int > occ::qm::cc::select_isdf_points ( const Mat coll,
IsdfMethod  method,
int  target,
double  tol 
)

Indices of interpolation grid points spanning products of the columns of coll (npts x nfunc).

target<=0 falls back to the tol rank cut.

◆ thc_eris()

CCIntegrals occ::qm::cc::thc_eris ( const AOBasis basis,
const AOBasis aux_basis,
const MolecularOrbitals mo,
const ThcOptions opts = {},
int  n_frozen = 0,
size_t  memory_budget = (size_t(1)<< 30) 
)

THC backend: the <=2-virtual blocks come from DF (scalable); ovvv and the vvvv ladder are applied through the THC factors (X, V) – the ladder as three GEMMs, never forming vvvv.

aux_basis is the DF/LS-THC reference basis.

◆ thc_mp2()

ThcMP2Result occ::qm::cc::thc_mp2 ( const AOBasis basis,
const AOBasis aux_basis,
const MolecularOrbitals mo,
const ThcMP2Options opts = {} 
)

LS-THC-MP2 correlation energy (restricted or unrestricted, dispatched on mo.kind).

The denominator is made separable by a Laplace quadrature so the THC factors collapse the orbital sums into n_isdf x n_isdf contractions: opposite-spin (Coulomb) is O(n_isdf^3) per Laplace point, same-spin exchange O(n_isdf^4). aux_basis is the density-fitting basis used both for the cheap DF reference and the LS-THC core fit (as in thc_eris).

◆ thc_select_collocation()

Mat occ::qm::cc::thc_select_collocation ( const AOBasis basis,
const MolecularOrbitals mo,
const ThcOptions opts 
)

Point-selection half of build_thc: select ISDF interpolation points (AO- or MO-based per opts.select_basis, geometry-only) and return the MO collocation X (nmo x n_isdf) = MO value at each selected point.

The caller then fits the core: fit_core over all pairs (CCSD), or fit_core_ov over the occ-virt block (MP2).

◆ u_df_eris()

UCCIntegrals occ::qm::cc::u_df_eris ( const AOBasis basis,
const AOBasis aux_basis,
const MolecularOrbitals mo,
int  n_frozen = 0,
std::size_t  memory_budget = (std::size_t(1)<< 30) 
)

Density-fitted spin-blocked integrals.

All blocks come from the metric-folded DF B-tensor (one 3-center store, shared aux basis), and the three vvvv ladders contract through the per-spin B-tensors so no O(V^4) block is ever formed.

◆ u_exact_eris()

UCCIntegrals occ::qm::cc::u_exact_eris ( const AOBasis basis,
const MolecularOrbitals mo,
int  n_frozen = 0,
std::size_t  memory_budget = (std::size_t(1)<< 30) 
)

Exact (full AO->MO) spin-blocked integrals.

Builds the three spatial chemist tensors (alpha, beta, alpha-beta) and materialises the vvvv blocks for the ladder closures. Reference backend. n_frozen frozen-core spatial orbitals are dropped from each spin's occupied space.

◆ u_thc_eris()

UCCIntegrals occ::qm::cc::u_thc_eris ( const AOBasis basis,
const AOBasis aux_basis,
const MolecularOrbitals mo,
const ThcOptions opts = {},
int  n_frozen = 0,
std::size_t  memory_budget = (std::size_t(1)<< 30) 
)

THC spin-blocked integrals: cheap blocks (<= 2 virtuals + ovvv) come from DF, and the three vvvv ladders use cross-spin THC factors (one ISDF point set, per-spin X and three cores Vaa/Vbb/Vab).

No O(V^4) block is ever formed.

◆ uccsd() [1/2]

UCCSDResult occ::qm::cc::uccsd ( const AOBasis basis,
const AOBasis aux_basis,
const MolecularOrbitals mo,
const UCCSDOptions opts = {} 
)

df/thc backends need an auxiliary basis; "exact" is also accepted here.

◆ uccsd() [2/2]

UCCSDResult occ::qm::cc::uccsd ( const AOBasis basis,
const MolecularOrbitals mo,
const UCCSDOptions opts = {} 
)

Spin-adapted unrestricted CCSD(T) for a UHF (or RHF) reference.

Amplitudes and integrals are organised by spin into spatial blocks (t1a,t1b; t2aa,t2ab,t2bb) – the formulation production codes use for open shell. ~2-4x less work/memory than the spin-orbital path (uccsd_so) and, for the df/thc backends, never forms the O(V^4) vvvv block. Exact backend only via this overload; df/thc take an auxiliary basis (see the aux overload).

◆ uccsd_so()

UCCSDResult occ::qm::cc::uccsd_so ( const AOBasis basis,
const MolecularOrbitals mo,
int  n_frozen = 0,
bool  with_triples = true,
int  max_cycle = 100,
double  tol = 1e-9 
)

Spin-orbital CCSD(T) for an open- or closed-shell reference.

Builds the antisymmetrised spin-orbital MO integrals from the (UHF or RHF) coefficients – spin orbitals are sorted by energy – then runs the textbook spin-orbital CCSD (Stanton-Gauss-Watts-Bartlett 1991) and, optionally, the perturbative (T) (Crawford project-6 formulas). Works for any reference but is ~4-8x the work of the spin-adapted unrestricted path; kept as an independent oracle for validating the spin-adapted uccsd and as a fallback for references the spin-adapted path does not handle (e.g. ROHF). n_frozen is the number of frozen-core spatial orbitals (2*n_frozen spin orbitals are frozen). Exact integrals only.

◆ uccsd_t()

double occ::qm::cc::uccsd_t ( const UCCIntegrals e,
const Eigen::Tensor< double, 2 > &  t1a,
const Eigen::Tensor< double, 2 > &  t1b,
const Eigen::Tensor< double, 4 > &  t2aa,
const Eigen::Tensor< double, 4 > &  t2ab,
const Eigen::Tensor< double, 4 > &  t2bb 
)

Perturbative (T) correction for spin-adapted unrestricted CCSD, evaluated natively from the spin-blocked UCCIntegrals (no spin-orbital integral build).

Port of PySCF uccsd_t_slow.py (4 spin cases aaa/bbb/baa/bba); a canonical UHF reference is assumed so the f_vo disconnected terms drop.

◆ uccsd_t_via_so()

double occ::qm::cc::uccsd_t_via_so ( const AOBasis basis,
const MolecularOrbitals mo,
int  n_frozen,
const Eigen::Tensor< double, 2 > &  t1a,
const Eigen::Tensor< double, 2 > &  t1b,
const Eigen::Tensor< double, 4 > &  t2aa,
const Eigen::Tensor< double, 4 > &  t2ab,
const Eigen::Tensor< double, 4 > &  t2bb 
)

Perturbative (T) correction for converged spin-adapted UCCSD amplitudes, evaluated through the validated spin-orbital triples kernel.

The spatial spin-block amplitudes (t1a,t1b; t2aa,t2ab,t2bb) are mapped into the energy-sorted spin-orbital basis built from the MOs, then so_triples runs.