35 #ifndef MADNESS_MRA_FUNCTION_FACTORY_H__INCLUDED
36 #define MADNESS_MRA_FUNCTION_FACTORY_H__INCLUDED
56 template<
typename T, std::
size_t NDIM>
59 template<
typename T, std::
size_t NDIM>
62 template<
typename T, std::
size_t NDIM>
63 Tensor<T>
fcube(
const Key<NDIM>&,
T (*
f)(
const Vector<double,NDIM>&),
const Tensor<double>&);
78 template<
typename T, std::
size_t NDIM>
79 class FunctionFactory {
121 _truncate_on_project(
124 _is_on_demand(false),
134 template<
typename opT>
149 (*
f)(
const coordT&)) {
208 _truncate_on_project =
true;
213 _truncate_on_project =
false;
228 _is_on_demand =
true;
263 template<
typename T, std::
size_t NDIM, std::
size_t MDIM>
291 this->_is_on_demand=
true;
343 if (this->_func)
return this->_func;
351 this->_world,_ket,_g12,_v1,_v2,_particle1,_particle2
464 InterfacePtr get_functor()
const {
467 if (this->interface_)
return this->interface_;
470 const_cast<InterfacePtr&
>(this->interface_)=
471 InterfacePtr(
new ElectronRepulsionInterface(
472 dcut_,thresh_,bc_,k_));
473 return this->interface_;
476 ERIFactory&
self() {
return *
this;}
481 class SlaterFunctionFactory :
public TwoElectronFactory<SlaterFunctionFacto> {
483 SlaterFunctionFactory(World& world)
484 : TwoElectronFactory(world), gamma_(-1.0), f12_(false) {}
488 this->gamma_ =
gamma;
493 SlaterFunctionFactory& f12() {
499 InterfacePtr get_functor()
const {
502 if (this->interface_)
return this->interface_;
505 MADNESS_ASSERT(gamma_>0);
509 const_cast<InterfacePtr&
>(this->interface_)=
510 InterfacePtr(
new SlaterF12Interface(
511 gamma_,dcut_,this->_thresh,bc_,this->_k));
513 const_cast<InterfacePtr&
>(this->interface_)=
514 InterfacePtr(
new SlaterFunctionInterface(
515 gamma_,dcut_,this->_thresh,bc_,this->_k));
517 return this->interface_;
520 SlaterFunctionFactory&
self() {
return *
this;}
529 template<
typename T, std::
size_t NDIM>
530 class ERIFactory :
public FunctionFactory<T, NDIM> {
539 BoundaryConditions<NDIM> _bc;
542 ERIFactory(World& world)
543 : FunctionFactory<
T,
NDIM>(world)
545 , _dcut(FunctionDefaults<
NDIM>::get_thresh())
546 , _bc(FunctionDefaults<
NDIM>::get_bc())
548 this->_is_on_demand=
true;
549 MADNESS_ASSERT(
NDIM==6);
554 this->_thresh = thresh;
568 if (this->_eri)
return this->_eri;
575 new ElectronRepulsionInterface(_dcut,this->_thresh,
585 template<
typename T, std::
size_t NDIM>
606 this->_is_on_demand=
true;
607 MADNESS_ASSERT(
NDIM==6);
626 if (this->_fg)
return this->_fg;
634 _gamma,_bc,this->_k));
643 #endif // MADNESS_MRA_FUNCTION_FACTORY_H__INCLUDED
std::shared_ptr< FunctionImpl< T, MDIM > > _particle1
supposedly particle 1
Definition: function_factory.h:270
const double thresh
Definition: dielectric.cc:185
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > get_functor() const
return the functor; override this if the functor needs deferred construction
Definition: function_factory.h:623
std::shared_ptr< FunctionImpl< T, MDIM > > _particle2
supposedly particle 2
Definition: function_factory.h:271
a function like f(x)=exp(-mu x)
Definition: function_interface.h:446
CompositeFactory & V_for_particle2(const Function< T, MDIM > &f)
a one-particle potential, acting on particle 2
Definition: function_factory.h:318
factory for generating TwoElectronInterfaces
Definition: function_factory.h:361
virtual std::shared_ptr< FunctionFunctorInterface< T, NDIM > > get_functor() const
return the functor; override this if the functor needs deferred construction
Definition: function_factory.h:242
Definition: shared_ptr_bits.h:38
FunctionFactory & max_refine_level(int max_refine_level)
Definition: function_factory.h:172
NDIM const Function< R, NDIM > & g
Definition: mra.h:2179
CompositeFactory & ket(const Function< T, NDIM > &f)
provide directly the NDIM (6D) pair function ket
Definition: function_factory.h:297
FunctionFactory & functor2(const opT &op)
Definition: function_factory.h:136
virtual FunctionFactory & k(int k)
Definition: function_factory.h:155
FunctionDefaults holds default paramaters as static class members.
Definition: funcdefaults.h:175
CompositeFactory & V_for_particle1(const Function< T, MDIM > &f)
a one-particle potential, acting on particle 1
Definition: function_factory.h:311
bool _fence
Definition: function_factory.h:93
const int NDIM
Definition: tdse1.cc:44
Factory to set up an ElectronRepulsion Function.
Definition: function_factory.h:586
operatortype
Definition: function_factory.h:443
CompositeFactory & particle1(const Function< T, MDIM > &f)
Definition: function_factory.h:326
TwoElectronFactory(World &world)
Definition: function_factory.h:367
int _k
Definition: function_factory.h:84
const std::shared_ptr< FunctionImpl< T, NDIM > > & get_impl() const
Returns a shared-pointer to the implementation.
Definition: mra.h:589
Definition: function_factory.h:443
Provides a tensor with taking advantage of possibly low rank.
FunctionFactory & initial_level(int initial_level)
Definition: function_factory.h:166
FunctionInterface implements a wrapper around any class with the operator()()
Definition: function_interface.h:243
double get_thresh() const
Definition: function_factory.h:238
a function like f(x) = (1 - exp(-mu x))/x
Definition: function_interface.h:516
BoundaryConditions< NDIM > _bc
Definition: function_factory.h:596
double gamma_
Definition: function_factory.h:452
NDIM & f
Definition: mra.h:2179
FunctionFactory & nofence()
Definition: function_factory.h:222
TwoElectronFactory & dcut(double dcut)
the smallest length scale to be represented (aka lo)
Definition: function_factory.h:381
static const double & get_thresh()
Returns the default threshold.
Definition: funcdefaults.h:225
Tensor< T > fcube(const Key< NDIM > &, T(*f)(const Vector< double, NDIM > &), const Tensor< double > &)
Definition: mraimpl.h:2047
Vector< double, 3 > coordT
Definition: chem/corepotential.cc:57
BoundaryConditions< 6 > bc_
Definition: function_factory.h:454
FunctionFactory & norefine(bool norefine=true)
Definition: function_factory.h:187
virtual FunctionFactory & thresh(double thresh)
Definition: function_factory.h:160
double _dcut
cutoff radius for 1/r12, aka regularization
Definition: function_factory.h:594
std::shared_ptr< FunctionImpl< T, MDIM > > _v1
supposedly a potential for particle 1
Definition: function_factory.h:268
FunctionImpl holds all Function state to facilitate shallow copy semantics.
Definition: funcdefaults.h:48
std::shared_ptr< FunctionImpl< T, MDIM > > _v2
supposedly a potential for particle 2
Definition: function_factory.h:269
FunctionFactory & refine(bool refine=true)
Definition: function_factory.h:182
FunctionFactory & noautorefine()
Definition: function_factory.h:202
std::shared_ptr< FunctionImpl< T, NDIM > > _g12
supposedly a interaction potential
Definition: function_factory.h:267
FunctionFactory & autorefine()
Definition: function_factory.h:197
Defines and implements most of Tensor.
FunctionFactory & fence(bool fence=true)
Definition: function_factory.h:217
int get_k() const
Definition: function_factory.h:237
CompositeFunctorInterface implements a wrapper of holding several functions and functors.
Definition: funcimpl.h:73
FGFactory & thresh(double thresh)
Definition: function_factory.h:611
FunctionFactory & empty()
Definition: function_factory.h:192
double _gamma
Definition: function_factory.h:595
Factory for facile setup of a CompositeFunctorInterface and its FuncImpl.
Definition: function_factory.h:264
TwoElectronFactory & slater()
return the operator (1 - exp(-gamma x) / (2 gamma)
Definition: function_factory.h:405
CompositeFactory & particle2(const Function< T, MDIM > &f)
Definition: function_factory.h:334
double dcut_
cutoff radius for 1/r12, aka regularization
Definition: function_factory.h:450
const T1 &f1 return GTEST_2_TUPLE_() T(f0, f1)
TwoElectronFactory & gamma(double g)
the exponent of a slater function
Definition: function_factory.h:393
FGFactory & dcut(double dcut)
Definition: function_factory.h:617
World & _world
Definition: function_factory.h:83
static int get_k()
Returns the default wavelet order.
Definition: funcdefaults.h:212
virtual ~FunctionFactory()
Definition: function_factory.h:127
FunctionFactory & functor(const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > &f)
Definition: function_factory.h:129
FunctionFactory & notruncate_on_project()
Definition: function_factory.h:212
std::shared_ptr< FunctionFunctorInterface< T, NDIM > > get_functor() const
return the functor; override this if the functor needs deferred construction
Definition: function_factory.h:340
FunctionFactory & truncate_mode(int truncate_mode)
Definition: function_factory.h:177
TwoElectronFactory & thresh(double thresh)
the requested precision
Definition: function_factory.h:387
std::shared_ptr< FunctionImpl< T, NDIM > > _ket
supposedly a 6D pair function ket
Definition: function_factory.h:266
bool _autorefine
Definition: function_factory.h:91
bool _empty
Definition: function_factory.h:90
bool _truncate_on_project
Definition: function_factory.h:92
Definition: function_factory.h:443
a function like f(x) = (1 - exp(-mu x))/(2 gamma)
Definition: function_interface.h:473
int _max_refine_level
Definition: function_factory.h:87
FunctionFactory & truncate_on_project()
Definition: function_factory.h:207
ElementaryInterface (formerly FunctorInterfaceWrapper) interfaces a c-function.
Definition: function_interface.h:207
a function like f(x)=1/x
Definition: function_interface.h:394
bool _is_on_demand
Definition: function_factory.h:94
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
const mpreal gamma(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2429
A multiresolution adaptive numerical function.
Definition: derivative.h:61
FunctionFactory & pmap(const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap)
Definition: function_factory.h:232
operatortype type_
Definition: function_factory.h:445
Definition: function_factory.h:443
InterfacePtr get_functor() const
return the functor; override this if the functor needs deferred construction
Definition: function_factory.h:411
Abstract base class interface required for functors used as input to Functions.
Definition: function_interface.h:58
std::shared_ptr< FunctionFunctorInterface< double, 6 > > InterfacePtr
Definition: function_factory.h:364
TwoElectronFactory & f12()
return the operator (1 - exp(-gamma x) / (2 gamma)
Definition: function_factory.h:399
int _initial_level
Definition: function_factory.h:86
void reset()
Definition: shared_ptr_bits.h:459
FunctionFactory & f(T(*f)(const coordT &))
Definition: function_factory.h:148
Definition: function_factory.h:443
World & get_world() const
Definition: function_factory.h:239
CompositeFactory & g12(const Function< T, NDIM > &f)
g12 is the interaction potential (6D)
Definition: function_factory.h:304
virtual FunctionFactory & is_on_demand()
Definition: function_factory.h:227
int _truncate_mode
Definition: function_factory.h:88
Tensor< double > op(const Tensor< double > &x)
Definition: kain.cc:508
Interface to be provided by any process map.
Definition: worlddc.h:64
#define MADNESS_EXCEPTION(msg, value)
Definition: worldexc.h:88
std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > _pmap
Definition: function_factory.h:96
InterfacePtr interface_
the interface providing the actual coefficients
Definition: function_factory.h:448
FunctionFactory(World &world)
Definition: function_factory.h:108
Multidimension Key for MRA tree and associated iterators.
CompositeFactory(World &world)
Definition: function_factory.h:280
FunctionFactory implements the named-parameter idiom for Function.
Definition: funcimpl.h:70
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
FGFactory(World &world, double gamma)
Definition: function_factory.h:599
bool _refine
Definition: function_factory.h:89
double _thresh
Definition: function_factory.h:85
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:69
FunctionFactory & no_functor()
Definition: function_factory.h:143
Definition: function_factory.h:443