|
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 GFit | InverseRSqFit (double lo, double hi, double eps, bool prnt=false) |
| return a fit for the inverse-square function 1/r^2 | |
| 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 GFit(), BSHFit(), CoulombFit(), F12Fit(), F12sqFit(), F2GFit(), FGFit(), GaussFit(), GeneralFit(), InverseRSqFit(), operator=(), and SlaterFit().
|
inline |
References BSHFit(), CoulombFit(), F12Fit(), F12sqFit(), F2GFit(), FGFit(), madness::FunctionDefaults< NDIM >::debug, GaussFit(), InverseRSqFit(), lo, MADNESS_CHECK_THROW, MADNESS_EXCEPTION, mu, madness::OT_BSH, madness::OT_F12, madness::OT_F212, madness::OT_F2G12, madness::OT_FG12, madness::OT_G12, madness::OT_GAUSS, madness::OT_INVRSQ, madness::OT_SLATER, madness::print(), and SlaterFit().
|
default |
copy constructor
References GFit().
|
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() |
References madness::f.
|
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 bsh_spherical_moments(), e(), gaussian_spherical_moments(), madness::gesv(), h(), lo, mu, madness::constants::pi, madness::print(), prune_small_coefficients(), and q().
|
inlinestaticprivate |
References std::abs(), c, h(), lo, mu, p(), madness::constants::pi, pow(), madness::print(), and test().
Referenced by BSHFit().
|
inlinestaticprivate |
|
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 GFit(), bsh_fit(), bsh_fit_ndim(), exact, fit(), lo, mu, NDIM, madness::constants::pi, and madness::print().
Referenced by GFit(), madness::BSHOperatorPtr3D(), madness::DiagnosticMatrix< T, NDIM >::build_Gab_bra(), CoulombFit(), madness::BSHFunctionInterface::fit(), madness::GradBSHOperator(), and GradBSHOperator_Joel().
|
inline |
|
inlinestatic |
return a fit for the Coulomb function
f(r) = 1/r
References GFit(), BSHFit(), fit(), lo, and madness::constants::pi.
Referenced by GFit(), madness::ExchangeCommutator::apply_KffK_lowrank_three_range(), madness::ExchangeCommutator::compute_lrf_exchange_operator(), madness::ElectronRepulsionInterface< T, NDIM >::fit(), madness::GradCoulombOperator(), and test_coulomb_gfit_discard_large_alpha().
|
inline |
|
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 slater_fit().
Referenced by 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 GFit(), exact, f12_fit(), fit(), lo, and madness::print().
Referenced by 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 slater_fit().
Referenced by 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 GFit(), exact, f12sq_fit(), fit(), lo, and madness::print().
Referenced by 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 GFit(), bsh_fit(), coeffs(), coeffs_, exact, exponents(), exponents_, lo, MADNESS_CHECK, madness::constants::pi, madness::print(), print_accuracy(), and prune_small_coefficients().
Referenced by 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 GFit(), bsh_fit(), coeffs(), coeffs_, exact, exponents(), exponents_, lo, MADNESS_CHECK, madness::constants::pi, madness::print(), print_accuracy(), and prune_small_coefficients().
Referenced by 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 GFit(), exact, fit(), lo, and madness::print().
Referenced by GFit().
|
inlinestaticprivate |
|
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 GFit(), and MADNESS_EXCEPTION.
|
inlinestatic |
return a fit for the inverse-square function 1/r^2
Built from the Beylkin-Monzon integral representation 1/r^2 = ∫_0^∞ exp(-t r^2) dt After the substitution t = exp(2s), this is trapezoidally discretized to give 1/r^2 ≈ Σ_k c_k exp(-α_k r^2) with c_k = 2 h exp(2 s_k), α_k = exp(2 s_k).
Implementation is a thin wrapper around bsh_fit_ndim(4, 0, ...), which fits the 4-D Poisson Green's function (proportional to 1/r^2 with a factor 0.5/π^2). The coefficients are rescaled by 4π^2 so that the returned fit is the pointwise approximation of 1/r^2.
| [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 |
| [in] | prnt | print level |
References GFit(), alpha, e(), exact, fit(), h(), lo, and madness::print().
Referenced by GFit(), and test_invrsq_operator().
|
inline |
assignment operator
References GFit(), coeffs_, and exponents_.
|
inlineprivate |
|
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 bsh_fit(), F2GFit(), FGFit(), and 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 f12_fit(), f12sq_fit(), and 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 GFit(), exact, fit(), lo, madness::print(), and slater_fit().
Referenced by GFit(), madness::SlaterFunctionInterface::fit(), madness::GradSlaterOperator(), and test_combine_generic().
|
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(), madness::FunctionDefaults< NDIM >::cell_width, lo, NDIM, and prune_small_coefficients().
|
private |
the coefficients of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2)
Referenced by coeffs(), F2GFit(), FGFit(), operator=(), and print_accuracy().
|
private |
the exponents of the expansion f(x) = \sum_m coeffs[m] exp(-exponents[m] * x^2)
Referenced by exponents(), F2GFit(), FGFit(), operator=(), and print_accuracy().