| 1 | //
 | 
|---|
| 2 | // grt.h
 | 
|---|
| 3 | //
 | 
|---|
| 4 | // Copyright (C) 2001 Edward Valeev
 | 
|---|
| 5 | //
 | 
|---|
| 6 | // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
 | 
|---|
| 7 | // Maintainer: EV
 | 
|---|
| 8 | //
 | 
|---|
| 9 | // This file is part of the SC Toolkit.
 | 
|---|
| 10 | //
 | 
|---|
| 11 | // The SC Toolkit is free software; you can redistribute it and/or modify
 | 
|---|
| 12 | // it under the terms of the GNU Library General Public License as published by
 | 
|---|
| 13 | // the Free Software Foundation; either version 2, or (at your option)
 | 
|---|
| 14 | // any later version.
 | 
|---|
| 15 | //
 | 
|---|
| 16 | // The SC Toolkit is distributed in the hope that it will be useful,
 | 
|---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 19 | // GNU Library General Public License for more details.
 | 
|---|
| 20 | //
 | 
|---|
| 21 | // You should have received a copy of the GNU Library General Public License
 | 
|---|
| 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
 | 
|---|
| 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
|---|
| 24 | //
 | 
|---|
| 25 | // The U.S. Government is granted a limited license as per AL 91-7.
 | 
|---|
| 26 | //
 | 
|---|
| 27 | 
 | 
|---|
| 28 | #ifdef __GNUG__
 | 
|---|
| 29 | #pragma interface
 | 
|---|
| 30 | #endif
 | 
|---|
| 31 | 
 | 
|---|
| 32 | #ifndef _chemistry_qc_cints_grt_h
 | 
|---|
| 33 | #define _chemistry_qc_cints_grt_h
 | 
|---|
| 34 | 
 | 
|---|
| 35 | #include <limits.h>
 | 
|---|
| 36 | 
 | 
|---|
| 37 | #include <util/ref/ref.h>
 | 
|---|
| 38 | #include <chemistry/qc/basis/basis.h>
 | 
|---|
| 39 | #include <chemistry/qc/cints/shellpairs.h>
 | 
|---|
| 40 | #include <chemistry/qc/intv3/fjt.h>
 | 
|---|
| 41 | #include <chemistry/qc/cints/int2e.h>
 | 
|---|
| 42 | #include <libr12/libr12.h>
 | 
|---|
| 43 | 
 | 
