| [0b990d] | 1 | //
 | 
|---|
 | 2 | // obintv3.cc
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // Copyright (C) 1996 Limit Point Systems, Inc.
 | 
|---|
 | 5 | //
 | 
|---|
 | 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
 | 
|---|
 | 7 | // Maintainer: LPS
 | 
|---|
 | 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 | #include <chemistry/qc/intv3/obintv3.h>
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | using namespace sc;
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 33 | // OneBodyIntV3
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | OneBodyIntV3::OneBodyIntV3(Integral* integral,
 | 
|---|
 | 36 |                            const Ref<GaussianBasisSet>&bs1,
 | 
|---|
 | 37 |                            const Ref<GaussianBasisSet>&bs2,
 | 
|---|
 | 38 |                            IntegralFunction ifunc):
 | 
|---|
 | 39 |   OneBodyInt(integral,bs1,bs2)
 | 
|---|
 | 40 | {
 | 
|---|
 | 41 |   int1ev3_ = new Int1eV3(integral,bs1,bs2,0);
 | 
|---|
 | 42 |   intfunc_ = ifunc;
 | 
|---|
 | 43 |   buffer_ = int1ev3_->buffer();
 | 
|---|
 | 44 | }
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | OneBodyIntV3::~OneBodyIntV3()
 | 
|---|
 | 47 | {
 | 
|---|
 | 48 | }
 | 
|---|
 | 49 | 
 | 
|---|
 | 50 | void
 | 
|---|
 | 51 | OneBodyIntV3::compute_shell(int i, int j)
 | 
|---|
 | 52 | {
 | 
|---|
 | 53 |   (int1ev3_.pointer()->*intfunc_)(i, j);
 | 
|---|
 | 54 | }
 | 
|---|
 | 55 | 
 | 
|---|
 | 56 | bool
 | 
|---|
 | 57 | OneBodyIntV3::cloneable()
 | 
|---|
 | 58 | {
 | 
|---|
 | 59 |   return true;
 | 
|---|
 | 60 | }
 | 
|---|
 | 61 | 
 | 
|---|
 | 62 | Ref<OneBodyInt>
 | 
|---|
 | 63 | OneBodyIntV3::clone()
 | 
|---|
 | 64 | {
 | 
|---|
 | 65 |   return new OneBodyIntV3(integral_, bs1_, bs2_, intfunc_);
 | 
|---|
 | 66 | }
 | 
|---|
 | 67 | 
 | 
|---|
 | 68 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 69 | // PointChargeIntV3
 | 
|---|
 | 70 | 
 | 
|---|
 | 71 | PointChargeIntV3::PointChargeIntV3(
 | 
|---|
 | 72 |     Integral *integral,
 | 
|---|
 | 73 |     const Ref<GaussianBasisSet>&bs1,
 | 
|---|
 | 74 |     const Ref<GaussianBasisSet>&bs2,
 | 
|---|
 | 75 |     const Ref<PointChargeData>&dat):
 | 
|---|
 | 76 |   OneBodyInt(integral,bs1,bs2),
 | 
|---|
 | 77 |   data_(dat)
 | 
|---|
 | 78 | {
 | 
|---|
 | 79 |   int1ev3_ = new Int1eV3(integral,bs1,bs2,0);
 | 
|---|
 | 80 |   buffer_ = int1ev3_->buffer();
 | 
|---|
 | 81 | }
 | 
|---|
 | 82 | 
 | 
|---|
 | 83 | PointChargeIntV3::~PointChargeIntV3()
 | 
|---|
 | 84 | {
 | 
|---|
 | 85 | }
 | 
|---|
 | 86 | 
 | 
|---|
 | 87 | void
 | 
|---|
 | 88 | PointChargeIntV3::compute_shell(int i,int j)
 | 
