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 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 SAPT0_H
29 #define SAPT0_H
30 
31 #include "sapt.h"
32 
33 namespace psi { namespace sapt {
34 
35 struct SAPTDFInts;
36 struct Iterator;
37 
38 class SAPT0 : public SAPT {
39 private:
40  virtual void print_header();
41  virtual void print_results();
42 
43  void check_memory();
44 
45  void df_integrals();
46  void df_integrals_aio();
47  void w_integrals();
48 
49  void first_order_terms();
50  void oo_df_integrals();
51 
68 
73 
84 
85  Iterator get_iterator(long int, SAPTDFInts*, bool alloc=true);
86  Iterator set_iterator(int, SAPTDFInts*, bool alloc=true);
87 
88  Iterator get_iterator(long int, SAPTDFInts*, SAPTDFInts*, bool alloc=true);
89  Iterator set_iterator(int, SAPTDFInts*, SAPTDFInts*, bool alloc=true);
90 
91  void read_all(SAPTDFInts*);
92  void read_block(Iterator *, SAPTDFInts *);
94 
95  void ind20rA_B();
96  void ind20rB_A();
97  void ind20rA_B_aio();
98  void ind20rB_A_aio();
99 
100  void get_denom();
101 
102  void theta_ar();
103  void theta_bs();
104  void test_theta();
105 
106  void arbs();
107  void v1();
108  void h1();
109  double h2();
110  void h3();
111  double h4();
112  void q1();
113  double q2();
114  void q3();
115  void q5();
116  double q6();
117  void q7();
118  void q10();
119  void q11();
120  void q12();
121  double q13();
122  double q14();
123 
124 protected:
126  bool aio_cphf_;
128  bool do_e10_;
131 
132  int maxiter_;
133  double e_conv_;
134  double d_conv_;
135 
136  double e_elst10_;
137  double e_exch10_;
138  double e_exch10_s2_;
139  double e_ind20_;
141  double e_disp20_;
143 
144  double e_disp20_ss_;
145  double e_disp20_os_;
148 
149  double e_sapt0_;
150  double e_sapt0_scs_;
151 
152  double **wBAR_;
153  double **wABS_;
154 
155 public:
158  std::shared_ptr<PSIO>psio);
159  virtual ~SAPT0();
160 
161  virtual double compute_energy();
162 
163  void elst10();
164  void exch10();
165  void exch10_s2();
166  void ind20();
167  void ind20r();
168  void exch_ind20A_B();
169  void exch_ind20B_A();
170  void disp20();
171  void exch_disp20_n4();
172  void exch_disp20_n5();
173 
174 };
175 
176 struct SAPTDFInts {
177 
178  bool dress_;
180  bool active_;
181 
182  size_t i_length_;
183  size_t j_length_;
184  size_t ij_length_;
185  size_t i_start_;
186  size_t j_start_;
187 
188  double **B_p_;
189  double **B_d_;
190 
191  int filenum_;
192  const char *label_;
193 
195 
196  SAPTDFInts() { next_DF_ = PSIO_ZERO; B_p_ = NULL; B_d_ = NULL; };
198  if (B_p_ != NULL) free_block(B_p_);
199  if (B_d_ != NULL) free_block(B_d_); };
200  void rewind() { next_DF_ = PSIO_ZERO; };
201  void clear() { free_block(B_p_); B_p_ = NULL; next_DF_ = PSIO_ZERO; };
202  void done() {
204  B_p_ = NULL; B_d_ = NULL; };
205 };
206 
207 struct Iterator {
208 
209  size_t num_blocks;
211 
212  size_t curr_block;
213  long int curr_size;
214 
215  ~Iterator() { free(block_size); };
216  void rewind() { curr_block = 1; curr_size = 0; };
217 };
218 
219 }}
220 
221 #endif
void ind20rB_A_aio()
Definition: ind20.cc:741
psio_address next_DF_
Definition: sapt0.h:194
void done()
Definition: sapt0.h:202
double e_disp20_os_
Definition: sapt0.h:145
double e_sapt0_
Definition: sapt0.h:149
SAPTDFInts set_C_SS()
Definition: utils.cc:619
SAPTDFInts set_C_BS()
Definition: utils.cc:599
bool aio_cphf_
Definition: sapt0.h:126
SAPTDFInts set_A_AB()
Definition: utils.cc:447
bool dress_
Definition: sapt0.h:178
Options & options() const
Definition: wavefunction.cc:400
double h4()
Definition: exch-disp20.cc:1260
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:395
size_t num_blocks
Definition: sapt0.h:209
SAPTDFInts set_Q12_RB()
Definition: utils.cc:1033
virtual void print_results()
Definition: sapt0.cc:184
void first_order_terms()
Definition: sapt0.cc:401
SAPT0(SharedWavefunction Dimer, SharedWavefunction MonomerA, SharedWavefunction MonomerB, Options &options, std::shared_ptr< PSIO >psio)
Definition: sapt0.cc:38
void exch10()
Definition: exch10.cc:205
size_t i_length_
Definition: sapt0.h:182
void h1()
Definition: exch-disp20.cc:1106
void q12()
Definition: exch-disp20.cc:1567
SAPTDFInts set_act_C_BS()
Definition: utils.cc:803
SAPTDFInts set_Q12_AS()
Definition: utils.cc:1013
double e_exch10_
Definition: sapt0.h:137
SAPTDFInts set_Q13_BS()
Definition: utils.cc:1053
SAPTDFInts set_B_AS()
Definition: utils.cc:747
SAPTDFInts set_act_B_BS()
Definition: utils.cc:858
int * block_size
Definition: sapt0.h:210
SAPTDFInts set_B_BS()
Definition: utils.cc:412
double e_exch_disp20_os_
Definition: sapt0.h:147
Definition: libpsio/config.h:64
SAPTDFInts set_H2_AS()
Definition: utils.cc:913
SAPTDFInts set_C_AR()
Definition: utils.cc:539
void ind20rA_B()
Definition: ind20.cc:112
void ind20()
Definition: ind20.cc:42
int filenum_
Definition: sapt0.h:191
double q2()
Definition: exch-disp20.cc:1338
size_t j_start_
Definition: sapt0.h:186
bool do_e20disp_
Definition: sapt0.h:130
SAPTDFInts set_C_BB()
Definition: utils.cc:579
void w_integrals()
Definition: sapt0.cc:1526
size_t i_start_
Definition: sapt0.h:185
SAPTDFInts set_B_AB()
Definition: utils.cc:483
void df_integrals_aio()
Definition: sapt0.cc:945
void check_memory()
Definition: sapt0.cc:373
void q7()
Definition: exch-disp20.cc:1486
SAPTDFInts set_B_BB()
Definition: utils.cc:339
void read_block(Iterator *, SAPTDFInts *)
Definition: utils.cc:77
size_t j_length_
Definition: sapt0.h:183
SAPTDFInts set_A_AS()
Definition: utils.cc:711
SAPTDFInts set_act_C_AR()
Definition: utils.cc:783
int maxiter_
Definition: sapt0.h:132
void df_integrals()
Definition: sapt0.cc:432
bool active_
Definition: sapt0.h:180
double e_ind20_
Definition: sapt0.h:139
void exch_ind20A_B()
Definition: exch-ind20.cc:33
Definition: sapt0.h:38
double e_exch_ind20_
Definition: sapt0.h:140
SAPTDFInts()
Definition: sapt0.h:196
SAPTDFInts set_B_RB()
Definition: utils.cc:675
SAPTDFInts set_act_A_AR()
Definition: utils.cc:823
double ** wABS_
Definition: sapt0.h:153
SAPTDFInts set_H4_AR()
Definition: utils.cc:933
double e_disp20_ss_
Definition: sapt0.h:144
SAPTDFInts set_H4_RB()
Definition: utils.cc:953
double d_conv_
Definition: sapt0.h:134
bool no_response_
Definition: sapt0.h:125
bool dress_disk_
Definition: sapt0.h:179
void oo_df_integrals()
Definition: sapt0.cc:1601
void theta_ar()
Definition: exch-disp20.cc:574
const char * label_
Definition: sapt0.h:192
SAPTDFInts set_Q2_AR()
Definition: utils.cc:973
virtual double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: sapt0.cc:88
void arbs()
Definition: exch-disp20.cc:930
double e_sapt0_scs_
Definition: sapt0.h:150
bool do_e10_
Definition: sapt0.h:128
SAPTDFInts set_C_AA()
Definition: utils.cc:519
double ** B_d_
Definition: sapt0.h:189
SAPTDFInts set_Q6_BS()
Definition: utils.cc:993
Definition: sapt.h:56
virtual void print_header()
Definition: sapt0.cc:148
void q11()
Definition: exch-disp20.cc:1541
void theta_bs()
Definition: exch-disp20.cc:723
double e_conv_
Definition: sapt0.h:133
Definition: liboptions.h:359
void rewind()
Definition: sapt0.h:200
void q5()
Definition: exch-disp20.cc:1405
void q1()
Definition: exch-disp20.cc:1293
void exch_disp20_n4()
Definition: exch-disp20.cc:259
void exch10_s2()
Definition: exch10.cc:33
double ** wBAR_
Definition: sapt0.h:152
double q13()
Definition: exch-disp20.cc:1667
SAPTDFInts set_H2_BS()
Definition: utils.cc:893
SAPTDFInts set_A_AA()
Definition: utils.cc:301
void q10()
Definition: exch-disp20.cc:1515
virtual ~SAPT0()
Definition: sapt0.cc:79
double e_disp20_
Definition: sapt0.h:141
SAPTDFInts set_A_AR()
Definition: utils.cc:377
size_t ij_length_
Definition: sapt0.h:184
double e_exch_disp20_ss_
Definition: sapt0.h:146
double h2()
Definition: exch-disp20.cc:1169
SAPTDFInts set_A_RB()
Definition: utils.cc:639
void ind20rA_B_aio()
Definition: ind20.cc:502
void h3()
Definition: exch-disp20.cc:1201
bool aio_dfints_
Definition: sapt0.h:127
void disp20()
Definition: disp20.cc:41
void test_theta()
Definition: exch-disp20.cc:872
~SAPTDFInts()
Definition: sapt0.h:197
Definition: sapt0.h:207
void ind20rB_A()
Definition: ind20.cc:307
psio_address PSIO_ZERO
Definition: libpsio/init.cc:56
SAPTDFInts set_Q14_AR()
Definition: utils.cc:1073
Iterator get_iterator(long int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:197
void free_block(double **array)
Definition: libciomr/block_matrix.cc:150
Definition: sapt0.h:176
long int curr_size
Definition: sapt0.h:213
double e_exch_disp20_
Definition: sapt0.h:142
PsiReturnType sapt(SharedWavefunction, SharedWavefunction, SharedWavefunction, Options &)
Definition: sapt/wrapper.cc:43
void v1()
Definition: exch-disp20.cc:998
void rewind()
Definition: sapt0.h:216
double q6()
Definition: exch-disp20.cc:1449
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:50
void read_all(SAPTDFInts *)
Definition: utils.cc:46
double e_exch10_s2_
Definition: sapt0.h:138
void exch_disp20_n5()
Definition: exch-disp20.cc:33
Iterator set_iterator(int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:210
size_t curr_block
Definition: sapt0.h:212
void clear()
Definition: sapt0.h:201
void exch_ind20B_A()
Definition: exch-ind20.cc:358
double ** B_p_
Definition: sapt0.h:188
~Iterator()
Definition: sapt0.h:215
SAPTDFInts set_C_RR()
Definition: utils.cc:559
void ind20r()
Definition: ind20.cc:86
void q3()
Definition: exch-disp20.cc:1376
void elst10()
Definition: elst10.cc:33
double e_elst10_
Definition: sapt0.h:136
double q14()
Definition: exch-disp20.cc:1703
bool do_e20ind_
Definition: sapt0.h:129