|
MADNESS 0.10.1
|
#include <gfit.h>
Public Member Functions | |
| GFit ()=default | |
| default ctor does nothing | |
| GFit (const GFit &other)=default | |
| copy constructor | |
| GFit (OperatorInfo info) | |
| Tensor< T > | coeffs () const |
| return the coefficients of the fit | |
| Tensor< T > | exponents () const |
| return the exponents of the fit | |
| GFit & | operator= (const GFit &other) |
| assignment operator | |
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 | |
| static GFit | CoulombFit (double lo, double hi, double eps, bool prnt=false) |
| return a fit for the Coulomb function | |
| static GFit | F12Fit (double gamma, double lo, double hi, double eps, bool prnt=false) |
| return a fit for the F12 correlation factor | |
| static GFit | F12sqFit (double gamma, double lo, double hi, double eps, bool prnt=false) |
| return a fit for the F12^2 correlation factor | |
| static GFit | F2GFit (double gamma, double lo, double hi, double eps, bool prnt=false) |
| return a fit for the F2G function | |
| static GFit | FGFit (double gamma, double lo, double hi, double eps, bool prnt=false) |
| return a fit for the FG function | |
| static GFit | GaussFit (double gamma, double lo, double hi, double eps, bool prnt=false) |
| return a (trivial) fit for a single Gauss function | |
| static GFit | GeneralFit () |
| return a fit for a general isotropic function | |
| static void | prune_small_coefficients (const double eps, const double lo, const double hi, Tensor< double > &coeff, Tensor< double > &expnt, const long first_prunable=1) |
| static GFit | SlaterFit (double gamma, double lo, double hi, double eps, bool prnt=false) |
| return a fit for the Slater function | |
| static void | truncate_mixed_expansion (Tensor< double > &c, Tensor< double > &e, const std::array< LatticeRange, NDIM > &lattice_ranges, const Tensor< double > &cell_width, double lo, double hi_fin, double eps) |
| Truncate the fit of a kernel that is lattice-summed along some axes. | |
Private Member Functions | |
| template<typename funcT > | |
| GFit (const funcT &f) | |
| ctor taking an isotropic function | |
| template<typename opT > | |
| void | print_accuracy (opT op, const double lo, const double hi) const |
| print coefficients and exponents, and values and errors | |
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 | |
| 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)) | |
| 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) | |
| 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 | |
Private Attributes | |
| Tensor< T > | coeffs_ |
| the coefficients of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2) | |
| Tensor< T > | exponents_ |
| the exponents of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2) | |
|
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. 103, 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, 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(), and GradBSHOperator_Joel().
|
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(), and madness::GradCoulombOperator().
|
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, 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 madness::GFit< T, NDIM >::coeffs_, 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 |
Fold the most diffuse Gaussians of a fit into their neighbours while the fit stays accurate to eps on [lo, hi]. Works from the tail inwards and stops at the first term that cannot be merged; terms before first_prunable are never merged into (so first_prunable - 1 and everything before it keep their coefficients).
References std::abs(), lo, and madness::BaseTensor::size().
Referenced by madness::GFit< T, NDIM >::bsh_fit(), madness::GFit< T, NDIM >::F2GFit(), madness::GFit< T, NDIM >::FGFit(), and madness::GFit< T, NDIM >::truncate_mixed_expansion().
|
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().
|
inlinestatic |
Truncate the fit of a kernel that is lattice-summed along some axes.
Along an axis with an infinite lattice sum, a Gaussian with exponent below tcut = 0.25/L^2 (L the largest such cell width) has a lattice sum that is flat to exp(-4 pi^2) over the cell: a gauge constant. If every axis is summed, those terms are dropped (all but the first, as before). If some axes are not summed, the same terms are not flat along them and carry real potential there – so they are kept as far as the finite axes need them: the tail is folded into its neighbours while the fit stays accurate to eps on [lo, hi_fin], where hi_fin is the largest distance the finite axes can reach. The first term below tcut is never merged into a term above it, whose lattice sum is not flat.
| [in,out] | c | coefficients of the fit; truncated (and possibly rescaled) on return |
| [in,out] | e | exponents of the fit, in decreasing order |
| [in] | lattice_ranges | lattice range of each axis |
| [in] | cell_width | width of each axis of the cell |
| [in] | lo | smallest distance the fit must represent accurately |
| [in] | hi_fin | largest distance the finite (non-infinite) axes must represent accurately |
| [in] | eps | accuracy of the fit on [lo, hi_fin] |
References b, c, d, e(), lo, NDIM, and madness::GFit< T, NDIM >::prune_small_coefficients().
|
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 >::GaussFit(), 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().