| [0b990d] | 1 | // | 
|---|
|  | 2 | // edipole.cc | 
|---|
|  | 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 implementation | 
|---|
|  | 30 | #endif | 
|---|
|  | 31 |  | 
|---|
|  | 32 | #include <util/misc/math.h> | 
|---|
|  | 33 |  | 
|---|
|  | 34 | #include <chemistry/qc/cints/int1e.h> | 
|---|
|  | 35 | #include <chemistry/qc/cints/macros.h> | 
|---|
|  | 36 |  | 
|---|
|  | 37 | using namespace sc; | 
|---|
|  | 38 |  | 
|---|
|  | 39 | void Int1eCints::edipole(int sh1, int sh2) | 
|---|
|  | 40 | { | 
|---|
|  | 41 | const int ntypes = 3;    // integrals for x, y, z | 
|---|
|  | 42 | zero_buffers_vec_(ntypes); | 
|---|
|  | 43 | compute_doublet_info_(sh1, sh2); | 
|---|
|  | 44 |  | 
|---|
|  | 45 | int maxam1 = int_shell1_->max_am(); | 
|---|
|  | 46 | int minam1 = int_shell1_->min_am(); | 
|---|
|  | 47 | int maxam2 = int_shell2_->max_am(); | 
|---|
|  | 48 | int minam2 = int_shell2_->min_am(); | 
|---|
|  | 49 |  | 
|---|
|  | 50 | if (multipole_origin_.null()) { | 
|---|
|  | 51 | double d[3] = {0.0, 0.0, 0.0}; | 
|---|
|  | 52 | set_multipole_origin(new DipoleData(d)); | 
|---|
|  | 53 | } | 
|---|
|  | 54 |  | 
|---|
|  | 55 | edipole_full_general_(); | 
|---|
|  | 56 | } | 
|---|
|  | 57 |  | 
|---|
|  | 58 |  | 
|---|
|  | 59 | void Int1eCints::edipole_full_general_() | 
|---|
|  | 60 | { | 
|---|
|  | 61 | int maxam1 = int_shell1_->max_am(); | 
|---|
|  | 62 | int maxam2 = int_shell2_->max_am(); | 
|---|
|  | 63 | const int ntypes = 3;      // integrals for x, y, z | 
|---|
|  | 64 |  | 
|---|
|  | 65 | /* See if need to transform to spherical harmonics */ | 
|---|
|  | 66 | bool need_cart2sph_transform = false; | 
|---|
|  | 67 | if (int_shell1_->has_pure() || | 
|---|
|  | 68 | int_shell2_->has_pure()) | 
|---|
|  | 69 | need_cart2sph_transform = true; | 
|---|
|  | 70 |  | 
|---|
|  | 71 | /* See if contraction quartets need to be resorted into a shell quartet */ | 
|---|
|  | 72 | bool need_sort_to_shell_doublet = false; | 
|---|
|  | 73 | int num_gen_shells = 0; | 
|---|
|  | 74 | if (int_shell1_->ncontraction() > 1) | 
|---|
|  | 75 | num_gen_shells++; | 
|---|
|  | 76 | if (int_shell2_->ncontraction() > 1) | 
|---|
|  | 77 | num_gen_shells++; | 
|---|
|  | 78 | if (maxam1 + maxam2 && num_gen_shells >= 1) | 
|---|
|  | 79 | need_sort_to_shell_doublet = true; | 
|---|
|  | 80 |  | 
|---|
|  | 81 | /* Determine where integrals need to go at each stage */ | 
|---|
|  | 82 | if (need_sort_to_shell_doublet) { | 
|---|
|  | 83 | prim_ints_ = cart_ints_; | 
|---|
|  | 84 | if (need_cart2sph_transform) | 
|---|
|  | 85 | contr_doublets_ = sphharm_ints_; | 
|---|
|  | 86 | else | 
|---|
|  | 87 | contr_doublets_ = cart_ints_; | 
|---|
|  | 88 | shell_doublet_ = target_ints_buffer_; | 
|---|
|  | 89 | } | 
|---|
|  | 90 | else { | 
|---|
|  | 91 | if (need_cart2sph_transform) { | 
|---|
|  | 92 | prim_ints_ = cart_ints_; | 
|---|
|  | 93 | contr_doublets_ = target_ints_buffer_; | 
|---|
|  | 94 | shell_doublet_ = target_ints_buffer_; | 
|---|
|  | 95 | } | 
|---|
|  | 96 | else { | 
|---|
|  | 97 | prim_ints_ = target_ints_buffer_; | 
|---|
|  | 98 | shell_doublet_ = target_ints_buffer_; | 
|---|
|  | 99 | } | 
|---|
|  | 100 | } | 
|---|
|  | 101 |  | 
|---|
|  | 102 | /* Begin loops over primitives. */ | 
|---|
|  | 103 | for (int p1=0; p1<int_shell1_->nprimitive(); p1++) { | 
|---|
|  | 104 | double a1 = int_shell1_->exponent(p1); | 
|---|
|  | 105 | for (int p2=0; p2<int_shell2_->nprimitive(); p2++) { | 
|---|
|  | 106 | double a2 = int_shell2_->exponent(p2); | 
|---|
|  | 107 |  | 
|---|
|  | 108 | double gamma = a1+a2; | 
|---|
|  | 109 | double oog = 1.0/gamma; | 
|---|
|  | 110 | double over_pf = exp(-a1*a2*doublet_info_.AB2*oog)*sqrt(M_PI*oog)*M_PI*oog; | 
|---|
|  | 111 |  | 
|---|
|  | 112 | double P[3], PA[3], PB[3], BO[3]; | 
|---|
|  | 113 | for(int xyz=0; xyz<3; xyz++) { | 
|---|
|  | 114 | P[xyz] = (a1*doublet_info_.A[xyz] + a2*doublet_info_.B[xyz])*oog; | 
|---|
|  | 115 | PA[xyz] = P[xyz] - doublet_info_.A[xyz]; | 
|---|
|  | 116 | PB[xyz] = P[xyz] - doublet_info_.B[xyz]; | 
|---|
|  | 117 | BO[xyz] = doublet_info_.B[xyz] - multipole_origin_->origin[xyz]; | 
|---|
|  | 118 | } | 
|---|
|  | 119 |  | 
|---|
|  | 120 | OI_OSrecurs_(OIX_,OIY_,OIZ_,PA,PB,gamma,maxam1,maxam2+1); | 
|---|
|  | 121 |  | 
|---|
|  | 122 | /*--- contract each buffer into appropriate location ---*/ | 
|---|
|  | 123 | double *ints_buf = prim_ints_; | 
|---|
|  | 124 | for (int gc1=0; gc1<int_shell1_->ncontraction(); gc1++) { | 
|---|
|  | 125 | double norm1 = int_shell1_->coefficient_unnorm(gc1,p1); | 
|---|
|  | 126 | int am1 = int_shell1_->am(gc1); | 
|---|
|  | 127 | for (int gc2=0; gc2<int_shell2_->ncontraction(); gc2++) { | 
|---|
|  | 128 | double norm2 = int_shell2_->coefficient_unnorm(gc2,p2); | 
|---|
|  | 129 | int am2 = int_shell2_->am(gc2); | 
|---|
|  | 130 | double total_pf = over_pf * norm1 * norm2; | 
|---|
|  | 131 |  | 
|---|
|  | 132 | int k1,l1,m1,k2,l2,m2; | 
|---|
|  | 133 | FOR_CART(k1,l1,m1,am1) | 
|---|
|  | 134 | FOR_CART(k2,l2,m2,am2) | 
|---|
|  | 135 | double x0 = OIX_[k1][k2]; | 
|---|
|  | 136 | double y0 = OIY_[l1][l2]; | 
|---|
|  | 137 | double z0 = OIZ_[m1][m2]; | 
|---|
|  | 138 | double x1 = OIX_[k1][k2+1]; | 
|---|
|  | 139 | double y1 = OIY_[l1][l2+1]; | 
|---|
|  | 140 | double z1 = OIZ_[m1][m2+1]; | 
|---|
|  | 141 | double mx = -total_pf * (x1 + BO[0]*x0) * y0 * z0; | 
|---|
|  | 142 | double my = -total_pf * (y1 + BO[1]*y0) * z0 * x0; | 
|---|
|  | 143 | double mz = -total_pf * (z1 + BO[2]*z0) * x0 * y0; | 
|---|
|  | 144 | *(ints_buf++) += mx; | 
|---|
|  | 145 | *(ints_buf++) += my; | 
|---|
|  | 146 | *(ints_buf++) += mz; | 
|---|
|  | 147 | END_FOR_CART | 
|---|
|  | 148 | END_FOR_CART | 
|---|
|  | 149 |  | 
|---|
|  | 150 | } | 
|---|
|  | 151 | } | 
|---|
|  | 152 | } | 
|---|
|  | 153 | } | 
|---|
|  | 154 |  | 
|---|
|  | 155 | if (need_cart2sph_transform) | 
|---|
|  | 156 | transform_contrquartets_vec_(ntypes, prim_ints_,contr_doublets_); | 
|---|
|  | 157 |  | 
|---|
|  | 158 | if (need_sort_to_shell_doublet) | 
|---|
|  | 159 | sort_contrdoublets_to_shelldoublet_vec_(ntypes, contr_doublets_,shell_doublet_); | 
|---|
|  | 160 | } | 
|---|
|  | 161 |  | 
|---|
|  | 162 |  | 
|---|
|  | 163 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 164 |  | 
|---|
|  | 165 | // Local Variables: | 
|---|
|  | 166 | // mode: c++ | 
|---|
|  | 167 | // c-file-style: "CLJ" | 
|---|
|  | 168 | // End: | 
|---|