Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

tbint.h

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 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034 
00035 #include <util/ref/ref.h>
00036 #include <util/group/message.h>
00037 #include <chemistry/qc/basis/gaussbas.h>
00038 #include <chemistry/qc/basis/dercent.h>
00039 
00040 namespace sc {
00041 
00042 // //////////////////////////////////////////////////////////////////////////
00043 
00044 class Integral;
00045 
00049 class TwoBodyInt : public RefCount {
00050   protected:
00051     // this is who created me
00052     Integral *integral_;
00053 
00054     Ref<GaussianBasisSet> bs1_;
00055     Ref<GaussianBasisSet> bs2_;
00056     Ref<GaussianBasisSet> bs3_;
00057     Ref<GaussianBasisSet> bs4_;
00058 
00059     double *buffer_;
00060 
00061     int redundant_;
00062     
00063     TwoBodyInt(Integral *integral,
00064                const Ref<GaussianBasisSet>&bs1,
00065                const Ref<GaussianBasisSet>&bs2,
00066                const Ref<GaussianBasisSet>&bs3,
00067                const Ref<GaussianBasisSet>&bs4);
00068   public:
00069     virtual ~TwoBodyInt();
00070   
00072     int nbasis() const;
00073     
00075 
00076     int nbasis1() const;
00077     int nbasis2() const;
00078     int nbasis3() const;
00079     int nbasis4() const;
00081 
00083     int nshell() const;
00084     
00086 
00087     int nshell1() const;
00088     int nshell2() const;
00089     int nshell3() const;
00090     int nshell4() const;
00092 
00094     Ref<GaussianBasisSet> basis();
00095 
00097 
00098     Ref<GaussianBasisSet> basis1();
00099     Ref<GaussianBasisSet> basis2();
00100     Ref<GaussianBasisSet> basis3();
00101     Ref<GaussianBasisSet> basis4();
00103 
00108     enum tbint_type { eri=0, r12=1, r12t1=2, r12t2=3};
00109 
00114     virtual const double * buffer(tbint_type type = eri) const;
00115     
00118     virtual void compute_shell(int,int,int,int) = 0;
00119 
00122     virtual int log2_shell_bound(int= -1,int= -1,int= -1,int= -1) = 0;
00123 
00127     int redundant() const { return redundant_; }
00128     void set_redundant(int i) { redundant_ = i; }
00130 
00132     virtual void set_integral_storage(size_t storage);
00133 
00135     Integral *integral() const { return integral_; }
00136 
00137 };
00138 
00139 // //////////////////////////////////////////////////////////////////////////
00140 
00141 class ShellQuartetIter {
00142   protected:
00143     const double * buf;
00144     double scale_;
00145 
00146     int redund_;
00147     
00148     int e12;
00149     int e34;
00150     int e13e24;
00151 
00152     int index;
00153     
00154     int istart;
00155     int jstart;
00156     int kstart;
00157     int lstart;
00158 
00159     int iend;
00160     int jend;
00161     int kend;
00162     int lend;
00163 
00164     int icur;
00165     int jcur;
00166     int kcur;
00167     int lcur;
00168 
00169     int i_;
00170     int j_;
00171     int k_;
00172     int l_;
00173     
00174   public:
00175     ShellQuartetIter();
00176     virtual ~ShellQuartetIter();
00177 
00178     virtual void init(const double *,
00179                       int, int, int, int,
00180                       int, int, int, int,
00181                       int, int, int, int,
00182                       double, int);
00183 
00184     virtual void start();
00185     virtual void next();
00186 
00187     int ready() const { return icur < iend; }
00188 
00189     int i() const { return i_; }
00190     int j() const { return j_; }
00191     int k() const { return k_; }
00192     int l() const { return l_; }
00193 
00194     int nint() const { return iend*jend*kend*lend; }
00195     
00196     double val() const { return buf[index]*scale_; }
00197 };
00198 
00199 class TwoBodyIntIter {
00200   protected:
00201     Ref<TwoBodyInt> tbi;
00202     ShellQuartetIter sqi;
00203     
00204     int iend;
00205     
00206     int icur;
00207     int jcur;
00208     int kcur;
00209     int lcur;
00210     
00211   public:
00212     TwoBodyIntIter();
00213     TwoBodyIntIter(const Ref<TwoBodyInt>&);
00214 
00215     virtual ~TwoBodyIntIter();
00216     
00217     virtual void start();
00218     virtual void next();
00219 
00220     int ready() const { return (icur < iend); }
00221 
00222     int ishell() const { return icur; }
00223     int jshell() const { return jcur; }
00224     int kshell() const { return kcur; }
00225     int lshell() const { return lcur; }
00226 
00227     virtual double scale() const;
00228 
00229     ShellQuartetIter& current_quartet();
00230 };
00231 
00232 // //////////////////////////////////////////////////////////////////////////
00233 
00237 class TwoBodyDerivInt : public RefCount {
00238   protected:
00239     // this is who created me
00240     Integral *integral_;
00241 
00242     Ref<GaussianBasisSet> bs1_;
00243     Ref<GaussianBasisSet> bs2_;
00244     Ref<GaussianBasisSet> bs3_;
00245     Ref<GaussianBasisSet> bs4_;
00246 
00247     double *buffer_;
00248 
00249     TwoBodyDerivInt(Integral* integral,
00250                     const Ref<GaussianBasisSet>&b1,
00251                     const Ref<GaussianBasisSet>&b2,
00252                     const Ref<GaussianBasisSet>&b3,
00253                     const Ref<GaussianBasisSet>&b4);
00254   public:
00255     virtual ~TwoBodyDerivInt();
00256   
00258     int nbasis() const;
00259 
00261 
00262     int nbasis1() const;
00263     int nbasis2() const;
00264     int nbasis3() const;
00265     int nbasis4() const;
00267 
00269     int nshell() const;
00270 
00272 
00273     int nshell1() const;
00274     int nshell2() const;
00275     int nshell3() const;
00276     int nshell4() const;
00278 
00280     Ref<GaussianBasisSet> basis();
00281 
00283 
00284     Ref<GaussianBasisSet> basis1();
00285     Ref<GaussianBasisSet> basis2();
00286     Ref<GaussianBasisSet> basis3();
00287     Ref<GaussianBasisSet> basis4();
00289 
00293     const double * buffer() const;
00294     
00297     virtual void compute_shell(int,int,int,int,DerivCenters&) = 0;
00298 
00301     virtual int log2_shell_bound(int= -1,int= -1,int= -1,int= -1) = 0;
00302 };
00303 
00304 }
00305 
00306 #endif
00307 
00308 // Local Variables:
00309 // mode: c++
00310 // c-file-style: "ETS"
00311 // End:

Generated at Wed Apr 28 10:12:54 2004 for MPQC 2.2.2 using the documentation package Doxygen 1.2.14.