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

Generated at Sat Jul 7 2012 11:52:44 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.0.