|---|
| 44 | namespace sc {
 | 
|---|
| 45 | 
 | 
|---|
| 46 | class Integral;
 | 
|---|
| 47 | 
 | 
|---|
| 48 | /** GRTCints is a specialization of Int2eCints that computes two-electron integrals specific to linear R12 methods */
 | 
|---|
| 49 | class GRTCints: public Int2eCints {
 | 
|---|
| 50 |   private:
 | 
|---|
| 51 |     // Number of integral types produced
 | 
|---|
| 52 | //    static const int num_te_types_ = 4;
 | 
|---|
| 53 | #define num_te_types_ 4
 | 
|---|
| 54 | 
 | 
|---|
| 55 |     // Storage for target integrals
 | 
|---|
| 56 |     double *target_ints_buffer_[num_te_types_];
 | 
|---|
| 57 | 
 | 
|---|
| 58 |     /*--- Intermediate scratch arrays (may be used in new[] and delete[]) ---*/
 | 
|---|
| 59 |     double *cart_ints_[num_te_types_];       // cartesian integrals, in by-contraction-quartet order
 | 
|---|
| 60 |     double *sphharm_ints_;    // transformed integrals, in by-contraction-quartet order
 | 
|---|
| 61 |     double *perm_ints_;       // redundant target integrals in shell quartet order, shells permuted
 | 
|---|
| 62 | 
 | 
|---|
| 63 |     /*--- Pointers to scratch arrays (never used in new[] and delete[]) ---*/
 | 
|---|
| 64 |     double *prim_ints_[num_te_types_];       // this points to the appropriate location for raw integrals
 | 
|---|
| 65 |     double *contr_quartets_[num_te_types_];
 | 
|---|
| 66 |     double *shell_quartet_[num_te_types_];
 | 
|---|
| 67 | 
 | 
|---|
| 68 |     /*--- Precomputed data ---*/
 | 
|---|
| 69 |     Ref<ShellPairsCints> shell_pairs12_;
 | 
|---|
| 70 |     Ref<ShellPairsCints> shell_pairs34_;
 | 
|---|
| 71 | 
 | 
|---|
| 72 |     /*--- Internally used "interfaces" ---*/
 | 
|---|
| 73 |     struct {
 | 
|---|
| 74 |       int p12, p34, p13p24;           // flags indicating if functions were permuted
 | 
|---|
| 75 |       ShellPairCints *shell_pair12, *shell_pair34;   // Shell pairs corresponding to the original
 | 
|---|
| 76 |                                                      // (before permutation) order of shell
 | 
|---|
| 77 |       int *op1, *op2, *op3, *op4;     // pointers to the primitive indices in the original order
 | 
|---|
| 78 |       /////////// The rest of data has been permuted according to p12, p34, p13p24
 | 
|---|
| 79 |       double A[3], B[3], C[3], D[3];
 | 
|---|
| 80 |       double AB2, CD2;
 | 
|---|
| 81 |       int gc1, gc2, gc3, gc4;
 | 
|---|
| 82 |       int p1, p2, p3, p4;
 | 
|---|
| 83 |       int am;
 | 
|---|
| 84 |     } quartet_info_;
 | 
|---|
| 85 |     void grt_quartet_data_(prim_data *Data, double scale);
 | 
|---|
| 86 |     /*--- Compute engines ---*/
 | 
|---|
| 87 |     Libr12_t Libr12_;
 | 
|---|
| 88 |     Ref<FJT> Fm_Eval_;
 | 
|---|
| 89 |   
 | 
|---|
| 90 |   public:
 | 
|---|
| 91 |     GRTCints(Integral *,
 | 
|---|
| 92 |              const Ref<GaussianBasisSet>&,
 | 
|---|
| 93 |              const Ref<GaussianBasisSet>&,
 | 
|---|
| 94 |              const Ref<GaussianBasisSet>&,
 | 
|---|
| 95 |              const Ref<GaussianBasisSet>&,
 | 
|---|
| 96 |              size_t storage);
 | 
|---|
| 97 |     ~GRTCints();
 | 
|---|
| 98 | 
 | 
|---|
| 99 |     double *buffer(TwoBodyInt::tbint_type te_type) const {
 | 
|---|
| 100 |       if (te_type == TwoBodyInt::eri ||
 | 
|---|
| 101 |           te_type == TwoBodyInt::r12 ||
 | 
|---|
| 102 |           te_type == TwoBodyInt::r12t1 ||
 | 
|---|
| 103 |           te_type == TwoBodyInt::r12t2)
 | 
|---|
| 104 |         return target_ints_buffer_[te_type];
 | 
|---|
| 105 |       else
 | 
|---|
| 106 |         return 0;
 | 
|---|
| 107 |     }
 | 
|---|
| 108 | 
 | 
|---|
| 109 |     static size_t storage_required(const Ref<GaussianBasisSet>& b1,
 | 
|---|
| 110 |                                    const Ref<GaussianBasisSet>& b2 = 0,
 | 
|---|
| 111 |                                    const Ref<GaussianBasisSet>& b3 = 0,
 | 
|---|
| 112 |                                    const Ref<GaussianBasisSet>& b4 = 0);
 | 
|---|
| 113 |     
 | 
|---|
| 114 |     // evaluate integrals
 | 
|---|
| 115 |     void compute_quartet(int*, int*, int*, int*);
 | 
|---|
| 116 | };
 | 
|---|
| 117 | 
 | 
|---|
| 118 | #include <chemistry/qc/cints/grt_quartet_data.h>
 | 
|---|
| 119 | 
 | 
|---|
| 120 | /* Libr12StaticInterface is an initializer class for the static part
 | 
|---|
| 121 |    of libr12's interface (one per executable) */
 | 
|---|
| 122 | class Libr12StaticInterface {
 | 
|---|
| 123 |     bool ready;
 | 
|---|
| 124 | 
 | 
|---|
| 125 |     public:
 | 
|---|
| 126 |     Libr12StaticInterface() { init_libr12_base(); ready = true; }
 | 
|---|
| 127 |     ~Libr12StaticInterface() { ready = false; }
 | 
|---|
| 128 | };
 | 
|---|
| 129 | 
 | 
|---|
| 130 | }
 | 
|---|
| 131 | 
 | 
|---|
| 132 | #endif
 | 
|---|
| 133 | 
 | 
|---|
| 134 | // Local Variables:
 | 
|---|
| 135 | // mode: c++
 | 
|---|
| 136 | // c-file-style: "CLJ"
 | 
|---|
| 137 | // End:
 | 
|---|