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