# grt.h

    00001 //
    00002 // grt.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_grt_h
    00033 #define _chemistry_qc_cints_grt_h
    00034
    00035 #include <limits.h>
    00036
    00037 #include <util/ref/ref.h>
    00038 #include <chemistry/qc/basis/basis.h>
    00039 #include <chemistry/qc/cints/shellpairs.h>
    00040 #include <chemistry/qc/intv3/fjt.h>
    00041 #include <chemistry/qc/cints/int2e.h>
    00042 #include <libr12/libr12.h>
    00043
    00044 namespace sc {
    00045
    00046 class Integral;
    00047
    00049 class GRTCints: public Int2eCints {
    00050   private:
    00051     // Number of integral types produced
    00052 //    static const int num_te_types_ = 4;
    00053 #define num_te_types_ 4
    00054
    00055     // Storage for target integrals
    00056     double *target_ints_buffer_[num_te_types_];
    00057
    00058     /*--- Intermediate scratch arrays (may be used in new[] and delete[]) ---*/
    00059     double *cart_ints_[num_te_types_];       // cartesian integrals, in by-contraction-quartet order
    00060     double *sphharm_ints_;    // transformed integrals, in by-contraction-quartet order
    00061     double *perm_ints_;       // redundant target integrals in shell quartet order, shells permuted
    00062
    00063     /*--- Pointers to scratch arrays (never used in new[] and delete[]) ---*/
    00064     double *prim_ints_[num_te_types_];       // this points to the appropriate location for raw integrals
    00065     double *contr_quartets_[num_te_types_];
    00066     double *shell_quartet_[num_te_types_];
    00067
    00068     /*--- Precomputed data ---*/
    00069     Ref<ShellPairsCints> shell_pairs12_;
    00070     Ref<ShellPairsCints> shell_pairs34_;
    00071
    00072     /*--- Internally used "interfaces" ---*/
    00073     struct {
    00074       int p12, p34, p13p24;           // flags indicating if functions were permuted
    00075       ShellPairCints *shell_pair12, *shell_pair34;   // Shell pairs corresponding to the original
    00076                                                      // (before permutation) order of shell
    00077       int *op1, *op2, *op3, *op4;     // pointers to the primitive indices in the original order
    00079       double A[3], B[3], C[3], D[3];
    00080       double AB2, CD2;
    00081       int gc1, gc2, gc3, gc4;
    00082       int p1, p2, p3, p4;
    00083       int am;
    00084     } quartet_info_;
    00085     void grt_quartet_data_(prim_data *Data, double scale);
    00086     /*--- Compute engines ---*/
    00087     Libr12_t Libr12_;
    00088     Ref<FJT> Fm_Eval_;
    00089
    00090   public:
    00091     GRTCints(Integral *,
    00092              const Ref<GaussianBasisSet>&,
    00093              const Ref<GaussianBasisSet>&,
    00094              const Ref<GaussianBasisSet>&,
    00095              const Ref<GaussianBasisSet>&,
    00096              size_t storage);
    00097     ~GRTCints();
    00098
    00099     double *buffer(TwoBodyInt::tbint_type te_type) const {
    00100       if (te_type == TwoBodyInt::eri ||
    00101           te_type == TwoBodyInt::r12 ||
    00102           te_type == TwoBodyInt::r12t1 ||
    00103           te_type == TwoBodyInt::r12t2)
    00104         return target_ints_buffer_[te_type];
    00105       else
    00106         return 0;
    00107     }
    00108
    00109     static size_t storage_required(const Ref<GaussianBasisSet>& b1,
    00110                                    const Ref<GaussianBasisSet>& b2 = 0,
    00111                                    const Ref<GaussianBasisSet>& b3 = 0,
    00112                                    const Ref<GaussianBasisSet>& b4 = 0);
    00113
    00114     // evaluate integrals
    00115     void compute_quartet(int*, int*, int*, int*);
    00116 };
    00117
    00118 #include <chemistry/qc/cints/grt_quartet_data.h>
    00119
    00120 /* Libr12StaticInterface is an initializer class for the static part
    00121    of libr12's interface (one per executable) */
    00122 class Libr12StaticInterface {
    00123     bool ready;
    00124
    00125     public:
    00126     Libr12StaticInterface() { init_libr12_base(); ready = true; }
    00127     ~Libr12StaticInterface() { ready = false; }
    00128 };
    00129
    00130 }
    00131
    00132 #endif
    00133
    00134 // Local Variables:
    00135 // mode: c++
    00136 // c-file-style: "CLJ"
    00137 // End: