MADNESS 0.10.1
Classes | Functions | Variables
test_ccpairfunction.cc File Reference
#include <madness/mra/mra.h>
#include <madness/chem/ccpairfunction.h>
#include <madness/chem/correlationfactor.h>
#include <madness/chem/electronic_correlation_factor.h>
#include <madness/chem/CCStructures.h>
#include <madness/chem/CCPotentials.h>
#include <madness/chem/projector.h>
#include <madness/world/test_utilities.h>
#include <random>
Include dependency graph for test_ccpairfunction.cc:

Classes

struct  data< T, NDIM >
 

Functions

int main (int argc, char **argv)
 
template<typename T , std::size_t NDIM>
int test_apply (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_consolidate (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_consolidate_vs_direct (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 detect that consolidate() is not equivalent to direct addition (operator+)
 
template<typename T , std::size_t NDIM>
int test_constructor (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_inner (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameters)
 
template<typename T , std::size_t NDIM>
int test_load_store (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_multiply (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameters)
 
template<typename T , std::size_t NDIM>
int test_multiply_with_f12 (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameters)
 
template<typename T , std::size_t NDIM>
int test_norm (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_operator_apply (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_partial_inner_3d (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_partial_inner_6d (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_projector (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_scalar_multiplication (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_swap_particles (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameters)
 
template<typename T , std::size_t NDIM>
int test_transformations (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 
template<typename T , std::size_t NDIM>
int test_tt2d_summation (World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, data< T, NDIM > &data, const CCParameters &parameter)
 minimal detector for the loss of precision of low-rank (TT_2D) summation
 

Variables

bool longtest =false
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

◆ test_apply()

template<typename T , std::size_t NDIM>
int test_apply ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

f12: exp(-r_1^2 - 2 r_2^2) f23: exp(-r_1^2 - 2 r_2^2) + exp(-2 r_1^2 - 3 r_2^2) p1: pure, corresponds to f12 p2: dec, corresponds to f23 p3: op_dec, corresponds to f23 p4: pure, corresponds to f23 p5: op_pure, corresponds to f23

References madness::test_output::end(), madness::f, f1, f2, f3, data< T, NDIM >::get_ccpairfunctions(), data< T, NDIM >::get_functions(), madness::inner(), NDIM, madness::nonlinear_vector_solver(), op(), madness::OT_F12, p(), madness::print(), and madness::r2().

◆ test_consolidate()

template<typename T , std::size_t NDIM>
int test_consolidate ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

f12: exp(-r_1^2 - 2 r_2^2) f23: exp(-r_1^2 - 2 r_2^2) + exp(-2 r_1^2 - 3 r_2^2) p1: pure, corresponds to f12 p2: dec, corresponds to f23 p3: op_dec, corresponds to f23 p4: pure, corresponds to f23 p5: op_pure, corresponds to f23

References c, madness::test_output::checkpoint(), madness::test_output::end(), data< T, NDIM >::get_ccpairfunctions(), madness::inner(), madness::is_collected(), m, NDIM, madness::nonlinear_vector_solver(), p(), madness::print(), and madness::r2().

◆ test_consolidate_vs_direct()

template<typename T , std::size_t NDIM>
int test_consolidate_vs_direct ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

detect that consolidate() is not equivalent to direct addition (operator+)

consolidate() merges same-type pure terms with transform_reconstructed (see collect_same_types), whereas direct addition uses operator+ (gaxpy_oop_reconstructed). For TT_2D these are different reconstructed-summation algorithms and diverge above threshold. The existing test_consolidate only compares via inner(.,{p1}), which projects onto p1 and hides the error; here we compare in FULL function space.

References madness::test_output::checkpoint(), compare(), madness::copy(), madness::test_output::end(), madness::f, madness::FunctionDefaults< NDIM >::get_k(), madness::FunctionDefaults< NDIM >::get_tensor_type(), madness::FunctionDefaults< NDIM >::get_thresh(), k, k0, NDIM, madness::nonlinear_vector_solver(), madness::norm2(), madness::print(), madness::r2(), madness::World::rank(), madness::FunctionDefaults< NDIM >::set_k(), madness::FunctionDefaults< NDIM >::set_tensor_type(), madness::FunctionDefaults< NDIM >::set_thresh(), thresh, madness::TT_2D, madness::TT_FULL, and madness::vec().

◆ test_constructor()

template<typename T , std::size_t NDIM>
int test_constructor ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_inner()

template<typename T , std::size_t NDIM>
int test_inner ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameters 
)

f1: exp(-1.0 r^2) f2: exp(-2.0 r^2) f3: exp(-3.0 r^2) f4: exp(-4.0 r^2) f5: exp(-5.0 r^2) f: exp(-r_1^2 - 2 r_2^2) f23: exp(-r_1^2 - 2 r_2^2) + exp(-2 r_1^2 - 3 r_2^2)

p1: pure, corresponds to f12 p2: dec, corresponds to f23 p3: op_dec, corresponds to f23 p4: pure, corresponds to f23 p5: op_pure, corresponds to f23

results

References a, madness::apply(), b, madness::test_output::checkpoint(), madness::dot(), madness::test_output::end(), madness::f, f1, data< T, NDIM >::f12_op, f2, f3, madness::CCParameters::gamma(), data< T, NDIM >::get_ccpairfunctions(), data< T, NDIM >::get_functions(), madness::FunctionDefaults< NDIM >::get_thresh(), madness::inner(), madness::CCParameters::lo(), madness::matrix_inner(), NDIM, madness::nonlinear_vector_solver(), madness::print(), thresh, and madness::CCParameters::thresh_bsh_3D().

◆ test_load_store()

template<typename T , std::size_t NDIM>
int test_load_store ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_multiply()

template<typename T , std::size_t NDIM>
int test_multiply ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameters 
)

◆ test_multiply_with_f12()

template<typename T , std::size_t NDIM>
int test_multiply_with_f12 ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameters 
)

◆ test_norm()

template<typename T , std::size_t NDIM>
int test_norm ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_operator_apply()

template<typename T , std::size_t NDIM>
int test_operator_apply ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_partial_inner_3d()

template<typename T , std::size_t NDIM>
int test_partial_inner_3d ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_partial_inner_6d()

template<typename T , std::size_t NDIM>
int test_partial_inner_6d ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_projector()

template<typename T , std::size_t NDIM>
int test_projector ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_scalar_multiplication()

template<typename T , std::size_t NDIM>
int test_scalar_multiplication ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_swap_particles()

template<typename T , std::size_t NDIM>
int test_swap_particles ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameters 
)

◆ test_transformations()

template<typename T , std::size_t NDIM>
int test_transformations ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

◆ test_tt2d_summation()

template<typename T , std::size_t NDIM>
int test_tt2d_summation ( World world,
std::shared_ptr< NuclearCorrelationFactor ncf,
data< T, NDIM > &  data,
const CCParameters parameter 
)

minimal detector for the loss of precision of low-rank (TT_2D) summation

Adds a smooth and a cuspy function whose analytic sum is known, and compares the numerically summed function against the analytic truth, once for TT_FULL and once for TT_2D. TT_FULL reaches the requested threshold (its scaling-function arithmetic is exact up to spatial truncation); TT_2D does not, because every low-rank add re-truncates the SVD spectrum of a cuspy (slowly decaying) function. The failing TT_2D checkpoint IS the detection.

Uses its own tight regime (k=8, thresh=1e-8) so the ~30x gap is unambiguous and deterministic; the previous k/thresh/tensor_type are restored on exit.

References madness::test_output::checkpoint(), madness::test_output::end(), exact, madness::f, madness::g, madness::FunctionDefaults< NDIM >::get_k(), madness::FunctionDefaults< NDIM >::get_tensor_type(), madness::FunctionDefaults< NDIM >::get_thresh(), k, k0, NDIM, madness::nonlinear_vector_solver(), madness::r2(), madness::World::rank(), madness::FunctionDefaults< NDIM >::set_k(), madness::FunctionDefaults< NDIM >::set_tensor_type(), madness::FunctionDefaults< NDIM >::set_thresh(), sum, thresh, madness::TT_2D, and madness::TT_FULL.

Variable Documentation

◆ longtest

bool longtest =false

Referenced by main(), and test_partial_inner_6d().