MADNESS  version 0.9
function_interface.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 
31  $Id: function_factory_and_interface.h 3422 2014-03-24 09:16:15Z 3ru6ruWu $
32 */
33 
34 
35 #ifndef MADNESS_MRA_FUNCTION_INTERFACE_H__INCLUDED
36 #define MADNESS_MRA_FUNCTION_INTERFACE_H__INCLUDED
37 
38 #include <madness/tensor/tensor.h>
40 #include <madness/mra/key.h>
41 
42 // needed for the TwoElectronInterface
43 #include <madness/mra/gfit.h>
46 namespace madness {
47 
48  // forward declaration needed for CompositeFunctorInterface
49  template<typename T, std::size_t NDIM>
50  class FunctionImpl;
51 
52  template<typename T, std::size_t NDIM>
53  Tensor<T> fcube(const Key<NDIM>&, T (*f)(const Vector<double,NDIM>&), const Tensor<double>&);
54 
55 
57  template<typename T, std::size_t NDIM>
59  public:
60 
62  typedef Key<NDIM> keyT;
63 
65  virtual bool screened(const Vector<double,NDIM>& c1, const Vector<double,NDIM>& c2) const {
66  return false;
67  }
68 
70  virtual bool supports_vectorized() const {return false;}
71 
72  virtual void operator()(const Vector<double*,1>& xvals, T* fvals, int npts) const {
73  MADNESS_EXCEPTION("FunctionFunctorInterface: This function should not be called!", 0);
74  }
75 
76  virtual void operator()(const Vector<double*,2>& xvals, T* fvals, int npts) const {
77  MADNESS_EXCEPTION("FunctionFunctorInterface: This function should not be called!", 0);
78  }
79 
80  virtual void operator()(const Vector<double*,3>& xvals, T* fvals, int npts) const {
81  MADNESS_EXCEPTION("FunctionFunctorInterface: This function should not be called!", 0);
82  }
83 
84  virtual void operator()(const Vector<double*,4>& xvals, T* fvals, int npts) const {
85  MADNESS_EXCEPTION("FunctionFunctorInterface: This function should not be called!", 0);
86  }
87 
88  virtual void operator()(const Vector<double*,5>& xvals, T* fvals, int npts) const {
89  MADNESS_EXCEPTION("FunctionFunctorInterface: This function should not be called!", 0);
90  }
91 
92  virtual void operator()(const Vector<double*,6>& xvals, T* fvals, int npts) const {
93  MADNESS_EXCEPTION("FunctionFunctorInterface: This function should not be called!", 0);
94  }
95 
97  virtual T operator()(const Vector<double, NDIM>& x) const = 0;
98 
100  virtual std::vector< Vector<double,NDIM> > special_points() const {
101  return std::vector< Vector<double,NDIM> >();
102  }
103 
105  virtual Level special_level() {return 6;}
106 
108 
109  virtual coeffT coeff(const keyT&) const {
110  MADNESS_EXCEPTION("implement coeff for FunctionFunctorInterface",0);
111  return coeffT();
112  }
113 
114  virtual coeffT values(const keyT& key, const Tensor<double>& tensor) const {
115  MADNESS_EXCEPTION("implement values for FunctionFunctorInterface",0);
116  return coeffT();
117  }
118 
120  virtual bool provides_coeff() const {
121  return false;
122  }
123 
124  };
125 
126 
128 
136  template<typename T, std::size_t NDIM, std::size_t MDIM>
137  class CompositeFunctorInterface : public FunctionFunctorInterface<T,NDIM> {
138 
139  typedef Vector<double, NDIM> coordT;
140  typedef FunctionImpl<T,NDIM> implT;
141  typedef FunctionImpl<T,MDIM> implL;
142  typedef std::shared_ptr<implT> pimplT;
143  typedef std::shared_ptr<implL> pimplL;
144 
145  World& world;
146 
147  public:
151 
157 
158  public:
159 
161  CompositeFunctorInterface(World& world, pimplT ket, pimplT g12,
162  pimplL v1, pimplL v2, pimplL p1, pimplL p2)
163  : world(world), impl_ket(ket), impl_eri(g12)
164  , impl_m1(v1), impl_m2(v2), impl_p1(p1), impl_p2(p2)
165  {
166 
167  // some consistency checks
168  // either a pair ket is provided, or two particles (tba)
169  MADNESS_ASSERT(impl_ket or (impl_p1 and impl_p2));
170 
171  // prepare base functions that make this function
172  if (impl_ket and (not impl_ket->is_on_demand())) impl_ket->make_redundant(false);
173  if (impl_eri) {
174  if (not impl_eri->is_on_demand()) impl_eri->make_redundant(false);
175  }
176  if (impl_m1 and (not impl_m1->is_on_demand())) impl_m1->make_redundant(false);
177  if (impl_m2 and (not impl_m2->is_on_demand())) impl_m2->make_redundant(false);
178 
179  if (impl_p1 and (not impl_p1->is_on_demand())) impl_p1->make_redundant(false);
180  if (impl_p2 and (not impl_p2->is_on_demand())) impl_p2->make_redundant(false);
181  world.gop.fence();
182 
183  }
184 
186  T operator()(const coordT& x) const {
187  print("there is no operator()(coordT&) in CompositeFunctorInterface, for good reason");
188  MADNESS_ASSERT(0);
189  return T(0);
190  };
191 
192  bool provides_coeff() const {
193  return false;
194  }
195 
196  };
197 
198 
200 
206  template<typename T, std::size_t NDIM>
208 
209  public:
212 
213  T (*f)(const coordT&);
214 
215  ElementaryInterface(T (*f)(const coordT&)) : f(f) {}
216 
217  T operator()(const coordT& x) const {return f(x);}
218 
219  coeffT values(const Key<NDIM>& key, const Tensor<double>& quad_x) const {
220  typedef Tensor<T> tensorT;
221  tensorT fval=madness::fcube(key,f,quad_x);
223  }
224  };
225 
227  template<typename T, std::size_t NDIM, typename opT>
229 
230  public:
233 
234  opT op;
235 
236  FunctorInterface(const opT& op) : op(op) {}
237 
238  T operator()(const coordT& x) const {return op(x);}
239  };
240 
242  template<typename T, size_t NDIM, typename opT>
244 
245  typedef GenTensor<T> coeffT;
246  typedef Vector<double, NDIM> coordT;
247 
248  const opT op;
249 
250  public:
251  FunctionInterface(const opT& op) : op(op) {}
252 
253  T operator()(const coordT& coord) const {return op(coord);}
254 
255  bool provides_coeff() const {return false;}
256 
257  };
258 
260 
266  template<typename T, std::size_t NDIM>
268  public:
269 
271 
273 
277  TwoElectronInterface(double lo,double eps,
280  :rank(), k(kk), lo(lo), hi(1.0) {
281 
282  // Presently we must have periodic or non-periodic in all dimensions.
283  for (std::size_t d=1; d<6; ++d) {MADNESS_ASSERT(bc(d,0)==bc(0,0));}
284 
285  const Tensor<double>& width = FunctionDefaults<6>::get_cell_width();
286  hi = width.normf(); // Diagonal width of cell
287  if (bc(0,0) == BC_PERIODIC) hi *= 100; // Extend range for periodic summation
288 
289  }
290 
291  bool provides_coeff() const {
292  return true;
293  }
294 
296  coeffT coeff(const Key<NDIM>& key) const {
297  Tensor<double> c=make_coeff(key);
299  }
300 
302  print("there is no operator()(coordT&) in TwoElectronInterface, for good reason");
303  MADNESS_ASSERT(0);
304  return T(0);
305  }
306 
307  protected:
308 
310  Tensor<double> make_coeff(const Key<6>& key) const {
311  const Level n=key.level();
312  const Vector<Translation,6> l=key.translation();
313 
314  // get the displacements for all 3 dimensions: x12, y12, z12
315  const Translation l0=(l[0]-l[3]);
316  const Translation l1=(l[1]-l[4]);
317  const Translation l2=(l[2]-l[5]);
318 
319  Tensor<double> scr1(rank,k*k), scr2(rank,k*k,k*k);
320 
321  // lump all the terms together
322  for (long mu=0; mu<rank; mu++) {
323  const Tensor<double> r0=(ops[mu].getop(0)->rnlij(n,l0)).reshape(k*k);
324  const Tensor<double> r1=(ops[mu].getop(1)->rnlij(n,l1)).reshape(k*k);
325  const Tensor<double> r2=(ops[mu].getop(2)->rnlij(n,l2)).reshape(k*k);
326 
327  // include weights in first vector
328  scr1(mu,Slice(_))=r0*ops[mu].getfac();
329 
330  // merge second and third vector to scr(r,k1,k2)
331  scr2(mu,Slice(_),Slice(_))=outer(r1,r2);
332  }
333 
334  Tensor<double> c=inner(scr1,scr2,0,0);
335  return c;
336  }
337 
339  Tensor<double> map_coeff(const Tensor<double>& c) const {
340  std::vector<long> map(6);
341  map[0]=0; map[1]=3; map[2]=1;
342  map[3]=4; map[4]=2; map[5]=5;
343  return copy(c.reshape(k,k,k,k,k,k).mapdim(map));
344  }
345 
347  void initialize(const double eps) {
348  GFit<double,3> fit=this->fit(eps);
349  Tensor<double> coeff=fit.coeffs();
350  Tensor<double> expnt=fit.exponents();
351 
352  // set some parameters
353  rank=coeff.dim(0);
354  ops.resize(rank);
355  const Tensor<double>& width = FunctionDefaults<6>::get_cell_width();
356 
357  // construct all the terms
358  for (int mu=0; mu<rank; ++mu) {
359  // double c = std::pow(sqrt(expnt(mu)/pi),static_cast<int>(NDIM)); // Normalization coeff
360  double c = std::pow(sqrt(expnt(mu)/constants::pi),3); // Normalization coeff
361 
362  // We cache the normalized operator so the factor is the value we must multiply
363  // by to recover the coeff we want.
364  ops[mu].setfac(coeff(mu)/c);
365 
366  // only 3 dimensions here!
367  for (std::size_t d=0; d<3; ++d) {
368  ops[mu].setop(d,GaussianConvolution1DCache<double>::get(k, expnt(mu)*width[d]*width[d], 0, false));
369  }
370  }
371  }
372 
374  virtual GFit<double,3> fit(const double eps) const = 0;
375 
377  mutable std::vector< ConvolutionND<double,6> > ops;
378 
380  int rank;
381 
383  int k;
384 
386  double lo;
387 
389  double hi;
390 
391  };
392 
395  public:
396 
398 
403  ElectronRepulsionInterface(double lo,double eps,
406  : TwoElectronInterface<double,6>(lo,eps,bc,kk) {
407 
408  initialize(eps);
409  }
410 
411  private:
412 
413  GFit<double,3> fit(const double eps) const {
414  return GFit<double,3>::CoulombFit(lo,hi,eps,false);
415  }
416  };
417 
419  class BSHFunctionInterface : public TwoElectronInterface<double,6> {
420  public:
421 
423 
428  BSHFunctionInterface(double mu, double lo,double eps,
431  : TwoElectronInterface<double,6>(lo,eps,bc,kk), mu(mu) {
432 
433  initialize(eps);
434  }
435 
436  private:
437 
438  double mu;
439 
440  GFit<double,3> fit(const double eps) const {
441  return GFit<double,3>::BSHFit(mu,lo,hi,eps,false);
442  }
443  };
444 
447  public:
448 
450 
455  SlaterFunctionInterface(double mu, double lo,double eps,
458  : TwoElectronInterface<double,6>(lo,eps,bc,kk), mu(mu) {
459 
460  initialize(eps);
461  }
462 
463  private:
464 
465  double mu;
466 
467  GFit<double,3> fit(const double eps) const {
468  return GFit<double,3>::SlaterFit(mu,lo,hi,eps,false);
469  }
470  };
471 
473  class SlaterF12Interface : public TwoElectronInterface<double,6> {
474  public:
475 
477 
482  SlaterF12Interface(double mu, double lo,double eps,
485  : TwoElectronInterface<double,6>(lo,eps,bc,kk), mu(mu) {
486 
487  initialize(eps);
488  }
489 
491  coeffT coeff(const Key<6>& key) const {
492 
493  Tensor<double> c=make_coeff(key);
494 
495  // subtract 1 from the (0,0,..,0) element of the tensor,
496  // which is the 0th order polynomial coefficient
497  double one_coeff1=1.0*sqrt(FunctionDefaults<6>::get_cell_volume())
498  *pow(0.5,0.5*6*key.level());
499  std::vector<long> v0(6,0L);
500  c(v0)-=one_coeff1;
501 
502  c.scale(-0.5/mu);
504  }
505 
506  private:
507 
508  double mu;
509 
510  GFit<double,3> fit(const double eps) const {
511  return GFit<double,3>::SlaterFit(mu,lo,hi,eps,false);
512  }
513  };
514 
516  class FGInterface : public TwoElectronInterface<double,6> {
517  public:
518 
520 
525  FGInterface(double mu, double lo,double eps,
528  : TwoElectronInterface<double,6>(lo,eps,bc,kk), mu(mu) {
529 
530  initialize(eps);
531  }
532 
533  private:
534 
535  double mu;
536 
537  GFit<double,3> fit(const double eps) const {
538  return GFit<double,3>::SlaterFit(mu,lo,hi,eps,false);
539  }
540  };
541 
542 
543 #if 0
544 
546 
548  template<typename T, std::size_t NDIM>
549  class ElectronRepulsionInterface : public FunctionFunctorInterface<T,NDIM> {
550 
551  typedef GenTensor<T> coeffT;
552  typedef Vector<double, NDIM> coordT;
553 
555  ElectronRepulsion eri;
556 
557  public:
558 
561  ElectronRepulsionInterface(World& world,double lo,double eps,
562  const BoundaryConditions<NDIM>& bc=FunctionDefaults<NDIM>::get_bc(),
563  int k=FunctionDefaults<NDIM>::get_k())
564  : eri(ElectronRepulsion(eps,eps,bc,k)) {
565  }
566 
567 
569  T operator()(const coordT& x) const {
570  print("there is no operator()(coordT&) in ElectronRepulsionInterface, for good reason");
571  MADNESS_ASSERT(0);
572  return T(0);
573  };
574 
575 
577  coeffT coeff(const Key<NDIM>& key) const {
578  return coeffT(this->eri.coeff(key),FunctionDefaults<NDIM>::get_thresh(),
579  TT_FULL);
580  }
581 
582  };
583 
585 
589  template<typename T, std::size_t NDIM>
590  class FGIntegralInterface : public FunctionFunctorInterface<T,NDIM> {
591 
592  typedef GenTensor<T> coeffT;
593  typedef Vector<double, NDIM> coordT;
594 
596  ElectronRepulsion eri;
597  BSHFunction bsh;
598 
599  public:
600 
603  FGIntegralInterface(World& world, double lo, double eps, double gamma,
604  const BoundaryConditions<NDIM>& bc=FunctionDefaults<NDIM>::get_bc(),
605  int k=FunctionDefaults<NDIM>::get_k())
606  : eri(ElectronRepulsion(eps,eps,0.0,bc,k))
607  , bsh(BSHFunction(eps,eps,gamma,bc,k)) {
608  }
609 
610  bool provides_coeff() const {
611  return true;
612  }
613 
615  T operator()(const coordT& x) const {
616  print("there is no operator()(coordT&) in FGIntegralInterface, for good reason");
617  MADNESS_ASSERT(0);
618  return T(0);
619  };
620 
622  coeffT coeff(const Key<NDIM>& key) const {
623  typedef Tensor<T> tensorT;
624  tensorT e_b=eri.coeff(key)-bsh.coeff(key);
625  return coeffT(e_b,FunctionDefaults<NDIM>::get_thresh(),TT_FULL);
626  }
627 
628  };
629 
630 #endif
631 
632 }
633 
634 #endif // MADNESS_MRA_FUNCTION_INTERFACE_H__INCLUDED
virtual void operator()(const Vector< double *, 4 > &xvals, T *fvals, int npts) const
Definition: function_interface.h:84
a function like f(x)=exp(-mu x)
Definition: function_interface.h:446
WorldGopInterface & gop
Global operations.
Definition: worldfwd.h:462
Definition: shared_ptr_bits.h:38
std::shared_ptr< implL > impl_m2
supposedly 1/r2
Definition: function_interface.h:154
virtual bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition: function_interface.h:120
const double pi
Mathematical constant pi.
Definition: constants.h:44
void initialize(const double eps)
initialize the Gaussian fit; uses the virtual function fit() to fit
Definition: function_interface.h:347
FunctionDefaults holds default paramaters as static class members.
Definition: funcdefaults.h:175
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:339
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:482
static GFit SlaterFit(double gamma, double lo, double hi, double eps, bool prnt=false)
return a fit for the Slater function
Definition: gfit.h:86
const Vector< Translation, NDIM > & translation() const
Definition: key.h:225
CompositeFunctorInterface(World &world, pimplT ket, pimplT g12, pimplL v1, pimplL v2, pimplL p1, pimplL p2)
constructor takes its Factory
Definition: function_interface.h:161
T operator()(const Vector< double, NDIM > &x) const
You should implement this to return f(x)
Definition: function_interface.h:301
virtual void operator()(const Vector< double *, 3 > &xvals, T *fvals, int npts) const
Definition: function_interface.h:80
GenTensor< T > outer(const GenTensor< T > &left, const GenTensor< T > &right)
Outer product ... result(i,j,...,p,q,...) = left(i,k,...)*right(p,q,...)
Definition: gentensor.h:230
Tensor< double > make_coeff(const Key< 6 > &key) const
make the coefficients from the 1d convolution
Definition: function_interface.h:310
Provides a tensor with taking advantage of possibly low rank.
const double L
Definition: 3dharmonic.cc:123
FunctionInterface implements a wrapper around any class with the operator()()
Definition: function_interface.h:243
std::shared_ptr< implL > impl_p2
supposedly orbital 2
Definition: function_interface.h:156
a function like f(x) = (1 - exp(-mu x))/x
Definition: function_interface.h:516
GenTensor< T > coeffT
Definition: function_interface.h:232
virtual void operator()(const Vector< double *, 6 > &xvals, T *fvals, int npts) const
Definition: function_interface.h:92
virtual coeffT values(const keyT &key, const Tensor< double > &tensor) const
Definition: function_interface.h:114
int k
the wavelet order
Definition: function_interface.h:383
double lo
the smallest length scale that needs to be represented
Definition: function_interface.h:386
virtual GFit< double, 3 > fit(const double eps) const =0
derived classes must implement this – cf GFit.h
ElementaryInterface(T(*f)(const coordT &))
Definition: function_interface.h:215
NDIM & f
Definition: mra.h:2179
Tensor< T > coeffs() const
return the coefficients of the fit
Definition: gfit.h:102
Definition: funcdefaults.h:56
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
GenTensor< T > coeffT
Definition: function_interface.h:61
T inner(const vecfunc< T, NDIM > &a, const vecfunc< T, NDIM > &b)
the non-linear solver requires an inner product
Definition: nemo.h:112
Vector< double, NDIM > coordT
Type of vector holding coordinates.
Definition: function_interface.h:231
bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition: function_interface.h:255
std::vector< ConvolutionND< double, 6 > > ops
storing the coefficients
Definition: function_interface.h:377
Defines and implements most of Tensor.
std::shared_ptr< implT > impl_ket
various MRA functions of NDIM dimensionality
Definition: function_interface.h:149
FunctorInterface(const opT &op)
Definition: function_interface.h:236
Tensor< T > exponents() const
return the exponents of the fit
Definition: gfit.h:105
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:428
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:100
T operator()(const coordT &x) const
You should implement this to return f(x)
Definition: function_interface.h:238
T operator()(const coordT &x) const
You should implement this to return f(x)
Definition: function_interface.h:217
const T1 &f1 return GTEST_2_TUPLE_() T(f0, f1)
base class to compute the wavelet coefficients for an isotropic 2e-operator
Definition: function_interface.h:267
virtual void operator()(const Vector< double *, 5 > &xvals, T *fvals, int npts) const
Definition: function_interface.h:88
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:70
const int k
Definition: dielectric.cc:184
coeffT values(const Key< NDIM > &key, const Tensor< double > &quad_x) const
Definition: function_interface.h:219
int rank
the number of terms in the Gaussian quadrature
Definition: function_interface.h:380
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:1835
double hi
the largest length scale that needs to be represented
Definition: function_interface.h:389
std::shared_ptr< implL > impl_p1
supposedly orbital 1
Definition: function_interface.h:155
Level level() const
Definition: key.h:220
bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition: function_interface.h:291
GenTensor< T > coeffT
Definition: function_interface.h:211
Tensor< double > tensorT
Definition: chem/distpm.cc:13
virtual void operator()(const Vector< double *, 1 > &xvals, T *fvals, int npts) const
Definition: function_interface.h:72
Vector< double, 3 > coordT
Definition: DFcode/corepotential.cc:55
Namespace for mathematical applications.
Definition: muParser.cpp:47
a function like f(x) = (1 - exp(-mu x))/(2 gamma)
Definition: function_interface.h:473
virtual Level special_level()
Override this change level refinement for special points (default is 6)
Definition: function_interface.h:105
ElementaryInterface (formerly FunctorInterfaceWrapper) interfaces a c-function.
Definition: function_interface.h:207
bool & is_on_demand()
Definition: mraimpl.h:269
coeffT coeff(const Key< 6 > &key) const
overload the function of the base class
Definition: function_interface.h:491
a function like f(x)=1/x
Definition: function_interface.h:394
tensorT sqrt(const tensorT &s, double tol=1e-8)
Computes matrix square root (not used any more?)
Definition: DFcode/moldft.cc:446
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
void fence()
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition: worldgop.cc:52
const mpreal gamma(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2429
int Level
Definition: key.h:58
virtual void operator()(const Vector< double *, 2 > &xvals, T *fvals, int npts) const
Definition: function_interface.h:76
std::shared_ptr< implT > impl_eri
supposedly 1/r12
Definition: function_interface.h:150
Abstract base class interface required for functors used as input to Functions.
Definition: function_interface.h:58
virtual ~FunctionFunctorInterface()
Definition: function_interface.h:107
fit isotropic functions to a set of Gaussians with controlled precision
static GFit CoulombFit(double lo, double hi, double eps, bool prnt=false)
return a fit for the Coulomb function
Definition: gfit.h:55
Key< NDIM > keyT
Definition: function_interface.h:62
Definition: convolution1d.h:837
T operator()(const coordT &x) const
return value at point x; fairly inefficient
Definition: function_interface.h:186
Vector< double, NDIM > coordT
Type of vector holding coordinates.
Definition: function_interface.h:210
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:455
FunctorInterface interfaces a class or struct with an operator()()
Definition: function_interface.h:228
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension.
Definition: funcdefaults.h:391
TwoElectronInterface(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:277
void print(const A &a)
Print a single item to std::cout terminating with new line.
Definition: print.h:122
Definition: gfit.h:47
#define MADNESS_EXCEPTION(msg, value)
Definition: worldexc.h:88
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:65
a function like f(x) = exp(-mu x)/x
Definition: function_interface.h:419
A slice defines a sub-range or patch of a dimension.
Definition: slice.h:103
T operator()(const coordT &coord) const
You should implement this to return f(x)
Definition: function_interface.h:253
Multidimension Key for MRA tree and associated iterators.
Definition: gentensor.h:123
Definition: tensor.h:275
int64_t Translation
Definition: key.h:57
virtual coeffT coeff(const keyT &) const
Definition: function_interface.h:109
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
const double c
Definition: gfit.cc:200
std::shared_ptr< implL > impl_m1
various MRA functions of MDIM dimensionality (e.g. 3, if NDIM==6)
Definition: function_interface.h:153
FGInterface(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:525
bool provides_coeff() const
does this functor directly provide sum coefficients? or only function values?
Definition: function_interface.h:192
FunctionInterface(const opT &op)
Definition: function_interface.h:251
opT op
Definition: function_interface.h:234
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:69
GenTensor< T > coeffT
Definition: function_interface.h:270
T(* f)(const coordT &)
Definition: function_interface.h:213
Compuates most matrix elements over 1D operators (including Gaussians)
virtual bool supports_vectorized() const
Does the interface support a vectorized operator()?
Definition: function_interface.h:70
ElectronRepulsionInterface(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:403
void make_redundant(const bool fence)
convert this to redundant, i.e. have sum coefficients on all levels
Definition: mraimpl.h:1485
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:296