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-2018 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 {
35 namespace sapt {
36 
37 struct SAPTDFInts;
38 struct Iterator;
39 
40 class SAPT0 : public SAPT {
41  private:
42  virtual void print_header();
43  virtual void print_results();
44 
45  void check_memory();
46 
47  void df_integrals();
48  void df_integrals_aio();
49  void w_integrals();
50 
51  void first_order_terms();
52  void oo_df_integrals();
53 
70 
75 
86 
87  Iterator get_iterator(long int, SAPTDFInts *, bool alloc = true);
88  Iterator set_iterator(long int, SAPTDFInts *, bool alloc = true);
89 
90  Iterator get_iterator(long int, SAPTDFInts *, SAPTDFInts *, bool alloc = true);
91  Iterator set_iterator(long int, SAPTDFInts *, SAPTDFInts *, bool alloc = true);
92 
93  void read_all(SAPTDFInts *);
94  void read_block(Iterator *, SAPTDFInts *);
96 
97  void ind20rA_B();
98  void ind20rB_A();
99  void ind20rA_B_aio();
100  void ind20rB_A_aio();
101 
102  void get_denom();
103 
104  void theta_ar();
105  void theta_bs();
106  void test_theta();
107 
108  void arbs();
109  void v1();
110  void h1();
111  double h2();
112  void h3();
113  double h4();
114  void q1();
115  double q2();
116  void q3();
117  void q5();
118  double q6();
119  void q7();
120  void q10();
121  void q11();
122  void q12();
123  double q13();
124  double q14();
125 
126  protected:
128  bool aio_cphf_;
130  bool do_e10_;
133 
134  int maxiter_;
135  double e_conv_;
136  double d_conv_;
137 
138  double e_elst10_;
139  double e_exch10_;
140  double e_exch10_s2_;
141  double e_ind20_;
143  double e_disp20_;
145 
146  double e_disp20_ss_;
147  double e_disp20_os_;
150 
151  double e_sapt0_;
152  double e_sapt0_scs_;
153 
154  double **wBAR_;
155  double **wABS_;
156 
157  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 struct SAPTDFInts {
177  bool dress_;
179  bool active_;
180 
181  size_t i_length_;
182  size_t j_length_;
183  size_t ij_length_;
184  size_t i_start_;
185  size_t j_start_;
186 
187  double **B_p_;
188  double **B_d_;
189 
190  int filenum_;
191  const char *label_;
192 
194 
197  B_p_ = nullptr;
198  B_d_ = nullptr;
199  };
201  if (B_p_ != nullptr) free_block(B_p_);
202  if (B_d_ != nullptr) free_block(B_d_);
203  };
204  void rewind() { next_DF_ = PSIO_ZERO; };
205  void clear() {
206  free_block(B_p_);
207  B_p_ = nullptr;
209  };
210  void done() {
211  free_block(B_p_);
212  if (dress_) free_block(B_d_);
213  B_p_ = nullptr;
214  B_d_ = nullptr;
215  };
216 };
217 
218 struct Iterator {
219  size_t num_blocks;
221 
222  size_t curr_block;
223  long int curr_size;
224 
225  ~Iterator() { free(block_size); };
226  void rewind() {
227  curr_block = 1;
228  curr_size = 0;
229  };
230 };
231 }
232 }
233 
234 #endif
void ind20rB_A_aio()
Definition: ind20.cc:714
psio_address next_DF_
Definition: sapt0.h:193
void done()
Definition: sapt0.h:210
double e_disp20_os_
Definition: sapt0.h:147
double e_sapt0_
Definition: sapt0.h:151
SAPTDFInts set_C_SS()
Definition: utils.cc:566
SAPTDFInts set_C_BS()
Definition: utils.cc:547
bool aio_cphf_
Definition: sapt0.h:128
SAPTDFInts set_A_AB()
Definition: utils.cc:399
bool dress_
Definition: sapt0.h:177
Options & options() const
Definition: wavefunction.cc:565
double h4()
Definition: exch-disp20.cc:1159
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:563
size_t num_blocks
Definition: sapt0.h:219
SAPTDFInts set_Q12_RB()
Definition: utils.cc:968
virtual void print_results()
Definition: sapt0.cc:197
void first_order_terms()
Definition: sapt0.cc:369
void exch10()
Definition: exch10.cc:203
size_t i_length_
Definition: sapt0.h:181
void h1()
Definition: exch-disp20.cc:1015
void q12()
Definition: exch-disp20.cc:1439
SAPTDFInts set_act_C_BS()
Definition: utils.cc:748
SAPTDFInts set_Q12_AS()
Definition: utils.cc:949
double e_exch10_
Definition: sapt0.h:139
SAPTDFInts set_Q13_BS()
Definition: utils.cc:987
SAPTDFInts set_B_AS()
Definition: utils.cc:693
SAPTDFInts set_act_B_BS()
Definition: utils.cc:801
int * block_size
Definition: sapt0.h:220
SAPTDFInts set_B_BS()
Definition: utils.cc:365
double e_exch_disp20_os_
Definition: sapt0.h:149
Definition: libpsio/config.h:65
SAPTDFInts set_H2_AS()
Definition: utils.cc:854
SAPTDFInts set_C_AR()
Definition: utils.cc:490
void ind20rA_B()
Definition: ind20.cc:111
void ind20()
Definition: ind20.cc:44
int filenum_
Definition: sapt0.h:190
double q2()
Definition: exch-disp20.cc:1230
size_t j_start_
Definition: sapt0.h:185
bool do_e20disp_
Definition: sapt0.h:132
SAPTDFInts set_C_BB()
Definition: utils.cc:528
void w_integrals()
Definition: sapt0.cc:1386
size_t i_start_
Definition: sapt0.h:184
SAPTDFInts set_B_AB()
Definition: utils.cc:435
void df_integrals_aio()
Definition: sapt0.cc:865
void check_memory()
Definition: sapt0.cc:344
void q7()
Definition: exch-disp20.cc:1365
SAPTDFInts set_B_BB()
Definition: utils.cc:294
void read_block(Iterator *, SAPTDFInts *)
Definition: utils.cc:74
size_t j_length_
Definition: sapt0.h:182
SAPTDFInts set_A_AS()
Definition: utils.cc:657
SAPTDFInts set_act_C_AR()
Definition: utils.cc:729
int maxiter_
Definition: sapt0.h:134
void df_integrals()
Definition: sapt0.cc:399
bool active_
Definition: sapt0.h:179
double e_ind20_
Definition: sapt0.h:141
void exch_ind20A_B()
Definition: exch-ind20.cc:35
Definition: sapt0.h:40
double e_exch_ind20_
Definition: sapt0.h:142
SAPTDFInts()
Definition: sapt0.h:195
SAPTDFInts set_B_RB()
Definition: utils.cc:621
SAPTDFInts set_act_A_AR()
Definition: utils.cc:767
double ** wABS_
Definition: sapt0.h:155
SAPTDFInts set_H4_AR()
Definition: utils.cc:873
double e_disp20_ss_
Definition: sapt0.h:146
SAPTDFInts set_H4_RB()
Definition: utils.cc:892
double d_conv_
Definition: sapt0.h:136
bool no_response_
Definition: sapt0.h:127
bool dress_disk_
Definition: sapt0.h:178
void oo_df_integrals()
Definition: sapt0.cc:1458
void theta_ar()
Definition: exch-disp20.cc:527
const char * label_
Definition: sapt0.h:191
SAPTDFInts set_Q2_AR()
Definition: utils.cc:911
virtual double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: sapt0.cc:90
void arbs()
Definition: exch-disp20.cc:853
double e_sapt0_scs_
Definition: sapt0.h:152
bool do_e10_
Definition: sapt0.h:130
SAPTDFInts set_C_AA()
Definition: utils.cc:471
double ** B_d_
Definition: sapt0.h:188
SAPTDFInts set_Q6_BS()
Definition: utils.cc:930
Definition: sapt.h:58
virtual void print_header()
Definition: sapt0.cc:164
void q11()
Definition: exch-disp20.cc:1415
void theta_bs()
Definition: exch-disp20.cc:662
double e_conv_
Definition: sapt0.h:135
Definition: liboptions.h:353
void rewind()
Definition: sapt0.h:204
void q5()
Definition: exch-disp20.cc:1291
void q1()
Definition: exch-disp20.cc:1190
void exch_disp20_n4()
Definition: exch-disp20.cc:237
void exch10_s2()
Definition: exch10.cc:35
double ** wBAR_
Definition: sapt0.h:154
double q13()
Definition: exch-disp20.cc:1532
SAPTDFInts set_H2_BS()
Definition: utils.cc:835
SAPTDFInts set_A_AA()
Definition: utils.cc:257
void q10()
Definition: exch-disp20.cc:1391
SAPT0(SharedWavefunction Dimer, SharedWavefunction MonomerA, SharedWavefunction MonomerB, Options &options, std::shared_ptr< PSIO > psio)
Definition: sapt0.cc:39
virtual ~SAPT0()
Definition: sapt0.cc:82
double e_disp20_
Definition: sapt0.h:143
SAPTDFInts set_A_AR()
Definition: utils.cc:331
size_t ij_length_
Definition: sapt0.h:183
double e_exch_disp20_ss_
Definition: sapt0.h:148
double h2()
Definition: exch-disp20.cc:1074
SAPTDFInts set_A_RB()
Definition: utils.cc:585
void ind20rA_B_aio()
Definition: ind20.cc:489
void h3()
Definition: exch-disp20.cc:1105
bool aio_dfints_
Definition: sapt0.h:129
void PSI_API free_block(double **array)
Definition: libciomr/block_matrix.cc:148
void disp20()
Definition: disp20.cc:43
void test_theta()
Definition: exch-disp20.cc:797
~SAPTDFInts()
Definition: sapt0.h:200
Definition: sapt0.h:218
void ind20rB_A()
Definition: ind20.cc:300
PSI_API psio_address PSIO_ZERO
Definition: libpsio/init.cc:55
SAPTDFInts set_Q14_AR()
Definition: utils.cc:1006
Iterator get_iterator(long int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:168
Definition: sapt0.h:176
long int curr_size
Definition: sapt0.h:223
double e_exch_disp20_
Definition: sapt0.h:144
PsiReturnType sapt(SharedWavefunction, SharedWavefunction, SharedWavefunction, Options &)
Definition: sapt/wrapper.cc:48
void v1()
Definition: exch-disp20.cc:916
void rewind()
Definition: sapt0.h:226
double q6()
Definition: exch-disp20.cc:1331
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
void read_all(SAPTDFInts *)
Definition: utils.cc:48
double e_exch10_s2_
Definition: sapt0.h:140
void exch_disp20_n5()
Definition: exch-disp20.cc:35
Iterator set_iterator(long int, SAPTDFInts *, bool alloc=true)
Definition: utils.cc:179
size_t curr_block
Definition: sapt0.h:222
void clear()
Definition: sapt0.h:205
void exch_ind20B_A()
Definition: exch-ind20.cc:343
double ** B_p_
Definition: sapt0.h:187
~Iterator()
Definition: sapt0.h:225
SAPTDFInts set_C_RR()
Definition: utils.cc:509
void ind20r()
Definition: ind20.cc:88
void q3()
Definition: exch-disp20.cc:1265
void elst10()
Definition: elst10.cc:35
double e_elst10_
Definition: sapt0.h:138
double q14()
Definition: exch-disp20.cc:1567
bool do_e20ind_
Definition: sapt0.h:131