|
MPQC
3.0.0-alpha
|
00001 // 00002 // df.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 00029 #ifndef _mpqc_src_lib_chemistry_qc_df_df_h 00030 #define _mpqc_src_lib_chemistry_qc_df_df_h 00031 00032 #include <util/state/state.h> 00033 #include <util/misc/compute.h> 00034 #include <util/group/memory.h> 00035 #include <math/scmat/result.h> 00036 #include <chemistry/qc/basis/integral.h> 00037 #include <chemistry/qc/lcao/tbint_runtime.h> 00038 00039 namespace sc { 00040 00041 class OrbitalSpace; 00042 class DistArray4; 00043 00061 class DensityFitting: virtual public SavableState { 00062 public: 00063 enum SolveMethod { 00064 SolveMethod_InverseCholesky = 0, 00065 SolveMethod_Cholesky = 1, 00066 SolveMethod_RefinedCholesky = 2, 00067 SolveMethod_InverseBunchKaufman = 3, 00068 SolveMethod_BunchKaufman = 4, 00069 SolveMethod_RefinedBunchKaufman = 5 00070 }; 00071 00072 typedef TwoBodyMOIntsRuntimeUnion23 MOIntsRuntime; 00073 00074 ~DensityFitting(); 00085 DensityFitting(const Ref<MOIntsRuntime>& rtime, 00086 const std::string& kernel_key, 00087 SolveMethod solver, 00088 const Ref<OrbitalSpace>& space1, 00089 const Ref<OrbitalSpace>& space2, 00090 const Ref<GaussianBasisSet>& fitting_basis); 00091 DensityFitting(StateIn&); 00092 void save_data_state(StateOut&); 00093 00094 const Ref<MOIntsRuntime>& runtime() const { return runtime_; } 00095 const Ref<Integral>& integral() const { 00096 return runtime()->factory()->integral(); 00097 } 00098 const Ref<OrbitalSpace>& space1() const { return space1_; } 00099 const Ref<OrbitalSpace>& space2() const { return space2_; } 00100 const Ref<GaussianBasisSet>& fbasis() const { return fbasis_; } 00101 const std::string& kernel_key() const { return kernel_key_; } 00102 SolveMethod solver() const { return solver_; } 00104 const Ref<DistArray4>& C() const { 00105 return C_; 00106 } 00108 RefSCDimension product_dimension() const; 00109 00110 virtual void compute(); 00111 00112 private: 00113 00114 Ref<MOIntsRuntime> runtime_; 00115 Ref<GaussianBasisSet> fbasis_; 00116 Ref<OrbitalSpace> space1_; 00117 Ref<OrbitalSpace> space2_; 00118 std::string kernel_key_; 00119 SolveMethod solver_; 00120 00121 bool evaluated_; 00122 00123 static ClassDesc class_desc_; 00124 00125 protected: 00126 00127 Ref<DistArray4> C_; 00128 RefSymmSCMatrix kernel_; 00129 Ref<DistArray4> cC_; 00130 00132 const RefSymmSCMatrix& kernel() const { 00133 return kernel_; 00134 } 00140 const Ref<DistArray4>& conjugateC() const { 00141 return cC_; 00142 } 00143 00144 }; 00145 00147 class TransformedDensityFitting: public DensityFitting { 00148 public: 00149 typedef DensityFitting::MOIntsRuntime MOIntsRuntime; 00150 00151 ~TransformedDensityFitting(); 00153 TransformedDensityFitting(const Ref<MOIntsRuntime>& rtime, 00154 const std::string& kernel_key, 00155 SolveMethod solver, 00156 const Ref<OrbitalSpace>& space1, 00157 const Ref<OrbitalSpace>& space2, 00158 const Ref<GaussianBasisSet>& fitting_basis, 00159 const Ref<DistArray4>& mo1_ao2_df); 00160 TransformedDensityFitting(StateIn&); 00161 void save_data_state(StateOut&); 00162 00163 private: 00164 00165 Ref<DistArray4> mo1_ao2_df_; 00166 00167 // overloads DensityFitting::compute() 00168 void compute(); 00169 00170 static ClassDesc class_desc_; 00171 00172 }; 00173 00175 class PermutedDensityFitting: public DensityFitting { 00176 public: 00177 ~PermutedDensityFitting(); 00179 PermutedDensityFitting(const Ref<DensityFitting>& df21); 00181 PermutedDensityFitting(const Ref<MOIntsRuntime>& rtime, 00182 const std::string& kernel_key, 00183 SolveMethod solver, 00184 const Ref<OrbitalSpace>& space1, 00185 const Ref<OrbitalSpace>& space2, 00186 const Ref<GaussianBasisSet>& fitting_basis, 00187 const Ref<DistArray4>& df21); 00188 PermutedDensityFitting(StateIn&); 00189 void save_data_state(StateOut&); 00190 00191 private: 00192 Ref<DistArray4> df21_; 00193 00194 // overloads DensityFitting::compute() 00195 void compute(); 00196 00197 static ClassDesc class_desc_; 00198 00199 }; 00200 00201 namespace test { 00202 00209 class BasisProductDecomposition: virtual public SavableState { 00210 public: 00211 ~BasisProductDecomposition(); 00212 BasisProductDecomposition(const Ref<Integral>& integral, const Ref< 00213 GaussianBasisSet>& basis1, const Ref<GaussianBasisSet>& basis2); 00214 BasisProductDecomposition(StateIn&); 00215 void save_data_state(StateOut&); 00216 00218 virtual const RefSCMatrix& C() const =0; 00219 00220 const Ref<Integral>& integral() const { 00221 return integral_; 00222 } 00223 const Ref<GaussianBasisSet>& basis(unsigned int i) const { 00224 return basis_[i]; 00225 } 00226 00227 virtual void compute() =0; 00228 00229 protected: 00230 const RefSCDimension& product_dimension() const { 00231 return pdim_; 00232 } 00233 00234 private: 00235 RefSCDimension pdim_; //< basis product dimension 00236 00237 Ref<Integral> integral_; 00238 Ref<GaussianBasisSet> basis_[2]; 00239 00240 }; 00241 00252 class DensityFitting: public BasisProductDecomposition { 00253 public: 00254 ~DensityFitting(); 00255 DensityFitting(const Ref<Integral>& integral, const Ref< 00256 GaussianBasisSet>& basis1, const Ref<GaussianBasisSet>& basis2, 00257 const Ref<GaussianBasisSet>& fitting_basis); 00258 DensityFitting(StateIn&); 00259 void save_data_state(StateOut&); 00260 00261 const RefSCMatrix& C() const { 00262 return C_; 00263 } 00265 const RefSymmSCMatrix& kernel() const { 00266 return kernel_; 00267 } 00269 const RefSCMatrix& conjugateC() const { 00270 return cC_; 00271 } 00272 00273 // implements BasisProductDecomposition::compute() 00274 void compute(); 00275 00276 private: 00277 RefSCMatrix C_; 00278 RefSymmSCMatrix kernel_; 00279 RefSCMatrix cC_; 00280 00281 Ref<GaussianBasisSet> fbasis_; 00282 00283 }; 00284 00285 } // end of namespace test 00286 00287 } // end of namespace sc 00288 00289 #endif // end of header guard 00290 00291 // Local Variables: 00292 // mode: c++ 00293 // c-file-style: "CLJ-CONDENSED" 00294 // End: