MADNESS 0.10.1
madness::ExchangeCommutator Struct Reference

#include <exchange_commutator.h>

Classes

struct  KffKResult
struct  SplitAlphaOptions
struct  ThreeRangeOptions

Public Member Functions

 ExchangeCommutator ()=default
DiagnosticMatrix diagnose_GKffK (World &world, const std::vector< CCPairFunction< double, 6 > > &GKf_cc, const std::vector< CCPairFunction< double, 6 > > &GfK_cc, const real_function_3d &phi_i, const real_function_3d &phi_j, const real_function_3d &Kphi_i, const real_function_3d &Kphi_j, const Info &info, double energy, const std::vector< real_function_3d > &aobasis, bool orthonormalize_basis=true) const
DiagnosticMatrix diagnose_GQKffK (World &world, const std::vector< CCPairFunction< double, 6 > > &GQKf_cc, const std::vector< CCPairFunction< double, 6 > > &GQfK_cc, const real_function_3d &phi_i, const real_function_3d &phi_j, const real_function_3d &Kphi_i, const real_function_3d &Kphi_j, const Info &info, double energy, const std::vector< real_function_3d > &aobasis, bool orthonormalize_basis=true) const
DiagnosticMatrix diagnose_KffK (World &world, const std::vector< CCPairFunction< double, 6 > > &Kf_cc, const std::vector< CCPairFunction< double, 6 > > &fK_cc, const real_function_3d &phi_i, const real_function_3d &phi_j, const real_function_3d &Kphi_i, const real_function_3d &Kphi_j, const Info &info, double energy, const std::vector< real_function_3d > &aobasis, bool orthonormalize_basis=true) const

Static Public Member Functions

static KffKResult apply_KffK_6d (World &world, const CCFunction< double, 3 > &phi_i, const CCFunction< double, 3 > &phi_j, const Info &info, const real_convolution_6d *Gscreen=nullptr)
static KffKResult apply_KffK_lowrank_split_alpha (World &world, const CCFunction< double, 3 > &phi_i, const CCFunction< double, 3 > &phi_j, const Info &info, const LowRankFunction< double, 6 > &exchange_op, const LowRankFunctionParameters &lrfparam, const SplitAlphaOptions &opt)
static KffKResult apply_KffK_lowrank_three_range (World &world, const CCFunction< double, 3 > &phi_i, const CCFunction< double, 3 > &phi_j, const Info &info, const ThreeRangeOptions &opt)
static LowRankFunction< double, 6 > compute_lrf_exchange_operator (World &world, const Info &info, const SplitAlphaOptions &opt, const LowRankFunctionParameters &lrfparam)
static DiagnosticMatrix ::ElementProvider fk_provider (World &world, const real_function_3d &phi_i, const real_function_3d &phi_j, const real_function_3d &Kphi_i, const real_function_3d &Kphi_j, const Info &info, double eps=-1.0)
static DiagnosticMatrix ::ElementProvider kf_provider (World &world, const real_function_3d &phi_i, const real_function_3d &phi_j, const Info &info, double eps=-1.0)

Constructor & Destructor Documentation

◆ ExchangeCommutator()

madness::ExchangeCommutator::ExchangeCommutator ( )
default

Member Function Documentation

◆ apply_KffK_6d()

◆ apply_KffK_lowrank_split_alpha()

ExchangeCommutator::KffKResult madness::ExchangeCommutator::apply_KffK_lowrank_split_alpha ( World & world,
const CCFunction< double, 3 > & phi_i,
const CCFunction< double, 3 > & phi_j,
const Info & info,
const LowRankFunction< double, 6 > & exchange_op,
const LowRankFunctionParameters & lrfparam,
const SplitAlphaOptions & opt )
static

Assemble the 6D exchange commutator [K̂, f] |ij⟩ using the split-α LRF k-commutator algorithm. Sums over occupied orbitals in info.mo_bra/info.mo_ket. Currently assumes phi_i == phi_j (symmetric case) and exploits swap_particles for the K̂₂ piece.

