Psi4
sapt0.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 SAPT0_H
30 #define SAPT0_H
31 
32 #include "sapt.h"
34 #include "psi4/libpsio/config.h"
35 #include "psi4/libmints/matrix.h"
36 
37 namespace psi {
38 namespace sapt {
39 
40 struct SAPTDFInts;
41 struct Iterator;
42 
43 class SAPT0 : public SAPT {
44  private:
45  virtual void print_header();
46  virtual void print_results();
47 
48  void check_memory();
49 
50  void df_integrals();
51  void df_integrals_aio();
52  void w_integrals();
53 
54  void first_order_terms();
55  void oo_df_integrals();
56 
73 
78 
89 
90  Iterator get_iterator(long int, SAPTDFInts *, bool alloc = true);
91  Iterator set_iterator(long int, SAPTDFInts *, bool alloc = true);
92 
93  Iterator get_iterator(long int, SAPTDFInts *, SAPTDFInts *, bool alloc = true);
94  Iterator set_iterator(long int, SAPTDFInts *, SAPTDFInts *, bool alloc = true);
95 
96  void read_all(SAPTDFInts *);
97  void read_block(Iterator *, SAPTDFInts *);
99 
100  void ind20rA_B();
101  void ind20rB_A();
102  void ind20rA_B_aio();
103  void ind20rB_A_aio();
104 
105  void get_denom();
106 
107  void theta_ar();
108  void theta_bs();
109  void test_theta();
110 
111  void arbs();
112  void v1();
113  void h1();
114  double h2();
115  void h3();
116  double h4();
117  void q1();
118  double q2();
119  void q3();
120  void q5();
121  double q6();
122  void q7();
123  void q10();
124  void q11();
125  void q12();
126  double q13();
127  double q14();
128 
129  protected:
131  bool aio_cphf_;
133  bool do_e10_;
136 
137  int maxiter_;
138  double e_conv_;
139  double d_conv_;
140 
141  double e_elst10_;
142  double e_exch10_;
143  double e_exch10_s2_;
144  double e_ind20_;
146  double e_disp20_;
148 
149  double e_disp20_ss_;
150  double e_disp20_os_;
153 
154  double e_sapt0_;
155  double e_sapt0_scs_;
156 
157  double **wBAR_;
158  double **wABS_;
159 
160  public:
162  std::shared_ptr<PSIO> psio);
163  ~SAPT0() override;
164 
165  double compute_energy() override;
166 
167  void elst10();
168  void exch10();
169  void exch10_s2();
170  void ind20();
171  void ind20r();
172  void exch_ind20A_B();
173  void exch_ind20B_A();
174  void disp20();
175  void exch_disp20_n4();
176  void exch_disp20_n5();
177 };
178 
179 struct SAPTDFInts {
180  bool dress_;
182  bool active_;
183 
184  size_t i_length_;
185  size_t j_length_;
186  size_t ij_length_;
187  size_t i_start_;
188  size_t j_start_;
189 
192  double **B_p_{nullptr};
193  double **B_d_{nullptr};
194 
195  int filenum_;
196  const char *label_;
197 
199 
202  B_p_ = nullptr;
203  B_d_ = nullptr;
204  };
206  B_p_ = nullptr;
207  B_d_ = nullptr;
208  };
209  void rewind() { next_DF_ = PSIO_ZERO; };
210  void clear() {
211  BpMat_.reset();
212  B_p_ = nullptr;
214  };
215  void done() {
216  BpMat_.reset();
217  if (dress_) BdMat_.reset();
218  B_p_ = nullptr;
219  B_d_ = nullptr;
220  };
221 };
222 
223 struct Iterator {
224  size_t num_blocks;
225  std::vector<int> block_size;
226 
227  size_t curr_block;
228  long int curr_size;
229 
230  void rewind() {
231  curr_block = 1;
232  curr_size = 0;
233  };
234 };
235 } // namespace sapt
236 } // namespace psi
237 
238 #endif
void ind20rB_A_aio()
Definition: ind20.cc:717
double compute_energy() override
Compute energy. Subclasses override this function to compute its energy.
Definition: sapt0.cc:97
psio_address next_DF_
Definition: sapt0.h:198
void done()
Definition: sapt0.h:215
double e_disp20_os_
Definition: sapt0.h:150
double e_sapt0_
Definition: sapt0.h:154
SAPTDFInts set_C_SS()
Definition: utils.cc:582
SAPTDFInts set_C_BS()
Definition: utils.cc:563
bool aio_cphf_
Definition: sapt0.h:131
SAPTDFInts set_A_AB()
Definition: utils.cc:413
bool dress_
Definition: sapt0.h:180
Options & options() const
Definition: wavefunction.cc:645
double h4()
Definition: exch-disp20.cc:1164
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:643
size_t num_blocks
Definition: sapt0.h:224
SAPTDFInts set_Q12_RB()
Definition: utils.cc:990
virtual void print_results()
Definition: sapt0.cc:204
void first_order_terms()
Definition: sapt0.cc:376
void exch10()
Definition: exch10.cc:206
size_t i_length_
Definition: sapt0.h:184
void h1()
Definition: exch-disp20.cc:1020
void q12()
Definition: exch-disp20.cc:1444
SAPTDFInts set_act_C_BS()
Definition: utils.cc:768
SAPTDFInts set_Q12_AS()
Definition: utils.cc:971
double e_exch10_
Definition: sapt0.h:142
SAPTDFInts set_Q13_BS()
Definition: utils.cc:1009
SAPTDFInts set_B_AS()
Definition: utils.cc:712
SAPTDFInts set_act_B_BS()
Definition: utils.cc:822
SAPTDFInts set_B_BS()
Definition: utils.cc:378
double e_exch_disp20_os_
Definition: sapt0.h:152
SharedMatrix BpMat_
Definition: sapt0.h:190
Definition: libpsio/config.h:65
SAPTDFInts set_H2_AS()
Definition: utils.cc:876
SAPTDFInts set_C_AR()
Definition: utils.cc:506
void ind20rA_B()
Definition: ind20.cc:114
void ind20()
Definition: ind20.cc:47
int filenum_
Definition: sapt0.h:195
double q2()
Definition: exch-disp20.cc:1235
size_t j_start_
Definition: sapt0.h:188
bool do_e20disp_
Definition: sapt0.h:135
SAPTDFInts set_C_BB()
Definition: utils.cc:544
void w_integrals()
Definition: sapt0.cc:1381
size_t i_start_
Definition: sapt0.h:187
SAPTDFInts set_B_AB()
Definition: utils.cc:450
void df_integrals_aio()
Definition: sapt0.cc:866
void check_memory()
Definition: sapt0.cc:351
void q7()
Definition: exch-disp20.cc:1370
SAPTDFInts set_B_BB()
Definition: utils.cc:305
void read_block(Iterator *, SAPTDFInts *)
Definition: utils.cc:79
size_t j_length_
Definition: sapt0.h:185
SAPTDFInts set_A_AS()
Definition: utils.cc:675
SAPTDFInts set_act_C_AR()
Definition: utils.cc:749
int maxiter_
Definition: sapt0.h:137
void df_integrals()
Definition: sapt0.cc:406
bool active_
Definition: sapt0.h:182
double e_ind20_
Definition: sapt0.h:144
void exch_ind20A_B()
Definition: exch-ind20.cc:39
Definition: sapt0.h:43
~SAPT0() override
Definition: sapt0.cc:89
double e_exch_ind20_
Definition: sapt0.h:145
SAPTDFInts()
Definition: sapt0.h:200
SAPTDFInts set_B_RB()
Definition: utils.cc:638
SAPTDFInts set_act_A_AR()
Definition: utils.cc:787
double ** wABS_
Definition: sapt0.h:158
SAPTDFInts set_H4_AR()
Definition: utils.cc:895
double e_disp20_ss_
Definition: sapt0.h:149
SAPTDFInts set_H4_RB()
Definition: utils.cc:914
double d_conv_
Definition: sapt0.h:139
bool no_response_
Definition: sapt0.h:130
bool dress_disk_
Definition: sapt0.h:181
void oo_df_integrals()
Definition: sapt0.cc:1453
void theta_ar()
Definition: exch-disp20.cc:532
const char * label_
Definition: sapt0.h:196
SAPTDFInts set_Q2_AR()
Definition: utils.cc:933
void arbs()
Definition: exch-disp20.cc:858
double e_sapt0_scs_
Definition: sapt0.h:155
bool do_e10_
Definition: sapt0.h:133
SAPTDFInts set_C_AA()
Definition: utils.cc:487
double ** B_d_
Definition: sapt0.h:193
SAPTDFInts set_Q6_BS()
Definition: utils.cc:952
Definition: sapt.h:51
virtual void print_header()
Definition: sapt0.cc:171
void q11()
Definition: exch-disp20.cc:1420
void theta_bs()
Definition: exch-disp20.cc:667
double e_conv_
Definition: sapt0.h:138
Definition: liboptions.h:352
void rewind()
Definition: sapt0.h:209
void q5()
Definition: exch-disp20.cc:1296
void q1()
Definition: exch-disp20.cc:1195
void exch_disp20_n4()
Definition: exch-disp20.cc:242
void exch10_s2()
Definition: exch10.cc:38
double ** wBAR_
Definition: sapt0.h:157
double q13()
Definition: exch-disp20.cc:1537
SAPTDFInts set_H2_BS()
Definition: utils.cc:857
SAPTDFInts set_A_AA()
Definition: utils.cc:267
void q10()
Definition: exch-disp20.cc:1396
SAPT0(SharedWavefunction Dimer, SharedWavefunction MonomerA, SharedWavefunction MonomerB, Options &options, std::shared_ptr< PSIO > psio)
Definition: sapt0.cc:46
double e_disp20_
Definition: sapt0.h:146
SAPTDFInts set_A_AR()
Definition: utils.cc:343
size_t ij_length_
Definition: sapt0.h:186
double e_exch_disp20_ss_
Definition: sapt0.h:151
double h2()
Definition: exch-disp20.cc:1079
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
SAPTDFInts set_A_RB()
Definition: utils.cc:601
std::vector< int > block_size
Definition: sapt0.h:225
void ind20rA_B_aio()
Definition: ind20.cc:492
void h3()
Definition: exch-disp20.cc:1110
bool aio_dfints_
Definition: sapt0.h:132
void disp20()
Definition: disp20.cc:47
SharedMatrix BdMat_
Definition: sapt0.h:191
void test_theta()
Definition: exch-disp20.cc:802
~SAPTDFInts()
Definition: sapt0.h:205
Definition: sapt0.h:223
void ind20rB_A()
Definition: ind20.cc:303
PSI_API psio_address PSIO_ZERO
Definition: libpsio/init.cc:55
SAPTDFInts set_Q14_AR()
Definition: utils.cc:1028
Iterator get_iterator(long int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:173
Definition: sapt0.h:179
long int curr_size
Definition: sapt0.h:228
double e_exch_disp20_
Definition: sapt0.h:147
PsiReturnType sapt(SharedWavefunction, SharedWavefunction, SharedWavefunction, Options &)
Definition: sapt/wrapper.cc:50
void v1()
Definition: exch-disp20.cc:921
void rewind()
Definition: sapt0.h:230
double q6()
Definition: exch-disp20.cc:1336
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
void read_all(SAPTDFInts *)
Definition: utils.cc:52
double e_exch10_s2_
Definition: sapt0.h:143
void exch_disp20_n5()
Definition: exch-disp20.cc:40
Iterator set_iterator(long int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:184
size_t curr_block
Definition: sapt0.h:227
void clear()
Definition: sapt0.h:210
void exch_ind20B_A()
Definition: exch-ind20.cc:347
SAPTDFInts set_C_RR()
Definition: utils.cc:525
void ind20r()
Definition: ind20.cc:91
void q3()
Definition: exch-disp20.cc:1270
void elst10()
Definition: elst10.cc:37
double e_elst10_
Definition: sapt0.h:141
double q14()
Definition: exch-disp20.cc:1572
bool do_e20ind_
Definition: sapt0.h:134