00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef __GNUC__
00029 #pragma interface
00030 #endif
00031
00032 #include <stdexcept>
00033 #include <vector>
00034 #include <cmath>
00035
00036 #ifndef _chemistry_qc_mbptr12_gaussianfit_h
00037 #define _chemistry_qc_mbptr12_gaussianfit_h
00038
00039 namespace sc {
00040
00044 template <typename Function,
00045 typename Weight>
00046 class GaussianFit {
00047 public:
00048
00049 static const bool weigh_F = 0;
00050
00051 typedef double Exp;
00052 typedef double Coef;
00053 typedef std::pair<Exp,Coef> Gaussian;
00054 typedef std::vector<Gaussian> Gaussians;
00056 GaussianFit(unsigned int N,
00057 const Weight& W,
00058 double left,
00059 double right,
00060 unsigned int NP);
00061 ~GaussianFit();
00062
00064 const Gaussians& operator()(const Function& F) const;
00065
00066 private:
00068 static const int k_ = 0;
00069
00071 Weight weight_;
00073 mutable std::vector< std::pair<Exp,Coef> > gaussians_;
00074 double left_;
00075 double right_;
00076 unsigned int npts_;
00077
00079 mutable double* p_;
00081 double* scratch_;
00082
00084 static const int classdebug_ = 0;
00085
00087 void extract_params() const;
00089 void assign_params() const;
00090 };
00091
00092 namespace mbptr12 {
00094 class Slater1D {
00095 public:
00096 Slater1D(double a, int k=0) : a_(a), k_(k) {}
00097 double operator()(double x) const { return std::pow(x,k_) * std::exp(-a_*x); }
00098 private:
00099 int k_;
00100 double a_;
00101 };
00103 class Gaussian1D {
00104 public:
00105 Gaussian1D(double a, int k=0) : a_(a), k_(k) {}
00106 double operator()(double x) const { return std::pow(x,k_) * std::exp(-a_*x*x); }
00107 private:
00108 int k_;
00109 double a_;
00110 };
00112 class PowerGaussian1D {
00113 public:
00114 PowerGaussian1D(double a, int l=2, int k=0) : a_(a), k_(k), l_(l) {}
00115 double operator()(double x) const { return std::pow(x,k_) * std::exp(-a_*std::pow(x,l_)); }
00116 private:
00117 int k_;
00118 int l_;
00119 double a_;
00120 };
00121 }
00122
00123 }
00124
00125 #endif
00126
00127
00128
00129
00130