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-2019 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)
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 
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, std::shared_ptr<Vector> eps_occ,
60  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();
65  SharedMatrix denominator() const { return denominator_; }
66 };
67 
69  protected:
70  // Fully split denominator (w in rows, i in columns)
72  // Fully split denominator (w in rows, a in columns)
74 
75  void decompose() override;
76 
77  public:
78  LaplaceDenominator(std::shared_ptr<Vector> eps_occ_, std::shared_ptr<Vector> eps_vir, double delta);
79  ~LaplaceDenominator() override;
80  void debug() override;
81  SharedMatrix denominator_occ() const { return denominator_occ_; }
82  SharedMatrix denominator_vir() const { return denominator_vir_; }
83 };
84 
86  protected:
87  void decompose() override;
88 
89  public:
90  CholeskyDenominator(std::shared_ptr<Vector> eps_occ_, std::shared_ptr<Vector> eps_vir, double delta);
91  ~CholeskyDenominator() override;
92  void debug() override;
93 };
94 
96  protected:
97  // Denominator (w in rows, ar in column) (monomer A)
99  // Denominator (w in rows, bs in column) (monomer B)
101 
102  // Pointer to active occupied orbital eigenvalues (monomer A)
103  std::shared_ptr<Vector> eps_occA_;
104  // Pointer to active virtual orbital eigenvalues (monomer A)
105  std::shared_ptr<Vector> eps_virA_;
106  // Pointer to active occupied orbital eigenvalues (monomer B)
107  std::shared_ptr<Vector> eps_occB_;
108  // Pointer to active virtual orbital eigenvalues (monomer B)
109  std::shared_ptr<Vector> eps_virB_;
110  // Number of vectors required to obtain given accuracy
111  int nvector_;
112  // Maximum error norm allowed in denominator
113  double delta_;
114  // Crap all over the output file?
115  bool debug_;
116 
117  virtual void decompose() = 0;
118  void check_denom(std::shared_ptr<Vector>, std::shared_ptr<Vector>, SharedMatrix);
119 
120  public:
121  SAPTDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>, std::shared_ptr<Vector>, std::shared_ptr<Vector>,
122  double, bool);
123  virtual ~SAPTDenominator();
124 
125  // Factory method, algorithm should be LAPLACE or CHOLESKY
126  static std::shared_ptr<SAPTDenominator> buildDenominator(
127  const std::string& algorithm, std::shared_ptr<Vector> eps_occA, std::shared_ptr<Vector> eps_virA,
128  std::shared_ptr<Vector> eps_occB, std::shared_ptr<Vector> eps_virB, double delta, bool debug = false);
129 
130  double delta() const { return delta_; }
131  int nvector() const { return nvector_; }
132  virtual void debug();
133  SharedMatrix denominatorA() const { return denominatorA_; }
134  SharedMatrix denominatorB() const { return denominatorB_; }
135 };
136 
138  protected:
139  // Fully split denominator (w in rows, a in columns) (monomer A)
141  // Fully split denominator (w in rows, r in columns) (monomer A)
143  // Fully split denominator (w in rows, b in columns) (monomer B)
145  // Fully split denominator (w in rows, s in columns) (monomer B)
147 
148  void decompose() override;
149  void check_split(std::shared_ptr<Vector>, std::shared_ptr<Vector>, SharedMatrix, SharedMatrix);
150 
151  public:
152  SAPTLaplaceDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>, std::shared_ptr<Vector>,
153  std::shared_ptr<Vector>, double, bool debug = false);
154  ~SAPTLaplaceDenominator() override;
155 
156  void debug() override;
157  SharedMatrix denominator_occA() const { return denominator_occA_; }
158  SharedMatrix denominator_virA() const { return denominator_virA_; }
159  SharedMatrix denominator_occB() const { return denominator_occB_; }
160  SharedMatrix denominator_virB() const { return denominator_virB_; }
161 };
162 
164  protected:
165  void decompose() override;
166 
167  public:
168  SAPTCholeskyDenominator(std::shared_ptr<Vector>, std::shared_ptr<Vector>, std::shared_ptr<Vector>,
169  std::shared_ptr<Vector>, double, bool debug = false);
170  ~SAPTCholeskyDenominator() override;
171 };
172 
174  // Pointer to active occupied orbital eigenvalues
175  std::shared_ptr<Vector> eps_occ_;
176  // Pointer to active virtual orbital eigenvalues
177  std::shared_ptr<Vector> eps_vir_;
178  // Maximum error norm allowed in denominator
179  double delta_;
180 
181  // Fully split denominator (w in rows i in columns)
183  // Fully split denominator (w in rows i in columns)
185  // Number of vectors required to obtain given accuracy
186  int nvector_;
187 
188  virtual void decompose();
189 
190  public:
191  TLaplaceDenominator(std::shared_ptr<Vector> eps_occ, std::shared_ptr<Vector> eps_vir, double delta);
192  virtual ~TLaplaceDenominator();
193 
194  double delta() const { return delta_; }
195  int nvector() const { return nvector_; }
196  virtual void debug();
197  SharedMatrix denominator_occ() const { return denominator_occ_; }
198  SharedMatrix denominator_vir() const { return denominator_vir_; }
199 };
200 
201 } // Namespace psi
202 #endif
SharedMatrix denominatorA() const
Definition: denominator.h:133
SharedMatrix denominator_virA() const
Definition: denominator.h:158
SharedMatrix denominator_virB() const
Definition: denominator.h:160
Definition: denominator.h:68
SharedMatrix denominator_occB_
Definition: denominator.h:144
Definition: denominator.h:95
SharedMatrix denominatorA_
Definition: denominator.h:98
SharedMatrix denominator_occA_
Definition: denominator.h:140
SharedMatrix denominator_occ_
Definition: denominator.h:71
double delta() const
Definition: denominator.h:194
Definition: denominator.h:137
int nvector_
Definition: denominator.h:186
SharedMatrix denominatorB_
Definition: denominator.h:100
SharedMatrix denominator_occB() const
Definition: denominator.h:159
Definition: denominator.h:173
SharedMatrix denominator() const
Definition: denominator.h:65
Definition: denominator.h:38
SharedMatrix denominator_occ() const
Definition: denominator.h:81
std::shared_ptr< Vector > eps_vir_
Definition: denominator.h:46
Definition: denominator.h:163
int nvector() const
Definition: denominator.h:131
SharedMatrix denominator_occA() const
Definition: denominator.h:157
int nvector_
Definition: denominator.h:48
SharedMatrix denominator_virA_
Definition: denominator.h:142
SharedMatrix denominator_vir() const
Definition: denominator.h:198
SharedMatrix denominator_vir() const
Definition: denominator.h:82
Definition: denominator.h:85
std::shared_ptr< Vector > eps_vir_
Definition: denominator.h:177
SharedMatrix denominatorB() const
Definition: denominator.h:134
std::shared_ptr< Vector > eps_occ_
Definition: denominator.h:44
SharedMatrix denominator_vir_
Definition: denominator.h:73
std::shared_ptr< Vector > eps_occA_
Definition: denominator.h:103
double delta() const
Definition: denominator.h:62
int nvector() const
Definition: denominator.h:63
double delta() const
Definition: denominator.h:130
std::shared_ptr< Vector > eps_virB_
Definition: denominator.h:109
double delta_
Definition: denominator.h:179
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
double delta_
Definition: denominator.h:113
std::shared_ptr< Vector > eps_occ_
Definition: denominator.h:175
int delta(const int i, const int j)
Definition: bend.cc:175
#define PSI_API
Definition: pragma.h:155
SharedMatrix denominator_occ() const
Definition: denominator.h:197
double delta_
Definition: denominator.h:50
int nvector_
Definition: denominator.h:111
int nvector() const
Definition: denominator.h:195
SharedMatrix denominator_
Definition: denominator.h:41
SharedMatrix denominator_occ_
Definition: denominator.h:182
std::shared_ptr< Vector > eps_occB_
Definition: denominator.h:107
std::shared_ptr< Vector > eps_virA_
Definition: denominator.h:105
SharedMatrix denominator_vir_
Definition: denominator.h:184
SharedMatrix denominator_virB_
Definition: denominator.h:146
bool debug_
Definition: denominator.h:115