Output pair layout: result.pair[0] = Σ_k Σ_ρ g_kρ(1) · (phi_j · A_kρ)(2) (separable) result.pair[1] = Σ_k Σ_ρ B_kρ · (g_kρ·phi_i)(1) · f(1,2) · phi_j(2) with coefficient −1 plus their particle-2 mirrors when i == j.

References madness::ExchangeCommutator::KffKResult::algo, madness::apply(), madness::CCConvolutionOperatorPtr(), compute_lrf_exchange_operator(), madness::ExchangeCommutator::KffKResult::fK, madness::CCFunction< T, NDIM >::function, madness::FunctionDefaults< NDIM >::thresh, madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), madness::ExchangeCommutator::KffKResult::Kf, madness::ExchangeCommutator::KffKResult::KffK, MADNESS_CHECK_THROW, NDIM, opt(), madness::OT_F12, madness::print(), madness::ExchangeCommutator::KffKResult::rank, madness::ExchangeCommutator::KffKResult::t_wall, madness::timer::tag(), and madness::transform().

Referenced by madness::CCPotentials::apply_KffK(), and main().

◆ apply_KffK_lowrank_three_range()

ExchangeCommutator::KffKResult madness::ExchangeCommutator::apply_KffK_lowrank_three_range ( World & world,
const CCFunction< double, 3 > & phi_i,
const CCFunction< double, 3 > & phi_j,
const Info & info,
const ThreeRangeOptions & opt )
static

◆ compute_lrf_exchange_operator()

LowRankFunction< double, 6 > madness::ExchangeCommutator::compute_lrf_exchange_operator ( World & world,
const Info & info,
const SplitAlphaOptions & opt,
const LowRankFunctionParameters & lrfparam )
static

◆ diagnose_GKffK()

DiagnosticMatrix madness::ExchangeCommutator::diagnose_GKffK ( World & world,
const std::vector< CCPairFunction< double, 6 > > & GKf_cc,
const std::vector< CCPairFunction< double, 6 > > & GfK_cc,
const real_function_3d & phi_i,
const real_function_3d & phi_j,
const real_function_3d & Kphi_i,
const real_function_3d & Kphi_j,
const Info & info,
double energy,
const std::vector< real_function_3d > & aobasis,
bool orthonormalize_basis = true ) const

Diagnose ⟨ab | G [K̂,f₁₂] | ij⟩ by comparing a 6D projection against a 3D Schwinger eigentime quadrature. Returns a DiagnosticMatrix with entries "GKf", "GfK", "GKffK". ref=3D Schwinger quadrature, result=6D projection <ab|G·piece|ij>, error=||ref-result||.

The 6D references GKf_cc and GfK_cc are the G-applied commutator pieces as CCPairFunction vectors. Accepting CCPairFunction (instead of a bare real_function_6d) allows any algorithm variant to be tested:

  • 6D path (apply_KffK_6d): Kf and fK are pure-6D; caller applies G6d via apply(G6d, kffk.Kf[0].get_function()) and wraps in a vector.
  • LRF path (apply_KffK_lowrank_split_alpha, three_range): Kf may be decomposed. Caller converts to pure (sum outer products), applies G6d, and passes the result wrapped in a CCPairFunction vector.
  • Mixed/multi-piece results: sum all pieces (each entry is summed inside).

The 6D reference is projected using the same partial_inner / matrix_inner machinery as diagnose(), handling both pure and decomposed CCPairFunctions.

The 3D Schwinger formulas use only K̂, K̂†, and the Slater f₁₂:

G Kf: ⟨ã b̃ | K̂₁ f₁₂ | φᵢ φⱼ⟩ = inner((K̂†ã)·φᵢ, f₁₂(b̃·φⱼ)) + K̂₂ swap G fK: ⟨ã b̃ | f₁₂ K̂₁ | φᵢ φⱼ⟩ = inner(ã·K̂φᵢ, f₁₂(b̃·φⱼ)) + K̂₂ swap

where ã = g_{αₙ}*a and b̃ = g_{αₙ}*b are Gaussian-smoothed AO basis functions and the sum over quadrature nodes n (with 6D weight w_n = c_n^{bsh}·(αₙ/π)^{3/2}) approximates G.

