|
MADNESS 0.10.1
|
#include <operator_diagnostics.h>

Public Types | |
| using | ElementProvider |
Public Member Functions | |
| DiagnosticMatrix (World &world, std::vector< Function< T, LDIM > > ao_basis_in, bool orthonormalize=true) | |
| std::vector< CCPairFunction< T, NDIM > > | build_Gab_bra (double energy, double lo, double eps=-1.0) const |
| std::vector< CCPairFunction< T, NDIM > > | build_simple_bra () const |
| Single-slot bra for plain. | |
| void | compute_errors () |
| Compute error = ||ref - result||_F for every initialized entry. | |
| Tensor< T > & | init (const std::string &name) |
| int | nbasis () const |
| void | print_report (const std::string &tag="") const |
| Print a compact report: name, ||ref||, ||result||, error. | |
| Tensor< T > | project_ab (const Function< T, NDIM > &ket) const |
| Returns T(a,b) = <ao_basis[a] ao_basis[b] | ket>. | |
| Tensor< T > | project_ab (const std::vector< CCPairFunction< T, NDIM > > &ket) const |
| Tensor< T > | project_Gab (const Function< T, NDIM > &ket, double energy, double lo) const |
| Returns T(a,b) ≈ <ao_basis[a] ao_basis[b] | G · ket> via Schwinger BSH quadrature. | |
| Tensor< T > | project_Gab (const std::vector< CCPairFunction< T, NDIM > > &ket, double energy, double lo) const |
| Tensor< T > | project_xy (const std::vector< CCPairFunction< T, NDIM > > &bra, const Function< T, NDIM > &ket) const |
| Tensor< T > | project_xy (const std::vector< CCPairFunction< T, NDIM > > &bra, const std::vector< CCPairFunction< T, NDIM > > &ket) const |
| Tensor< T > | ref_Gab (const ElementProvider &elements, double energy, double lo, double eps=-1.0) const |
| Tensor< T > | ref_GQab (const ElementProvider &elements, const std::vector< Function< T, LDIM > > &occ_ket, const std::vector< Function< T, LDIM > > &occ_bra, double energy, double lo, double eps=-1.0) const |
Public Attributes | |
| std::vector< Function< T, LDIM > > | ao_basis |
| orthonormalized observer basis | |
| std::map< std::string, DiagnosticEntry< T > > | entries |
| double | time = 0.0 |
Static Public Attributes | |
| static constexpr std::size_t | LDIM = NDIM / 2 |
| one-particle space dimension | |
Private Attributes | |
| World & | world_ |
Container for named <ab|op|ij> diagnostic matrix elements.
Each named entry holds a pair (ref, result) of nbasis×nbasis tensors and their Frobenius-norm difference. The caller fills ref from LDIM-D analytic formulas; the project_ab / project_Gab methods fill result by projecting NDIM-D functions onto the AO observer basis pairs |ab>.
| T | scalar type (default double) |
| NDIM | pair-space dimension (default 6); LDIM = NDIM/2 is the one-particle space |
| using madness::DiagnosticMatrix< T, NDIM >::ElementProvider |
element provider: M(x,y) = <p1[x](1) p2[y](2) | X | ij> for arbitrary LDIM-D bra lists p1, p2 — the operator-specific unit plugged into ref_Gab / ref_GQab. Build via the provider factories of the operator classes (CorrelationFactor::ue_*_provider, ExchangeCommutator::*_provider), which hoist convolution operators and intermediates into the closure.
| madness::DiagnosticMatrix< T, NDIM >::DiagnosticMatrix | ( | World & | world, |
| std::vector< Function< T, LDIM > > | ao_basis_in, | ||
| bool | orthonormalize = true ) |
Construct with a World reference and an AO basis. If the basis is not orthonormal (||S - I||_F > 1e-10) it is orthonormalized in-place via symmetric (Löwdin) orthonormalization. Pass orthonormalize=false to keep the basis as given (e.g. when matrix elements in the raw basis carry physical meaning, like pair energies).
References ao_basis, madness::copy(), diff(), e(), madness::matrix_inner(), madness::orthonormalize(), madness::orthonormalize_symmetric(), madness::print(), madness::World::rank(), and world_.
| std::vector< CCPairFunction< T, NDIM > > madness::DiagnosticMatrix< T, NDIM >::build_Gab_bra | ( | double | energy, |
| double | lo, | ||
| double | eps = -1.0 ) const |
Multi-slot Schwinger bra for <ab|G| projection (BSH fit for energy). bra[n].get_a()[a] = w_n * (g_n * ao_basis[a]) (weight absorbed into particle 1) bra[n].get_b()[b] = g_n * ao_basis[b]
| [in] | eps | fit/convolution accuracy for the Schwinger G representation; if <=0 falls back to FunctionDefaults<LDIM>::get_thresh(). (the diagnostics pass tight_thresh_3d to make the 3D reference a stable, threshold-decoupled yardstick). |
References alpha, ao_basis, madness::GFit< T, NDIM >::BSHFit(), madness::copy(), energy, fit(), madness::FunctionDefaults< NDIM >::thresh, madness::FunctionDefaults< NDIM >::get_cell_width(), madness::FunctionDefaults< NDIM >::get_thresh(), LDIM, lo, MADNESS_CHECK_THROW, mu, madness::Tensor< T >::normf(), madness::OT_GAUSS, madness::constants::pi, madness::scale(), and world_.
Referenced by project_Gab(), project_Gab(), ref_Gab(), and ref_GQab().
|
inline |
Single-slot bra for plain.
References ao_basis.
| void madness::DiagnosticMatrix< T, NDIM >::compute_errors | ( | ) |
Compute error = ||ref - result||_F for every initialized entry.
References e(), entries, and madness::name().
Referenced by madness::ExchangeCommutator::diagnose_GKffK(), madness::ExchangeCommutator::diagnose_GQKffK(), and madness::ExchangeCommutator::diagnose_KffK().
|
inline |
Allocate zero tensors for a new named quantity. Returns the ref tensor by reference so the caller can fill it in-place.
References e(), entries, madness::name(), and nbasis().
Referenced by madness::ExchangeCommutator::diagnose_GKffK(), madness::ExchangeCommutator::diagnose_GQKffK(), and madness::ExchangeCommutator::diagnose_KffK().
|
inline |
References ao_basis.
Referenced by init(), project_xy(), project_xy(), ref_Gab(), ref_GQab(), test_ctor_orthonormalization(), test_GQUe(), test_GUe(), and test_project_ab().
| void madness::DiagnosticMatrix< T, NDIM >::print_report | ( | const std::string & | tag = "" | ) | const |
Print a compact report: name, ||ref||, ||result||, error.
References e(), entries, madness::name(), madness::print(), and time.
Referenced by main(), and test_diagnose_GQKffK().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::project_ab | ( | const Function< T, NDIM > & | ket | ) | const |
Returns T(a,b) = <ao_basis[a] ao_basis[b] | ket>.
References ao_basis, and project_xy().
Referenced by madness::ExchangeCommutator::diagnose_GKffK(), madness::ExchangeCommutator::diagnose_GQKffK(), and madness::ExchangeCommutator::diagnose_KffK().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::project_ab | ( | const std::vector< CCPairFunction< T, NDIM > > & | ket | ) | const |
References ao_basis, and project_xy().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::project_Gab | ( | const Function< T, NDIM > & | ket, |
| double | energy, | ||
| double | lo ) const |
Returns T(a,b) ≈ <ao_basis[a] ao_basis[b] | G · ket> via Schwinger BSH quadrature.
References build_Gab_bra(), energy, lo, and project_xy().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::project_Gab | ( | const std::vector< CCPairFunction< T, NDIM > > & | ket, |
| double | energy, | ||
| double | lo ) const |
References build_Gab_bra(), energy, lo, and project_xy().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::project_xy | ( | const std::vector< CCPairFunction< T, NDIM > > & | bra, |
| const Function< T, NDIM > & | ket ) const |
Core primitive: returns T(a,b) = Σ_k inner(bra[k].get_a()[a](1) bra[k].get_b()[b](2), ket_piece) summed over all assigned ket pieces and all bra slots k. Weight is absorbed into bra[k].get_a() by the bra builder (project_Gab etc.). Loop order: ket-pieces outer, (a,b) middle, bra-slots k innermost. Caller assigns the returned tensor to entries[name].result.
References a, b, madness::FunctionDefaults< NDIM >::k, madness::inner(), nbasis(), and madness::Function< T, NDIM >::project_out().
Referenced by project_ab(), project_ab(), project_Gab(), and project_Gab().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::project_xy | ( | const std::vector< CCPairFunction< T, NDIM > > & | bra, |
| const std::vector< CCPairFunction< T, NDIM > > & | ket ) const |
References a, b, madness::f, madness::FunctionDefaults< NDIM >::k, madness::inner(), nbasis(), and madness::particle< PDIM >::particle1().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::ref_Gab | ( | const ElementProvider & | elements, |
| double | energy, | ||
| double | lo, | ||
| double | eps = -1.0 ) const |
ref(a,b) = Σ_n w_n <ã_n b̃_n | X | ij> with ã_n = w_n g_{α_n}⋆a, b̃_n = g_{α_n}⋆b (Schwinger/BSH fit of G moved onto the bra; X supplied as an element provider).
References build_Gab_bra(), energy, lo, and nbasis().
Referenced by madness::ExchangeCommutator::diagnose_GKffK().
| Tensor< T > madness::DiagnosticMatrix< T, NDIM >::ref_GQab | ( | const ElementProvider & | elements, |
| const std::vector< Function< T, LDIM > > & | occ_ket, | ||
| const std::vector< Function< T, LDIM > > & | occ_bra, | ||
| double | energy, | ||
| double | lo, | ||
| double | eps = -1.0 ) const |
ref(a,b) = Σ_n w_n <ã_n b̃_n | Q₁₂ X | ij> with Q₁₂ = (1-O₁)(1-O₂), O = Σ_k |k_ket><k_bra| (plain sum, matching StrongOrthogonalityProjector). Q₁₂ is expanded on the ket side as scalar contractions: per slot A − S1·B − C·S2ᵀ + S1·D·S2ᵀ with element blocks over p1 = {ã_a} ∪ {occ_bra_k}, p2 = {b̃_b} ∪ {occ_bra_l} and overlaps S1(a,k) = <ã_a|occ_ket_k>, S2(b,l) = <b̃_b|occ_ket_l>. No nearly-vanishing functions like Q(g_n⋆a) are ever formed — applying Q to the bra functions suffers catastrophic cancellation when the convolved observers lie nearly in the occupied space (see operator_diagnostics.md).
References build_Gab_bra(), madness::copy(), energy, madness::inner(), lo, MADNESS_CHECK_THROW, madness::matrix_inner(), nbasis(), madness::transpose(), and world_.
Referenced by madness::ExchangeCommutator::diagnose_GQKffK().
| std::vector<Function<T,LDIM> > madness::DiagnosticMatrix< T, NDIM >::ao_basis |
orthonormalized observer basis
Referenced by DiagnosticMatrix(), build_Gab_bra(), build_simple_bra(), madness::ExchangeCommutator::diagnose_KffK(), nbasis(), project_ab(), project_ab(), and test_ctor_orthonormalization().
| std::map<std::string, DiagnosticEntry<T> > madness::DiagnosticMatrix< T, NDIM >::entries |
Referenced by compute_errors(), madness::ExchangeCommutator::diagnose_GKffK(), madness::ExchangeCommutator::diagnose_GQKffK(), madness::ExchangeCommutator::diagnose_KffK(), init(), madness::print_pair_energy_report(), madness::print_pair_energy_report_RI(), madness::print_pair_energy_table_RI(), and print_report().
|
staticconstexpr |
one-particle space dimension
Referenced by build_Gab_bra().
| double madness::DiagnosticMatrix< T, NDIM >::time = 0.0 |
|
private |
Referenced by DiagnosticMatrix(), build_Gab_bra(), and ref_GQab().