MPQC
2.3.1
|
00001 // 00002 // obint.h 00003 // 00004 // Copyright (C) 1996 Limit Point Systems, Inc. 00005 // 00006 // Author: Curtis Janssen <cljanss@limitpt.com> 00007 // Maintainer: LPS 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 _chemistry_qc_basis_obint_h 00029 #define _chemistry_qc_basis_obint_h 00030 00031 #ifdef __GNUC__ 00032 #pragma interface 00033 #endif 00034 00035 #include <util/ref/ref.h> 00036 #include <util/state/state.h> 00037 #include <math/scmat/matrix.h> 00038 #include <math/scmat/elemop.h> 00039 00040 #include <chemistry/qc/basis/gaussbas.h> 00041 #include <chemistry/qc/basis/dercent.h> 00042 00043 namespace sc { 00044 00045 class Integral; 00046 00047 // ////////////////////////////////////////////////////////////////////////// 00048 00049 class EfieldDotVectorData: public RefCount 00050 { 00051 public: 00052 EfieldDotVectorData() {}; 00053 ~EfieldDotVectorData(); 00054 00055 double position[3]; 00056 double vector[3]; 00057 00058 void set_position(double*); 00059 void set_vector(double*); 00060 }; 00061 00062 00063 class DipoleData: public RefCount 00064 { 00065 public: 00066 double origin[3]; 00067 00068 DipoleData(double *d) {origin[0]=d[0]; origin[1]=d[1]; origin[2]=d[2];} 00069 DipoleData() {origin[0]=origin[1]=origin[2]=0.0;} 00070 ~DipoleData(); 00071 void set_origin(double*); 00072 }; 00073 00074 00075 class PointChargeData: public RefCount 00076 { 00077 private: 00078 int ncharges_; 00079 const double *charges_; 00080 const double *const*positions_; 00081 double *alloced_charges_; 00082 double **alloced_positions_; 00083 00084 public: 00085 // If copy_data is 0, the passed positions and charges will 00086 // be stored (but not freed). 00087 PointChargeData(int ncharge, 00088 const double *const*positions, const double *charges, 00089 int copy_data = 0); 00090 ~PointChargeData(); 00091 00092 int ncharges() const { return ncharges_; } 00093 const double *charges() const { return charges_; } 00094 const double *const*positions() const { return positions_; } 00095 }; 00096 00097 00100 class OneBodyInt : public RefCount { 00101 protected: 00102 // this is who created me 00103 Integral *integral_; 00104 00105 Ref<GaussianBasisSet> bs1_; 00106 Ref<GaussianBasisSet> bs2_; 00107 00108 double *buffer_; 00109 00110 OneBodyInt(Integral *integral, 00111 const Ref<GaussianBasisSet>&b1, 00112 const Ref<GaussianBasisSet>&b2 = 0); 00113 00114 public: 00115 virtual ~OneBodyInt(); 00116 00118 int nbasis() const; 00119 00121 int nbasis1() const; 00123 int nbasis2() const; 00124 00126 int nshell() const; 00127 00129 int nshell1() const; 00131 int nshell2() const; 00132 00134 Ref<GaussianBasisSet> basis(); 00135 00137 Ref<GaussianBasisSet> basis1(); 00139 Ref<GaussianBasisSet> basis2(); 00140 00142 const double * buffer() const; 00143 00146 virtual void compute_shell(int,int) = 0; 00147 00150 virtual void reinitialize(); 00151 00154 virtual bool cloneable(); 00155 00158 virtual Ref<OneBodyInt> clone(); 00159 00160 Integral *integral() const { return integral_; } 00161 }; 00162 00163 // ////////////////////////////////////////////////////////////////////////// 00164 00167 class OneBodyOneCenterInt : public RefCount { 00168 protected: 00169 // this is who created me 00170 Integral *integral_; 00171 00172 Ref<GaussianBasisSet> bs1_; 00173 00174 double *buffer_; 00175 00176 OneBodyOneCenterInt(Integral *integral, 00177 const Ref<GaussianBasisSet>&b1); 00178 00179 public: 00180 virtual ~OneBodyOneCenterInt(); 00181 00183 int nbasis() const; 00184 00186 int nbasis1() const; 00187 00189 int nshell() const; 00190 00192 int nshell1() const; 00193 00195 Ref<GaussianBasisSet> basis(); 00196 00198 Ref<GaussianBasisSet> basis1(); 00199 00201 const double * buffer() const; 00202 00205 virtual void compute_shell(int) = 0; 00206 00209 virtual void reinitialize(); 00210 00213 virtual bool cloneable(); 00214 00217 virtual Ref<OneBodyOneCenterInt> clone(); 00218 00219 Integral *integral() const { return integral_; } 00220 }; 00221 00222 // ////////////////////////////////////////////////////////////////////////// 00223 00224 class OneBodyOneCenterWrapper : public OneBodyOneCenterInt { 00225 Ref<OneBodyInt> ob_; 00226 int jsh_; 00227 public: 00228 OneBodyOneCenterWrapper(const Ref<OneBodyInt>& ob, 00229 int sh2 = 0); 00230 void compute_shell(int); 00231 }; 00232 00233 // ////////////////////////////////////////////////////////////////////////// 00234 00235 class ShellPairIter { 00236 private: 00237 const double * buf; 00238 double scale_; 00239 00240 int e12; 00241 00242 int index; 00243 00244 int ioffset; 00245 int joffset; 00246 00247 int iend; 00248 int jend; 00249 00250 int icur; 00251 int jcur; 00252 00253 public: 00254 ShellPairIter(); 00255 ~ShellPairIter(); 00256 00257 void init(const double * buffer, int ishell, int jshell, 00258 int ioff, int joff, int nfunci, int nfuncj, int redund=0, 00259 double scale=1.0); 00260 00261 void start() { icur=jcur=index=0; } 00262 int ready() const { return (icur < iend); } 00263 00264 void next() { 00265 if (jcur < ((e12)?(icur):((jend)-1))) { 00266 index++; 00267 jcur++; 00268 return; 00269 } 00270 00271 jcur=0; 00272 icur++; 00273 00274 index = icur*jend; 00275 } 00276 00277 int current_i() const { return icur; } 00278 int current_j() const { return jcur; } 00279 00280 int i() const { return icur+ioffset; } 00281 int j() const { return jcur+joffset; } 00282 00283 int nint() const { return iend*jend; } 00284 00285 double val() const { return buf[index]*scale_; } 00286 }; 00287 00288 // ////////////////////////////////////////////////////////////////////////// 00289 00290 class OneBodyIntIter : public RefCount { 00291 protected: 00292 Ref<OneBodyInt> obi; // help me obi wan 00293 ShellPairIter spi; 00294 00295 int redund; 00296 00297 int istart; 00298 int jstart; 00299 00300 int iend; 00301 int jend; 00302 00303 int icur; 00304 int jcur; 00305 00306 int ij; 00307 00308 public: 00309 OneBodyIntIter(); 00310 OneBodyIntIter(const Ref<OneBodyInt>&); 00311 virtual ~OneBodyIntIter(); 00312 00313 virtual void start(int ist=0, int jst=0, int ien=0, int jen=0); 00314 virtual void next(); 00315 00316 int ready() const { return (icur < iend); } 00317 00318 int ishell() const { return icur; } 00319 int jshell() const { return jcur; } 00320 00321 int ijshell() const { return ij; } 00322 00323 int redundant() const { return redund; } 00324 void set_redundant(int i) { redund=i; } 00325 00326 virtual double scale() const; 00327 00328 Ref<OneBodyInt> one_body_int() { return obi; } 00329 00330 ShellPairIter& current_pair(); 00331 00332 virtual bool cloneable(); 00333 virtual Ref<OneBodyIntIter> clone(); 00334 }; 00335 00336 00337 00338 // ////////////////////////////////////////////////////////////////////////// 00339 00340 class OneBodyIntOp: public SCElementOp { 00341 protected: 00342 Ref<OneBodyIntIter> iter; 00343 00344 public: 00345 OneBodyIntOp(const Ref<OneBodyInt>&); 00346 OneBodyIntOp(const Ref<OneBodyIntIter>&); 00347 virtual ~OneBodyIntOp(); 00348 00349 void process(SCMatrixBlockIter&); 00350 void process_spec_rect(SCMatrixRectBlock*); 00351 void process_spec_ltri(SCMatrixLTriBlock*); 00352 void process_spec_rectsub(SCMatrixRectSubBlock*); 00353 void process_spec_ltrisub(SCMatrixLTriSubBlock*); 00354 00355 bool cloneable(); 00356 Ref<SCElementOp> clone(); 00357 00358 int has_side_effects(); 00359 }; 00360 00361 class OneBody3IntOp: public SCElementOp3 { 00362 private: 00363 Ref<OneBodyIntIter> iter; 00364 00365 public: 00366 OneBody3IntOp(const Ref<OneBodyInt>&b); 00367 OneBody3IntOp(const Ref<OneBodyIntIter>&); 00368 virtual ~OneBody3IntOp(); 00369 00370 void process(SCMatrixBlockIter&, 00371 SCMatrixBlockIter&, 00372 SCMatrixBlockIter&); 00373 void process_spec_rect(SCMatrixRectBlock*, 00374 SCMatrixRectBlock*, 00375 SCMatrixRectBlock*); 00376 void process_spec_ltri(SCMatrixLTriBlock*, 00377 SCMatrixLTriBlock*, 00378 SCMatrixLTriBlock*); 00379 00380 int has_side_effects(); 00381 int has_side_effects_in_arg1(); 00382 int has_side_effects_in_arg2(); 00383 00384 }; 00385 00386 // ////////////////////////////////////////////////////////////////////////// 00387 00390 class OneBodyDerivInt : public RefCount { 00391 protected: 00392 // this is who created me 00393 Integral *integral_; 00394 00395 Ref<GaussianBasisSet> bs1; 00396 Ref<GaussianBasisSet> bs2; 00397 00398 double *buffer_; 00399 00400 public: 00401 OneBodyDerivInt(Integral *, const Ref<GaussianBasisSet>&b); 00402 OneBodyDerivInt(Integral *, 00403 const Ref<GaussianBasisSet>&b1, 00404 const Ref<GaussianBasisSet>&b2); 00405 virtual ~OneBodyDerivInt(); 00406 00408 int nbasis() const; 00410 int nbasis1() const; 00412 int nbasis2() const; 00413 00415 int nshell() const; 00417 int nshell1() const; 00419 int nshell2() const; 00420 00422 Ref<GaussianBasisSet> basis(); 00424 Ref<GaussianBasisSet> basis1(); 00426 Ref<GaussianBasisSet> basis2(); 00427 00430 const double * buffer() const; 00431 00434 virtual void compute_shell(int ish, int jsh, DerivCenters&) = 0; 00437 virtual void compute_shell(int ish, int jsh, int center) = 0; 00438 }; 00439 00440 // ////////////////////////////////////////////////////////////////////////// 00441 00444 class OneBodyOneCenterDerivInt : public RefCount { 00445 protected: 00446 // this is who created me 00447 Integral *integral_; 00448 00449 Ref<GaussianBasisSet> bs1; 00450 00451 double *buffer_; 00452 00453 public: 00454 OneBodyOneCenterDerivInt(Integral *, const Ref<GaussianBasisSet>&b); 00455 virtual ~OneBodyOneCenterDerivInt(); 00456 00458 int nbasis() const; 00460 int nbasis1() const; 00461 00463 int nshell() const; 00465 int nshell1() const; 00466 00468 Ref<GaussianBasisSet> basis(); 00470 Ref<GaussianBasisSet> basis1(); 00471 00474 const double * buffer() const; 00475 00478 virtual void compute_shell(int ish, DerivCenters&) = 0; 00481 virtual void compute_shell(int ish, int center) = 0; 00482 }; 00483 00484 } 00485 00486 #endif 00487 00488 // Local Variables: 00489 // mode: c++ 00490 // c-file-style: "ETS" 00491 // End: