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-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 SAPT0_H
30 #define SAPT0_H
31 
32 #include "sapt.h"
33 
34 namespace psi { namespace sapt {
35 
36 struct SAPTDFInts;
37 struct Iterator;
38 
39 class SAPT0 : public SAPT {
40 private:
41  virtual void print_header();
42  virtual void print_results();
43 
44  void check_memory();
45 
46  void df_integrals();
47  void df_integrals_aio();
48  void w_integrals();
49 
50  void first_order_terms();
51  void oo_df_integrals();
52 
69 
74 
85 
86  Iterator get_iterator(long int, SAPTDFInts*, bool alloc=true);
87  Iterator set_iterator(int, SAPTDFInts*, bool alloc=true);
88 
89  Iterator get_iterator(long int, SAPTDFInts*, SAPTDFInts*, bool alloc=true);
90  Iterator set_iterator(int, SAPTDFInts*, SAPTDFInts*, bool alloc=true);
91 
92  void read_all(SAPTDFInts*);
93  void read_block(Iterator *, SAPTDFInts *);
95 
96  void ind20rA_B();
97  void ind20rB_A();
98  void ind20rA_B_aio();
99  void ind20rB_A_aio();
100 
101  void get_denom();
102 
103  void theta_ar();
104  void theta_bs();
105  void test_theta();
106 
107  void arbs();
108  void v1();
109  void h1();
110  double h2();
111  void h3();
112  double h4();
113  void q1();
114  double q2();
115  void q3();
116  void q5();
117  double q6();
118  void q7();
119  void q10();
120  void q11();
121  void q12();
122  double q13();
123  double q14();
124 
125 protected:
127  bool aio_cphf_;
129  bool do_e10_;
132 
133  int maxiter_;
134  double e_conv_;
135  double d_conv_;
136 
137  double e_elst10_;
138  double e_exch10_;
139  double e_exch10_s2_;
140  double e_ind20_;
142  double e_disp20_;
144 
145  double e_disp20_ss_;
146  double e_disp20_os_;
149 
150  double e_sapt0_;
151  double e_sapt0_scs_;
152 
153  double **wBAR_;
154  double **wABS_;
155 
156 public:
159  std::shared_ptr<PSIO>psio);
160  virtual ~SAPT0();
161 
162  virtual double compute_energy();
163 
164  void elst10();
165  void exch10();
166  void exch10_s2();
167  void ind20();
168  void ind20r();
169  void exch_ind20A_B();
170  void exch_ind20B_A();
171  void disp20();
172  void exch_disp20_n4();
173  void exch_disp20_n5();
174 
175 };
176 
177 struct SAPTDFInts {
178 
179  bool dress_;
181  bool active_;
182 
183  size_t i_length_;
184  size_t j_length_;
185  size_t ij_length_;
186  size_t i_start_;
187  size_t j_start_;
188 
189  double **B_p_;
190  double **B_d_;
191 
192  int filenum_;
193  const char *label_;
194 
196 
197  SAPTDFInts() { next_DF_ = PSIO_ZERO; B_p_ = NULL; B_d_ = NULL; };
199  if (B_p_ != NULL) free_block(B_p_);
200  if (B_d_ != NULL) free_block(B_d_); };
201  void rewind() { next_DF_ = PSIO_ZERO; };
202  void clear() { free_block(B_p_); B_p_ = NULL; next_DF_ = PSIO_ZERO; };
203  void done() {
205  B_p_ = NULL; B_d_ = NULL; };
206 };
207 
208 struct Iterator {
209 
210  size_t num_blocks;
212 
213  size_t curr_block;
214  long int curr_size;
215 
216  ~Iterator() { free(block_size); };
217  void rewind() { curr_block = 1; curr_size = 0; };
218 };
219 
220 }}
221 
222 #endif
void ind20rB_A_aio()
Definition: ind20.cc:742
psio_address next_DF_
Definition: sapt0.h:195
void done()
Definition: sapt0.h:203
double e_disp20_os_
Definition: sapt0.h:146
double e_sapt0_
Definition: sapt0.h:150
SAPTDFInts set_C_SS()
Definition: utils.cc:620
SAPTDFInts set_C_BS()
Definition: utils.cc:600
bool aio_cphf_
Definition: sapt0.h:127
SAPTDFInts set_A_AB()
Definition: utils.cc:448
bool dress_
Definition: sapt0.h:179
Options & options() const
Definition: wavefunction.cc:396
double h4()
Definition: exch-disp20.cc:1261
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:391
size_t num_blocks
Definition: sapt0.h:210
SAPTDFInts set_Q12_RB()
Definition: utils.cc:1034
virtual void print_results()
Definition: sapt0.cc:206
void first_order_terms()
Definition: sapt0.cc:423
SAPT0(SharedWavefunction Dimer, SharedWavefunction MonomerA, SharedWavefunction MonomerB, Options &options, std::shared_ptr< PSIO >psio)
Definition: sapt0.cc:39
void exch10()
Definition: exch10.cc:206
size_t i_length_
Definition: sapt0.h:183
void h1()
Definition: exch-disp20.cc:1107
void q12()
Definition: exch-disp20.cc:1568
SAPTDFInts set_act_C_BS()
Definition: utils.cc:804
SAPTDFInts set_Q12_AS()
Definition: utils.cc:1014
double e_exch10_
Definition: sapt0.h:138
SAPTDFInts set_Q13_BS()
Definition: utils.cc:1054
SAPTDFInts set_B_AS()
Definition: utils.cc:748
SAPTDFInts set_act_B_BS()
Definition: utils.cc:859
int * block_size
Definition: sapt0.h:211
SAPTDFInts set_B_BS()
Definition: utils.cc:413
double e_exch_disp20_os_
Definition: sapt0.h:148
Definition: libpsio/config.h:65
SAPTDFInts set_H2_AS()
Definition: utils.cc:914
SAPTDFInts set_C_AR()
Definition: utils.cc:540
void ind20rA_B()
Definition: ind20.cc:113
void ind20()
Definition: ind20.cc:43
int filenum_
Definition: sapt0.h:192
double q2()
Definition: exch-disp20.cc:1339
size_t j_start_
Definition: sapt0.h:187
bool do_e20disp_
Definition: sapt0.h:131
SAPTDFInts set_C_BB()
Definition: utils.cc:580
void w_integrals()
Definition: sapt0.cc:1548
size_t i_start_
Definition: sapt0.h:186
SAPTDFInts set_B_AB()
Definition: utils.cc:484
void df_integrals_aio()
Definition: sapt0.cc:967
void check_memory()
Definition: sapt0.cc:395
void q7()
Definition: exch-disp20.cc:1487
SAPTDFInts set_B_BB()
Definition: utils.cc:340
void read_block(Iterator *, SAPTDFInts *)
Definition: utils.cc:78
size_t j_length_
Definition: sapt0.h:184
SAPTDFInts set_A_AS()
Definition: utils.cc:712
SAPTDFInts set_act_C_AR()
Definition: utils.cc:784
int maxiter_
Definition: sapt0.h:133
void df_integrals()
Definition: sapt0.cc:454
bool active_
Definition: sapt0.h:181
double e_ind20_
Definition: sapt0.h:140
void exch_ind20A_B()
Definition: exch-ind20.cc:34
Definition: sapt0.h:39
double e_exch_ind20_
Definition: sapt0.h:141
SAPTDFInts()
Definition: sapt0.h:197
SAPTDFInts set_B_RB()
Definition: utils.cc:676
SAPTDFInts set_act_A_AR()
Definition: utils.cc:824
double ** wABS_
Definition: sapt0.h:154
SAPTDFInts set_H4_AR()
Definition: utils.cc:934
double e_disp20_ss_
Definition: sapt0.h:145
SAPTDFInts set_H4_RB()
Definition: utils.cc:954
double d_conv_
Definition: sapt0.h:135
bool no_response_
Definition: sapt0.h:126
bool dress_disk_
Definition: sapt0.h:180
void oo_df_integrals()
Definition: sapt0.cc:1623
void theta_ar()
Definition: exch-disp20.cc:575
const char * label_
Definition: sapt0.h:193
SAPTDFInts set_Q2_AR()
Definition: utils.cc:974
virtual double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: sapt0.cc:94
void arbs()
Definition: exch-disp20.cc:931
double e_sapt0_scs_
Definition: sapt0.h:151
bool do_e10_
Definition: sapt0.h:129
SAPTDFInts set_C_AA()
Definition: utils.cc:520
double ** B_d_
Definition: sapt0.h:190
SAPTDFInts set_Q6_BS()
Definition: utils.cc:994
Definition: sapt.h:57
virtual void print_header()
Definition: sapt0.cc:170
void q11()
Definition: exch-disp20.cc:1542
void theta_bs()
Definition: exch-disp20.cc:724
double e_conv_
Definition: sapt0.h:134
Definition: liboptions.h:360
void rewind()
Definition: sapt0.h:201
void q5()
Definition: exch-disp20.cc:1406
void q1()
Definition: exch-disp20.cc:1294
void exch_disp20_n4()
Definition: exch-disp20.cc:260
void exch10_s2()
Definition: exch10.cc:34
double ** wBAR_
Definition: sapt0.h:153
double q13()
Definition: exch-disp20.cc:1668
SAPTDFInts set_H2_BS()
Definition: utils.cc:894
SAPTDFInts set_A_AA()
Definition: utils.cc:302
void q10()
Definition: exch-disp20.cc:1516
virtual ~SAPT0()
Definition: sapt0.cc:85
double e_disp20_
Definition: sapt0.h:142
SAPTDFInts set_A_AR()
Definition: utils.cc:378
size_t ij_length_
Definition: sapt0.h:185
double e_exch_disp20_ss_
Definition: sapt0.h:147
double h2()
Definition: exch-disp20.cc:1170
SAPTDFInts set_A_RB()
Definition: utils.cc:640
void ind20rA_B_aio()
Definition: ind20.cc:503
void h3()
Definition: exch-disp20.cc:1202
bool aio_dfints_
Definition: sapt0.h:128
void free_block(double **array)
Definition: libciomr/block_matrix.cc:151
void disp20()
Definition: disp20.cc:42
void test_theta()
Definition: exch-disp20.cc:873
~SAPTDFInts()
Definition: sapt0.h:198
Definition: sapt0.h:208
void ind20rB_A()
Definition: ind20.cc:308
psio_address PSIO_ZERO
Definition: libpsio/init.cc:57
SAPTDFInts set_Q14_AR()
Definition: utils.cc:1074
Iterator get_iterator(long int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:198
Definition: sapt0.h:177
long int curr_size
Definition: sapt0.h:214
double e_exch_disp20_
Definition: sapt0.h:143
PsiReturnType sapt(SharedWavefunction, SharedWavefunction, SharedWavefunction, Options &)
Definition: sapt/wrapper.cc:44
void v1()
Definition: exch-disp20.cc:999
void rewind()
Definition: sapt0.h:217
double q6()
Definition: exch-disp20.cc:1450
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:52
void read_all(SAPTDFInts *)
Definition: utils.cc:47
double e_exch10_s2_
Definition: sapt0.h:139
void exch_disp20_n5()
Definition: exch-disp20.cc:34
Iterator set_iterator(int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:211
size_t curr_block
Definition: sapt0.h:213
void clear()
Definition: sapt0.h:202
void exch_ind20B_A()
Definition: exch-ind20.cc:359
double ** B_p_
Definition: sapt0.h:189
~Iterator()
Definition: sapt0.h:216
SAPTDFInts set_C_RR()
Definition: utils.cc:560
void ind20r()
Definition: ind20.cc:87
void q3()
Definition: exch-disp20.cc:1377
void elst10()
Definition: elst10.cc:34
double e_elst10_
Definition: sapt0.h:137
double q14()
Definition: exch-disp20.cc:1704
bool do_e20ind_
Definition: sapt0.h:130