int2e.h

00001 //
00002 // int2e.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_int2e_h
00033 #define _chemistry_qc_cints_int2e_h
00034 
00035 #include <limits.h>
00036 
00037 #include <util/ref/ref.h>
00038 #include <chemistry/qc/basis/basis.h>
00039 #include <chemistry/qc/basis/tbint.h>
00040 
00041 namespace sc {
00042 
00043 class Integral;
00044 
00048 class Int2eCints: public RefCount {
00049   protected:
00050     Integral *integral_;
00051 
00052     Ref<GaussianBasisSet> bs1_;
00053     Ref<GaussianBasisSet> bs2_;
00054     Ref<GaussianBasisSet> bs3_;
00055     Ref<GaussianBasisSet> bs4_;
00056 
00057     Ref<MessageGrp> grp_;
00058 
00059     GaussianShell *int_shell1_;
00060     GaussianShell *int_shell2_;
00061     GaussianShell *int_shell3_;
00062     GaussianShell *int_shell4_;
00063 
00064     // Whether shells can be permuted
00065     int permute_;
00066     // Whether redundant integrals are needed or only unique ones
00067     int redundant_;
00068 
00069     /*--- Storage related stuff ---*/
00070     // Available storage
00071     size_t storage_;
00072     // Storage currently used
00073     size_t storage_used_;
00074     // Checks if too much storage is used
00075     void check_storage_() const;
00076     // Reports minimum "significant" storage needed to initialize the Int2e base
00077     static size_t storage_required_(const Ref<GaussianBasisSet>& b1,
00078                                     const Ref<GaussianBasisSet>& b2 = 0,
00079                                     const Ref<GaussianBasisSet>& b3 = 0,
00080                                     const Ref<GaussianBasisSet>& b4 = 0);
00081 
00082     /*--- Scratch ---*/
00083     double *tformbuf_;    // stores one partially transformed contraction quartet
00084 
00085     /*--- helper functions ---*/
00086     // cart.->sph.harm. transform functions
00087     void transform_contrquartets_(double *,double *);
00088     // sort from by-contraction-quartet to shell-quartet order
00089     void sort_contrquartets_to_shellquartet_(double *,double *);
00090     // permute perm_ints_ into target_int_buf_
00091     void permute_target_(double *, double *, int, int, int);
00092     void permute_1234_to_1243_(double *, double *);
00093     void permute_1234_to_2134_(double *, double *);
00094     void permute_1234_to_2143_(double *, double *);
00095     void permute_1234_to_3412_(double *, double *);
00096     void permute_1234_to_3421_(double *, double *);
00097     void permute_1234_to_4312_(double *, double *);
00098     void permute_1234_to_4321_(double *, double *);
00099     // retrieve nonredundant integrals
00100     void get_nonredundant_ints_(double *, double *, int, int, int);
00101     
00102   public:
00103     Int2eCints(Integral *,
00104                const Ref<GaussianBasisSet>&,
00105                const Ref<GaussianBasisSet>&,
00106                const Ref<GaussianBasisSet>&,
00107                const Ref<GaussianBasisSet>&,
00108                size_t storage);
00109     ~Int2eCints();
00110 
00112     void init_storage(size_t);
00114     void done_storage();
00116     size_t storage_used() const { return storage_used_; }
00117 
00119     int redundant() const { return redundant_; }
00121     void set_redundant(int flag) { redundant_ = flag; }
00122 
00124     int permute() const { return permute_; }
00126     void set_permute(int flag) { permute_ = flag; }
00127 
00129     virtual void compute_quartet(int *, int*, int*, int*) =0;
00131     virtual double *buffer(TwoBodyInt::tbint_type = TwoBodyInt::eri) const =0;
00132 
00133     Ref<GaussianBasisSet> basis()
00134     {
00135       if (bs1_==bs2_ && bs1_ == bs3_ && bs1_ == bs4_) return bs1_;
00136       return 0;
00137     }
00138     Ref<GaussianBasisSet> basis1() { return bs1_; }
00139     Ref<GaussianBasisSet> basis2() { return bs2_; }
00140     Ref<GaussianBasisSet> basis3() { return bs3_; }
00141     Ref<GaussianBasisSet> basis4() { return bs4_; }
00142 
00143 };
00144 
00145 }
00146 
00147 #endif
00148 
00149 // Local Variables:
00150 // mode: c++
00151 // c-file-style: "CLJ"
00152 // End:

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