Psi4
denominator.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-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef three_index_denominator_H
29 #define three_index_denominator_H
30 
31 namespace psi {
32 
33 class Matrix;
34 class Vector;
35 
36 // Denominator Factorizations (MP2-like for now)
37 class Denominator {
38 
39 protected:
40  // Denominator (w in rows, ia in column)
42 
43  // Pointer to active occupied orbital eigenvalues
44  std::shared_ptr<Vector> eps_occ_;
45  // Pointer to active virtual orbital eigenvalues
46  std::shared_ptr<Vector> eps_vir_;
47  // Number of vectors required to obtain given accuracy
48  int nvector_;
49  // Maximum error norm allowed in denominator
50  double delta_;
51 
52  virtual void decompose() = 0;
53 public:
54  Denominator(std::shared_ptr<Vector> eps_occ, std::shared_ptr<Vector> eps_vir, double delta);
55  virtual ~Denominator();
56 
57  // Factory method, algorithm should be LAPLACE or CHOLESKY
58  static std::shared_ptr<Denominator> buildDenominator(const std::string& algorithm,
59  std::shared_ptr<Vector> eps_occ, std::shared_ptr<Vector> eps_vir, double delta);
60 
61  double delta() const { return delta_; }
62  int nvector() const { return nvector_; }
63  virtual void debug();
65 
66 };
67 
69 
70 protected:
71  // Fully split denominator (w in rows, i in columns)
73  // Fully split denominator (w in rows, a in columns)
75 
76  void decompose();
77 public:
78  LaplaceDenominator(std::shared_ptr<Vector> eps_occ_, std::shared_ptr<Vector> eps_vir, double delta);
80  void debug();
83 
84 };
85 
87 
88 protected:
89  void decompose();
90 public:
91  CholeskyDenominator(std::shared_ptr<Vector> eps_occ_, std::shared_ptr<Vector> eps_vir, double delta);
93  void debug();
94 
95 };
96 
98 
99 protected:
100  // Denominator (w in rows, ar in column) (monomer A)
102  // Denominator (w in rows, bs in column) (monomer B)
104 
105  // Pointer to active occupied orbital eigenvalues (monomer A)
106  std::shared_ptr<Vector> eps_occA_;
107  // Pointer to active virtual orbital eigenvalues (monomer A)
108  std::shared_ptr<Vector> eps_virA_;
109  // Pointer to active occupied orbital eigenvalues (monomer B)
110  std::shared_ptr<Vector> eps_occB_;
111  // Pointer to active virtual orbital eigenvalues (monomer B)
112  std::shared_ptr<Vector> eps_virB_;
113  // Number of vectors required to obtain given accuracy
114  int nvector_;
115  // Maximum error norm allowed in denominator
116  double delta_;
117  // Crap all over the output file?
118  bool debug_;
119 
120  virtual void decompose() = 0;
121  void check_denom(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
122  SharedMatrix);
123 public:
124  SAPTDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
125  std::shared_ptr<Vector>, std::shared_ptr<Vector>, double, bool);
126  virtual ~SAPTDenominator();
127 
128  // Factory method, algorithm should be LAPLACE or CHOLESKY
129  static std::shared_ptr<SAPTDenominator> buildDenominator(const std::string& algorithm,
130  std::shared_ptr<Vector> eps_occA, std::shared_ptr<Vector> eps_virA,
131  std::shared_ptr<Vector> eps_occB, std::shared_ptr<Vector> eps_virB,
132  double delta, bool debug = false);
133 
134  double delta() const { return delta_; }
135  int nvector() const { return nvector_; }
136  virtual void debug();
139 
140 };
141 
143 
144 protected:
145  // Fully split denominator (w in rows, a in columns) (monomer A)
147  // Fully split denominator (w in rows, r in columns) (monomer A)
149  // Fully split denominator (w in rows, b in columns) (monomer B)
151  // Fully split denominator (w in rows, s in columns) (monomer B)
153 
154  void decompose();
155  void check_split(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
157 public:
158  SAPTLaplaceDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
159  std::shared_ptr<Vector>, std::shared_ptr<Vector>, double, bool debug = false);
161 
162  void debug();
167 
168 };
169 
171 
172 protected:
173  void decompose();
174 public:
175  SAPTCholeskyDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
176  std::shared_ptr<Vector>, std::shared_ptr<Vector>, double, bool debug = false);
178 };
179 
181 
182  // Pointer to active occupied orbital eigenvalues
183  std::shared_ptr<Vector> eps_occ_;
184  // Pointer to active virtual orbital eigenvalues
185  std::shared_ptr<Vector> eps_vir_;
186  // Maximum error norm allowed in denominator
187  double delta_;
188 
189  // Fully split denominator (w in rows i in columns)
191  // Fully split denominator (w in rows i in columns)
193  // Number of vectors required to obtain given accuracy
194  int nvector_;
195 
196  virtual void decompose();
197 public:
198  TLaplaceDenominator(std::shared_ptr<Vector> eps_occ, std::shared_ptr<Vector> eps_vir, double delta);
199  virtual ~TLaplaceDenominator();
200 
201  double delta() const { return delta_; }
202  int nvector() const { return nvector_; }
203  virtual void debug();
206 };
207 
208 } // Namespace psi
209 #endif
SharedMatrix denominatorA() const
Definition: denominator.h:137
void decompose()
Definition: lib3index/denominator.cc:377
SharedMatrix denominator_virA() const
Definition: denominator.h:164
SAPTDenominator(std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, double, bool)
Definition: lib3index/denominator.cc:484
virtual ~Denominator()
Definition: lib3index/denominator.cc:78
SharedMatrix denominator_virB() const
Definition: denominator.h:166
Definition: denominator.h:68
SharedMatrix denominator_occB_
Definition: denominator.h:150
void debug()
Definition: lib3index/denominator.cc:778
virtual void debug()
Definition: lib3index/denominator.cc:513
Definition: denominator.h:97
static std::shared_ptr< Denominator > buildDenominator(const std::string &algorithm, std::shared_ptr< Vector > eps_occ, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:82
SharedMatrix denominatorA_
Definition: denominator.h:101
SharedMatrix denominator_occA_
Definition: denominator.h:146
SharedMatrix denominator_occ_
Definition: denominator.h:72
double delta() const
Definition: denominator.h:201
Definition: denominator.h:142
int nvector_
Definition: denominator.h:194
SharedMatrix denominatorB_
Definition: denominator.h:103
SharedMatrix denominator_occB() const
Definition: denominator.h:165
static std::shared_ptr< SAPTDenominator > buildDenominator(const std::string &algorithm, std::shared_ptr< Vector > eps_occA, std::shared_ptr< Vector > eps_virA, std::shared_ptr< Vector > eps_occB, std::shared_ptr< Vector > eps_virB, double delta, bool debug=false)
Definition: lib3index/denominator.cc:496
Definition: denominator.h:180
SharedMatrix denominator() const
Definition: denominator.h:64
Definition: denominator.h:37
SharedMatrix denominator_occ() const
Definition: denominator.h:81
std::shared_ptr< Vector > eps_vir_
Definition: denominator.h:46
Definition: denominator.h:170
int nvector() const
Definition: denominator.h:135
virtual ~TLaplaceDenominator()
Definition: lib3index/denominator.cc:1046
SharedMatrix denominator_occA() const
Definition: denominator.h:163
int nvector_
Definition: denominator.h:48
SharedMatrix denominator_virA_
Definition: denominator.h:148
SharedMatrix denominator_vir() const
Definition: denominator.h:205
SharedMatrix denominator_vir() const
Definition: denominator.h:82
CholeskyDenominator(std::shared_ptr< Vector > eps_occ_, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:367
virtual void debug()
Definition: lib3index/denominator.cc:1217
Definition: denominator.h:86
~SAPTLaplaceDenominator()
Definition: lib3index/denominator.cc:568
std::shared_ptr< Vector > eps_vir_
Definition: denominator.h:185
SharedMatrix denominatorB() const
Definition: denominator.h:138
LaplaceDenominator(std::shared_ptr< Vector > eps_occ_, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:99
std::shared_ptr< Vector > eps_occ_
Definition: denominator.h:44
SharedMatrix denominator_vir_
Definition: denominator.h:74
std::shared_ptr< Vector > eps_occA_
Definition: denominator.h:106
double delta() const
Definition: denominator.h:61
void decompose()
Definition: lib3index/denominator.cc:572
virtual void decompose()=0
SAPTCholeskyDenominator(std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, double, bool debug=false)
Definition: lib3index/denominator.cc:828
int nvector() const
Definition: denominator.h:62
Denominator(std::shared_ptr< Vector > eps_occ, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:73
~LaplaceDenominator()
Definition: lib3index/denominator.cc:143
double delta() const
Definition: denominator.h:134
void debug()
Definition: lib3index/denominator.cc:321
std::shared_ptr< Vector > eps_virB_
Definition: denominator.h:112
double delta_
Definition: denominator.h:187
TLaplaceDenominator(std::shared_ptr< Vector > eps_occ, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:1040
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
double delta_
Definition: denominator.h:116
std::shared_ptr< Vector > eps_occ_
Definition: denominator.h:183
virtual void decompose()=0
SharedMatrix denominator_occ() const
Definition: denominator.h:204
virtual ~SAPTDenominator()
Definition: lib3index/denominator.cc:492
void decompose()
Definition: lib3index/denominator.cc:147
double delta_
Definition: denominator.h:50
int nvector_
Definition: denominator.h:114
void check_denom(std::shared_ptr< Vector >, std::shared_ptr< Vector >, SharedMatrix)
Definition: lib3index/denominator.cc:521
void debug()
Definition: lib3index/denominator.cc:477
int nvector() const
Definition: denominator.h:202
SAPTLaplaceDenominator(std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, double, bool debug=false)
Definition: lib3index/denominator.cc:560
SharedMatrix denominator_
Definition: denominator.h:41
SharedMatrix denominator_occ_
Definition: denominator.h:190
~CholeskyDenominator()
Definition: lib3index/denominator.cc:373
void decompose()
Definition: lib3index/denominator.cc:840
std::shared_ptr< Vector > eps_occB_
Definition: denominator.h:110
std::shared_ptr< Vector > eps_virA_
Definition: denominator.h:108
SharedMatrix denominator_vir_
Definition: denominator.h:192
virtual void decompose()
Definition: lib3index/denominator.cc:1050
SharedMatrix denominator_virB_
Definition: denominator.h:152
bool debug_
Definition: denominator.h:118
void check_split(std::shared_ptr< Vector >, std::shared_ptr< Vector >, SharedMatrix, SharedMatrix)
Definition: lib3index/denominator.cc:787
~SAPTCholeskyDenominator()
Definition: lib3index/denominator.cc:836
virtual void debug()
Definition: lib3index/denominator.cc:105