NOTE: diagnose_GKffK and diagnose_GQKffK share the same signature.

Parameters
GKf_ccG·K̂f₁₂|ij⟩ pieces (caller applies G6d externally)
GfK_ccG·f₁₂K̂|ij⟩ pieces
Kphi_iK̂φᵢ (precomputed once by caller)
Kphi_jK̂φⱼ (precomputed once by caller)
infomolecular/orbital info carrying mo_ket, mo_bra, parameters
energyε_i + ε_j (must be negative)
aobasisobserver basis
orthonormalize_basisLöwdin-orthonormalize aobasis (false: keep raw)

References aobasis, madness::DiagnosticMatrix< T, NDIM >::compute_errors(), energy, madness::DiagnosticMatrix< T, NDIM >::entries, fk_provider(), madness::DiagnosticMatrix< T, NDIM >::init(), kf_provider(), lo, MADNESS_CHECK_THROW, madness::DiagnosticMatrix< T, NDIM >::project_ab(), madness::DiagnosticMatrix< T, NDIM >::ref_Gab(), madness::DiagnosticMatrix< T, NDIM >::time, and madness::wall_time().

Referenced by madness::CCPotentials::apply_KffK(), main(), and test_diagnose_GQKffK().

◆ diagnose_GQKffK()

DiagnosticMatrix madness::ExchangeCommutator::diagnose_GQKffK ( World & world,
const std::vector< CCPairFunction< double, 6 > > & GQKf_cc,
const std::vector< CCPairFunction< double, 6 > > & GQfK_cc,
const real_function_3d & phi_i,
const real_function_3d & phi_j,
const real_function_3d & Kphi_i,
const real_function_3d & Kphi_j,
const Info & info,
double energy,
const std::vector< real_function_3d > & aobasis,
bool orthonormalize_basis = true ) const

Diagnose ⟨ab | G Q₁₂ [K̂,f₁₂] | ij⟩, Q₁₂ = (1-O₁)(1-O₂), O = Σ|k_ket⟩⟨k_bra|.

Caller supplies G·Q₁₂·K̂f₁₂|ij⟩ and G·Q₁₂·f₁₂K̂|ij⟩ (neither G nor Q is applied internally). The reference is computed via 3D functions only: G is moved to the bra via the Schwinger/BSH fit and Q₁₂ is expanded on the ket side as scalar contractions of analytic Kf/fK matrix elements — see operator_diagnostics.md for the full derivation. Entries: "GQKf", "GQfK", "GQKffK" (= GQKf − GQfK).

The observer basis is an explicit parameter (unlike diagnose_GKffK): pass info.ao for the accuracy check, or the raw pair-bra functions {mo_bra[i], mo_bra[j]} with orthonormalize_basis=false so that the (0,1) element ⟨ī j̄|G Q₁₂ [K̂,f]|ij⟩ is the exchange-commutator contribution to the MP2 pair energy.

Parameters
GQKf_ccG Q₁₂ K̂f₁₂|ij⟩ pieces (caller applies Q12 and G externally)
GQfK_ccG Q₁₂ f₁₂K̂|ij⟩ pieces
Kphi_iK̂φᵢ (precomputed once by caller)
Kphi_jK̂φⱼ (precomputed once by caller)
infocarries mo_ket, mo_bra (Q₁₂ and K̂ spaces) and parameters
energyε_i + ε_j (must be negative)
aobasisobserver basis
orthonormalize_basisLöwdin-orthonormalize aobasis (false: keep raw)

References aobasis, madness::DiagnosticMatrix< T, NDIM >::compute_errors(), energy, madness::DiagnosticMatrix< T, NDIM >::entries, fk_provider(), madness::DiagnosticMatrix< T, NDIM >::init(), kf_provider(), lo, MADNESS_CHECK_THROW, madness::DiagnosticMatrix< T, NDIM >::project_ab(), madness::DiagnosticMatrix< T, NDIM >::ref_GQab(), madness::DiagnosticMatrix< T, NDIM >::time, and madness::wall_time().

Referenced by madness::CCPotentials::apply_KffK(), and test_diagnose_GQKffK().

