35#ifndef MADNESS_MRA_FUNCTION_INTERFACE_H__INCLUDED
36#define MADNESS_MRA_FUNCTION_INTERFACE_H__INCLUDED
51 template<
typename T, std::
size_t NDIM>
54 template<
typename T, std::
size_t NDIM>
57 template<
typename T, std::
size_t NDIM>
67 template<
typename T, std::
size_t NDIM>
100 MADNESS_EXCEPTION(
"FunctionFunctorInterface: This function should not be called!", 0);
104 MADNESS_EXCEPTION(
"FunctionFunctorInterface: This function should not be called!", 0);
108 MADNESS_EXCEPTION(
"FunctionFunctorInterface: This function should not be called!", 0);
112 MADNESS_EXCEPTION(
"FunctionFunctorInterface: This function should not be called!", 0);
116 MADNESS_EXCEPTION(
"FunctionFunctorInterface: This function should not be called!", 0);
120 MADNESS_EXCEPTION(
"FunctionFunctorInterface: This function should not be called!", 0);
130 return std::vector< Vector<double,NDIM> >();
158 template <
typename T, std::
size_t NDIM>
171 template<
typename T, std::
size_t NDIM, std::
size_t MDIM>
253 print(
"there is no operator()(coordT&) in CompositeFunctorInterface, for good reason");
272 template<
typename T, std::
size_t NDIM>
293 template<
typename T, std::
size_t NDIM,
typename opT>
308 template<
typename T,
size_t NDIM,
typename opT>
332 template<
typename T, std::
size_t NDIM>
369 print(
"there is no operator()(coordT&) in TwoElectronInterface, for good reason");
385 }
else if (
NDIM==4) {
388 }
else if (
NDIM==6) {
401 if (
NDIM>=2) r0=(
ops[
mu].getop(0)->rnlij(n,
l0)).reshape(
k*
k);
410 }
else if (
NDIM==4) {
412 }
else if (
NDIM==6) {
436 std::vector<long> map(
NDIM);
440 }
else if (
NDIM==4) {
443 return copy(
c.reshape(
k,
k,
k,
k).mapdim(map));
444 }
else if (
NDIM==6) {
445 map[0]=0; map[1]=3; map[2]=1;
446 map[3]=4; map[4]=2; map[5]=5;
473 for (std::size_t
d=0;
d<
LDIM; ++
d) {
483 mutable std::vector< ConvolutionND<double,NDIM> >
ops;
501 template<
typename T, std::
size_t NDIM>
532 template<
typename T, std::
size_t NDIM>
683 template<
typename T, std::
size_t NDIM>
684 class ElectronRepulsionInterface :
public FunctionFunctorInterface<T,NDIM> {
686 typedef GenTensor<T>
coeffT;
687 typedef Vector<double, NDIM>
coordT;
696 ElectronRepulsionInterface(World& world,
double lo,
double eps,
705 print(
"there is no operator()(coordT&) in ElectronRepulsionInterface, for good reason");
724 template<
typename T, std::
size_t NDIM>
727 typedef GenTensor<T> coeffT;
728 typedef Vector<double, NDIM>
coordT;
745 bool provides_coeff()
const {
750 T operator()(
const coordT& x)
const {
751 print(
"there is no operator()(coordT&) in FGIntegralInterface, for good reason");
757 coeffT coeff(
const Key<NDIM>& key)
const {
a function like f(x) = exp(-mu x)/x
Definition function_interface.h:558
GFit< double, 3 > fit(const double eps) const
derived classes must implement this – cf GFit.h
Definition function_interface.h:578
double mu
Definition function_interface.h:576
BSHFunctionInterface(double mu, double lo, double eps, const BoundaryConditions< 6 > &bc=FunctionDefaults< 6 >::get_bc(), int kk=FunctionDefaults< 6 >::get_k())
constructor: cf the Coulomb kernel
Definition function_interface.h:566
This class is used to specify boundary conditions for all operators.
Definition bc.h:72
CompositeFunctorInterface implements a wrapper of holding several functions and functors.
Definition function_interface.h:172
FunctionImpl< T, NDIM > implT
Definition function_interface.h:175
CompositeFunctorInterface(World &world, std::vector< pimplT > ket, pimplT g12, pimplL v1, pimplL v2, std::vector< pimplL > p1, std::vector< pimplL > p2)
constructor takes its Factory
Definition function_interface.h:196
std::vector< std::shared_ptr< implT > > impl_ket_vector
various MRA functions of NDIM dimensionality
Definition function_interface.h:184
std::shared_ptr< implT > pimplT
Definition function_interface.h:177
bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition function_interface.h:258
T operator()(const coordT &x) const
return value at point x; fairly inefficient
Definition function_interface.h:252
World & world
Definition function_interface.h:180
std::vector< std::shared_ptr< implL > > impl_p1_vector
supposedly orbital 1
Definition function_interface.h:190
std::shared_ptr< implL > pimplL
Definition function_interface.h:178
std::shared_ptr< implL > impl_m1
various MRA functions of MDIM dimensionality (e.g. 3, if NDIM==6)
Definition function_interface.h:188
FunctionImpl< T, MDIM > implL
Definition function_interface.h:176
std::shared_ptr< implT > impl_eri
supposedly 1/r12
Definition function_interface.h:185
std::shared_ptr< implL > impl_m2
supposedly 1/r2
Definition function_interface.h:189
void make_redundant(const bool fence)
Definition function_interface.h:219
bool check_redundant() const
return true if all constituent functions are in redundant tree state
Definition function_interface.h:238
std::vector< std::shared_ptr< implL > > impl_p2_vector
supposedly orbital 2
Definition function_interface.h:191
Vector< double, NDIM > coordT
Type of vector holding coordinates.
Definition function_interface.h:174
void replicate_low_dim_functions(const bool fence)
replicate low-dimensional functions over all ranks of this world
Definition function_interface.h:210
a function like f(x)=1/x
Definition function_interface.h:533
static constexpr std::size_t LDIM
Definition function_interface.h:550
GFit< double, LDIM > fit(const double eps) const
derived classes must implement this – cf GFit.h
Definition function_interface.h:552
ElectronRepulsionInterface(double lo, double eps, const BoundaryConditions< NDIM > &bc=FunctionDefaults< NDIM >::get_bc(), int kk=FunctionDefaults< NDIM >::get_k())
constructor: cf the Coulomb kernel
Definition function_interface.h:541
ElementaryInterface (formerly FunctorInterfaceWrapper) interfaces a c-function.
Definition function_interface.h:273
ElementaryInterface(T(*f)(const coordT &))
Definition function_interface.h:281
T operator()(const coordT &x) const
You should implement this to return f(x)
Definition function_interface.h:283
T(* f)(const coordT &)
Definition function_interface.h:279
coeffT values(const Key< NDIM > &key, const Tensor< double > &quad_x) const
Definition function_interface.h:285
GenTensor< T > coeffT
Definition function_interface.h:277
Vector< double, NDIM > coordT
Type of vector holding coordinates.
Definition function_interface.h:276
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:100
static int get_k()
Returns the default wavelet order.
Definition funcdefaults.h:164
static const double & get_thresh()
Returns the default threshold.
Definition funcdefaults.h:177
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension.
Definition funcdefaults.h:370
static const BoundaryConditions< NDIM > & get_bc()
Returns the default boundary conditions.
Definition funcdefaults.h:311
Abstract base class interface required for functors used as input to Functions.
Definition function_interface.h:68
virtual ~FunctionFunctorInterface()
Definition function_interface.h:136
virtual bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition function_interface.h:149
virtual void operator()(const Vector< double *, 4 > &xvals, T *fvals, int npts) const
Definition function_interface.h:111
virtual bool supports_vectorized() const
Does the interface support a vectorized operator()?
Definition function_interface.h:92
GenTensor< T > coeffT
Definition function_interface.h:71
virtual coeffT coeff(const keyT &) const
Definition function_interface.h:138
virtual coeffT values(const keyT &key, const Tensor< double > &tensor) const
Definition function_interface.h:143
virtual bool screened(const Vector< double, NDIM > &c1, const Vector< double, NDIM > &c2) const
Can we screen this function based on the bounding box information?
Definition function_interface.h:87
T value_type
Definition function_interface.h:73
Level special_level_
Definition function_interface.h:75
void set_length_scale(double lo)
adapt the special level to resolve the smallest length scale
Definition function_interface.h:80
virtual void operator()(const Vector< double *, 2 > &xvals, T *fvals, int npts) const
Definition function_interface.h:103
virtual Level special_level() const
Override this to change the minimum level of refinement at special points (default is 6)
Definition function_interface.h:134
virtual void operator()(const Vector< double *, 5 > &xvals, T *fvals, int npts) const
Definition function_interface.h:115
virtual void operator()(const Vector< double *, 3 > &xvals, T *fvals, int npts) const
Definition function_interface.h:107
FunctionFunctorInterface()
Definition function_interface.h:77
Key< NDIM > keyT
Definition function_interface.h:72
virtual std::vector< Vector< double, NDIM > > special_points() const
Override this to return list of special points to be refined more deeply.
Definition function_interface.h:129
virtual void operator()(const Vector< double *, 6 > &xvals, T *fvals, int npts) const
Definition function_interface.h:119
FunctionImpl holds all Function state to facilitate shallow copy semantics.
Definition funcimpl.h:945
FunctionInterface implements a wrapper around any class with the operator()()
Definition function_interface.h:309
const opT op
Definition function_interface.h:314
bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition function_interface.h:321
Vector< double, NDIM > coordT
Type of vector holding coordinates.
Definition function_interface.h:312
GenTensor< T > coeffT
Definition function_interface.h:311
FunctionInterface(const opT &op)
Definition function_interface.h:317
T operator()(const coordT &coord) const
You should implement this to return f(x)
Definition function_interface.h:319
FunctorInterface interfaces a class or struct with an operator()()
Definition function_interface.h:294
GenTensor< T > coeffT
Definition function_interface.h:298
Vector< double, NDIM > coordT
Type of vector holding coordinates.
Definition function_interface.h:297
FunctorInterface(const opT &op)
Definition function_interface.h:302
opT op
Definition function_interface.h:300
T operator()(const coordT &x) const
You should implement this to return f(x)
Definition function_interface.h:304
static GFit BSHFit(double mu, double lo, double hi, double eps, bool prnt=false)
return a fit for the bound-state Helmholtz function
Definition gfit.h:117
static GFit F12Fit(double gamma, double lo, double hi, double eps, bool prnt=false)
return a fit for the F12 correlation factor
Definition gfit.h:183
static GFit SlaterFit(double gamma, double lo, double hi, double eps, bool prnt=false)
return a fit for the Slater function
Definition gfit.h:140
static GFit CoulombFit(double lo, double hi, double eps, bool prnt=false)
return a fit for the Coulomb function
Definition gfit.h:102
Definition lowranktensor.h:59
long dim(const int i) const
return the number of entries in dimension i
Definition lowranktensor.h:391
a function like f(x)=1/x
Definition function_interface.h:502
static constexpr std::size_t LDIM
Definition function_interface.h:524
GeneralTwoElectronInterface(OperatorInfo info, const BoundaryConditions< NDIM > &bc=FunctionDefaults< NDIM >::get_bc(), int kk=FunctionDefaults< NDIM >::get_k())
constructor: cf the Coulomb kernel
Definition function_interface.h:509
GFit< double, LDIM > fit(const double eps) const
derived classes must implement this – cf GFit.h
Definition function_interface.h:526
OperatorInfo info
Definition function_interface.h:523
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:69
Level level() const
Definition key.h:168
const Vector< Translation, NDIM > & translation() const
Definition key.h:173
a function like f(x) = (1 - exp(-mu x))/(2 gamma)
Definition function_interface.h:609
GFit< double, 3 > fit(const double eps) const
derived classes must implement this – cf GFit.h
Definition function_interface.h:645
double mu
Definition function_interface.h:643
SlaterF12Interface(double mu, double lo, double eps, const BoundaryConditions< 6 > &bc=FunctionDefaults< 6 >::get_bc(), int kk=FunctionDefaults< 6 >::get_k())
constructor: cf the Coulomb kernel
Definition function_interface.h:617
a function like f(x)=exp(-mu x)
Definition function_interface.h:584
GFit< double, 3 > fit(const double eps) const
derived classes must implement this – cf GFit.h
Definition function_interface.h:603
SlaterFunctionInterface(double mu, double lo, double eps, const BoundaryConditions< 6 > &bc=FunctionDefaults< 6 >::get_bc(), int kk=FunctionDefaults< 6 >::get_k())
constructor: cf the Coulomb kernel
Definition function_interface.h:592
double mu
Definition function_interface.h:601
A slice defines a sub-range or patch of a dimension.
Definition slice.h:103
A tensor is a multidimensional array.
Definition tensor.h:317
float_scalar_type normf() const
Returns the Frobenius norm of the tensor.
Definition tensor.h:1726
T max(long *ind=0) const
Return the maximum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1703
base class to compute the wavelet coefficients for an isotropic 2e-operator
Definition function_interface.h:333
double hi
the largest length scale that needs to be represented
Definition function_interface.h:495
coeffT coeff(const Key< NDIM > &key) const
return the coefficients of the function in 6D (x1,y1,z1, x2,y2,z2)
Definition function_interface.h:363
TwoElectronInterface(double lo, double eps, const BoundaryConditions< NDIM > &bc=FunctionDefaults< NDIM >::get_bc(), int kk=FunctionDefaults< NDIM >::get_k())
constructor: cf the Coulomb kernel
Definition function_interface.h:344
int rank
the number of terms in the Gaussian quadrature
Definition function_interface.h:486
T operator()(const Vector< double, NDIM > &x) const
You should implement this to return f(x)
Definition function_interface.h:368
Tensor< double > map_coeff(const Tensor< double > &c) const
the dimensions are a bit confused (x1,x2, y1,y2, z1,z2) -> (x1,y1,z1, x2,y2,z2)
Definition function_interface.h:435
std::vector< ConvolutionND< double, NDIM > > ops
storing the coefficients
Definition function_interface.h:483
Tensor< double > make_coeff(const Key< NDIM > &key) const
make the coefficients from the 1d convolution
Definition function_interface.h:377
bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition function_interface.h:358
virtual GFit< double, LDIM > fit(const double eps) const =0
derived classes must implement this – cf GFit.h
double lo
the smallest length scale that needs to be represented
Definition function_interface.h:492
static constexpr std::size_t LDIM
Definition function_interface.h:335
void initialize(const double eps)
initialize the Gaussian fit; uses the virtual function fit() to fit
Definition function_interface.h:453
int k
the wavelet order
Definition function_interface.h:489
GenTensor< T > coeffT
Definition function_interface.h:338
A simple, fixed dimension vector.
Definition vector.h:64
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:161
A parallel world class.
Definition world.h:132
WorldGopInterface & gop
Global operations.
Definition world.h:207
Computes most matrix elements over 1D operators (including Gaussians)
static double lo
Definition dirac-hatom.cc:23
fit isotropic functions to a set of Gaussians with controlled precision
auto T(World &world, response_space &f) -> response_space
Definition global_functions.cc:28
Multidimension Key for MRA tree and associated iterators.
#define MADNESS_PRAGMA_CLANG(x)
Definition madness_config.h:200
#define MADNESS_PRAGMA_GCC(x)
Definition madness_config.h:205
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
#define MADNESS_CHECK_THROW(condition, msg)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition madness_exception.h:207
Vector< double, 3 > coordT
Definition mcpfit.cc:48
constexpr double pi
Mathematical constant .
Definition constants.h:48
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
@ BC_PERIODIC
Definition bc.h:52
Vector< double, 3 > coordT
Definition corepotential.cc:54
@ redundant
s coeffs everywhere
Definition funcdefaults.h:65
static double r2(const coord_3d &x)
Definition smooth.h:45
Tensor< double > tensorT
Definition distpm.cc:21
std::vector< Function< T, NDIM > > impl2function(const std::vector< std::shared_ptr< FunctionImpl< T, NDIM > > > vimpl)
Definition vmra.h:694
int64_t Translation
Definition key.h:57
static const Slice _(0,-1, 1)
int Level
Definition key.h:58
std::enable_if< std::is_base_of< ProjectorBase, projT >::value, OuterProjector< projT, projQ > >::type outer(const projT &p0, const projQ &p1)
Definition projector.h:457
static double pop(std::vector< double > &v)
Definition SCF.cc:115
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:226
Tensor< T > fcube(const Key< NDIM > &, T(*f)(const Vector< double, NDIM > &), const Tensor< double > &)
Definition mraimpl.h:2133
@ TT_FULL
Definition gentensor.h:120
NDIM & f
Definition mra.h:2528
const Function< T, NDIM > & change_tree_state(const Function< T, NDIM > &f, const TreeState finalstate, bool fence=true)
change tree state of a function
Definition mra.h:2854
double inner(response_space &a, response_space &b)
Definition response_functions.h:639
static XNonlinearSolver< std::vector< Function< T, NDIM > >, T, vector_function_allocator< T, NDIM > > nonlinear_vector_solver(World &world, const long nvec)
Definition nonlinsol.h:371
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition mra.h:2096
const double mu
Definition navstokes_cosines.cc:95
static const double d
Definition nonlinschro.cc:121
static const double c
Definition relops.cc:10
static const double thresh
Definition rk.cc:45
static const long k
Definition rk.cc:44
Definition convolution1d.h:992
Definition operatorinfo.h:58
double hi
Definition operatorinfo.h:67
double thresh
Definition operatorinfo.h:65
Defines and implements most of Tensor.
constexpr std::size_t NDIM
Definition testgconv.cc:54
const auto npts
Definition testgconv.cc:52