|
MADNESS 0.10.1
|
#include <madness.h>#include <madness/chem/lowrankfunction.h>#include <madness/chem/SCFOperators.h>#include <madness/world/test_utilities.h>#include <madness/world/timing_utilities.h>#include <cstdio>#include <random>
Functions | |
| int | main (int argc, char **argv) |
| template<std::size_t LDIM> | |
| int | make_ri_basis (World &world, LowRankFunctionParameters parameters) |
| make an RI basis for an atom, namely Gaussian functions | |
| int | test_adaptive_diagnosis (World &world) |
| template<std::size_t LDIM> | |
| int | test_adaptive_grid_projection (World &world, LowRankFunctionParameters parameters) |
| template<std::size_t LDIM> | |
| int | test_adaptive_project (World &world, LowRankFunctionParameters ¶meters) |
| template<std::size_t LDIM> | |
| int | test_arithmetic (World &world, LowRankFunctionParameters parameters) |
| int | test_combine_generic (World &world) |
| template<std::size_t LDIM> | |
| int | test_construction (World &world, LowRankFunctionParameters parameters) |
| int | test_coulomb_gfit_discard_large_alpha (World &world) |
| template<std::size_t LDIM> | |
| int | test_direct_projection (World &world, LowRankFunctionParameters parameters) |
| template<std::size_t LDIM> | |
| int | test_inner (World &world, LowRankFunctionParameters parameters) |
| test partial inner products | |
| int | test_inv_rsq_gfit (World &world) |
| int | test_invrsq_operator (World &world) |
| int | test_lowrank_function (World &world, LowRankFunctionParameters parameters) |
| template<std::size_t LDIM> | |
| int | test_molecular_grid (World &world, LowRankFunctionParameters parameters) |
| template<std::size_t LDIM> | |
| int | test_numerics (World &world, LowRankFunctionParameters ¶meters) |
| template<std::size_t LDIM> | |
| int | test_recursive_apply (World &world) |
| template<std::size_t LDIM> | |
| int | test_remove_lindep (World &world, LowRankFunctionParameters parameters) |
| int | test_stuff (World &world, LowRankFunctionParameters parameters) |
| int main | ( | int | argc, |
| char ** | argv ) |
References e(), madness::finalize(), madness::FunctionDefaults< NDIM >::get_cell(), madness::FunctionDefaults< NDIM >::get_k(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::initialize(), k, madness::commandlineparser::key_exists(), madness::print(), madness::QCCalculationParametersBase::print(), madness::LowRankFunctionParameters::read_and_set_derived_values(), madness::FunctionDefaults< NDIM >::set_cubic_cell(), madness::QCCalculationParametersBase::set_derived_value(), madness::FunctionDefaults< NDIM >::set_k(), madness::FunctionDefaults< NDIM >::set_tensor_type(), madness::FunctionDefaults< NDIM >::set_thresh(), madness::FunctionDefaults< NDIM >::set_truncate_mode(), madness::startup(), test_adaptive_project(), test_arithmetic(), test_combine_generic(), test_construction(), test_coulomb_gfit_discard_large_alpha(), test_direct_projection(), test_inner(), test_inv_rsq_gfit(), test_invrsq_operator(), test_molecular_grid(), test_recursive_apply(), test_remove_lindep(), thresh, madness::TT_2D, madness::TT_FULL, and madness::commandlineparser::value().
| int make_ri_basis | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
make an RI basis for an atom, namely Gaussian functions
References madness::timer::end(), error(), madness::LowRankFunctionParameters::f12type(), madness::WorldGopInterface::fence(), madness::FunctionFactory< T, NDIM >::functor(), madness::LowRankFunctionParameters::gamma(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::World::gop, madness::inner(), madness::LowRankFunctionParameters::lmax(), MADNESS_EXCEPTION, NDIM, madness::particle< PDIM >::particle1(), madness::particle< PDIM >::particle2(), madness::print(), madness::QCCalculationParametersBase::print(), madness::LowRankFunctionParameters::radius(), madness::QCCalculationParametersBase::set_derived_value(), madness::SlaterF12OperatorPtr_ND(), madness::SlaterOperatorPtr_ND(), madness::timer::tag(), madness::LowRankFunctionParameters::tempered(), madness::LowRankFunctionParameters::tol(), madness::LowRankFunctionParameters::volume_element(), and zeta.
| int test_adaptive_diagnosis | ( | World & | world | ) |
Test that each diagnosis path (tol-limited, thresh-limited, grid-limited) is exercised. Uses LDIM=1 (2D) for speed. Each sub-test sets up parameters that force a specific diagnosis.
References madness::test_output::checkpoint(), madness::test_output::end(), error(), madness::FunctionFactory< T, NDIM >::functor(), gauss1(), madness::GaussOperatorPtr(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), NDIM, one(), madness::print(), madness::QCCalculationParametersBase::set_derived_value(), madness::FunctionDefaults< NDIM >::set_thresh(), and target().
| int test_adaptive_grid_projection | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
References madness::test_output::checkpoint(), madness::test_output::end(), error(), madness::FunctionFactory< T, NDIM >::functor(), madness::GaussOperatorPtr(), madness::LowRankFunctionParameters::gridtype(), madness::inner(), NDIM, one(), op(), madness::print(), madness::QCCalculationParametersBase::print(), madness::print_header2(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), and madness::QCCalculationParametersBase::set_derived_value().
| int test_adaptive_project | ( | World & | world, |
| LowRankFunctionParameters & | parameters ) |
References madness::test_output::checkpoint(), madness::test_output::end(), error(), madness::FunctionFactory< T, NDIM >::functor(), gauss1(), madness::GaussOperatorPtr(), madness::inner(), NDIM, one(), madness::print(), and target().
Referenced by main().
| int test_arithmetic | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
References madness::test_output::checkpoint(), madness::test_output::end(), madness::Vector< T, N >::fill(), madness::FunctionFactory< T, NDIM >::functor(), gauss1(), madness::GaussOperatorPtr(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), NDIM, madness::print(), madness::QCCalculationParametersBase::print(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), madness::QCCalculationParametersBase::set_derived_value(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_radius(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_rank_revealing_tol(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_volume_element(), and thresh.
Referenced by main().
| int test_combine_generic | ( | World & | world | ) |
Verify the generic outer-product combine: Slater(μ_A) × Slater(μ_B) ≈ exp(-(μ_A+μ_B) r) pointwise. Compares the outer-product (c, α) tensors against a direct SlaterFit at μ_A+μ_B on a log-spaced grid.
References std::abs(), madness::test_output::checkpoint(), madness::SeparatedConvolution< Q, NDIM >::combine_generic(), madness::SeparatedConvolution< Q, NDIM >::combine_generic_coeffs(), madness::test_output::end(), exact, k, lo, np, madness::print(), and madness::GFit< T, NDIM >::SlaterFit().
Referenced by main().
| int test_construction | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
References a, b, madness::test_output::checkpoint(), madness::test_output::end(), madness::FunctionFactory< T, NDIM >::functor(), gauss1(), madness::GaussOperatorPtr(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::LowRankFunctionParameters::gridtype(), madness::inner(), NDIM, madness::print(), madness::QCCalculationParametersBase::print(), madness::QCCalculationParametersBase::set_derived_value(), madness::FunctionDefaults< NDIM >::set_thresh(), and madness::LowRankFunctionParameters::tol().
| int test_coulomb_gfit_discard_large_alpha | ( | World & | world | ) |
Analyze the error of discarding large-alpha terms in the GFit of the Coulomb kernel 1/r ≈ Σ_μ c_μ exp(-α_μ r²).
Context: in the k-commutator algorithm [k̂₁, f(1,2)] |ij⟩ with k̂₁ carrying the Coulomb kernel, large-α_μ Gaussians act like δ(r₁-r₁') and their contribution cancels between the two pieces of the commutator. The leading non-cancelling contribution per term is c_μ · π^{3/2} / (4 α_μ^{5/2}) · ∇²F(r₁) so the relevant error proxies for a discard threshold α* are weight Σ_{α_μ > α*} |c_μ| (π/α_μ)^{3/2} err_proxy Σ_{α_μ > α*} |c_μ| π^{3/2} / (4 α_μ^{5/2})
This routine runs CoulombFit at several target epsilons and reports both the per-term spectrum and the cumulative drop-curve.
References a, std::abs(), c, madness::GFit< T, NDIM >::CoulombFit(), madness::test_output::end(), fit(), lo, mu, madness::constants::pi, pi, and madness::print().
Referenced by main().
| int test_direct_projection | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
Test direct operator projection: construct LRF from the Gaussian expansion of the operator instead of random-Y probing.
References madness::test_output::checkpoint(), madness::test_output::end(), error(), madness::FunctionFactory< T, NDIM >::functor(), madness::GaussOperatorPtr(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), NDIM, madness::OT_SLATER, madness::print(), madness::FunctionDefaults< NDIM >::set_thresh(), and target().
Referenced by main().
| int test_inner | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
test partial inner products
with f1(x,y) = exp(-a*x^2) * exp(-(x-y)^2) f2(x,y) = exp(-a*x^2) * exp(-g (x-y)^2) test the inner products a) inner(f1,f2,i,j) for i,j=0,1 b) inner(f1,
References a, madness::arg(), madness::test_output::checkpoint(), madness::test_output::end(), madness::FunctionFactory< T, NDIM >::functor(), gauss1(), madness::GaussOperatorPtr(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), NDIM, madness::norm2(), madness::Vector< T, N >::normf(), madness::particle< PDIM >::particle1(), madness::particle< PDIM >::particle2(), madness::print(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), madness::Function< T, NDIM >::reconstruct(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_radius(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_rank_revealing_tol(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_volume_element(), and thresh.
Referenced by main().
| int test_inv_rsq_gfit | ( | World & | world | ) |
Verify that 1/r² can be represented as a sum of Gaussians via the Beylkin–Monzón integral representation
1/r^α = (1/Γ(α/2)) ∫_0^∞ t^{α/2-1} exp(-t r²) dt
For α=2 (i.e. 1/r²) this reduces to
1/r² = ∫_0^∞ exp(-t r²) dt
Substituting t = exp(2s):
1/r² = 2 ∫_{-∞}^{∞} exp(2s) exp(-exp(2s) r²) ds
Trapezoidal discretization on s with step h yields
1/r² ≈ 2h · Σ_k exp(2 s_k) · exp(-exp(2 s_k) r²) (c_k, α_k) pair
= Σ_k c_k · exp(-α_k r²)
with c_k = 2 h · exp(2 s_k), α_k = exp(2 s_k). This is exactly the d=4 case of MADNESS's private bsh_fit_ndim(4, μ=0, …), whose per-term coefficient is c = h · exp((d-2) s) · 0.5/π^{d/2} (the d=4 BSH normalization carries a factor 0.5/π² that is not present in the pointwise-fit convention here).
This routine builds the pointwise fit directly and reports the number of Gaussians and the maximum relative error on a range of r values.
References std::abs(), alpha, e(), madness::test_output::end(), exact, h(), k, lo, np, and madness::print().
Referenced by main().
| int test_invrsq_operator | ( | World & | world | ) |
Verify that the new OT_INVRSQ operator type gives the correct pointwise approximation of 1/r^2 and that combine(Coulomb, Coulomb) → OT_INVRSQ via the public API.
References a, std::abs(), c, madness::SeparatedConvolution< Q, NDIM >::can_combine(), madness::test_output::checkpoint(), madness::SeparatedConvolution< Q, NDIM >::combine_OT(), madness::test_output::end(), exact, fit(), madness::FunctionFactory< T, NDIM >::functor(), madness::GFit< T, NDIM >::InverseRSqFit(), k, lo, madness::Function< T, NDIM >::norm2(), madness::LRFunctorF12< T, NDIM, LDIM >::norm2(), madness::Vector< T, N >::normf(), np, madness::OT_G12, madness::OT_INVRSQ, madness::print(), and madness::Function< T, NDIM >::scale().
Referenced by main().
| int test_lowrank_function | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
References madness::cpu_time(), madness::default_random_generator, diff(), madness::test_output::end(), error(), madness::LowRankFunctionParameters::f12type(), madness::FunctionFactory< T, NDIM >::functor(), madness::LowRankFunctionParameters::gamma(), madness::QCCalculationParametersBase::get(), madness::FunctionDefaults< NDIM >::get_k(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::LowRankFunctionParameters::gridtype(), madness::inner(), MADNESS_EXCEPTION, NDIM, madness::Function< T, NDIM >::norm2(), offset, one(), madness::LowRankFunctionParameters::optimize(), madness::particle< PDIM >::particle1(), madness::particle< PDIM >::particle2(), madness::plot_plane(), madness::print(), madness::QCCalculationParametersBase::print(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), madness::LowRankFunctionParameters::radius(), madness::World::rank(), madness::SlaterF12OperatorPtr_ND(), madness::SlaterOperatorPtr_ND(), madness::LowRankFunctionParameters::tol(), madness::transpose(), madness::unique_fileid(), and madness::LowRankFunctionParameters::volume_element().
| int test_molecular_grid | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
References c, madness::test_output::checkpoint(), d, e(), madness::test_output::end(), madness::molecular_grid< NDIM >::get_grid(), madness::grid(), madness::LowRankFunctionParameters::gridtype(), lower, NDIM, p(), madness::constants::pi, madness::print(), madness::QCCalculationParametersBase::print(), madness::LowRankFunctionParameters::radius(), upper, madness::gridbase::visualize(), and madness::LowRankFunctionParameters::volume_element().
Referenced by main().
| int test_numerics | ( | World & | world, |
| LowRankFunctionParameters & | parameters ) |
2D numerical results for tol, volume_element with thresh 1.e-6 (canonical representation) lrf l2 err, tol, volume 1.00e-05 1.00e-01 error 1.216274e-02 lrf l2 err, tol, volume 1.00e-06 1.00e-01 error 5.161666e-03 lrf l2 err, tol, volume 1.00e-07 1.00e-01 error 1.629885e-03 lrf l2 err, tol, volume 1.00e-08 1.00e-01 error 6.962729e-04 lrf l2 err, tol, volume 1.00e-09 1.00e-01 error 2.404550e-04
3D numerical results: numerical parameters: k, eps(3D), eps(6D) 6 3.000000e-05 1.000000e-03 lrf l2 err, tol, volume 1.00e-05 1.00e-01 error 3.389503e-02 lrf l2 err, tol, volume 1.00e-06 1.00e-01 error 1.216609e-02 lrf l2 err, tol, volume 1.00e-07 1.00e-01 error 5.161720e-03 lrf l2 err, tol, volume 1.00e-08 1.00e-01 error 3.033423e-03 lrf l2 err, tol, volume 1.00e-09 1.00e-01 error 2.738746e-03
References a, b, madness::test_output::checkpoint(), madness::test_output::end(), madness::FunctionFactory< T, NDIM >::functor(), gauss1(), madness::GaussOperatorPtr(), madness::inner(), NDIM, one(), madness::print(), madness::QCCalculationParametersBase::print(), madness::QCCalculationParametersBase::set_derived_value(), madness::LowRankFunctionParameters::tol(), and madness::LowRankFunctionParameters::volume_element().
| int test_recursive_apply | ( | World & | world | ) |
test recursive_apply: apply a full-dimensional operator on a Hartree product
Build f(1)*g(2), apply a 2D BSH operator via the recursive_apply pathway (which calls do_apply_directed_screening with opdim==NDIM), and compare against applying the same operator on an explicitly constructed Hartree product.
References a, madness::apply(), madness::BSHOperator(), c, madness::test_output::checkpoint(), diff(), madness::test_output::end(), error(), f, madness::g, madness::LowRankFunction< T, NDIM, LDIM >::get_g(), madness::LowRankFunction< T, NDIM, LDIM >::get_h(), madness::FunctionDefaults< NDIM >::get_tensor_type(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), mu, NDIM, madness::Function< T, NDIM >::norm2(), op(), madness::print(), madness::LowRankFunction< T, NDIM, LDIM >::reconstruct(), madness::FunctionDefaults< NDIM >::set_tensor_type(), thresh, and madness::TT_2D.
Referenced by main().
| int test_remove_lindep | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
References madness::test_output::checkpoint(), madness::test_output::end(), error(), madness::FunctionFactory< T, NDIM >::functor(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::LowRankFunctionParameters::gridtype(), madness::inner(), MADNESS_CHECK, NDIM, one(), madness::OT_SLATER, madness::QCCalculationParametersBase::print(), madness::print_header2(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project(), madness::QCCalculationParametersBase::set_derived_value(), madness::FunctionDefaults< NDIM >::set_thresh(), and thresh.
Referenced by main().
| int test_stuff | ( | World & | world, |
| LowRankFunctionParameters | parameters ) |
References madness::test_output::end(), and madness::print().