MADNESS 0.10.1
test_apply_screen.cc File Reference
#include <madness/mra/mra.h>
#include <madness/mra/vmra.h>
#include <madness/mra/operator.h>
#include <madness/mra/legendre.h>
#include <madness/world/test_utilities.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <memory>
#include <random>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for test_apply_screen.cc:

Classes

class  Cusp
 exp(-Z r), refined to level 15 at the origin: a nuclear cusp More...
class  Gauss
 exp(-a |r-R|^2) More...
class  GaussPotential
 the Coulomb potential of exp(-a r^2): (pi/a)^{3/2} erf(sqrt(a) r) / r, 2 pi/a at the origin More...
struct  operands
 the operands of T1, T2, T4 at k 8, thresh 1e-6 More...

Functions

template<typename T>
static Function< T, D > apply_with (World &world, const real_convolution_3d &P, const Function< T, D > &f, const apply_screen_t< D > &screen, std::array< long, 2 > *counts=nullptr)
 one apply through the vector overload, with screen (none if empty); the counters cover this apply
static apply_screen_t< D > box_b_screen (const double inside, const double outside)
 the screen of T3: inside in the boxes that intersect B = [4,8] x [-2,2] x [-2,2], outside elsewhere
static std::array< double, 3 > distribution (std::vector< double > v)
 median, 90th percentile and max
static double eval_in_box (const Key< D > &key, const Tensor< double > &c, const std::array< double, D > &x)
 the function in the box key at the point x in [0,1]^D of the box, from the box's scaling coefficients
int main (int argc, char **argv)
static operands make_operands (World &world, const real_convolution_3d &P, const double thresh)
static apply_screen_t< D > never_screen ()
static real_function_3d project (World &world, const std::shared_ptr< FunctionFunctorInterface< double, D > > &functor, const double thresh)
static std::array< long, 2 > screen_counts (World &world)
 blocks that passed the source test, and blocks the screen skipped, since the last reset, all ranks
static void set_defaults (const int k, const double thresh)
static apply_screen_t< D > sup_screen (const std::vector< real_function_3d > &m)
 the screen built from the multipliers' sup bounds
int test_accuracy (World &world, const real_convolution_3d &P, operands &o, const double thresh)
 T2: the weighted error of the screened potential, for reconstructed and redundant multipliers.
int test_complex (World &world, const real_convolution_3d &P, operands &o, const double thresh)
 T4: a complex function under a real screen.
int test_exchange_geometry (World &world, const real_convolution_3d &P, const double thresh)
int test_shell_loop (World &world)
 T3, T3b: the shell loop must reach the boxes where the multiplier lives.
int test_sup_bound (World &world, const double thresh)
 T5: the sup bound per box bounds the function.
int test_unbounded_screen (World &world, const real_convolution_3d &P, operands &o)
 T1: a screen that never screens reproduces the unscreened apply.

Variables

static const double C_T2 = 1.0
static const double C_T6 = 1.0
static const std::size_t D = 3
static const double REL_T3 = 1.e-10
static const double SLACK_T5 = 2.0
static const double THRESH_REF = 1.e-9
 projection threshold of the analytic reference potential

Function Documentation

◆ apply_with()

template<typename T>
Function< T, D > apply_with ( World & world,
const real_convolution_3d & P,
const Function< T, D > & f,
const apply_screen_t< D > & screen,
std::array< long, 2 > * counts = nullptr )
static

◆ box_b_screen()

apply_screen_t< D > box_b_screen ( const double inside,
const double outside )
static

the screen of T3: inside in the boxes that intersect B = [4,8] x [-2,2] x [-2,2], outside elsewhere

References d, madness::FunctionDefaults< NDIM >::cell, madness::FunctionDefaults< NDIM >::get_cell(), madness::FunctionDefaults< NDIM >::get_cell_width(), h(), L, and lo.

Referenced by test_shell_loop().

◆ distribution()

std::array< double, 3 > distribution ( std::vector< double > v)
static

median, 90th percentile and max

References q(), and v.

Referenced by test_sup_bound().

◆ eval_in_box()

double eval_in_box ( const Key< D > & key,
const Tensor< double > & c,
const std::array< double, D > & x )
static

the function in the box key at the point x in [0,1]^D of the box, from the box's scaling coefficients

References c, d, madness::FunctionCommonData< T, NDIM >::data, madness::FunctionDefaults< NDIM >::get_cell_volume(), k, madness::legendre_scaling_functions(), madness::Key< NDIM >::level(), and p().

Referenced by test_sup_bound().

◆ main()

◆ make_operands()

operands make_operands ( World & world,
const real_convolution_3d & P,
const double thresh )
static

◆ never_screen()

apply_screen_t< D > never_screen ( )
static

a screen that never screens: the multiplier is unbounded everywhere, so the apply runs as without a screen while the counters still see every block that passes the source test

References madness::SupBoundScreen< NDIM >::unbounded().

Referenced by test_exchange_geometry(), test_shell_loop(), and test_unbounded_screen().

◆ project()

real_function_3d project ( World & world,
const std::shared_ptr< FunctionFunctorInterface< double, D > > & functor,
const double thresh )
static

◆ screen_counts()

std::array< long, 2 > screen_counts ( World & world)
static

blocks that passed the source test, and blocks the screen skipped, since the last reset, all ranks

References madness::ApplyScreenStats::blocks, madness::World::gop, madness::ApplyScreenStats::skipped, and madness::WorldGopInterface::sum().

Referenced by apply_with().

◆ set_defaults()

◆ sup_screen()

apply_screen_t< D > sup_screen ( const std::vector< real_function_3d > & m)
static

the screen built from the multipliers' sup bounds

References m.

Referenced by test_accuracy(), test_complex(), and test_exchange_geometry().

◆ test_accuracy()

◆ test_complex()

◆ test_exchange_geometry()

int test_exchange_geometry ( World & world,
const real_convolution_3d & P,
const double thresh )

T6: the exchange's own geometry. The source is the product of the multiplier with itself, as in the diagonal product bra_i vf_i of the exchange (vf = bra = ket), so the multiplier is O(1) on top of the source at every level of the source. Two multipliers: a Gaussian, whose tree stops at level 5, and a cusp, refined to level 13 at the nucleus, where a box's volume is far below one bohr^3.

References apply_with(), C_T6, madness::test_output::checkpoint(), madness::test_output::end(), madness::g, madness::name(), never_screen(), madness::norm2(), P, madness::project(), madness::World::rank(), madness::test_output::set_do_print(), sup_screen(), thresh, and u().

Referenced by main().

◆ test_shell_loop()

◆ test_sup_bound()

◆ test_unbounded_screen()

Variable Documentation

◆ C_T2

const double C_T2 = 1.0
static

T2, T4: the weighted error of the screened potential stays below C_T2 * thresh (or twice the unscreened error); measured C 0.18 and 0.15, see the header

Referenced by test_accuracy(), and test_complex().

◆ C_T6

const double C_T6 = 1.0
static

T6: the weighted error of the screened potential against the unscreened one stays below C_T6 * thresh; measured 0.02 (Gaussian) and 3e-14 (cusp), see the header

Referenced by test_exchange_geometry().

◆ D

const std::size_t D = 3
static

◆ REL_T3

const double REL_T3 = 1.e-10
static

T3, T3b: inside B the screened potential is the unscreened one to roundoff, relative to |chi u|; measured at most 1.4e-15 (shell loops stopped too early: 5e-8), see the header

Referenced by test_shell_loop().

◆ SLACK_T5

const double SLACK_T5 = 2.0
static

T5: the bound must lie above the analytic function less SLACK_T5 thresh, the projection's pointwise error; measured worst 1.04 thresh (m2, two of its 20000 points), every other point within the bound

Referenced by test_sup_bound().

◆ THRESH_REF

const double THRESH_REF = 1.e-9
static

projection threshold of the analytic reference potential

Referenced by main(), and make_operands().