Psi4
fjt.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) 2007-2018 The Psi4 Developers.
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 //
30 // fjt.h
31 //
32 // Copyright (C) 2001 Edward Valeev
33 //
34 // Author: Edward Valeev <evaleev@vt.edu>
35 // Maintainer: EV
36 //
37 // This file is part of the SC Toolkit.
38 //
39 // The SC Toolkit is free software; you can redistribute it and/or modify
40 // it under the terms of the GNU Library General Public License as published by
41 // the Free Software Foundation; either version 2, or (at your option)
42 // any later version.
43 //
44 // The SC Toolkit is distributed in the hope that it will be useful,
45 // but WITHOUT ANY WARRANTY; without even the implied warranty of
46 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47 // GNU Library General Public License for more details.
48 //
49 // You should have received a copy of the GNU General Public License along
50 // with this program; if not, write to the Free Software Foundation, Inc.,
51 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
52 //
53 // The U.S. Government is granted a limited license as per AL 91-7.
54 //
55 
56 #ifndef _chemistry_qc_basis_fjt_h
57 #define _chemistry_qc_basis_fjt_h
58 
59 #include "psi4/pragma.h"
60 
61 namespace psi {
62 
63 class CorrelationFactor;
64 
66 class Fjt {
67  public:
68  Fjt();
69  virtual ~Fjt();
74  virtual double* values(int J, double T) = 0;
75  virtual void set_rho(double /*rho*/) {}
76 };
77 
78 #define TAYLOR_INTERPOLATION_ORDER 6
79 #define TAYLOR_INTERPOLATION_AND_RECURSION \
80  0 // compute F_lmax(T) and then iterate down to F_0(T)? Else use interpolation only
81 class Taylor_Fjt : public Fjt {
83  static double relative_zero_;
84 
85  public:
86  static const int max_interp_order = 8;
87 
88  Taylor_Fjt(size_t jmax, double accuracy);
89  ~Taylor_Fjt() override;
91  double* values(int J, double T) override;
92 
93  private:
94  double** grid_; /* Table of "exact" Fm(T) values. Row index corresponds to
95  values of T (max_T+1 rows), column index to values
96  of m (max_m+1 columns) */
97  double delT_; /* The step size for T, depends on cutoff */
98  double oodelT_; /* 1.0 / delT_, see above */
99  double cutoff_; /* Tolerance cutoff used in all computations of Fm(T) */
100  int interp_order_; /* Order of (Taylor) interpolation */
101  int max_m_; /* Maximum value of m in the table, depends on cutoff
102  and the number of terms in Taylor interpolation */
103  int max_T_; /* Maximum index of T in the table, depends on cutoff
104  and m */
105  double* T_crit_; /* Maximum T for each row, depends on cutoff;
106  for a given m and T_idx <= max_T_idx[m] use Taylor interpolation,
107  for a given m and T_idx > max_T_idx[m] use the asymptotic formula */
108  double* F_; /* Here computed values of Fj(T) are stored */
109 };
110 
113 class FJT : public Fjt {
114  private:
115  double** gtable;
116 
117  int maxj;
118  double* denomarray;
121 
122  double* int_fjttable;
123 
124  int ngtable() const { return maxj + 7; }
125 
126  public:
127  FJT(int n);
128  ~FJT() override;
130  double* values(int J, double T) override;
131 };
132 
133 class GaussianFundamental : public Fjt {
134  protected:
135  std::shared_ptr<CorrelationFactor> cf_;
136  double rho_;
137  double* value_;
138 
139  public:
140  GaussianFundamental(std::shared_ptr<CorrelationFactor> cf, int max);
141  ~GaussianFundamental() override;
142 
143  double* values(int J, double T) override = 0;
144  void set_rho(double rho) override;
145 };
146 
151  public:
152  F12Fundamental(std::shared_ptr<CorrelationFactor> cf, int max);
153  ~F12Fundamental() override;
154  double* values(int J, double T) override;
155 };
156 
161  public:
162  F12ScaledFundamental(std::shared_ptr<CorrelationFactor> cf, int max);
163  ~F12ScaledFundamental() override;
164  double* values(int J, double T) override;
165 };
166 
168  public:
169  F12SquaredFundamental(std::shared_ptr<CorrelationFactor> cf, int max);
170  ~F12SquaredFundamental() override;
171  double* values(int J, double T) override;
172 };
173 
175  private:
176  std::shared_ptr<FJT> Fm_;
177 
178  public:
179  F12G12Fundamental(std::shared_ptr<CorrelationFactor> cf, int max);
180  ~F12G12Fundamental() override;
181  double* values(int J, double T) override;
182 };
183 
185  public:
186  F12DoubleCommutatorFundamental(std::shared_ptr<CorrelationFactor> cf, int max);
188  double* values(int J, double T) override;
189 };
190 
192  private:
193  double omega_;
194  std::shared_ptr<FJT> boys_;
195 
196  public:
197  ErfFundamental(double omega, int max);
198  ~ErfFundamental() override;
199  double* values(int J, double T) override;
200  void setOmega(double omega) { omega_ = omega; }
201 };
202 
204  private:
205  double omega_;
206  std::shared_ptr<FJT> boys_;
207 
208  public:
209  ErfComplementFundamental(double omega, int max);
210  ~ErfComplementFundamental() override;
211  double* values(int J, double T) override;
212  void setOmega(double omega) { omega_ = omega; }
213 };
214 
215 } // namespace psi
216 
217 #endif // header guard
218 
219 // Local Variables:
220 // mode: c++
221 // c-file-style: "CLJ"
222 // End:
~F12Fundamental() override
Definition: fjt.cc:545
F12SquaredFundamental(std::shared_ptr< CorrelationFactor > cf, int max)
Definition: fjt.cc:615
~GaussianFundamental() override
Definition: fjt.cc:535
std::shared_ptr< FJT > Fm_
Definition: fjt.h:176
double rho_
Definition: fjt.h:136
F12ScaledFundamental(std::shared_ptr< CorrelationFactor > cf, int max)
Definition: fjt.cc:578
virtual ~Fjt()
Definition: fjt.cc:84
Fjt()
Definition: fjt.cc:83
F12Fundamental(std::shared_ptr< CorrelationFactor > cf, int max)
Definition: fjt.cc:543
~F12G12Fundamental() override
Definition: fjt.cc:655
Definition: fjt.h:150
int max_T_
Definition: fjt.h:103
double wval_infinity
Definition: fjt.h:119
void setOmega(double omega)
Definition: fjt.h:212
int max_m_
Definition: fjt.h:101
double omega_
Definition: fjt.h:205
virtual void set_rho(double)
Definition: fjt.h:75
Definition: fjt.h:160
double ** gtable
Definition: fjt.h:115
int ngtable() const
Definition: fjt.h:124
static double relative_zero_
Definition: fjt.h:83
F12G12Fundamental(std::shared_ptr< CorrelationFactor > cf, int max)
Definition: fjt.cc:651
double omega_
Definition: fjt.h:193
~ErfComplementFundamental() override
Definition: fjt.cc:782
#define max(a, b)
Definition: svd.cc:38
double * values(int J, double T) override
Definition: fjt.cc:784
double * values(int J, double T) override=0
int * T
Definition: stringlist.cc:66
GaussianFundamental(std::shared_ptr< CorrelationFactor > cf, int max)
Definition: fjt.cc:525
Definition: fjt.h:174
Evaluates the Boys function F_j(T)
Definition: fjt.h:66
double * values(int J, double T) override
Definition: fjt.cc:620
std::shared_ptr< FJT > boys_
Definition: fjt.h:206
double * int_fjttable
Definition: fjt.h:122
double * T_crit_
Definition: fjt.h:105
double * values(int J, double T) override
Definition: fjt.cc:751
~ErfFundamental() override
Definition: fjt.cc:749
std::shared_ptr< FJT > boys_
Definition: fjt.h:194
double ** grid_
Definition: fjt.h:94
F12DoubleCommutatorFundamental(std::shared_ptr< CorrelationFactor > cf, int max)
Definition: fjt.cc:700
double * denomarray
Definition: fjt.h:118
double * values(int J, double T) override
implementation of Fjt::values()
Definition: fjt.cc:414
void set_rho(double rho) override
Definition: fjt.cc:537
double * values(int J, double T) override
Implements Fjt::values()
Definition: fjt.cc:205
double * value_
Definition: fjt.h:137
ErfFundamental(double omega, int max)
Definition: fjt.cc:743
int itable_infinity
Definition: fjt.h:120
std::shared_ptr< CorrelationFactor > cf_
Definition: fjt.h:135
double * values(int J, double T) override
Definition: fjt.cc:583
~F12DoubleCommutatorFundamental() override
Definition: fjt.cc:703
~Taylor_Fjt() override
Definition: fjt.cc:193
Definition: fjt.h:203
~F12ScaledFundamental() override
Definition: fjt.cc:581
double * F_
Definition: fjt.h:108
int maxj
Definition: fjt.h:117
~F12SquaredFundamental() override
Definition: fjt.cc:618
double * values(int J, double T) override
Definition: fjt.cc:705
Definition: fjt.h:133
static const int max_interp_order
Definition: fjt.h:86
virtual double * values(int J, double T)=0
Definition: fjt.h:167
FJT(int n)
Definition: fjt.cc:342
double cutoff_
Definition: fjt.h:99
double oodelT_
Definition: fjt.h:98
Definition: fjt.h:191
ErfComplementFundamental(double omega, int max)
Definition: fjt.cc:775
int interp_order_
Definition: fjt.h:100
double * values(int J, double T) override
Definition: fjt.cc:547
void setOmega(double omega)
Definition: fjt.h:200
double delT_
Definition: fjt.h:97
Definition: fjt.h:113
double * values(int J, double T) override
Definition: fjt.cc:657
~FJT() override
Definition: fjt.cc:401
Taylor_Fjt(size_t jmax, double accuracy)
Definition: fjt.cc:92