MADNESS  0.10.1
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
madness::GFit< T, NDIM > Class Template Reference

#include <gfit.h>

Public Member Functions

 GFit ()=default
 default ctor does nothing More...
 
 GFit (const GFit &other)=default
 copy constructor More...
 
 GFit (OperatorInfo info)
 
Tensor< Tcoeffs () const
 return the coefficients of the fit More...
 
Tensor< Texponents () const
 return the exponents of the fit More...
 
GFitoperator= (const GFit &other)
 assignment operator More...
 
void truncate_periodic_expansion (Tensor< double > &c, Tensor< double > &e, double L, bool discardG0) const
 

Static Public Member Functions

static GFit BSHFit (double mu, double lo, double hi, double eps, bool prnt=false)
 return a fit for the bound-state Helmholtz function More...
 
static GFit CoulombFit (double lo, double hi, double eps, bool prnt=false)
 return a fit for the Coulomb function More...
 
static GFit F12Fit (double gamma, double lo, double hi, double eps, bool prnt=false)
 return a fit for the F12 correlation factor More...
 
static GFit F12sqFit (double gamma, double lo, double hi, double eps, bool prnt=false)
 return a fit for the F12^2 correlation factor More...
 
static GFit F2GFit (double gamma, double lo, double hi, double eps, bool prnt=false)
 return a fit for the F2G function More...
 
static GFit FGFit (double gamma, double lo, double hi, double eps, bool prnt=false)
 return a fit for the FG function More...
 
static GFit GaussFit (double gamma, double lo, double hi, double eps, bool prnt=false)
 return a (trivial) fit for a single Gauss function More...
 
static GFit GeneralFit ()
 return a fit for a general isotropic function More...
 
static void prune_small_coefficients (const double eps, const double lo, const double hi, Tensor< double > &coeff, Tensor< double > &expnt)
 
static GFit SlaterFit (double gamma, double lo, double hi, double eps, bool prnt=false)
 return a fit for the Slater function More...
 

Private Member Functions

template<typename funcT >
 GFit (const funcT &f)
 ctor taking an isotropic function More...
 
template<typename opT >
void print_accuracy (opT op, const double lo, const double hi) const
 print coefficients and exponents, and values and errors More...
 

Static Private Member Functions

static void bsh_fit (double mu, double lo, double hi, double eps, Tensor< double > &pcoeff, Tensor< double > &pexpnt, bool prnt, bool fix_interval)
 fit the function exp(-mu r)/r More...
 
static void bsh_fit_ndim (int ndim, double mu, double lo, double hi, double eps, Tensor< double > &pcoeff, Tensor< double > &pexpnt, bool prnt)
 
static void bsh_spherical_moments (double mu, double R, Tensor< double > &q)
 
static void f12_fit (double gamma, double lo, double hi, double eps, Tensor< double > &pcoeff, Tensor< double > &pexpnt, bool prnt)
 fit a correlation factor (1- exp(-mu r)) More...
 
static void f12sq_fit (double gamma, double lo, double hi, double eps, Tensor< double > &pcoeff, Tensor< double > &pexpnt, bool prnt)
 fit a correlation factor f12^2 = (1- exp(-mu r))^2 = 1 - 2 exp(-mu r) + exp(-2 mu r) More...
 
static void gaussian_spherical_moments (double alpha, double R, Tensor< double > &q)
 
static void slater_fit (double gamma, double lo, double hi, double eps, Tensor< double > &pcoeff, Tensor< double > &pexpnt, bool prnt)
 fit a Slater function using a sum of Gaussians More...
 

Private Attributes

Tensor< Tcoeffs_
 the coefficients of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2) More...
 
Tensor< Texponents_
 the exponents of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2) More...
 

Constructor & Destructor Documentation

◆ GFit() [1/4]

template<typename T , std::size_t NDIM>
madness::GFit< T, NDIM >::GFit ( )
default

default ctor does nothing

Referenced by madness::GFit< T, NDIM >::GeneralFit().

◆ GFit() [2/4]

template<typename T , std::size_t NDIM>
madness::GFit< T, NDIM >::GFit ( OperatorInfo  info)
inline

◆ GFit() [3/4]

template<typename T , std::size_t NDIM>
madness::GFit< T, NDIM >::GFit ( const GFit< T, NDIM > &  other)
default

copy constructor

◆ GFit() [4/4]

template<typename T , std::size_t NDIM>
template<typename funcT >
madness::GFit< T, NDIM >::GFit ( const funcT &  f)
inlineprivate

ctor taking an isotropic function

the function will be represented with a uniform error on a uniform grid

Parameters
[in]fa 1d-function that implements T operator()

Member Function Documentation

◆ bsh_fit()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::bsh_fit ( double  mu,
double  lo,
double  hi,
double  eps,
Tensor< double > &  pcoeff,
Tensor< double > &  pexpnt,
bool  prnt,
bool  fix_interval 
)
inlinestaticprivate

fit the function exp(-mu r)/r

formulas taken from G. Beylkin and L. Monzon, On approximation of functions by exponential sums, Appl Comput Harmon A, vol. 19, no. 1, pp. 17-48, Jul. 2005. and R. J. Harrison, G. I. Fann, T. Yanai, and G. Beylkin, Multiresolution Quantum Chemistry in Multiwavelet Bases, Lecture Notes in Computer Science, vol. 2660, p. 707, 2003.

References madness::GFit< T, NDIM >::bsh_spherical_moments(), e(), madness::GFit< T, NDIM >::gaussian_spherical_moments(), madness::gesv(), h(), lo, mu, madness::constants::pi, madness::print(), madness::GFit< T, NDIM >::prune_small_coefficients(), and q().

Referenced by madness::GFit< T, NDIM >::BSHFit(), madness::GFit< T, NDIM >::F2GFit(), and madness::GFit< T, NDIM >::FGFit().

◆ bsh_fit_ndim()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::bsh_fit_ndim ( int  ndim,
double  mu,
double  lo,
double  hi,
double  eps,
Tensor< double > &  pcoeff,
Tensor< double > &  pexpnt,
bool  prnt 
)
inlinestaticprivate

◆ bsh_spherical_moments()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::bsh_spherical_moments ( double  mu,
double  R,
Tensor< double > &  q 
)
inlinestaticprivate

