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 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 #ifndef three_index_denominator_H
30 #define three_index_denominator_H
31 
32 namespace psi {
33 
34 class Matrix;
35 class Vector;
36 
37 // Denominator Factorizations (MP2-like for now)
38 class Denominator {
39 
40 protected:
41  // Denominator (w in rows, ia in column)
43 
44  // Pointer to active occupied orbital eigenvalues
45  std::shared_ptr<Vector> eps_occ_;
46  // Pointer to active virtual orbital eigenvalues
47  std::shared_ptr<Vector> eps_vir_;
48  // Number of vectors required to obtain given accuracy
49  int nvector_;
50  // Maximum error norm allowed in denominator
51  double delta_;
52 
53  virtual void decompose() = 0;
54 public:
55  Denominator(std::shared_ptr<Vector> eps_occ, std::shared_ptr<Vector> eps_vir, double delta);
56  virtual ~Denominator();
57 
58  // Factory method, algorithm should be LAPLACE or CHOLESKY
59  static std::shared_ptr<Denominator> buildDenominator(const std::string& algorithm,
60  std::shared_ptr<Vector> eps_occ, std::shared_ptr<Vector> eps_vir, double delta);
61 
62  double delta() const { return delta_; }
63  int nvector() const { return nvector_; }
64  virtual void debug();
66 
67 };
68 
70 
71 protected:
72  // Fully split denominator (w in rows, i in columns)
74  // Fully split denominator (w in rows, a in columns)
76 
77  void decompose();
78 public:
79  LaplaceDenominator(std::shared_ptr<Vector> eps_occ_, std::shared_ptr<Vector> eps_vir, double delta);
81  void debug();
84 
85 };
86 
88 
89 protected:
90  void decompose();
91 public:
92  CholeskyDenominator(std::shared_ptr<Vector> eps_occ_, std::shared_ptr<Vector> eps_vir, double delta);
94  void debug();
95 
96 };
97 
99 
100 protected:
101  // Denominator (w in rows, ar in column) (monomer A)
103  // Denominator (w in rows, bs in column) (monomer B)
105 
106  // Pointer to active occupied orbital eigenvalues (monomer A)
107  std::shared_ptr<Vector> eps_occA_;
108  // Pointer to active virtual orbital eigenvalues (monomer A)
109  std::shared_ptr<Vector> eps_virA_;
110  // Pointer to active occupied orbital eigenvalues (monomer B)
111  std::shared_ptr<Vector> eps_occB_;
112  // Pointer to active virtual orbital eigenvalues (monomer B)
113  std::shared_ptr<Vector> eps_virB_;
114  // Number of vectors required to obtain given accuracy
115  int nvector_;
116  // Maximum error norm allowed in denominator
117  double delta_;
118  // Crap all over the output file?
119  bool debug_;
120 
121  virtual void decompose() = 0;
122  void check_denom(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
123  SharedMatrix);
124 public:
125  SAPTDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
126  std::shared_ptr<Vector>, std::shared_ptr<Vector>, double, bool);
127  virtual ~SAPTDenominator();
128 
129  // Factory method, algorithm should be LAPLACE or CHOLESKY
130  static std::shared_ptr<SAPTDenominator> buildDenominator(const std::string& algorithm,
131  std::shared_ptr<Vector> eps_occA, std::shared_ptr<Vector> eps_virA,
132  std::shared_ptr<Vector> eps_occB, std::shared_ptr<Vector> eps_virB,
133  double delta, bool debug = false);
134 
135  double delta() const { return delta_; }
136  int nvector() const { return nvector_; }
137  virtual void debug();
140 
141 };
142 
144 
145 protected:
146  // Fully split denominator (w in rows, a in columns) (monomer A)
148  // Fully split denominator (w in rows, r in columns) (monomer A)
150  // Fully split denominator (w in rows, b in columns) (monomer B)
152  // Fully split denominator (w in rows, s in columns) (monomer B)
154 
155  void decompose();
156  void check_split(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
158 public:
159  SAPTLaplaceDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
160  std::shared_ptr<Vector>, std::shared_ptr<Vector>, double, bool debug = false);
162 
163  void debug();
168 
169 };
170 
172 
173 protected:
174  void decompose();
175 public:
176  SAPTCholeskyDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>,
177  std::shared_ptr<Vector>, std::shared_ptr<Vector>, double, bool debug = false);
179 };
180 
182 
183  // Pointer to active occupied orbital eigenvalues
184  std::shared_ptr<Vector> eps_occ_;
185  // Pointer to active virtual orbital eigenvalues
186  std::shared_ptr<Vector> eps_vir_;
187  // Maximum error norm allowed in denominator
188  double delta_;
189 
190  // Fully split denominator (w in rows i in columns)
192  // Fully split denominator (w in rows i in columns)
194  // Number of vectors required to obtain given accuracy
195  int nvector_;
196 
197  virtual void decompose();
198 public:
199  TLaplaceDenominator(std::shared_ptr<Vector> eps_occ, std::shared_ptr<Vector> eps_vir, double delta);
200  virtual ~TLaplaceDenominator();
201 
202  double delta() const { return delta_; }
203  int nvector() const { return nvector_; }
204  virtual void debug();
207 };
208 
209 } // Namespace psi
210 #endif
SharedMatrix denominatorA() const
Definition: denominator.h:138
void decompose()
Definition: lib3index/denominator.cc:378
SharedMatrix denominator_virA() const
Definition: denominator.h:165
SAPTDenominator(std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, std::shared_ptr< Vector >, double, bool)
Definition: lib3index/denominator.cc:485
virtual ~Denominator()
Definition: lib3index/denominator.cc:79
SharedMatrix denominator_virB() const
Definition: denominator.h:167
Definition: denominator.h:69
SharedMatrix denominator_occB_
Definition: denominator.h:151
void debug()
Definition: lib3index/denominator.cc:779
virtual void debug()
Definition: lib3index/denominator.cc:514
Definition: denominator.h:98
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:83
SharedMatrix denominatorA_
Definition: denominator.h:102
SharedMatrix denominator_occA_
Definition: denominator.h:147
SharedMatrix denominator_occ_
Definition: denominator.h:73
double delta() const
Definition: denominator.h:202
Definition: denominator.h:143
int nvector_
Definition: denominator.h:195
SharedMatrix denominatorB_
Definition: denominator.h:104
SharedMatrix denominator_occB() const
Definition: denominator.h:166
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:497
Definition: denominator.h:181
SharedMatrix denominator() const
Definition: denominator.h:65
Definition: denominator.h:38
SharedMatrix denominator_occ() const
Definition: denominator.h:82
std::shared_ptr< Vector > eps_vir_
Definition: denominator.h:47
Definition: denominator.h:171
int nvector() const
Definition: denominator.h:136
virtual ~TLaplaceDenominator()
Definition: lib3index/denominator.cc:1047
SharedMatrix denominator_occA() const
Definition: denominator.h:164
int nvector_
Definition: denominator.h:49
SharedMatrix denominator_virA_
Definition: denominator.h:149
SharedMatrix denominator_vir() const
Definition: denominator.h:206
SharedMatrix denominator_vir() const
Definition: denominator.h:83
CholeskyDenominator(std::shared_ptr< Vector > eps_occ_, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:368
virtual void debug()
Definition: lib3index/denominator.cc:1218
Definition: denominator.h:87
~SAPTLaplaceDenominator()
Definition: lib3index/denominator.cc:569
std::shared_ptr< Vector > eps_vir_
Definition: denominator.h:186
SharedMatrix denominatorB() const
Definition: denominator.h:139
LaplaceDenominator(std::shared_ptr< Vector > eps_occ_, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:100
std::shared_ptr< Vector > eps_occ_
Definition: denominator.h:45
SharedMatrix denominator_vir_
Definition: denominator.h:75
std::shared_ptr< Vector > eps_occA_
Definition: denominator.h:107
double delta() const
Definition: denominator.h:62
void decompose()
Definition: lib3index/denominator.cc:573
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:829
int nvector() const
Definition: denominator.h:63
Denominator(std::shared_ptr< Vector > eps_occ, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:74
~LaplaceDenominator()
Definition: lib3index/denominator.cc:144
double delta() const
Definition: denominator.h:135
void debug()
Definition: lib3index/denominator.cc:322
std::shared_ptr< Vector > eps_virB_
Definition: denominator.h:113
double delta_
Definition: denominator.h:188
TLaplaceDenominator(std::shared_ptr< Vector > eps_occ, std::shared_ptr< Vector > eps_vir, double delta)
Definition: lib3index/denominator.cc:1041
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
double delta_
Definition: denominator.h:117
std::shared_ptr< Vector > eps_occ_
Definition: denominator.h:184
virtual void decompose()=0
SharedMatrix denominator_occ() const
Definition: denominator.h:205
virtual ~SAPTDenominator()
Definition: lib3index/denominator.cc:493
void decompose()
Definition: lib3index/denominator.cc:148
double delta_
Definition: denominator.h:51
int nvector_
Definition: denominator.h:115
void check_denom(std::shared_ptr< Vector >, std::shared_ptr< Vector >, SharedMatrix)
Definition: lib3index/denominator.cc:522
void debug()
Definition: lib3index/denominator.cc:478
int nvector() const
Definition: denominator.h:203
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:561
SharedMatrix denominator_
Definition: denominator.h:42
SharedMatrix denominator_occ_
Definition: denominator.h:191
~CholeskyDenominator()
Definition: lib3index/denominator.cc:374
void decompose()
Definition: lib3index/denominator.cc:841
std::shared_ptr< Vector > eps_occB_
Definition: denominator.h:111
std::shared_ptr< Vector > eps_virA_
Definition: denominator.h:109
SharedMatrix denominator_vir_
Definition: denominator.h:193
virtual void decompose()
Definition: lib3index/denominator.cc:1051
SharedMatrix denominator_virB_
Definition: denominator.h:153
bool debug_
Definition: denominator.h:119
void check_split(std::shared_ptr< Vector >, std::shared_ptr< Vector >, SharedMatrix, SharedMatrix)
Definition: lib3index/denominator.cc:788
~SAPTCholeskyDenominator()
Definition: lib3index/denominator.cc:837
virtual void debug()
Definition: lib3index/denominator.cc:106