|---|
 | 89 | {
 | 
|---|
 | 90 |   int1ev3_->point_charge(i,j,
 | 
|---|
 | 91 |                          data_->ncharges(),
 | 
|---|
 | 92 |                          data_->charges(),
 | 
|---|
 | 93 |                          data_->positions());
 | 
|---|
 | 94 | }
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 97 | // EfieldDotVectorIntV3
 | 
|---|
 | 98 | 
 | 
|---|
 | 99 | EfieldDotVectorIntV3::EfieldDotVectorIntV3(
 | 
|---|
 | 100 |     Integral *integral,
 | 
|---|
 | 101 |     const Ref<GaussianBasisSet>&bs1,
 | 
|---|
 | 102 |     const Ref<GaussianBasisSet>&bs2,
 | 
|---|
 | 103 |     const Ref<EfieldDotVectorData>&dat) :
 | 
|---|
 | 104 |   OneBodyInt(integral,bs1,bs2),
 | 
|---|
 | 105 |   data_(dat)
 | 
|---|
 | 106 | {
 | 
|---|
 | 107 |   int1ev3_ = new Int1eV3(integral,bs1,bs2,0);
 | 
|---|
 | 108 |   buffer_ = int1ev3_->buffer();
 | 
|---|
 | 109 | }
 | 
|---|
 | 110 | 
 | 
|---|
 | 111 | EfieldDotVectorIntV3::~EfieldDotVectorIntV3()
 | 
|---|
 | 112 | {
 | 
|---|
 | 113 | }
 | 
|---|
 | 114 | 
 | 
|---|
 | 115 | void
 | 
|---|
 | 116 | EfieldDotVectorIntV3::compute_shell(int i,int j)
 | 
|---|
 | 117 | {
 | 
|---|
 | 118 |   int nbfi = basis1()->shell(i).nfunction();
 | 
|---|
 | 119 |   int nbfj = basis2()->shell(j).nfunction();
 | 
|---|
 | 120 |   int nint = nbfi*nbfj;
 | 
|---|
 | 121 |   double *tmp;
 | 
|---|
 | 122 |   int ii,jj;
 | 
|---|
 | 123 | 
 | 
|---|
 | 124 |   int1ev3_->efield(i,j,data_->position);
 | 
|---|
 | 125 | 
 | 
|---|
 | 126 |   tmp = int1ev3_->buffer();
 | 
|---|
 | 127 |   for (ii=0; ii<nint; ii++) {
 | 
|---|
 | 128 |       double tmpval = 0.0;
 | 
|---|
 | 129 |       for (jj=0; jj<3; jj++) {
 | 
|---|
 | 130 |           tmpval += *tmp++ * data_->vector[jj];
 | 
|---|
 | 131 |         }
 | 
|---|
 | 132 |       buffer_[ii] = tmpval;
 | 
|---|
 | 133 |     }
 | 
|---|
 | 134 | }
 | 
|---|
 | 135 | 
 | 
|---|
 | 136 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 137 | // DipoleIntV3
 | 
|---|
 | 138 | 
 | 
|---|
 | 139 | DipoleIntV3::DipoleIntV3(Integral *integral,
 | 
|---|
 | 140 |                          const Ref<GaussianBasisSet>&bs1,
 | 
|---|
 | 141 |                          const Ref<GaussianBasisSet>&bs2,
 | 
|---|
 | 142 |                          const Ref<DipoleData>&dat) :
 | 
|---|
 | 143 |   OneBodyInt(integral,bs1,bs2),
 | 
|---|
 | 144 |   data_(dat)
 | 
|---|
 | 145 | {
 | 
|---|
 | 146 |   int1ev3_ = new Int1eV3(integral,bs1,bs2,0);
 | 
|---|
 | 147 |   buffer_ = int1ev3_->buffer();
 | 
|---|
 | 148 |   if (data_.null()) {
 | 
|---|
 | 149 |       data_ = new DipoleData;
 | 
|---|
 | 150 |     }
 | 
|---|
 | 151 | }
 | 
|---|
 | 152 | 
 | 
|---|
 | 153 | DipoleIntV3::~DipoleIntV3()
 | 
|---|
 | 154 | {
 | 
|---|
 | 155 | }
 | 
|---|
 | 156 | 
 | 
|---|
 | 157 | void
 | 
|---|
 | 158 | DipoleIntV3::compute_shell(int i,int j)
 | 
|---|
 | 159 | {
 | 
|---|
 | 160 |   int1ev3_->dipole(i,j,data_->origin);
 | 
|---|
 | 161 | }
 | 
|---|
 | 162 | 
 | 
|---|
 | 163 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 164 | // OneBodyDerivIntV3
 | 
|---|
 | 165 | 
 | 
|---|
 | 166 | OneBodyDerivIntV3::OneBodyDerivIntV3(Integral *integral,
 | 
|---|
 | 167 |                                      const Ref<GaussianBasisSet>&bs1,
 | 
|---|
 | 168 |                                      const Ref<GaussianBasisSet>&bs2,
 | 
|---|
 | 169 |                                      IntegralFunction ifunc):
 | 
|---|
 | 170 |   OneBodyDerivInt(integral,bs1,bs2)
 | 
|---|
 | 171 | {
 | 
|---|
 | 172 |   int1ev3_ = new Int1eV3(integral,bs1,bs2,1);
 | 
|---|
 | 173 |   intfunc_ = ifunc;
 | 
|---|
 | 174 |   buffer_ = int1ev3_->buffer();
 | 
|---|
 | 175 | }
 | 
|---|
 | 176 | 
 | 
|---|
 | 177 | OneBodyDerivIntV3::~OneBodyDerivIntV3()
 | 
|---|
 | 178 | {
 | 
|---|
 | 179 | }
 | 
|---|
 | 180 | 
 | 
|---|
 | 181 | void
 | 
|---|
 | 182 | OneBodyDerivIntV3::compute_shell(int i, int j, DerivCenters& c)
 | 
|---|
 | 183 | {
 | 
|---|
 | 184 |   (int1ev3_.pointer()->*intfunc_)(i,j,0,basis1()->shell_to_center(i));
 | 
|---|
 | 185 |   c.clear();
 | 
|---|
 | 186 |   c.add_center(0,basis1(),i);
 | 
|---|
 | 187 |   c.add_omitted(1,basis2(),j);
 | 
|---|
 | 188 | 
 | 
|---|
 | 189 | // temporary debugging stuff for cca integrals comparison
 | 
|---|
 | 190 | //  if( 1 ) {
 | 
|---|
 | 191 | //    std::cerr << "buffer for shell doublet (with dc):\n";
 | 
|---|
 | 192 | //    std::cerr << "shellnum1: " << i << std::endl;
 | 
|---|
 | 193 | //    GaussianShell* s1 = &( bs1->shell(i) );
 | 
|---|
 | 194 | //    int nc1 = s1->ncontraction();
 | 
|---|
 | 195 | //    for (int ii=0; ii<nc1; ++ii)
 | 
|---|
 | 196 | //      std::cerr << "am: " << s1->am(ii) << std::endl;
 | 
|---|
 | 197 | //    std::cerr << "shellnum2: " << j << std::endl;
 | 
|---|
 | 198 | //    GaussianShell* s2 = &( bs2->shell(j) );
 | 
|---|
 | 199 | //    int nc2 = s2->ncontraction();
 | 
|---|
 | 200 | //    for (int ii=0; ii<nc2; ++ii)
 | 
|---|
 | 201 | //      std::cerr << "am: " << s2->am(ii) << std::endl;
 | 
|---|
 | 202 | //
 | 
|---|
 | 203 | //    int nfunc = s1->max_cartesian() * s2->max_cartesian();
 | 
|---|
 | 204 | //    std::cerr << "dx\n";
 | 
|---|
 | 205 | //    for( int ii=0; ii<nfunc; ++ii)
 | 
|---|
 | 206 | //      std::cerr << buffer_[ii] << std::endl;
 | 
|---|
 | 207 | //    std::cerr << "dy\n";
 | 
|---|
 | 208 | //    for( int ii=nfunc; ii<nfunc*2; ++ii)
 | 
|---|
 | 209 | //      std::cerr << buffer_[ii] << std::endl;
 | 
|---|
 | 210 | //    std::cerr << "dz\n";
 | 
|---|
 | 211 | //    for( int ii=nfunc*2; ii<nfunc*3; ++ii)
 | 
|---|
 | 212 | //      std::cerr << buffer_[ii] << std::endl;
 | 
|---|
 | 213 | //  }
 | 
|---|
 | 214 | 
 | 
|---|
 | 215 | }
 | 
