|
MPQC
3.0.0-alpha
|
00001 // 00002 // pt2r12.h 00003 // 00004 // Copyright (C) 2009 Edward Valeev 00005 // 00006 // Author: Edward Valeev <evaleev@vt.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 #ifndef _mpqc_src_lib_chemistry_qc_mbptr12_pt2r12_h 00029 #define _mpqc_src_lib_chemistry_qc_mbptr12_pt2r12_h 00030 00031 #include <chemistry/qc/wfn/wfn.h> 00032 #include <chemistry/qc/wfn/spin.h> 00033 #include <chemistry/qc/mbptr12/r12wfnworld.h> 00034 #include <chemistry/qc/mbptr12/r12int_eval.h> 00035 #include <chemistry/qc/wfn/rdm.h> 00036 00037 namespace sc { 00038 00040 class SpinOrbitalPT2R12 : public Wavefunction { 00041 public: 00069 SpinOrbitalPT2R12(const Ref<KeyVal> &keyval); 00070 SpinOrbitalPT2R12(StateIn &s); 00071 ~SpinOrbitalPT2R12(); 00072 void save_data_state(StateOut &s); 00073 00074 void compute(); 00075 void print(std::ostream& os =ExEnv::out0()) const; 00076 RefSymmSCMatrix density(); 00077 int spin_polarized(); 00078 int value_implemented() const { return 1; } 00079 void set_desired_value_accuracy(double acc); 00080 00082 const Ref<R12WavefunctionWorld>& r12world() const { return r12world_; } 00083 Ref<R12IntEval>& get_r12eval() {return r12eval_;} 00084 RefSCMatrix transform_MO(); // when using screening, we rotate (occ_act) orbitals; row: new orbs, col: old MO 00085 // new orbs differ from old orbs in that the occ_act part is rotated to natural orbs. 00086 // this is used to get RDM in new orbitals spaces so that later on the orbital space comparison with ggspace() 00087 // can be done (since ggspace etc already use rotated and screened orbitals). 00088 00089 void obsolete(); 00090 int nelectron(); 00091 static double zero_occupancy() { return sc::PopulatedOrbitalSpace::zero_occupancy(); } 00092 00093 private: 00094 enum Tensor4_Permute {Permute23 =1, Permute34 = 2, Permute14 = 3}; 00095 static double ref_to_pt2r12_acc() { return 0.01; } 00096 00097 Ref< RDM<Two> > rdm2_; 00098 Ref< RDM<One> > rdm1_; 00099 Ref<R12IntEval> r12eval_; 00100 Ref<R12WavefunctionWorld> r12world_; 00101 unsigned int nfzc_; 00102 bool omit_uocc_; 00103 bool pt2_correction_; // for testing purposes only, set to false to skip the [2]_R12 computation 00104 bool cabs_singles_; 00105 std::string cabs_singles_h0_; // specify zeroth order H; options: 'fock', 00106 // 'dyall' 00107 bool calc_davidson_; // print out Davidson correction coefficient or not. Defaults to false. 00108 bool cabs_singles_coupling_; // if set to true, we include the coupling between cabs and OBS virtual orbitals. This should be preferred choice, 00109 // as explained in the paper. 00110 bool rotate_core_; // if set to false, when doing rasscf cabs_singles correction, don't include excitation from core orbitals to cabs orbitals in 00111 // first-order Hamiltonian. (this may be used when using frozen core orbitals which 00112 // are not optimized (does not satisfy Brillouin condition)). Currently, we suggest set it to 'true' 00113 int debug_; 00114 std::vector<double> B_; 00115 std::vector<double> X_; 00116 std::vector<double> V_; // store the values for different spins 00117 00119 RefSymmSCMatrix rdm1(SpinCase1 spin); 00121 RefSymmSCMatrix rdm2(SpinCase2 spin); 00123 RefSymmSCMatrix lambda2(SpinCase2 spin); 00125 RefSymmSCMatrix rdm1_gg(SpinCase1 spin); 00127 RefSymmSCMatrix rdm2_gg(SpinCase2 spin); 00129 RefSymmSCMatrix lambda2_gg(SpinCase2 spin); 00130 // the above 2 functions are implemented using this function 00131 RefSymmSCMatrix _rdm2_to_gg(SpinCase2 spin, 00132 RefSymmSCMatrix input); 00133 00135 RefSCMatrix C(SpinCase2 S); 00136 00137 RefSCMatrix V_genref_projector2(SpinCase2 pairspin); 00138 RefSCMatrix V_transformed_by_C(SpinCase2 pairspin); 00139 RefSymmSCMatrix X_transformed_by_C(SpinCase2 pairspin); 00140 RefSymmSCMatrix B_transformed_by_C(SpinCase2 pairspin); 00142 double compute_DC_energy_GenRefansatz2(); 00143 00145 double energy_PT2R12_projector1(SpinCase2 pairspin); 00146 double energy_PT2R12_projector2(SpinCase2 pairspin); 00147 00149 template<Tensor4_Permute HowPermute> 00150 RefSCMatrix RefSCMAT4_permu(RefSCMatrix rdm2_4space_int, 00151 const Ref<OrbitalSpace> b1space, 00152 const Ref<OrbitalSpace> b2space, 00153 const Ref<OrbitalSpace> k1space, 00154 const Ref<OrbitalSpace> k2space); 00155 00156 00157 00159 double cabs_singles_Fock(SpinCase1 spin); 00161 double cabs_singles_Dyall(); 00162 00164 RefSymmSCMatrix hcore_mo(); 00165 RefSymmSCMatrix hcore_mo(SpinCase1 spin); 00167 RefSCMatrix moints(SpinCase2 pairspin = AlphaBeta); 00169 RefSCMatrix g(SpinCase2 pairspin, 00170 const Ref<OrbitalSpace>& space1, 00171 const Ref<OrbitalSpace>& space2); 00173 RefSCMatrix g(SpinCase2 pairspin, 00174 const Ref<OrbitalSpace>& bra1, 00175 const Ref<OrbitalSpace>& bra2, 00176 const Ref<OrbitalSpace>& ket1, 00177 const Ref<OrbitalSpace>& ket2); 00181 RefSCMatrix f(SpinCase1 spin); 00182 00183 /* 00184 * phi truncated in lambda: terms with three-particle lambda's or higher or terms with 00185 * squares (or higher) of two-particle lambda's are neglected. 00186 * this version does not uses the 2-body cumulant (2-lambda). 00187 * 00188 * phi is reported in the same space as given by rdm2() 00189 */ 00190 RefSymmSCMatrix phi_cumulant(SpinCase2 pairspin); 00192 RefSymmSCMatrix phi_gg(SpinCase2 spin); 00193 00195 double energy_recomputed_from_densities(); 00196 00198 void brillouin_matrix(); 00199 00204 double compute_energy(const RefSCMatrix &hmat, 00205 SpinCase2 pairspin, 00206 bool print_pair_energies = true, 00207 std::ostream& os = ExEnv::out0()); 00208 00209 }; 00210 00212 class PT2R12 : public Wavefunction { 00213 public: 00245 PT2R12(const Ref<KeyVal> &keyval); 00246 PT2R12(StateIn &s); 00247 ~PT2R12(); 00248 void save_data_state(StateOut &s); 00249 00250 void compute(); 00251 void print(std::ostream& os =ExEnv::out0()) const; 00252 RefSymmSCMatrix density(); 00253 int spin_polarized(); 00254 int value_implemented() const { return 1; } 00255 void set_desired_value_accuracy(double acc); 00256 00258 const Ref<R12WavefunctionWorld>& r12world() const { return r12world_; } 00259 Ref<R12IntEval>& get_r12eval() {return r12eval_;} 00260 RefSCMatrix transform_MO(); // when using screening, we rotate (occ_act) orbitals; row: new orbs, col: old MO 00261 // new orbs differ from old orbs in that the occ_act part is rotated to natural orbs. 00262 // this is used to get RDM in new orbitals spaces so that later on the orbital space comparison with ggspace() 00263 // can be done (since ggspace etc already use rotated and screened orbitals). 00264 00265 void obsolete(); 00266 int nelectron(); 00267 static double zero_occupancy() { return sc::PopulatedOrbitalSpace::zero_occupancy(); } 00268 00269 private: 00270 enum Tensor4_Permute {Permute23 =1, Permute34 = 2, Permute14 = 3}; 00271 static double ref_to_pt2r12_acc() { return 0.01; } 00272 00273 Ref< SpinFreeRDM<Two> > rdm2_; 00274 Ref< SpinFreeRDM<One> > rdm1_; 00275 Ref<R12IntEval> r12eval_; 00276 Ref<R12WavefunctionWorld> r12world_; 00277 unsigned int nfzc_; 00278 bool omit_uocc_; 00279 bool pt2_correction_; // for testing purposes only, set to false to skip the [2]_R12 computation 00280 bool cabs_singles_; 00281 std::string cabs_singles_h0_; // specify zeroth order H; options: 'CI' 00282 // 'dyall_1', 'dyall_2', 'complete'; '1' and '2' 00283 // in dyall_sf options 00284 // represent whether use 1-body Fock or including 2-b op 00285 // in H(1). 00286 bool calc_davidson_; // print out Davidson correction coefficient or not. Defaults to false. 00287 bool cabs_singles_coupling_; // if set to true, we include the coupling between cabs and OBS virtual orbitals. This should be preferred choice, 00288 // as explained in the paper. 00289 bool rotate_core_; // if set to false, when doing rasscf cabs_singles correction, don't include excitation from core orbitals to cabs orbitals in 00290 // first-order Hamiltonian. (this may be used when using frozen core orbitals which 00291 // are not optimized (does not satisfy Brillouin condition)). Currently, we suggest set it to 'true' 00292 int debug_; 00293 std::vector<double> B_; 00294 std::vector<double> X_; 00295 std::vector<double> V_; // store the values for different spins 00296 00297 00298 00299 00301 RefSymmSCMatrix rdm1(); 00303 RefSymmSCMatrix rdm2(); 00305 RefSymmSCMatrix rdm1_gg(); 00307 RefSymmSCMatrix rdm2_gg(); 00308 // the above 2 functions are implemented using this function 00309 RefSymmSCMatrix _rdm2_to_gg(RefSymmSCMatrix input); 00310 00312 RefSCMatrix C(); 00313 00315 double compute_DC_energy_GenRefansatz2(); 00316 00318 double energy_PT2R12_projector2(); 00319 RefSCMatrix V_genref_projector2(); 00321 RefSCMatrix X_term_Gamma_F_T(); 00322 RefSymmSCMatrix X_transformed_by_C(); 00323 RefSCMatrix B_others(); 00324 00325 // TODO reimplement using native spin-free densities from Psi3 00326 RefSCMatrix rdm1_gg_sf(); // return spin-free 1/2 rdm 00327 RefSymmSCMatrix rdm1_sf(); 00328 RefSymmSCMatrix rdm1_sf_transform(); 00329 RefSCMatrix rdm1_sf_2spaces(const Ref<OrbitalSpace> bspace, const Ref<OrbitalSpace> kspace); 00330 00331 RefSymmSCMatrix rdm2_sf(); 00332 // return 2-RDM in certain spaces; all the spaces should be subsets of 1-RDM/2-RDM orbital space 00333 RefSCMatrix rdm2_sf_4spaces(const Ref<OrbitalSpace> b1space, const Ref<OrbitalSpace> b2space, const Ref<OrbitalSpace> k1space, const Ref<OrbitalSpace> k2space); 00335 RefSCMatrix rdm2_sf_4spaces_int(const double a, const double b, double const c, 00336 const Ref<OrbitalSpace> b1space, 00337 const Ref<OrbitalSpace> b2space, 00338 const Ref<OrbitalSpace> k1space, 00339 const Ref<OrbitalSpace> k2space); 00340 00342 template<Tensor4_Permute HowPermute> 00343 RefSCMatrix RefSCMAT4_permu(RefSCMatrix rdm2_4space_int, 00344 const Ref<OrbitalSpace> b1space, 00345 const Ref<OrbitalSpace> b2space, 00346 const Ref<OrbitalSpace> k1space, 00347 const Ref<OrbitalSpace> k2space); 00348 00349 00350 00352 double cabs_singles_Complete(); 00354 double cabs_singles_Dyall(); 00355 00357 RefSymmSCMatrix hcore_mo(); 00359 RefSCMatrix moints(); 00361 RefSCMatrix g(const Ref<OrbitalSpace>& space1, 00362 const Ref<OrbitalSpace>& space2); 00364 RefSCMatrix g(const Ref<OrbitalSpace>& bra1, 00365 const Ref<OrbitalSpace>& bra2, 00366 const Ref<OrbitalSpace>& ket1, 00367 const Ref<OrbitalSpace>& ket2); 00371 RefSCMatrix f(); 00372 00374 double energy_recomputed_from_densities(); 00375 00377 void brillouin_matrix(); 00378 00382 double compute_energy(const RefSCMatrix &hmat, 00383 bool print_pair_energies = true, 00384 std::ostream& os = ExEnv::out0()); 00385 00386 }; 00387 00388 00389 } // end of namespace sc 00390 00391 #endif // end of header guard 00392 00393 00394 // Local Variables: 00395 // mode: c++ 00396 // c-file-style: "CLJ-CONDENSED" 00397 // End: