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

obint.h

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 class Integral;
00044 
00045 // //////////////////////////////////////////////////////////////////////////
00046 
00047 class EfieldDotVectorData: public RefCount
00048 {
00049   public:
00050     double position[3];
00051     double vector[3];
00052 
00053     void set_position(double*);
00054     void set_vector(double*);
00055 };
00056 
00057 
00058 class DipoleData: public RefCount
00059 {
00060   public:
00061     double origin[3];
00062 
00063     DipoleData(double *d) {origin[0]=d[0]; origin[1]=d[1]; origin[2]=d[2];}
00064     DipoleData() {origin[0]=origin[1]=origin[2];}
00065     void set_origin(double*);
00066 };
00067 
00068 
00069 class PointChargeData: public RefCount
00070 {
00071   private:
00072     int ncharges_;
00073     const double *charges_;
00074     const double *const*positions_;
00075     double *alloced_charges_;
00076     double **alloced_positions_;
00077 
00078   public:
00079     // If copy_data is 0, the passed positions and charges will
00080     // be stored (but not freed).
00081     PointChargeData(int ncharge,
00082                     const double *const*positions, const double *charges,
00083                     int copy_data = 0);
00084     ~PointChargeData();
00085 
00086     int ncharges() const { return ncharges_; }
00087     const double *charges() const { return charges_; }
00088     const double *const*positions() const { return positions_; }
00089 };
00090 
00091 
00094 class OneBodyInt : public RefCount {
00095   protected:
00096     // this is who created me
00097     Integral *integral_;
00098 
00099     Ref<GaussianBasisSet> bs1_;
00100     Ref<GaussianBasisSet> bs2_;
00101 
00102     double *buffer_;
00103 
00104     OneBodyInt(Integral *integral,
00105                const Ref<GaussianBasisSet>&b1,
00106                const Ref<GaussianBasisSet>&b2 = 0);
00107 
00108   public:
00109     virtual ~OneBodyInt();
00110   
00112     int nbasis() const;
00113 
00115 
00116     int nbasis1() const;
00117     int nbasis2() const;
00119 
00121     int nshell() const;
00122 
00124 
00125     int nshell1() const;
00126     int nshell2() const;
00128 
00130     Ref<GaussianBasisSet> basis();
00131 
00133 
00134     Ref<GaussianBasisSet> basis1();
00135     Ref<GaussianBasisSet> basis2();
00137 
00139     const double * buffer() const;
00140     
00143     virtual void compute_shell(int,int) = 0;
00144 
00147     virtual void reinitialize();
00148 
00149     Integral *integral() const { return integral_; }
00150 };
00151 
00152 
00153 
00154 // //////////////////////////////////////////////////////////////////////////
00155 
00156 class ShellPairIter {
00157   private:
00158     const double * buf;
00159     double scale_;
00160 
00161     int e12;
00162 
00163     int index;
00164     
00165     int ioffset;
00166     int joffset;
00167 
00168     int iend;
00169     int jend;
00170 
00171     int icur;
00172     int jcur;
00173     
00174   public:
00175     ShellPairIter();
00176     ~ShellPairIter();
00177 
00178     void init(const double * buffer, int ishell, int jshell,
00179               int ioff, int joff, int nfunci, int nfuncj, int redund=0,
00180               double scale=1.0);
00181 
00182     void start() { icur=jcur=index=0; }
00183     int ready() const { return (icur < iend); }
00184 
00185     void next() {
00186       if (jcur < ((e12)?(icur):((jend)-1))) {
00187         index++;
00188         jcur++;
00189         return;
00190       }
00191 
00192       jcur=0;
00193       icur++;
00194 
00195       index = icur*jend;
00196     }
00197 
00198     int current_i() const { return icur; }
00199     int current_j() const { return jcur; }
00200 
00201     int i() const { return icur+ioffset; }
00202     int j() const { return jcur+joffset; }
00203 
00204     int nint() const { return iend*jend; }
00205     
00206     double val() const { return buf[index]*scale_; }
00207 };
00208 
00209 // //////////////////////////////////////////////////////////////////////////
00210 
00211 class OneBodyIntIter : public RefCount {
00212   protected:
00213     Ref<OneBodyInt> obi; // help me obi wan
00214     ShellPairIter spi;
00215     
00216     int redund;
00217     
00218     int istart;
00219     int jstart;
00220     
00221     int iend;
00222     int jend;
00223 
00224     int icur;
00225     int jcur;
00226 
00227     int ij;
00228     
00229   public:
00230     OneBodyIntIter();
00231     OneBodyIntIter(const Ref<OneBodyInt>&);
00232     virtual ~OneBodyIntIter();
00233     
00234     virtual void start(int ist=0, int jst=0, int ien=0, int jen=0);
00235     virtual void next();
00236 
00237     int ready() const { return (icur < iend); }
00238 
00239     int ishell() const { return icur; }
00240     int jshell() const { return jcur; }
00241 
00242     int ijshell() const { return ij; }
00243 
00244     int redundant() const { return redund; }
00245     void set_redundant(int i) { redund=i; }
00246     
00247     virtual double scale() const;
00248 
00249     Ref<OneBodyInt> one_body_int() { return obi; }
00250 
00251     ShellPairIter& current_pair();
00252 };
00253 
00254 
00255 
00256 // //////////////////////////////////////////////////////////////////////////
00257 
00258 class OneBodyIntOp: public SCElementOp {
00259   protected:
00260     Ref<OneBodyIntIter> iter;
00261 
00262   public:
00263     OneBodyIntOp(const Ref<OneBodyInt>&);
00264     OneBodyIntOp(const Ref<OneBodyIntIter>&);
00265     virtual ~OneBodyIntOp();
00266   
00267     void process(SCMatrixBlockIter&);
00268     void process_spec_rect(SCMatrixRectBlock*);
00269     void process_spec_ltri(SCMatrixLTriBlock*);
00270     void process_spec_rectsub(SCMatrixRectSubBlock*);
00271     void process_spec_ltrisub(SCMatrixLTriSubBlock*);
00272 
00273     int has_side_effects();
00274 };
00275 
00276 class OneBody3IntOp: public SCElementOp3 {
00277   private:
00278     Ref<OneBodyIntIter> iter;
00279 
00280   public:
00281     OneBody3IntOp(const Ref<OneBodyInt>&b);
00282     OneBody3IntOp(const Ref<OneBodyIntIter>&);
00283     virtual ~OneBody3IntOp();
00284   
00285     void process(SCMatrixBlockIter&,
00286                  SCMatrixBlockIter&,
00287                  SCMatrixBlockIter&);
00288     void process_spec_rect(SCMatrixRectBlock*,
00289                            SCMatrixRectBlock*,
00290                            SCMatrixRectBlock*);
00291     void process_spec_ltri(SCMatrixLTriBlock*,
00292                            SCMatrixLTriBlock*,
00293                            SCMatrixLTriBlock*);
00294 
00295     int has_side_effects();
00296     int has_side_effects_in_arg1();
00297     int has_side_effects_in_arg2();
00298 
00299 };
00300 
00301 // //////////////////////////////////////////////////////////////////////////
00302 
00305 class OneBodyDerivInt : public RefCount {
00306   protected:
00307     // this is who created me
00308     Integral *integral_;
00309 
00310     Ref<GaussianBasisSet> bs1;
00311     Ref<GaussianBasisSet> bs2;
00312 
00313     double *buffer_;
00314 
00315   public:
00316     OneBodyDerivInt(Integral *, const Ref<GaussianBasisSet>&b);
00317     OneBodyDerivInt(Integral *,
00318                     const Ref<GaussianBasisSet>&b1,
00319                     const Ref<GaussianBasisSet>&b2);
00320     virtual ~OneBodyDerivInt();
00321   
00323     int nbasis() const;
00325 
00326     int nbasis1() const;
00327     int nbasis2() const;
00329 
00331     int nshell() const;
00333 
00334     int nshell1() const;
00335     int nshell2() const;
00337 
00339     Ref<GaussianBasisSet> basis();
00341 
00342     Ref<GaussianBasisSet> basis1();
00343     Ref<GaussianBasisSet> basis2();
00345 
00348     const double * buffer() const;
00349     
00353     virtual void compute_shell(int ish, int jsh, DerivCenters&) = 0;
00354     virtual void compute_shell(int ish, int jsh, int center) = 0;
00356 };
00357 
00358 
00359 
00360 #endif
00361 
00362 // Local Variables:
00363 // mode: c++
00364 // c-file-style: "ETS"
00365 // End:

Generated at Thu Oct 4 18:08:46 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.