| 1 | // | 
|---|
| 2 | // int1e.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_int1e_h | 
|---|
| 33 | #define _chemistry_qc_cints_int1e_h | 
|---|
| 34 |  | 
|---|
| 35 | #include <util/ref/ref.h> | 
|---|
| 36 | #include <chemistry/qc/basis/basis.h> | 
|---|
| 37 | #include <chemistry/qc/basis/obint.h> | 
|---|
| 38 | #include <chemistry/qc/intv3/fjt.h> | 
|---|
| 39 |  | 
|---|
| 40 | namespace sc { | 
|---|
| 41 |  | 
|---|
| 42 | class Integral; | 
|---|
| 43 |  | 
|---|
| 44 | /** Int1eCints is used by OneBodyIntCints and OneBodyDerivIntCints to | 
|---|
| 45 | implement IntegralCints. */ | 
|---|
| 46 | class Int1eCints: public RefCount { | 
|---|
| 47 | protected: | 
|---|
| 48 | Integral *integral_; | 
|---|
| 49 |  | 
|---|
| 50 | Ref<GaussianBasisSet> bs1_; | 
|---|
| 51 | Ref<GaussianBasisSet> bs2_; | 
|---|
| 52 |  | 
|---|
| 53 | // This was really an afterthought, should have designed better | 
|---|
| 54 | Ref<DipoleData> multipole_origin_; | 
|---|
| 55 | Ref<EfieldDotVectorData> EdotV_origin_; | 
|---|
| 56 | Ref<PointChargeData> Q_origin_; | 
|---|
| 57 |  | 
|---|
| 58 | bool need_overlap_; | 
|---|
| 59 | bool need_coulomb_; | 
|---|
| 60 |  | 
|---|
| 61 | int ntypes_;                  // Number of integrals held together | 
|---|
| 62 | // usually 1, 3 for dipole, 6 for quadrupole, etc. | 
|---|
| 63 |  | 
|---|
| 64 | double *target_ints_buffer_;  // buffer of integrals in a shell doublet | 
|---|
| 65 | int max_doublet_size_; | 
|---|
| 66 |  | 
|---|
| 67 | /*--- Internal scratch ---*/ | 
|---|
| 68 | double *cart_ints_;           // buffer of cartesian integrals in by-contraction-doublets order | 
|---|
| 69 | double *sphharm_ints_;        // buffer of integrals over spherical harmonics in by-contraction-doublets order | 
|---|
| 70 | double *tformbuf_;            // temporary scratch used in cart.->sph.harm. transforms | 
|---|
| 71 | int max_cart_doublet_size_; | 
|---|
| 72 |  | 
|---|
| 73 | /*--- Pointers to scratch arrays (never used in new[] and delete[]) ---*/ | 
|---|
| 74 | double *prim_ints_;       // this points to the appropriate location for raw integrals | 
|---|
| 75 | double *contr_doublets_; | 
|---|
| 76 | double *shell_doublet_; | 
|---|
| 77 |  | 
|---|
| 78 | /*--- Internally used "interfaces" ---*/ | 
|---|
| 79 | GaussianShell *int_shell1_; | 
|---|
| 80 | GaussianShell *int_shell2_; | 
|---|
| 81 | struct { | 
|---|
| 82 | double A[3], B[3]; | 
|---|
| 83 | double AB2; | 
|---|
| 84 | int gc1, gc2; | 
|---|
| 85 | int p1, p2; | 
|---|
| 86 | int am; | 
|---|
| 87 | } doublet_info_; | 
|---|
| 88 | // Buffers for primitive overlap integrals over 1D Gaussians | 
|---|
| 89 | double **OIX_, **OIY_, **OIZ_; | 
|---|
| 90 | // Buffer for primitive nuclear attraction integrals | 
|---|
| 91 | // Such buffer contains all integrals including intermediates | 
|---|
| 92 | // These integrals are nonseparable, hence the first and second indices are composite | 
|---|
| 93 | double ***AI0_; | 
|---|
| 94 | int indmax_;         // that's the range of the first 2 indices of AI0 | 
|---|
| 95 | // Compute engines | 
|---|
| 96 | void AI_OSrecurs_(double ***AI0, double PA[3], double PB[3], | 
|---|
| 97 | double PC[3], double gamma, int iang, int jang); | 
|---|
| 98 | void OI_OSrecurs_(double **OIX, double **OIY, double **OIZ, double PA[3], double PB[3], | 
|---|
| 99 | double gamma, int lmaxi, int lmaxj); | 
|---|
| 100 | Ref<FJT> Fm_Eval_; | 
|---|
| 101 |  | 
|---|
| 102 | // tasks common to different types of integral evaluation | 
|---|
| 103 | void compute_doublet_info_(int, int); | 
|---|
| 104 | void zero_buffers_(); | 
|---|
| 105 | void transform_contrquartets_(double *, double *); | 
|---|
| 106 | void sort_contrdoublets_to_shelldoublet_(double *, double *); | 
|---|
| 107 | // same tasks, but adapted for the case of several sets of integrals (multipole, etc.) | 
|---|
| 108 | void zero_buffers_vec_(const int); | 
|---|
| 109 | void transform_contrquartets_vec_(const int, double *, double *); | 
|---|
| 110 | void sort_contrdoublets_to_shelldoublet_vec_(const int, double *, double *); | 
|---|
| 111 | // specialized versions of compute routines | 
|---|
| 112 | void overlap_full_general_(); | 
|---|
| 113 | void overlap_sameam_general_(); | 
|---|
| 114 | void kinetic_full_general_(); | 
|---|
| 115 | void kinetic_sameam_general_(); | 
|---|
| 116 | void nuclear_full_general_(); | 
|---|
| 117 | void nuclear_sameam_general_(); | 
|---|
| 118 | void hcore_full_general_(); | 
|---|
| 119 | void hcore_sameam_general_(); | 
|---|
| 120 | void edipole_full_general_(); | 
|---|
| 121 | void equadrupole_full_general_(); | 
|---|
| 122 |  | 
|---|
| 123 | // Utility functions | 
|---|
| 124 | double **init_block_(int, int);     // Used to allocate OIXYZ | 
|---|
| 125 | void free_block_(double **); | 
|---|
| 126 | double ***init_box_(int, int, int);   // Used to allocate AI0; | 
|---|
| 127 | void free_box_(double ***); | 
|---|
| 128 |  | 
|---|
| 129 | public: | 
|---|
| 130 | Int1eCints(Integral *, | 
|---|
| 131 | const Ref<GaussianBasisSet>&, | 
|---|
| 132 | const Ref<GaussianBasisSet>&, | 
|---|
| 133 | int order, bool need_overlap, bool need_coulomb, int ntypes); | 
|---|
| 134 | ~Int1eCints(); | 
|---|
| 135 |  | 
|---|
| 136 | void set_multipole_origin(const Ref<DipoleData>&); | 
|---|
| 137 | void set_EdotV_origin(const Ref<EfieldDotVectorData>&); | 
|---|
| 138 | void set_Q_origin(const Ref<PointChargeData>&); | 
|---|
| 139 | Ref<DipoleData> multipole_origin(); | 
|---|
| 140 | Ref<EfieldDotVectorData> EdotV_origin(); | 
|---|
| 141 | Ref<PointChargeData> Q_origin(); | 
|---|
| 142 |  | 
|---|
| 143 | double *buffer() { return target_ints_buffer_; } | 
|---|
| 144 | Ref<GaussianBasisSet> basis() { if (bs1_==bs2_) return bs1_; return 0; } | 
|---|
| 145 | Ref<GaussianBasisSet> basis1() { return bs1_; } | 
|---|
| 146 | Ref<GaussianBasisSet> basis2() { return bs2_; } | 
|---|
| 147 |  | 
|---|
| 148 | void kinetic(int ish, int jsh); | 
|---|
| 149 | void nuclear(int ish, int jsh); | 
|---|
| 150 | void overlap(int ish, int jsh); | 
|---|
| 151 | void hcore(int ish, int jsh); | 
|---|
| 152 | void edipole(int ish, int jsh); | 
|---|
| 153 | void equadrupole(int ish, int jsh); | 
|---|
| 154 | }; | 
|---|
| 155 |  | 
|---|
| 156 | } | 
|---|
| 157 |  | 
|---|
| 158 | #endif | 
|---|
| 159 |  | 
|---|
| 160 | // Local Variables: | 
|---|
| 161 | // mode: c++ | 
|---|
| 162 | // c-file-style: "CLJ" | 
|---|
| 163 | // End: | 
|---|