int1e.h

00001 //
00002 // int1e.h
00003 //
00004 // Copyright (C) 2001 Edward Valeev
00005 //
00006 // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
00007 // Maintainer: EV
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 #ifdef __GNUG__
00029 #pragma interface
00030 #endif
00031 
00032 #ifndef _chemistry_qc_cints_int1e_h
00033 #define _chemistry_qc_cints_int1e_h
00034 
00035 #include <util/ref/ref.h>
00036 #include <chemistry/qc/basis/basis.h>
00037 #include <chemistry/qc/basis/obint.h>
00038 #include <chemistry/qc/intv3/fjt.h>
00039 
00040 namespace sc {
00041 
00042 class Integral;
00043 
00046 class Int1eCints: public RefCount {
00047   protected:
00048     Integral *integral_;
00049 
00050     Ref<GaussianBasisSet> bs1_;
00051     Ref<GaussianBasisSet> bs2_;
00052 
00053     // This was really an afterthought, should have designed better
00054     Ref<DipoleData> multipole_origin_;
00055     Ref<EfieldDotVectorData> EdotV_origin_;
00056     Ref<PointChargeData> Q_origin_;
00057 
00058     bool need_overlap_;
00059     bool need_coulomb_;
00060 
00061     int ntypes_;                  // Number of integrals held together
00062                                   // usually 1, 3 for dipole, 6 for quadrupole, etc.
00063 
00064     double *target_ints_buffer_;  // buffer of integrals in a shell doublet
00065     int max_doublet_size_;
00066 
00067     /*--- Internal scratch ---*/
00068     double *cart_ints_;           // buffer of cartesian integrals in by-contraction-doublets order
00069     double *sphharm_ints_;        // buffer of integrals over spherical harmonics in by-contraction-doublets order
00070     double *tformbuf_;            // temporary scratch used in cart.->sph.harm. transforms
00071     int max_cart_doublet_size_;
00072     
00073     /*--- Pointers to scratch arrays (never used in new[] and delete[]) ---*/
00074     double *prim_ints_;       // this points to the appropriate location for raw integrals
00075     double *contr_doublets_;
00076     double *shell_doublet_;
00077 
00078     /*--- Internally used "interfaces" ---*/
00079     GaussianShell *int_shell1_;
00080     GaussianShell *int_shell2_;
00081     struct {
00082       double A[3], B[3];
00083       double AB2;
00084       int gc1, gc2;
00085       int p1, p2;
00086       int am;
00087     } doublet_info_;
00088     // Buffers for primitive overlap integrals over 1D Gaussians
00089     double **OIX_, **OIY_, **OIZ_;
00090     // Buffer for primitive nuclear attraction integrals
00091     // Such buffer contains all integrals including intermediates
00092     // These integrals are nonseparable, hence the first and second indices are composite
00093     double ***AI0_;
00094     int indmax_;         // that's the range of the first 2 indices of AI0
00095     // Compute engines
00096     void AI_OSrecurs_(double ***AI0, double PA[3], double PB[3],
00097                       double PC[3], double gamma, int iang, int jang);
00098     void OI_OSrecurs_(double **OIX, double **OIY, double **OIZ, double PA[3], double PB[3],
00099                       double gamma, int lmaxi, int lmaxj);
00100     Ref<FJT> Fm_Eval_;
00101 
00102     // tasks common to different types of integral evaluation
00103     void compute_doublet_info_(int, int);
00104     void zero_buffers_();
00105     void transform_contrquartets_(double *, double *);
00106     void sort_contrdoublets_to_shelldoublet_(double *, double *);
00107     // same tasks, but adapted for the case of several sets of integrals (multipole, etc.)
00108     void zero_buffers_vec_(const int);
00109     void transform_contrquartets_vec_(const int, double *, double *);
00110     void sort_contrdoublets_to_shelldoublet_vec_(const int, double *, double *);
00111     // specialized versions of compute routines
00112     void overlap_full_general_();
00113     void overlap_sameam_general_();
00114     void kinetic_full_general_();
00115     void kinetic_sameam_general_();
00116     void nuclear_full_general_();
00117     void nuclear_sameam_general_();
00118     void hcore_full_general_();
00119     void hcore_sameam_general_();
00120     void edipole_full_general_();
00121     void equadrupole_full_general_();
00122 
00123     // Utility functions
00124     double **init_block_(int, int);     // Used to allocate OIXYZ
00125     void free_block_(double **);
00126     double ***init_box_(int, int, int);   // Used to allocate AI0;
00127     void free_box_(double ***);
00128   
00129   public:
00130     Int1eCints(Integral *,
00131             const Ref<GaussianBasisSet>&,
00132             const Ref<GaussianBasisSet>&,
00133             int order, bool need_overlap, bool need_coulomb, int ntypes);
00134     ~Int1eCints();
00135 
00136     void set_multipole_origin(const Ref<DipoleData>&);
00137     void set_EdotV_origin(const Ref<EfieldDotVectorData>&);
00138     void set_Q_origin(const Ref<PointChargeData>&);
00139     Ref<DipoleData> multipole_origin();
00140     Ref<EfieldDotVectorData> EdotV_origin();
00141     Ref<PointChargeData> Q_origin();
00142 
00143     double *buffer() { return target_ints_buffer_; }
00144     Ref<GaussianBasisSet> basis() { if (bs1_==bs2_) return bs1_; return 0; }
00145     Ref<GaussianBasisSet> basis1() { return bs1_; }
00146     Ref<GaussianBasisSet> basis2() { return bs2_; }
00147 
00148     void kinetic(int ish, int jsh);
00149     void nuclear(int ish, int jsh);
00150     void overlap(int ish, int jsh);
00151     void hcore(int ish, int jsh);
00152     void edipole(int ish, int jsh);
00153     void equadrupole(int ish, int jsh);
00154 };
00155 
00156 }
00157 
00158 #endif
00159 
00160 // Local Variables:
00161 // mode: c++
00162 // c-file-style: "CLJ"
00163 // End:

Generated at Mon Dec 3 23:23:37 2007 for MPQC 2.3.1 using the documentation package Doxygen 1.5.2.