|
MPQC
3.0.0-alpha
|
00001 // 00002 // tbint.h 00003 // 00004 // Copyright (C) 1996 Limit Point Systems, Inc. 00005 // 00006 // Author: Edward Seidl <seidl@janed.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_tbint_h 00029 #define _chemistry_qc_basis_tbint_h 00030 00031 #include <util/ref/ref.h> 00032 #include <util/group/message.h> 00033 #include <util/container/stdarray.h> 00034 #include <chemistry/qc/basis/gaussbas.h> 00035 #include <chemistry/qc/basis/dercent.h> 00036 #include <chemistry/qc/basis/operator.h> 00037 #include <chemistry/qc/basis/obint.h> 00038 00039 namespace sc { 00040 00041 // ////////////////////////////////////////////////////////////////////////// 00042 00043 class Integral; 00044 00048 class TwoBodyInt : public RefCount { 00049 00050 private: 00051 double *log2_to_double_; 00052 00053 protected: 00054 // this is who created me 00055 Integral *integral_; 00056 00057 Ref<GaussianBasisSet> bs1_; 00058 Ref<GaussianBasisSet> bs2_; 00059 Ref<GaussianBasisSet> bs3_; 00060 Ref<GaussianBasisSet> bs4_; 00061 00062 double *buffer_; 00063 00064 int redundant_; 00065 00066 TwoBodyInt(Integral *integral, 00067 const Ref<GaussianBasisSet>&bs1, 00068 const Ref<GaussianBasisSet>&bs2, 00069 const Ref<GaussianBasisSet>&bs3, 00070 const Ref<GaussianBasisSet>&bs4); 00071 public: 00072 virtual ~TwoBodyInt(); 00073 00075 int nbasis() const; 00076 00078 int nbasis1() const; 00080 int nbasis2() const; 00082 int nbasis3() const; 00084 int nbasis4() const; 00085 00087 int nshell() const; 00088 00090 int nshell1() const; 00092 int nshell2() const; 00094 int nshell3() const; 00096 int nshell4() const; 00097 00099 Ref<GaussianBasisSet> basis(); 00100 00102 Ref<GaussianBasisSet> basis1(); 00104 Ref<GaussianBasisSet> basis2(); 00106 Ref<GaussianBasisSet> basis3(); 00108 Ref<GaussianBasisSet> basis4(); 00109 00113 virtual TwoBodyOperSet::type type() const =0; 00115 virtual const Ref<TwoBodyOperSetDescr>& descr() const =0; 00116 00121 virtual const double * buffer(TwoBodyOper::type type = TwoBodyOper::eri) const; 00122 00126 virtual void compute_shell(int,int,int,int) = 0; 00127 00134 std::pair<std::map<TwoBodyOper::type,const double*>,std::array<unsigned long,4> > 00135 compute_shell_arrays(int,int,int,int); 00136 00140 virtual int log2_shell_bound(int= -1,int= -1,int= -1,int= -1) = 0; 00141 00145 double shell_bound(int= -1,int= -1,int= -1,int= -1); 00146 00149 virtual int redundant() const { return redundant_; } 00151 virtual void set_redundant(int i) { redundant_ = i; } 00152 00154 virtual void set_integral_storage(size_t storage); 00155 00158 virtual bool cloneable(); 00159 00162 virtual Ref<TwoBodyInt> clone(); 00163 00165 Integral *integral() const { return integral_; } 00166 00167 }; 00168 00169 // ////////////////////////////////////////////////////////////////////////// 00170 00174 class TwoBodyThreeCenterInt : public RefCount { 00175 00176 private: 00177 double *log2_to_double_; 00178 00179 protected: 00180 // this is who created me 00181 Integral *integral_; 00182 00183 Ref<GaussianBasisSet> bs1_; 00184 Ref<GaussianBasisSet> bs2_; 00185 Ref<GaussianBasisSet> bs3_; 00186 00187 double *buffer_; 00188 00189 int redundant_; 00190 00191 TwoBodyThreeCenterInt(Integral *integral, 00192 const Ref<GaussianBasisSet>&bs1, 00193 const Ref<GaussianBasisSet>&bs2, 00194 const Ref<GaussianBasisSet>&bs3); 00195 public: 00196 virtual ~TwoBodyThreeCenterInt(); 00197 00199 int nbasis() const; 00200 00202 int nbasis1() const; 00204 int nbasis2() const; 00206 int nbasis3() const; 00207 00209 int nshell() const; 00210 00212 int nshell1() const; 00214 int nshell2() const; 00216 int nshell3() const; 00217 00219 Ref<GaussianBasisSet> basis(); 00220 00222 Ref<GaussianBasisSet> basis1(); 00224 Ref<GaussianBasisSet> basis2(); 00226 Ref<GaussianBasisSet> basis3(); 00227 00231 virtual TwoBodyOperSet::type type() const =0; 00233 virtual const Ref<TwoBodyOperSetDescr>& descr() const =0; 00234 00239 virtual const double * buffer(TwoBodyOper::type type = TwoBodyOper::eri) const; 00240 00244 virtual void compute_shell(int,int,int) = 0; 00245 00249 virtual int log2_shell_bound(int= -1,int= -1,int= -1) = 0; 00250 00254 double shell_bound(int= -1,int= -1,int= -1); 00255 00258 int redundant() const { return redundant_; } 00260 void set_redundant(int i) { redundant_ = i; } 00261 00263 virtual void set_integral_storage(size_t storage); 00264 00267 virtual bool cloneable(); 00268 00271 virtual Ref<TwoBodyThreeCenterInt> clone(); 00272 00274 Integral *integral() const { return integral_; } 00275 00276 }; 00277 00278 // ////////////////////////////////////////////////////////////////////////// 00279 00284 class TwoBodyTwoCenterInt : public RefCount { 00285 00286 private: 00287 double *log2_to_double_; 00288 00289 protected: 00290 // this is who created me 00291 Integral *integral_; 00292 00293 Ref<GaussianBasisSet> bs1_; 00294 Ref<GaussianBasisSet> bs2_; 00295 00296 double *buffer_; 00297 00298 int redundant_; 00299 00300 TwoBodyTwoCenterInt(Integral *integral, 00301 const Ref<GaussianBasisSet>&bs1, 00302 const Ref<GaussianBasisSet>&bs2); 00303 public: 00304 virtual ~TwoBodyTwoCenterInt(); 00305 00307 int nbasis() const; 00308 00310 int nbasis1() const; 00312 int nbasis2() const; 00313 00315 int nshell() const; 00316 00318 int nshell1() const; 00320 int nshell2() const; 00321 00323 Ref<GaussianBasisSet> basis(); 00324 00326 Ref<GaussianBasisSet> basis1(); 00328 Ref<GaussianBasisSet> basis2(); 00329 00333 virtual TwoBodyOperSet::type type() const =0; 00335 virtual const Ref<TwoBodyOperSetDescr>& descr() const =0; 00336 00341 virtual const double * buffer(TwoBodyOper::type type = TwoBodyOper::eri) const; 00342 00346 virtual void compute_shell(int,int) = 0; 00347 00351 virtual int log2_shell_bound(int= -1,int= -1) = 0; 00352 00356 double shell_bound(int= -1,int= -1); 00357 00360 int redundant() const { return redundant_; } 00362 void set_redundant(int i) { redundant_ = i; } 00363 00365 virtual void set_integral_storage(size_t storage); 00366 00369 virtual bool cloneable(); 00370 00373 virtual Ref<TwoBodyTwoCenterInt> clone(); 00374 00376 Integral *integral() const { return integral_; } 00377 00378 }; 00379 00380 // ////////////////////////////////////////////////////////////////////////// 00381 00382 class ShellQuartetIter { 00383 protected: 00384 const double * buf; 00385 double scale_; 00386 00387 int redund_; 00388 00389 int e12; 00390 int e34; 00391 int e13e24; 00392 00393 int index; 00394 00395 int istart; 00396 int jstart; 00397 int kstart; 00398 int lstart; 00399 00400 int iend; 00401 int jend; 00402 int kend; 00403 int lend; 00404 00405 int icur; 00406 int jcur; 00407 int kcur; 00408 int lcur; 00409 00410 int i_; 00411 int j_; 00412 int k_; 00413 int l_; 00414 00415 public: 00416 ShellQuartetIter(); 00417 virtual ~ShellQuartetIter(); 00418 00419 virtual void init(const double *, 00420 int, int, int, int, 00421 int, int, int, int, 00422 int, int, int, int, 00423 double, int); 00424 00425 virtual void start(); 00426 virtual void next(); 00427 00428 int ready() const { return icur < iend; } 00429 00430 int i() const { return i_; } 00431 int j() const { return j_; } 00432 int k() const { return k_; } 00433 int l() const { return l_; } 00434 00435 int nint() const { return iend*jend*kend*lend; } 00436 00437 double val() const { return buf[index]*scale_; } 00438 }; 00439 00440 class TwoBodyIntIter { 00441 protected: 00442 Ref<TwoBodyInt> tbi; 00443 ShellQuartetIter sqi; 00444 00445 int iend; 00446 00447 int icur; 00448 int jcur; 00449 int kcur; 00450 int lcur; 00451 00452 public: 00453 TwoBodyIntIter(); 00454 TwoBodyIntIter(const Ref<TwoBodyInt>&); 00455 00456 virtual ~TwoBodyIntIter(); 00457 00458 virtual void start(); 00459 virtual void next(); 00460 00461 int ready() const { return (icur < iend); } 00462 00463 int ishell() const { return icur; } 00464 int jshell() const { return jcur; } 00465 int kshell() const { return kcur; } 00466 int lshell() const { return lcur; } 00467 00468 virtual double scale() const; 00469 00470 ShellQuartetIter& current_quartet(); 00471 }; 00472 00473 // ////////////////////////////////////////////////////////////////////////// 00474 00475 class TwoBodyTwoCenterIntIter : public RefCount { 00476 protected: 00477 Ref<TwoBodyTwoCenterInt> tbi; // help me obi wan 00478 ShellPairIter spi; 00479 00480 int redund; 00481 00482 int istart; 00483 int jstart; 00484 00485 int iend; 00486 int jend; 00487 00488 int icur; 00489 int jcur; 00490 00491 int ij; 00492 00493 public: 00494 TwoBodyTwoCenterIntIter(); 00495 TwoBodyTwoCenterIntIter(const Ref<TwoBodyTwoCenterInt>&); 00496 virtual ~TwoBodyTwoCenterIntIter(); 00497 00498 virtual void start(int ist=0, int jst=0, int ien=0, int jen=0); 00499 virtual void next(); 00500 00501 int ready() const { return (icur < iend); } 00502 00503 int ishell() const { return icur; } 00504 int jshell() const { return jcur; } 00505 00506 int ijshell() const { return ij; } 00507 00508 int redundant() const { return redund; } 00509 void set_redundant(int i) { redund=i; } 00510 00511 virtual double scale() const; 00512 00513 Ref<TwoBodyTwoCenterInt> two_body_int() { return tbi; } 00514 00515 ShellPairIter& current_pair(); 00516 00517 virtual bool cloneable(); 00518 virtual Ref<TwoBodyTwoCenterIntIter> clone(); 00519 }; 00520 00521 // ////////////////////////////////////////////////////////////////////////// 00522 00526 class TwoBodyDerivInt : public RefCount { 00527 00528 private: 00529 double *log2_to_double_; 00530 00531 protected: 00532 // this is who created me 00533 Integral *integral_; 00534 00535 Ref<GaussianBasisSet> bs1_; 00536 Ref<GaussianBasisSet> bs2_; 00537 Ref<GaussianBasisSet> bs3_; 00538 Ref<GaussianBasisSet> bs4_; 00539 00540 double *buffer_; 00541 00542 TwoBodyDerivInt(Integral* integral, 00543 const Ref<GaussianBasisSet>&b1, 00544 const Ref<GaussianBasisSet>&b2, 00545 const Ref<GaussianBasisSet>&b3, 00546 const Ref<GaussianBasisSet>&b4); 00547 public: 00548 virtual ~TwoBodyDerivInt(); 00549 00551 int nbasis() const; 00552 00554 int nbasis1() const; 00556 int nbasis2() const; 00558 int nbasis3() const; 00560 int nbasis4() const; 00561 00563 int nshell() const; 00564 00566 int nshell1() const; 00568 int nshell2() const; 00570 int nshell3() const; 00572 int nshell4() const; 00573 00575 Ref<GaussianBasisSet> basis(); 00576 00578 Ref<GaussianBasisSet> basis1(); 00580 Ref<GaussianBasisSet> basis2(); 00582 Ref<GaussianBasisSet> basis3(); 00584 Ref<GaussianBasisSet> basis4(); 00585 00589 const double * buffer() const; 00590 00593 virtual void compute_shell(int,int,int,int,DerivCenters&) = 0; 00594 00597 virtual int log2_shell_bound(int= -1,int= -1,int= -1,int= -1) = 0; 00598 00601 double shell_bound(int= -1,int= -1,int= -1,int= -1); 00602 00604 Integral *integral() const { return integral_; } 00605 00606 }; 00607 00608 // ////////////////////////////////////////////////////////////////////////// 00609 00613 class TwoBodyThreeCenterDerivInt : public RefCount { 00614 00615 private: 00616 double *log2_to_double_; 00617 00618 protected: 00619 // this is who created me 00620 Integral *integral_; 00621 00622 Ref<GaussianBasisSet> bs1_; 00623 Ref<GaussianBasisSet> bs2_; 00624 Ref<GaussianBasisSet> bs3_; 00625 00626 double *buffer_; 00627 00628 TwoBodyThreeCenterDerivInt(Integral* integral, 00629 const Ref<GaussianBasisSet>&b1, 00630 const Ref<GaussianBasisSet>&b2, 00631 const Ref<GaussianBasisSet>&b3); 00632 public: 00633 virtual ~TwoBodyThreeCenterDerivInt(); 00634 00636 int nbasis() const; 00637 00639 int nbasis1() const; 00641 int nbasis2() const; 00643 int nbasis3() const; 00644 00646 int nshell() const; 00647 00649 int nshell1() const; 00651 int nshell2() const; 00653 int nshell3() const; 00654 00656 Ref<GaussianBasisSet> basis(); 00657 00659 Ref<GaussianBasisSet> basis1(); 00661 Ref<GaussianBasisSet> basis2(); 00663 Ref<GaussianBasisSet> basis3(); 00664 00668 const double * buffer() const; 00669 00672 virtual void compute_shell(int,int,int,DerivCenters&) = 0; 00673 00676 virtual int log2_shell_bound(int= -1,int= -1,int= -1) = 0; 00677 00680 double shell_bound(int= -1,int= -1,int= -1); 00681 00682 }; 00683 00684 // ////////////////////////////////////////////////////////////////////////// 00685 00689 class TwoBodyTwoCenterDerivInt : public RefCount { 00690 00691 private: 00692 double *log2_to_double_; 00693 00694 protected: 00695 // this is who created me 00696 Integral *integral_; 00697 00698 Ref<GaussianBasisSet> bs1_; 00699 Ref<GaussianBasisSet> bs2_; 00700 00701 double *buffer_; 00702 00703 TwoBodyTwoCenterDerivInt(Integral* integral, 00704 const Ref<GaussianBasisSet>&b1, 00705 const Ref<GaussianBasisSet>&b2); 00706 public: 00707 virtual ~TwoBodyTwoCenterDerivInt(); 00708 00710 int nbasis() const; 00711 00713 int nbasis1() const; 00715 int nbasis2() const; 00716 00718 int nshell() const; 00719 00721 int nshell1() const; 00723 int nshell2() const; 00724 00726 Ref<GaussianBasisSet> basis(); 00727 00729 Ref<GaussianBasisSet> basis1(); 00731 Ref<GaussianBasisSet> basis2(); 00732 00736 const double * buffer() const; 00737 00740 virtual void compute_shell(int,int,DerivCenters&) = 0; 00741 00744 virtual int log2_shell_bound(int= -1,int= -1) = 0; 00745 00748 double shell_bound(int= -1,int= -1); 00749 00750 }; 00751 00753 00755 class TwoBodyTwoCenterIntOp: public SCElementOp { 00756 protected: 00757 Ref<TwoBodyTwoCenterIntIter> iter; 00758 00759 public: 00760 TwoBodyTwoCenterIntOp(const Ref<TwoBodyTwoCenterInt>&); 00761 TwoBodyTwoCenterIntOp(const Ref<TwoBodyTwoCenterIntIter>&); 00762 virtual ~TwoBodyTwoCenterIntOp(); 00763 00764 void process(SCMatrixBlockIter&); 00765 void process_spec_rect(SCMatrixRectBlock*); 00766 void process_spec_ltri(SCMatrixLTriBlock*); 00767 void process_spec_rectsub(SCMatrixRectSubBlock*); 00768 void process_spec_ltrisub(SCMatrixLTriSubBlock*); 00769 00770 bool cloneable(); 00771 Ref<SCElementOp> clone(); 00772 00773 int has_side_effects(); 00774 }; 00775 00776 00777 } 00778 00779 #endif 00780 00781 // Local Variables: 00782 // mode: c++ 00783 // c-file-style: "ETS" 00784 // End: