MADNESS
0.10.1
|
#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< T > | coeffs () const |
return the coefficients of the fit More... | |
Tensor< T > | exponents () const |
return the exponents of the fit More... | |
GFit & | operator= (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< T > | coeffs_ |
the coefficients of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2) More... | |
Tensor< T > | exponents_ |
the exponents of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2) More... | |
|
default |
default ctor does nothing
Referenced by madness::GFit< T, NDIM >::GeneralFit().
|
inline |
References madness::GFit< T, NDIM >::BSHFit(), madness::GFit< T, NDIM >::CoulombFit(), debug, madness::OperatorInfo::debug, madness::GFit< T, NDIM >::F12Fit(), madness::GFit< T, NDIM >::F12sqFit(), madness::GFit< T, NDIM >::F2GFit(), madness::GFit< T, NDIM >::FGFit(), madness::GFit< T, NDIM >::GaussFit(), madness::OperatorInfo::hi, lo, madness::OperatorInfo::lo, MADNESS_CHECK_THROW, MADNESS_EXCEPTION, mu, madness::OperatorInfo::mu, madness::OT_BSH, madness::OT_F12, madness::OT_F212, madness::OT_F2G12, madness::OT_FG12, madness::OT_G12, madness::OT_GAUSS, madness::OT_SLATER, madness::print(), madness::GFit< T, NDIM >::SlaterFit(), madness::OperatorInfo::thresh, madness::type(), and madness::OperatorInfo::type.
|
default |
copy constructor
|
inlineprivate |
ctor taking an isotropic function
the function will be represented with a uniform error on a uniform grid
[in] | f | a 1d-function that implements T operator() |
|
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().
|
inlinestaticprivate |
References std::abs(), c, h(), lo, max, mu, p(), madness::constants::pi, pow(), madness::print(), and test().
Referenced by madness::GFit< T, NDIM >::BSHFit().
|
inlinestaticprivate |
References mu, madness::constants::pi, pow(), q(), and R.
Referenced by madness::GFit< T, NDIM >::bsh_fit().
|
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
[in] | mu | the exponent of the BSH |
[in] | lo | the smallest length scale that needs to be precisely represented |
[in] | hi | the largest length scale that needs to be precisely represented |
[in] | eps | the 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().
|
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().
|
inlinestatic |
return a fit for the Coulomb function
f(r) = 1/r
References madness::GFit< T, NDIM >::BSHFit(), fit(), lo, and madness::constants::pi.
Referenced by madness::GFit< T, NDIM >::GFit(), madness::ElectronRepulsionInterface< T, NDIM >::fit(), madness::GradCoulombOperator(), and madness::PeriodicHFExchangeOperator().
|
inline |
return the exponents of the fit
References madness::GFit< T, NDIM >::exponents_.
Referenced by madness::GFit< T, NDIM >::F2GFit(), and madness::GFit< T, NDIM >::FGFit().
|
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().
|
inlinestatic |
return a fit for the F12 correlation factor
the Slater function is defined by f(r) = 1/(2 gamma) * (1 - exp(-\gamma r))
[in] | gamma | the exponent of the Slater function |
[in] | lo | the smallest length scale that needs to be precisely represented |
[in] | hi | the largest length scale that needs to be precisely represented |
[in] | eps | the 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().
|
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().
|
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
[in] | gamma | the exponent of the Slater function |
[in] | lo | the smallest length scale that needs to be precisely represented |
[in] | hi | the largest length scale that needs to be precisely represented |
[in] | eps | the 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().
|
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 ]
[in] | gamma | the exponent of the Slater function |
[in] | lo | the smallest length scale that needs to be precisely represented |
[in] | hi | the largest length scale that needs to be precisely represented |
[in] | eps | the 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().
|
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)
[in] | gamma | the exponent of the Slater function |
[in] | lo | the smallest length scale that needs to be precisely represented |
[in] | hi | the largest length scale that needs to be precisely represented |
[in] | eps | the 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().
|
inlinestatic |
return a (trivial) fit for a single Gauss function
the Gauss function is defined by f(r) = exp(-\gamma r^2)
[in] | gamma | the exponent of the Gauss function |
[in] | lo | the smallest length scale that needs to be precisely represented |
[in] | hi | the largest length scale that needs to be precisely represented |
[in] | eps | the precision threshold @parma[in] prnt print level |
References exact, fit(), lo, and madness::print().
Referenced by madness::GFit< T, NDIM >::GFit().
|
inlinestaticprivate |
References alpha, madness::constants::pi, pow(), q(), and R.
Referenced by madness::GFit< T, NDIM >::bsh_fit().
|
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.
|
inline |
assignment operator
References madness::GFit< T, NDIM >::coeffs_, and madness::GFit< T, NDIM >::exponents_.
|
inlineprivate |
print coefficients and exponents, and values and errors
[in] | op | the exact function, e.g. 1/r, exp(-mu r), etc |
[in] | lo | lower bound for the range r |
[in] | hi | higher 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().
|
inlinestatic |
References std::abs(), lo, max, and madness::BaseTensor::size().
Referenced by madness::GFit< T, NDIM >::bsh_fit(), madness::GFit< T, NDIM >::F2GFit(), and madness::GFit< T, NDIM >::FGFit().
|
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().
|
inlinestatic |
return a fit for the Slater function
the Slater function is defined by f(r) = exp(-\gamma r)
[in] | gamma | the exponent of the Slater function |
[in] | lo | the smallest length scale that needs to be precisely represented |
[in] | hi | the largest length scale that needs to be precisely represented |
[in] | eps | the 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().
|
inline |
|
private |
the coefficients of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2)
Referenced by madness::GFit< T, NDIM >::coeffs(), madness::GFit< T, NDIM >::F2GFit(), madness::GFit< T, NDIM >::FGFit(), madness::GFit< T, NDIM >::operator=(), and madness::GFit< T, NDIM >::print_accuracy().
|
private |
the exponents of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2)
Referenced by madness::GFit< T, NDIM >::exponents(), madness::GFit< T, NDIM >::F2GFit(), madness::GFit< T, NDIM >::FGFit(), madness::GFit< T, NDIM >::operator=(), and madness::GFit< T, NDIM >::print_accuracy().