◆ BSHFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::BSHFit ( double  mu,
double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

return a fit for the bound-state Helmholtz function

the BSH function is defined by f(r) = 1/ (4 pi) exp(-\mu r)/r

Parameters
[in]muthe exponent of the BSH
[in]lothe smallest length scale that needs to be precisely represented
[in]hithe largest length scale that needs to be precisely represented
[in]epsthe precision threshold @parma[in] prnt print level

References madness::GFit< T, NDIM >::bsh_fit(), madness::GFit< T, NDIM >::bsh_fit_ndim(), exact, fit(), lo, mu, NDIM, madness::constants::pi, and madness::print().

Referenced by madness::GFit< T, NDIM >::GFit(), madness::BSHOperatorPtr3D(), madness::GFit< T, NDIM >::CoulombFit(), madness::BSHFunctionInterface::fit(), madness::GradBSHOperator(), GradBSHOperator_Joel(), madness::PeriodicBSHOperator3D(), and madness::PeriodicBSHOperatorPtr3D().

◆ coeffs()

template<typename T , std::size_t NDIM>
Tensor<T> madness::GFit< T, NDIM >::coeffs ( ) const
inline

return the coefficients of the fit

References madness::GFit< T, NDIM >::coeffs_.

Referenced by madness::GFit< T, NDIM >::F2GFit(), and madness::GFit< T, NDIM >::FGFit().

◆ CoulombFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::CoulombFit ( double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

◆ exponents()

template<typename T , std::size_t NDIM>
Tensor<T> madness::GFit< T, NDIM >::exponents ( ) const
inline

◆ f12_fit()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::f12_fit ( double  gamma,
double  lo,
double  hi,
double  eps,
Tensor< double > &  pcoeff,
Tensor< double > &  pexpnt,
bool  prnt 
)
inlinestaticprivate

fit a correlation factor (1- exp(-mu r))

use the Slater fit with an additional term: 1*exp(-0 r^2)

References madness::_(), lo, madness::BaseTensor::size(), and madness::GFit< T, NDIM >::slater_fit().

Referenced by madness::GFit< T, NDIM >::F12Fit().

◆ F12Fit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::F12Fit ( double  gamma,
double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

return a fit for the F12 correlation factor

the Slater function is defined by f(r) = 1/(2 gamma) * (1 - exp(-\gamma r))

Parameters
[in]gammathe exponent of the Slater function
[in]lothe smallest length scale that needs to be precisely represented
[in]hithe largest length scale that needs to be precisely represented
[in]epsthe precision threshold @parma[in] prnt print level

References exact, madness::GFit< T, NDIM >::f12_fit(), fit(), lo, and madness::print().

Referenced by madness::GFit< T, NDIM >::GFit(), and madness::SlaterF12Interface::fit().

◆ f12sq_fit()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::f12sq_fit ( double  gamma,
double  lo,
double  hi,
double  eps,
Tensor< double > &  pcoeff,
Tensor< double > &  pexpnt,
bool  prnt 
)
inlinestaticprivate

fit a correlation factor f12^2 = (1- exp(-mu r))^2 = 1 - 2 exp(-mu r) + exp(-2 mu r)

no factor 1/(2 mu) or square of it included! use the Slater fit with an additional term: 1*exp(-0 r^2)

References madness::_(), lo, MADNESS_CHECK, madness::BaseTensor::size(), and madness::GFit< T, NDIM >::slater_fit().

Referenced by madness::GFit< T, NDIM >::F12sqFit().

◆ F12sqFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::F12sqFit ( double  gamma,
double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

return a fit for the F12^2 correlation factor

the Slater function square is defined by f(r) = [ 1/(2 gamma) * (1 - exp(-\gamma r)) ] ^2

Parameters
[in]gammathe exponent of the Slater function
[in]lothe smallest length scale that needs to be precisely represented
[in]hithe largest length scale that needs to be precisely represented
[in]epsthe precision threshold @parma[in] prnt print level

References exact, madness::GFit< T, NDIM >::f12sq_fit(), fit(), lo, pow(), and madness::print().

Referenced by madness::GFit< T, NDIM >::GFit().

◆ F2GFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::F2GFit ( double  gamma,
double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

return a fit for the F2G function

f2g = (1/(2 mu) * (1 - exp(-gamma r12)))^2 / r12 = 1/(4 mu^2) * [ 1/r12 - 2 exp(-gamma r12)/r12) + exp(-2 gamma r12)/r12 ]

Parameters
[in]gammathe exponent of the Slater function
[in]lothe smallest length scale that needs to be precisely represented
[in]hithe largest length scale that needs to be precisely represented
[in]epsthe precision threshold @parma[in] prnt print level

References madness::GFit< T, NDIM >::bsh_fit(), madness::GFit< T, NDIM >::coeffs(), madness::GFit< T, NDIM >::coeffs_, exact, madness::GFit< T, NDIM >::exponents(), madness::GFit< T, NDIM >::exponents_, lo, MADNESS_CHECK, madness::constants::pi, madness::print(), madness::GFit< T, NDIM >::print_accuracy(), and madness::GFit< T, NDIM >::prune_small_coefficients().

Referenced by madness::GFit< T, NDIM >::GFit().

◆ FGFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::FGFit ( double  gamma,
double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

return a fit for the FG function

fg = 1/(2 mu) * (1 - exp(-gamma r12)) / r12 = 1/(2 mu) *( 1/r12 - exp(-gamma r12)/r12) = 1/(2 mu) * (coulomb - bsh)

Parameters
[in]gammathe exponent of the Slater function
[in]lothe smallest length scale that needs to be precisely represented
[in]hithe largest length scale that needs to be precisely represented
[in]epsthe precision threshold @parma[in] prnt print level

References madness::GFit< T, NDIM >::bsh_fit(), madness::GFit< T, NDIM >::coeffs(), madness::GFit< T, NDIM >::coeffs_, exact, madness::GFit< T, NDIM >::exponents(), madness::GFit< T, NDIM >::exponents_, lo, MADNESS_CHECK, madness::constants::pi, madness::print(), madness::GFit< T, NDIM >::print_accuracy(), and madness::GFit< T, NDIM >::prune_small_coefficients().

Referenced by madness::GFit< T, NDIM >::GFit().

◆ GaussFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::GaussFit ( double  gamma,
double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

return a (trivial) fit for a single Gauss function

the Gauss function is defined by f(r) = exp(-\gamma r^2)

Parameters
[in]gammathe exponent of the Gauss function
[in]lothe smallest length scale that needs to be precisely represented
[in]hithe largest length scale that needs to be precisely represented
[in]epsthe precision threshold @parma[in] prnt print level

References exact, fit(), lo, and madness::print().

Referenced by madness::GFit< T, NDIM >::GFit().

◆ gaussian_spherical_moments()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::gaussian_spherical_moments ( double  alpha,
double  R,
Tensor< double > &  q 
)
inlinestaticprivate

◆ GeneralFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::GeneralFit ( )
inlinestatic

return a fit for a general isotropic function

note that the error is controlled over a uniform grid, the boundaries will be poorly represented in general. Following Beylkin 2005

References madness::GFit< T, NDIM >::GFit(), and MADNESS_EXCEPTION.

◆ operator=()

template<typename T , std::size_t NDIM>
GFit& madness::GFit< T, NDIM >::operator= ( const GFit< T, NDIM > &  other)
inline

◆ print_accuracy()

template<typename T , std::size_t NDIM>
template<typename opT >
void madness::GFit< T, NDIM >::print_accuracy ( opT  op,
const double  lo,
const double  hi 
) const
inlineprivate

print coefficients and exponents, and values and errors

Parameters
[in]opthe exact function, e.g. 1/r, exp(-mu r), etc
[in]lolower bound for the range r
[in]hihigher bound for the range r

References madness::GFit< T, NDIM >::coeffs_, exact, madness::GFit< T, NDIM >::exponents_, lo, op(), pow(), and test().

Referenced by madness::GFit< T, NDIM >::F2GFit(), and madness::GFit< T, NDIM >::FGFit().

◆ prune_small_coefficients()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::prune_small_coefficients ( const double  eps,
const double  lo,
const double  hi,
Tensor< double > &  coeff,
Tensor< double > &  expnt 
)
inlinestatic

◆ slater_fit()

template<typename T , std::size_t NDIM>
static void madness::GFit< T, NDIM >::slater_fit ( double  gamma,
double  lo,
double  hi,
double  eps,
Tensor< double > &  pcoeff,
Tensor< double > &  pexpnt,
bool  prnt 
)
inlinestaticprivate

fit a Slater function using a sum of Gaussians

formula inspired by the BSH fit, with the roles of r and mu exchanged see also Eq. (A3) in S. Ten-no, Initiation of explicitly correlated Slater-type geminal theory, Chem. Phys. Lett., vol. 398, no. 1, pp. 56-61, 2004.

References e(), exact, h(), lo, MADNESS_CHECK, madness::constants::pi, pow(), and test().

Referenced by madness::GFit< T, NDIM >::f12_fit(), madness::GFit< T, NDIM >::f12sq_fit(), and madness::GFit< T, NDIM >::SlaterFit().

◆ SlaterFit()

template<typename T , std::size_t NDIM>
static GFit madness::GFit< T, NDIM >::SlaterFit ( double  gamma,
double  lo,
double  hi,
double  eps,
bool  prnt = false 
)
inlinestatic

return a fit for the Slater function

the Slater function is defined by f(r) = exp(-\gamma r)

Parameters
[in]gammathe exponent of the Slater function
[in]lothe smallest length scale that needs to be precisely represented
[in]hithe largest length scale that needs to be precisely represented
[in]epsthe precision threshold @parma[in] prnt print level

References exact, fit(), lo, madness::print(), and madness::GFit< T, NDIM >::slater_fit().

Referenced by madness::GFit< T, NDIM >::GFit(), madness::SlaterFunctionInterface::fit(), and madness::GradSlaterOperator().

◆ truncate_periodic_expansion()

template<typename T , std::size_t NDIM>
void madness::GFit< T, NDIM >::truncate_periodic_expansion ( Tensor< double > &  c,
Tensor< double > &  e,
double  L,
bool  discardG0 
) const
inline

References c, e(), and L.

Member Data Documentation

◆ coeffs_

template<typename T , std::size_t NDIM>
Tensor<T> madness::GFit< T, NDIM >::coeffs_
private

◆ exponents_

template<typename T , std::size_t NDIM>
Tensor<T> madness::GFit< T, NDIM >::exponents_
private

The documentation for this class was generated from the following file: