00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef __GNUG__
00029 #pragma interface
00030 #endif
00031
00032 #ifndef _chemistry_qc_mbptr12_r12inteval_h
00033 #define _chemistry_qc_mbptr12_r12inteval_h
00034
00035 #include <util/ref/ref.h>
00036 #include <chemistry/qc/mbptr12/vxb_eval_info.h>
00037 #include <chemistry/qc/mbptr12/linearr12.h>
00038 #include <chemistry/qc/mbptr12/r12_amps.h>
00039
00040 namespace sc {
00041
00046 class R12IntEval : virtual public SavableState {
00047
00048 bool evaluated_;
00049
00050
00051 Ref<R12IntEvalInfo> r12info_;
00052
00053
00054
00055 RefSCMatrix Vaa_, Vab_, Xaa_, Xab_, Baa_, Bab_, Aaa_, Aab_, T2aa_, T2ab_;
00056 RefSCMatrix Ac_aa_, Ac_ab_;
00057 RefSCMatrix Raa_, Rab_;
00058 Ref<R12Amplitudes> Amps_;
00059 RefSCVector emp2pair_aa_, emp2pair_ab_;
00060 RefSCDimension dim_ij_aa_, dim_ij_ab_, dim_ij_s_, dim_ij_t_;
00061 RefSCDimension dim_ab_aa_, dim_ab_ab_;
00062
00063 bool gbc_;
00064 bool ebc_;
00065 LinearR12::ABSMethod abs_method_;
00066 LinearR12::StandardApproximation stdapprox_;
00067 bool spinadapted_;
00068 bool include_mp1_;
00070 bool follow_ks_ebcfree_;
00071 int debug_;
00072
00073
00074 typedef std::map<std::string, Ref<TwoBodyMOIntsTransform> > TformMap;
00075 TformMap tform_map_;
00076
00077
00078 Ref<TwoBodyMOIntsTransform> get_tform_(const std::string&);
00079
00081 Ref<MOIndexSpace> focc_space_;
00083 void form_focc_space_();
00085 Ref<MOIndexSpace> factocc_space_;
00087 void form_factocc_space_();
00089 Ref<MOIndexSpace> canonvir_space_;
00091 void form_canonvir_space_();
00092
00094 void init_tforms_();
00096 void init_intermeds_();
00098 void r2_contrib_to_X_orig_();
00100 void r2_contrib_to_X_new_();
00102 RefSCMatrix compute_r2_(const Ref<MOIndexSpace>& space1, const Ref<MOIndexSpace>& space2);
00105 RefSCMatrix fock_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
00106 const Ref<MOIndexSpace>& ket_space, double scale_J = 1.0, double scale_K = 1.0);
00108 RefSCMatrix coulomb_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
00109 const Ref<MOIndexSpace>& ket_space);
00111 RefSCMatrix exchange_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
00112 const Ref<MOIndexSpace>& ket_space);
00113
00115 void checkpoint_() const;
00116
00121 const int tasks_with_ints_(const Ref<R12IntsAcc> ints_acc, vector<int>& map_to_twi);
00122
00128 void contrib_to_VXB_a_symm_(const std::string& tform_name);
00129
00135 void contrib_to_VXB_a_asymm_(const std::string& tform_name);
00136
00138 void obs_contrib_to_VXB_gebc_vbseqobs_();
00139
00141 void abs1_contrib_to_VXB_gebc_();
00142
00144 void contrib_to_VXB_gebc_vbsneqobs_();
00145
00147 void compute_A_simple_();
00148
00150 void compute_A_via_commutator_();
00151
00153 void compute_T2_();
00154
00156 void compute_R_();
00157
00159 void AT2_contrib_to_V_();
00160
00162 void AR_contrib_to_B_();
00163
00166 void compute_B_gbc_1_();
00167
00170 void compute_B_gbc_2_();
00171
00173 void compute_dualEmp2_();
00174
00176 void compute_dualEmp1_();
00177
00179 void compute_T2_vbsneqobs_();
00180
00183 void compute_R_vbsneqobs_(const Ref<TwoBodyMOIntsTransform>& ipjq_tform,
00184 RefSCMatrix& Raa, RefSCMatrix& Rab);
00185
00187 void compute_amps_();
00188
00194 void globally_sum_scmatrix_(RefSCMatrix& A, bool to_all_tasks = false, bool to_average = false);
00195
00201 void globally_sum_scvector_(RefSCVector& A, bool to_all_tasks = false, bool to_average = false);
00202
00207 void globally_sum_intermeds_(bool to_all_tasks = false);
00208
00209 public:
00210 R12IntEval(StateIn&);
00213 R12IntEval(const Ref<R12IntEvalInfo>& info, bool gbc = true, bool ebc = true,
00214 LinearR12::ABSMethod abs_method = LinearR12::ABS_CABSPlus,
00215 LinearR12::StandardApproximation stdapprox = LinearR12::StdApprox_Ap,
00216 bool follow_ks_ebcfree = false);
00217 ~R12IntEval();
00218
00219 void save_data_state(StateOut&);
00220 virtual void obsolete();
00221
00222 void include_mp1(bool include_mp1);
00223 void set_debug(int debug);
00224 void set_dynamic(bool dynamic);
00225 void set_print_percent(double print_percent);
00226 void set_memory(size_t nbytes);
00227
00228 const bool gbc() const { return gbc_; }
00229 const bool ebc() const { return ebc_; }
00230 const LinearR12::StandardApproximation stdapprox() const { return stdapprox_; }
00231 bool follow_ks_ebcfree() const { return follow_ks_ebcfree_; }
00232
00233 Ref<R12IntEvalInfo> r12info() const;
00234 RefSCDimension dim_oo_aa() const;
00235 RefSCDimension dim_oo_ab() const;
00236 RefSCDimension dim_oo_s() const;
00237 RefSCDimension dim_oo_t() const;
00238 RefSCDimension dim_vv_aa() const;
00239 RefSCDimension dim_vv_ab() const;
00240
00242 virtual void compute();
00243
00245 RefSCMatrix V_aa();
00247 RefSCMatrix X_aa();
00249 RefSymmSCMatrix B_aa();
00251 RefSCMatrix A_aa();
00253 RefSCMatrix Ac_aa();
00255 RefSCMatrix T2_aa();
00257 RefSCMatrix V_ab();
00259 RefSCMatrix X_ab();
00261 RefSymmSCMatrix B_ab();
00263 RefSCMatrix A_ab();
00265 RefSCMatrix Ac_ab();
00267 RefSCMatrix T2_ab();
00269 RefSCVector emp2_aa();
00271 RefSCVector emp2_ab();
00273 Ref<R12Amplitudes> amps();
00274
00275 RefDiagSCMatrix evals() const;
00276 };
00277
00278 }
00279
00280 #endif
00281
00282
00283
00284
00285
00286
00287