|
MADNESS 0.10.1
|
test various functionality for 6d functions More...
#include <madness/mra/mra.h>#include <madness/world/test_utilities.h>#include <map>#include <fstream>#include <sstream>#include <vector>#include <algorithm>
Functions | |
| int | check (bool b, const std::string message) |
| int | check_small (const double val, const double eps, const std::string message) |
| static double | gauss_3d (const coord_3d &r) |
| static double | gauss_plus_one_3d (const coord_3d &r) |
| static double | gauss_plus_tight_3d (const coord_3d &r) |
| bool | is_large (const double &val, const double &eps) |
| bool | is_small (const double &val, const double &eps) |
| template<size_t NDIM> | |
| void | load_function (World &world, Function< double, NDIM > &pair, const std::string name) |
| int | main (int argc, char **argv) |
| std::string | ok (const bool b) |
| static double | one_3d (const coord_3d &r) |
| static double | one_6d (const coord_6d &r) |
| template<size_t NDIM> | |
| void | save_function (World &world, Function< double, NDIM > &pair, const std::string name) |
| int | test (World &world, const long &k, const double thresh) |
| int | test_add (World &world, const long &k, const double thresh) |
| test f(1,2) + g(1,2) for both f and g reconstructed | |
| int | test_convolution (World &world, const long &k, const double thresh) |
| test 6D convolution | |
| int | test_exchange (World &world, const long &k, const double thresh) |
| test f(1,2) + g(1,2) for both f and g reconstructed | |
| template<typename T, std::size_t NDIM> | |
| int | test_hartree_product (World &world, const long &k, const double thresh) |
| test f(1,2) = g(1) h(2) | |
| int | test_inner (World &world, const long &k, const double thresh) |
| test inner product using redundant wave functions | |
| template<typename T, std::size_t NDIM> | |
| int | test_multiply (World &world, const long &k, double thresh) |
| test f(1,2)*g(1) | |
| int | test_replicate (World &world, const long &k, const double thresh) |
| template<typename T, std::size_t NDIM> | |
| int | test_sum_down (World &world, const long &k, double thresh) |
| template<typename T, std::size_t NDIM> | |
| int | test_sum_down_files (World &world, const long &k, double thresh) |
| template<typename T, std::size_t NDIM> | |
| int | test_vector_composite (World &world, const long &k, const double thresh) |
| template<typename T, std::size_t NDIM> | |
| int | test_Vphi_ij_u (World &world, const long &k, double thresh) |
| static double | tightgauss_3d (const coord_3d &r) |
| static double | V (const Vector< double, 3 > &r) |
| static double | zero_3d (const coord_3d &r) |
test various functionality for 6d functions
| int check | ( | bool | b, |
| const std::string | message ) |
References b, ok(), and madness::print().
Referenced by test_add().
| int check_small | ( | const double | val, |
| const double | eps, | ||
| const std::string | message ) |
References is_small(), ok(), and madness::print().
Referenced by test_add().
|
static |
References norm(), and madness::r2().
Referenced by gauss_plus_one_3d(), and gauss_plus_tight_3d().
|
static |
References gauss_3d(), and one_3d().
Referenced by test_add().
|
static |
References gauss_3d(), and tightgauss_3d().
Referenced by test_add().
| bool is_large | ( | const double & | val, |
| const double & | eps ) |
| bool is_small | ( | const double & | val, |
| const double & | eps ) |
| void load_function | ( | World & | world, |
| Function< double, NDIM > & | pair, | ||
| const std::string | name ) |
References madness::Function< T, NDIM >::k(), madness::name(), madness::print(), madness::Function< T, NDIM >::print_size(), madness::World::rank(), madness::FunctionDefaults< NDIM >::set_k(), madness::FunctionDefaults< NDIM >::set_thresh(), and madness::Function< T, NDIM >::thresh().
Referenced by test_sum_down_files().
| int main | ( | int | argc, |
| char ** | argv ) |
References madness::arg(), madness::WorldGopInterface::broadcast(), error(), madness::WorldGopInterface::fence(), madness::finalize(), madness::FunctionDefaults< NDIM >::tt, madness::FunctionDefaults< NDIM >::get_tensor_type(), madness::World::gop, madness::initialize(), k, L, MADNESS_EXCEPTION, ok(), madness::print(), madness::World::rank(), madness::FunctionDefaults< NDIM >::set_cubic_cell(), 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_sum_down_files(), thresh, madness::TT_2D, madness::TT_FULL, and madness::TT_TENSORTRAIN.
| std::string ok | ( | const bool | b | ) |
References b.
Referenced by check(), check(), check(), check_small(), madness::ensure_tree_state_respecting_fence(), madness::QCCalculationParametersBase::from_json(), main(), main(), run_batched_cell(), run_one(), run_real_mo(), test(), test_apply_push_1d(), test_basic(), test_batch_split(), test_conv(), test_conversion(), test_convolution(), test_coulomb(), test_diff(), test_exchange(), test_golden_values(), test_inner(), test_io(), test_math(), test_op(), test_output_param_overload(), test_plot(), test_qm(), test_scaling_factor(), madness::WorldAmInterface::SendReq::TestAndFree(), and testbsh().
|
static |
Referenced by gauss_plus_one_3d(), and test_add().
|
static |
Referenced by test_add().
| int test | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
| int test_add | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
test f(1,2) + g(1,2) for both f and g reconstructed
References madness::Function< T, NDIM >::add_scalar(), check(), check_small(), madness::Function< T, NDIM >::compress(), madness::copy(), madness::Function< T, NDIM >::err(), error(), f, madness::FunctionFactory< T, NDIM >::f(), gauss_3d(), gauss_plus_one_3d(), gauss_plus_tight_3d(), madness::gaxpy_oop(), madness::gaxpy_oop_reconstructed(), madness::hartree_product(), madness::Function< T, NDIM >::is_compressed(), k, madness::Function< T, NDIM >::norm2(), madness::norm2(), one_3d(), one_6d(), madness::print(), madness::r2(), madness::Function< T, NDIM >::reconstruct(), madness::Function< T, NDIM >::scale(), thresh, tightgauss_3d(), and zero_3d().
Referenced by main().
| int test_convolution | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
test 6D convolution
References a, madness::BSHOperator(), madness::copy(), diff(), madness::FunctionFactory< T, NDIM >::f(), madness::WorldGopInterface::fence(), madness::free_space_derivative(), gauss_3d(), madness::World::gop, madness::hartree_product(), madness::inner(), is_small(), k, norm(), madness::Function< T, NDIM >::norm2(), ok(), madness::print(), madness::World::rank(), thresh, V(), and v.
| int test_exchange | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
test f(1,2) + g(1,2) for both f and g reconstructed
References madness::CoulombOperator(), diff(), f, madness::FunctionFactory< T, NDIM >::f(), f2, gauss_3d(), madness::hartree_product(), is_small(), k, madness::multiply(), norm(), madness::Function< T, NDIM >::norm2(), ok(), madness::print(), madness::Function< T, NDIM >::print_size(), madness::World::rank(), and thresh.
| int test_hartree_product | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
References madness::test_output::checkpoint(), madness::test_output::end(), madness::FunctionFactory< T, NDIM >::f(), madness::hartree_product(), ij(), madness::inner(), is_small(), k, NDIM, madness::print(), madness::r2(), madness::FunctionDefaults< NDIM >::set_tensor_type(), thresh, madness::TT_2D, and madness::TT_FULL.
| int test_inner | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
test inner product using redundant wave functions
References a1, a2, madness::FunctionFactory< T, NDIM >::f(), f1, f2, gauss_3d(), madness::hartree_product(), madness::inner(), is_small(), k, norm(), ok(), madness::print(), madness::World::rank(), and thresh.
| int test_multiply | ( | World & | world, |
| const long & | k, | ||
| double | thresh ) |
test f(1,2)*g(1)
Slater factor
References madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::FunctionFactory< T, NDIM >::f(), madness::Function< T, NDIM >::fill_tree(), madness::CompositeFactory< T, NDIM, MDIM >::g12(), madness::FunctionFactory< T, NDIM >::is_on_demand(), k, madness::CompositeFactory< T, NDIM, MDIM >::ket(), madness::multiply(), NDIM, madness::norm2(), madness::Vector< T, N >::normf(), madness::CompositeFactory< T, NDIM, MDIM >::particle1(), madness::CompositeFactory< T, NDIM, MDIM >::particle2(), madness::Function< T, NDIM >::print_size(), madness::r2(), madness::test_output::set_cout_to_terminal(), madness::FunctionDefaults< NDIM >::set_tensor_type(), thresh, madness::Function< T, NDIM >::truncate(), madness::TT_2D, madness::TT_FULL, madness::CompositeFactory< T, NDIM, MDIM >::V_for_particle1(), and madness::CompositeFactory< T, NDIM, MDIM >::V_for_particle2().
| int test_replicate | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
| int test_sum_down | ( | World & | world, |
| const long & | k, | ||
| double | thresh ) |
Attribute the error of the accumulate_trees+sum_down addition path to its two stages.
We add an s-type function f_s(r) = exp(-a|r|) and a p-type function f_p(r) = r[0]*exp(-a|r|) (Slater cusp + nodal plane -> deeply refined, so the low-rank / sum_down error is pronounced).
The path used by transform_reconstructed()/finalize_sum() has TWO lossy stages, each truncating low-rank tensors to the impl's stored TensorArgs.thresh:
run accumulate thr sum_down thr isolates A_tight tight tight near-exact sum (internal gold) A0 tau tau full path A1 tau tight accumulate error only A2 tight tau sum_down error only
then ||A1-A_tight|| = accumulate_trees error, ||A2-A_tight|| = sum_down error. Using the internal gold A_tight (not the analytic function) removes the shared projection error of f_s,f_p so only the arithmetic error of the two stages remains.
References A2(), c, madness::test_output::checkpoint(), madness::test_output::end(), madness::Function< T, NDIM >::err(), madness::FunctionFactory< T, NDIM >::f(), madness::WorldGopInterface::fence(), madness::Function< T, NDIM >::get_impl(), madness::FunctionDefaults< NDIM >::get_k(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::World::gop, madness::inner(), k, NDIM, madness::norm2(), madness::print(), madness::Function< T, NDIM >::reconstruct(), madness::redundant_after_merge, madness::test_output::set_cout_to_terminal(), madness::FunctionDefaults< NDIM >::set_k(), madness::FunctionDefaults< NDIM >::set_tensor_type(), madness::FunctionDefaults< NDIM >::set_thresh(), madness::Function< T, NDIM >::sum_down(), thresh, madness::TT_2D, madness::TT_FULL, and madness::zero_functions().
| int test_sum_down_files | ( | World & | world, |
| const long & | k, | ||
| double | thresh ) |
Load two real functions Ue and fK from parallel archives and compare adding them via operator+ against the accumulate_trees + sum_down path. Run from the directory that holds Ue.00000 and fK.00000.
References c, madness::FunctionDefaults< NDIM >::clear_cell(), e(), madness::test_output::end(), madness::FunctionDefaults< NDIM >::get_k(), madness::FunctionDefaults< NDIM >::get_thresh(), k, load_function(), NDIM, madness::Function< T, NDIM >::norm2(), madness::print(), madness::Function< T, NDIM >::reconstruct(), madness::test_output::set_cout_to_terminal(), madness::FunctionDefaults< NDIM >::set_tensor_type(), target(), thresh, madness::Function< T, NDIM >::tree_size(), madness::TT_2D, and madness::TT_FULL.
Referenced by main().
| int test_vector_composite | ( | World & | world, |
| const long & | k, | ||
| const double | thresh ) |
test construction with a single pair of functions
test construction with a single pair of functions and eri
test construction with a vector of functions:
References std::abs(), madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::FunctionFactory< T, NDIM >::f(), madness::Function< T, NDIM >::fill_cuspy_tree(), madness::Function< T, NDIM >::fill_tree(), madness::FunctionDefaults< NDIM >::thresh, madness::CompositeFactory< T, NDIM, MDIM >::g12(), madness::inner(), madness::FunctionFactory< T, NDIM >::is_on_demand(), k, madness::CompositeFactory< T, NDIM, MDIM >::ket(), MADNESS_CHECK, NDIM, madness::Function< T, NDIM >::norm2(), madness::norm2(), madness::CompositeFactory< T, NDIM, MDIM >::particle1(), madness::CompositeFactory< T, NDIM, MDIM >::particle2(), madness::print(), madness::r2(), madness::FunctionDefaults< NDIM >::set_tensor_type(), thresh, and madness::TT_2D.
| int test_Vphi_ij_u | ( | World & | world, |
| const long & | k, | ||
| double | thresh ) |
test Vphi_ij_u_op_NS: u(1,2) * [phi(1)] * [phi(2)] and inner product with on-demand ERI.
Setup avoids all 6D fill_tree by using Gaussian orbitals (LDIM) and a separable 2-particle Gaussian factor: gauss(1,2) = g(r1) * g(r2), u(1,2) = (g*a)(1) ⊗ (g*b)(2) so u is a pure Hartree product. f12 is a Gaussian-r12 kernel; combined with the (separable) gauss factor it is absorbed into the orbital products, so the reference <k(1) l(2) | f12 | u(1,2)> = <g*a*k | conv | g*b*l> is a single LDIM convolution-then-inner — no explicit functor for f12, no 6D ref.
References a, std::abs(), madness::apply(), b, beta, madness::Function< T, NDIM >::change_tree_state(), madness::test_output::checkpoint(), madness::copy(), madness::test_output::end(), madness::Function< T, NDIM >::err(), madness::FunctionFactory< T, NDIM >::f(), f12_lambda(), madness::g, gauss_a(), gauss_b(), madness::GaussOperator(), madness::Function< T, NDIM >::get_impl(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::hartree_product(), madness::inner(), madness::FunctionFactory< T, NDIM >::is_on_demand(), k, madness::multiply(), madness::name(), NDIM, madness::print(), madness::r2(), madness::redundant, madness::test_output::set_cout_to_terminal(), madness::Function< T, NDIM >::set_impl(), madness::FunctionDefaults< NDIM >::set_tensor_type(), madness::FunctionDefaults< NDIM >::set_thresh(), madness::Function< T, NDIM >::thresh(), thresh, madness::Function< T, NDIM >::tree_size(), madness::TT_2D, madness::TT_FULL, u(), and madness::wall_time().
|
static |
References norm(), and madness::r2().
Referenced by gauss_plus_tight_3d(), and test_add().
|
static |
Referenced by test_add().