|
MADNESS 0.10.1
|
#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) |
|
default |
|
static |
6D algorithm: Kf via apply_Kfxy, fK via make_f_xy_macrotask(Kx,...). Mirrors the body of test_kcomm_6d in the original benchmark file.
References madness::ExchangeCommutator::KffKResult::algo, madness::CCPotentials::apply_Kfxy(), madness::ExchangeCommutator::KffKResult::fK, madness::CCFunction< T, NDIM >::function, madness::CCFunction< T, NDIM >::i, madness::ExchangeCommutator::KffKResult::Kf, madness::ExchangeCommutator::KffKResult::KffK, madness::Function< T, NDIM >::reduce_rank(), madness::swap_particles(), madness::ExchangeCommutator::KffKResult::t_wall, madness::Function< T, NDIM >::truncate(), madness::truncate(), madness::CCFunction< T, NDIM >::type, and madness::UNDEFINED.
Referenced by madness::CCPotentials::apply_KffK(), and main().
|
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().
|
static |
Three-range LRF k-commutator: builds two LRFs (diffuse + medium) with independent LowRankFunctionParameters, concatenates their g/h vectors and assembles Kf / fK / KffK with the same algebra as apply_KffK_lowrank_split_alpha. Tight terms (α_μ > opt.alpha_hi) are discarded. Returns KffKResult with algo = "lrf-three-range" and rank = rank_diffuse + rank_medium (printed individually in t_wall summary).
References a, madness::ExchangeCommutator::KffKResult::algo, madness::apply(), c, madness::CCConvolutionOperatorPtr(), madness::GFit< T, NDIM >::CoulombFit(), fit(), madness::ExchangeCommutator::KffKResult::fK, madness::CCFunction< T, NDIM >::function, madness::FunctionDefaults< NDIM >::thresh, madness::get_size(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::CCFunction< T, NDIM >::i, madness::inner(), madness::ExchangeCommutator::KffKResult::Kf, madness::ExchangeCommutator::KffKResult::KffK, MADNESS_ASSERT, MADNESS_CHECK_THROW, mu, NDIM, opt(), madness::OT_F12, madness::print(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), madness::ExchangeCommutator::KffKResult::rank, madness::World::rank(), madness::Function< T, NDIM >::reduce_rank(), madness::BaseTensor::size(), madness::swap_particles(), madness::ExchangeCommutator::KffKResult::t_wall, madness::timer::tag(), madness::transform(), madness::Function< T, NDIM >::truncate(), madness::truncate(), madness::CCFunction< T, NDIM >::type, and madness::UNDEFINED.
Referenced by main().
|
static |
compute the LRF of the exchange operator: K(r,r') = \sum_k k(r)g(r,r') R2(r') k(r')
apply K to a function f via: Kf(r) = inner(K,f,p2,p1); note K is not self-adjoint due to the ncf factor
References madness::GFit< T, NDIM >::CoulombFit(), fit(), madness::FunctionDefaults< NDIM >::thresh, madness::FunctionDefaults< NDIM >::get_thresh(), MADNESS_ASSERT, mu, NDIM, opt(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), madness::BaseTensor::size(), and madness::timer::tag().
Referenced by apply_KffK_lowrank_split_alpha(), madness::CC2::iterate_lrcc2_pairs(), main(), madness::CC2::solve_cc2(), and madness::CC2::solve_mp2_coupled().
| 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:
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.
| GKf_cc | G·K̂f₁₂|ij⟩ pieces (caller applies G6d externally) |
| GfK_cc | G·f₁₂K̂|ij⟩ pieces |
| Kphi_i | K̂φᵢ (precomputed once by caller) |
| Kphi_j | K̂φⱼ (precomputed once by caller) |
| info | molecular/orbital info carrying mo_ket, mo_bra, parameters |
| energy | ε_i + ε_j (must be negative) |
| aobasis | observer basis |
| orthonormalize_basis | Lö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().
| 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.
| GQKf_cc | G Q₁₂ K̂f₁₂|ij⟩ pieces (caller applies Q12 and G externally) |
| GQfK_cc | G Q₁₂ f₁₂K̂|ij⟩ pieces |
| Kphi_i | K̂φᵢ (precomputed once by caller) |
| Kphi_j | K̂φⱼ (precomputed once by caller) |
| info | carries mo_ket, mo_bra (Q₁₂ and K̂ spaces) and parameters |
| energy | ε_i + ε_j (must be negative) |
| aobasis | observer basis |
| orthonormalize_basis | Lö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().
| 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().
|
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().
|
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().