MPQC 2.3.1
|
00001 // 00002 // r12int_eval.h 00003 // 00004 // Copyright (C) 2004 Edward Valeev 00005 // 00006 // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu> 00007 // Maintainer: EV 00008 // 00009 // This file is part of the SC Toolkit. 00010 // 00011 // The SC Toolkit is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Library General Public License as published by 00013 // the Free Software Foundation; either version 2, or (at your option) 00014 // any later version. 00015 // 00016 // The SC Toolkit is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Library General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Library General Public License 00022 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to 00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00024 // 00025 // The U.S. Government is granted a limited license as per AL 91-7. 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 // Calculation information (number of basis functions, R12 approximation, etc.) 00051 Ref<R12IntEvalInfo> r12info_; 00052 00053 // Note that intermediate B is symmetric but is stored as a full matrix to simplify the code 00054 // that computes asymmetric form of B 00055 RefSCMatrix Vaa_, Vab_, Xaa_, Xab_, Baa_, Bab_, Aaa_, Aab_, T2aa_, T2ab_; 00056 RefSCMatrix Ac_aa_, Ac_ab_; 00057 RefSCMatrix Raa_, Rab_; // Not sure if I'll compute and keep these explicitly later 00058 Ref<R12Amplitudes> Amps_; // Amplitudes of various R12-contributed terms in pair functions 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 // Map to TwoBodyMOIntsTransform objects that have been computed previously 00074 typedef std::map<std::string, Ref<TwoBodyMOIntsTransform> > TformMap; 00075 TformMap tform_map_; 00076 // Returns pointer to the appropriate transform. 00077 // If the transform is not found then throw runtime_error 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 // Local Variables: 00283 // mode: c++ 00284 // c-file-style: "CLJ" 00285 // End: 00286 00287