|---|
 | 216 | 
 | 
|---|
 | 217 | void
 | 
|---|
 | 218 | OneBodyDerivIntV3::compute_shell(int i, int j, int c)
 | 
|---|
 | 219 | {
 | 
|---|
 | 220 |   (int1ev3_.pointer()->*intfunc_)(i,j,0,c);
 | 
|---|
 | 221 | 
 | 
|---|
 | 222 | // temporary debuging stuff for cca integrals comparison
 | 
|---|
 | 223 | //  if( 1 ) {
 | 
|---|
 | 224 | //    std::cerr << "doing center " << c << std::endl;
 | 
|---|
 | 225 | //    std::cerr << "buffer for shell doublet:\n";
 | 
|---|
 | 226 | //    std::cerr << "shellnum1: " << i << std::endl;
 | 
|---|
 | 227 | //    GaussianShell* s1 = &( bs1->shell(i) );
 | 
|---|
 | 228 | //    int nc1 = s1->ncontraction();
 | 
|---|
 | 229 | //    for (int ii=0; ii<nc1; ++ii)
 | 
|---|
 | 230 | //      std::cerr << "am: " << s1->am(ii) << std::endl;
 | 
|---|
 | 231 | //    std::cerr << "shellnum2: " << j << std::endl;
 | 
|---|
 | 232 | //    GaussianShell* s2 = &( bs2->shell(j) );
 | 
|---|
 | 233 | //    int nc2 = s2->ncontraction();
 | 
|---|
 | 234 | //    for (int ii=0; ii<nc2; ++ii)
 | 
|---|
 | 235 | //      std::cerr << "am: " << s2->am(ii) << std::endl;
 | 
|---|
 | 236 | //
 | 
|---|
 | 237 | //    int nfunc = s1->max_cartesian() * s2->max_cartesian();
 | 
|---|
 | 238 | //    std::cerr << "dx\n";
 | 
|---|
 | 239 | //    for( int ii=0; ii<nfunc; ++ii)
 | 
|---|
 | 240 | //      std::cerr << buffer_[ii] << std::endl;
 | 
|---|
 | 241 | //    std::cerr << "dy\n";
 | 
|---|
 | 242 | //    for( int ii=nfunc; ii<nfunc*2; ++ii)
 | 
|---|
 | 243 | //      std::cerr << buffer_[ii] << std::endl;
 | 
|---|
 | 244 | //    std::cerr << "dz\n";
 | 
|---|
 | 245 | //    for( int ii=nfunc*2; ii<nfunc*3; ++ii)
 | 
|---|
 | 246 | //      std::cerr << buffer_[ii] << std::endl;
 | 
|---|
 | 247 | //  }
 | 
|---|
 | 248 | 
 | 
|---|
 | 249 | }
 | 
|---|
 | 250 | 
 | 
|---|
 | 251 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 252 | 
 | 
|---|
 | 253 | // Local Variables:
 | 
|---|
 | 254 | // mode: c++
 | 
|---|
 | 255 | // c-file-style: "CLJ"
 | 
|---|
 | 256 | // End:
 | 
|---|