Psi4
gaussquad.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2016-2017 Robert A. Shaw.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 /* class GCQuadrature contains the information and methods needed to carry out
30  Gauss-Chebyshev quadrature of the second kind.
31 
32  Robert A. Shaw 2016
33 
34  REFERENCES:
35  (Perez92) J.M. Perez-Jorda et al., Comput. Phys. Comm. 70 (1992), 271-284
36  (Perez93) J.M. Perez-Jorda et al., Comput. Phys. Comm. 77 (1993), 46-56
37  (Krack98) M. Krack, A.M. Koster, J. Chem. Phys. 108 (1998), 3226 - 3234
38  (Flores06) R. Flores-Moreno et al., J. Comput. Chem. 27 (2006), 1009-1019
39 */
40 
41 #ifndef GC_QUAD_HEAD
42 #define GC_QUAD_HEAD
43 
44 #include <vector>
45 #include <functional>
46 
47 #include "psi4/pragma.h"
48 
49 namespace psi {
50 
51 enum GCTYPE {
52  ONEPOINT, // Described in Perez92
53  TWOPOINT // Described in Perez93
54 };
55 
65  private:
67  int maxN;
69  int M;
70 
72  std::vector<double> x;
74  std::vector<double> w;
76  double I;
77 
80 
82  double sumTerms(std::function<double(double, double *, int)> &f, double *p, int limit, int shift, int skip);
83 
84  public:
86  int start, end;
87 
89  GCQuadrature();
91  GCQuadrature(const GCQuadrature &other);
92 
101  void initGrid(int points, GCTYPE t);
102 
110  bool integrate(std::function<double(double, double *, int)> &f, double *params, const double tolerance);
111 
115  void transformZeroInf();
123  void transformRMinMax(double z, double p); // Transfromation from [-1, 1] to [rmin, rmax] from Flores06
124 
126  double getI() const { return I; }
127 
129  int getN() const { return maxN; }
130 
132  std::vector<double> &getX() { return x; }
133 };
134 } // namespace psi
135 
136 #endif
Definition: gaussquad.h:52
double getI() const
Returns the calculated integral value - must have called integrate first.
Definition: gaussquad.h:126
Performs adaptive Gauss-Chebyshev quadrature for any given function.
Definition: gaussquad.h:64
std::vector< double > & getX()
Returns a reference to the abscissae.
Definition: gaussquad.h:132
double I
Integration value.
Definition: gaussquad.h:76
std::vector< double > x
Weights.
Definition: gaussquad.h:72
int M
Index of midpoint.
Definition: gaussquad.h:69
Definition: gaussquad.h:53
std::vector< double > w
Abscissae.
Definition: gaussquad.h:74
int getN() const
Returns the maximum number of quadrature points.
Definition: gaussquad.h:129
#define PSI_API
Definition: pragma.h:155
GCTYPE t
Algorithm to be used.
Definition: gaussquad.h:79
int start
Start and endpoints of integration, used for prescreening.
Definition: gaussquad.h:86
EXTERN struct Params params
Definition: cc/ccdensity/globals.h:55
int maxN
Maximum number of points to use in quadrature.
Definition: gaussquad.h:67
GCTYPE
Definition: gaussquad.h:51