◆ diagnose_KffK()

DiagnosticMatrix madness::ExchangeCommutator::diagnose_KffK ( World & world,
const std::vector< CCPairFunction< double, 6 > > & Kf_cc,
const std::vector< CCPairFunction< double, 6 > > & fK_cc,
const real_function_3d & phi_i,
const real_function_3d & phi_j,
const real_function_3d & Kphi_i,
const real_function_3d & Kphi_j,
const Info & info,
double energy,
const std::vector< real_function_3d > & aobasis,
bool orthonormalize_basis = true ) const

Diagnose ⟨ab | [K̂,f₁₂] | ij⟩ (no G, no Q₁₂): the 6D pieces are projected onto the observer basis and compared against the analytic Kf/fK matrix elements from kf_provider/fk_provider evaluated over the plain ⟨ab| bra. Unassigned CCPairFunctions are skipped.

NOTE: diagnose_KffK, diagnose_GKffK and diagnose_GQKffK share the same signature; parameters not needed by a particular diagnostic are ignored (here: energy — pass any value). Returns a DiagnosticMatrix with entries "Kf", "fK", "KffK" (= Kf − fK). ref=3D Exchange+f12 analytic formula, result=6D projection, error=||ref-result||.

References madness::DiagnosticMatrix< T, NDIM >::ao_basis, aobasis, madness::DiagnosticMatrix< T, NDIM >::compute_errors(), madness::DiagnosticMatrix< T, NDIM >::entries, fk_provider(), madness::DiagnosticMatrix< T, NDIM >::init(), kf_provider(), MADNESS_CHECK_THROW, madness::DiagnosticMatrix< T, NDIM >::project_ab(), madness::DiagnosticMatrix< T, NDIM >::time, and madness::wall_time().

Referenced by madness::CCPotentials::apply_KffK(), and main().

◆ fk_provider()

DiagnosticMatrix::ElementProvider madness::ExchangeCommutator::fk_provider ( World & world,
const real_function_3d & phi_i,
const real_function_3d & phi_j,
const real_function_3d & Kphi_i,
const real_function_3d & Kphi_j,
const Info & info,
double eps = -1.0 )
static

element provider: M(x,y) = Σ_p ⟨p1[x](1) p2[y](2)|f₁₂ K̂_p|φᵢφⱼ⟩ K̂₁: ⟨x·(K̂φᵢ) | f₁₂⋆(y·φⱼ)⟩ K̂₂: ⟨x·φᵢ | f₁₂⋆(y·(K̂φⱼ))⟩ The f₁₂ convolution is built once from info and captured in the closure.

References madness::FunctionDefaults< NDIM >::thresh, madness::FunctionDefaults< NDIM >::get_thresh(), lo, madness::matrix_inner(), and madness::SlaterF12OperatorPtr_ND().

Referenced by diagnose_GKffK(), diagnose_GQKffK(), diagnose_KffK(), and madness::CCPotentials::make_constant_part_macrotask().

◆ kf_provider()

DiagnosticMatrix::ElementProvider madness::ExchangeCommutator::kf_provider ( World & world,
const real_function_3d & phi_i,
const real_function_3d & phi_j,
const Info & info,
double eps = -1.0 )
static

element provider: M(x,y) = Σ_p ⟨p1[x](1) p2[y](2)|K̂_p f₁₂|φᵢφⱼ⟩ K̂₁: ⟨(K̂†x)·φᵢ | f₁₂⋆(y·φⱼ)⟩ K̂₂: ⟨f₁₂⋆(x·φᵢ) | (K̂†y)·φⱼ⟩ K̂† (Exchange with bra=mo_ket, ket=mo_bra) and the f₁₂ convolution are built once from info and captured in the closure.

References madness::FunctionDefaults< NDIM >::thresh, madness::FunctionDefaults< NDIM >::get_thresh(), lo, madness::matrix_inner(), and madness::SlaterF12OperatorPtr_ND().

Referenced by diagnose_GKffK(), diagnose_GQKffK(), diagnose_KffK(), and madness::CCPotentials::make_constant_part_macrotask().


The documentation for this struct was generated from the following files: