| 1 | //
 | 
|---|
| 2 | // comp2e3c.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 | /* These routines compute two and three center electron repulsion
 | 
|---|
| 29 |  * integrals. */
 | 
|---|
| 30 | 
 | 
|---|
| 31 | #include <stdexcept>
 | 
|---|
| 32 | 
 | 
|---|
| 33 | #include <stdlib.h>
 | 
|---|
| 34 | #include <math.h>
 | 
|---|
| 35 | 
 | 
|---|
| 36 | #include <chemistry/qc/intv3/flags.h>
 | 
|---|
| 37 | #include <chemistry/qc/intv3/macros.h>
 | 
|---|
| 38 | #include <chemistry/qc/intv3/types.h>
 | 
|---|
| 39 | 
 | 
|---|
| 40 | #include <chemistry/qc/intv3/int2e.h>
 | 
|---|
| 41 | 
 | 
|---|
| 42 | using namespace sc;
 | 
|---|
| 43 | 
 | 
|---|
| 44 | void
 | 
|---|
| 45 | Int2eV3::make_int_unit_shell()
 | 
|---|
| 46 | {
 | 
|---|
| 47 |   double *exp = new double[1];
 | 
|---|
| 48 |   int *am = new int[1];
 | 
|---|
| 49 |   int *pure = new int[1];
 | 
|---|
| 50 |   double **c = new double*[1];
 | 
|---|
| 51 |   *c = new double[1];
 | 
|---|
| 52 | 
 | 
|---|
| 53 |   exp[0] = 0.0;
 | 
|---|
| 54 |   am[0] = 0;
 | 
|---|
| 55 |   pure[0] = 0;
 | 
|---|
| 56 |   c[0][0] = 1.0;
 | 
|---|
| 57 | 
 | 
|---|
| 58 |   int_unit_shell = new GaussianShell(1,1,exp,am,pure,c,
 | 
|---|
| 59 |                                      GaussianShell::Unnormalized,
 | 
|---|
| 60 |                                      false);
 | 
|---|
| 61 | }
 | 
|---|
| 62 | 
 | 
|---|
| 63 | void
 | 
|---|
| 64 | Int2eV3::delete_int_unit_shell()
 | 
|---|
| 65 | {
 | 
|---|
| 66 |   delete int_unit_shell;
 | 
|---|
| 67 |   int_unit_shell = 0;
 | 
|---|
| 68 | }
 | 
|---|
| 69 | 
 | 
|---|
| 70 | /* Compute a 2 center electron repulsion integral.  Electron 1 is in
 | 
|---|
| 71 |  * shell psh1 and electron 2 is in psh2, that is (1 | 2).  To avoid
 | 
|---|
| 72 |  * confusing the user of these routines, the INT_NOPERM is set.
 | 
|---|
| 73 |  */
 | 
|---|
| 74 | void
 | 
|---|
| 75 | Int2eV3::erep_2center(int &psh1, int &psh2)
 | 
|---|
| 76 | {
 | 
|---|
| 77 |   if (bs2_.nonnull() || bs4_.nonnull()) {
 | 
|---|
| 78 |       throw std::runtime_error("erep_2center: bs2 or bs4 not null");
 | 
|---|
| 79 |     }
 | 
|---|
| 80 |   //int shd = 0x11111111; /* a dummy shell that will cause death if used */
 | 
|---|
| 81 |   int shd = 0; // shell = 0 is used so intermediate lookup will work
 | 
|---|
| 82 |   int oldperm = permute();
 | 
|---|
| 83 |   set_permute(0);
 | 
|---|
| 84 |   erep(psh1,shd,psh2,shd);
 | 
|---|
| 85 |   set_permute(oldperm);
 | 
|---|
| 86 | }
 | 
|---|
| 87 | 
 | 
|---|
| 88 | /* This is an alternate interface to int_erep2.  It takes
 | 
|---|
| 89 |  * as arguments the flags, an integer vector of shell numbers
 | 
|---|
| 90 |  * and an integer vector which will be filled in with size
 | 
|---|
| 91 |  * information, if it is non-NULL. */
 | 
|---|
| 92 | void
 | 
|---|
| 93 | Int2eV3::erep_2center(int *shells, int  *sizes)
 | 
|---|
| 94 | {
 | 
|---|
| 95 |   erep_2center(shells[0],shells[1]);
 | 
|---|
| 96 |   if (sizes) {
 | 
|---|
| 97 |       sizes[0] = bs1_->shell(shells[0]).nfunction();
 | 
|---|
| 98 |       sizes[1] = bs3_->shell(shells[1]).nfunction();
 | 
|---|
| 99 |     }
 | 
|---|
| 100 | }
 | 
|---|
| 101 | 
 | 
|---|
| 102 | 
 | 
|---|
| 103 | /* Computes a 3 center two electron integral.  Electron 1 is in psh1
 | 
|---|
| 104 |  * and electron 2 is in psh2 and psh3, that is (1 2 | 3).  To avoid
 | 
|---|
| 105 |  * confusing the user of these routines, the INT_NOPERM is set.
 | 
|---|
| 106 |  */
 | 
|---|
| 107 | void
 | 
|---|
| 108 | Int2eV3::erep_3center(int &psh1, int &psh2, int &psh3)
 | 
|---|
| 109 | {
 | 
|---|
| 110 |   if (bs4_.nonnull()) {
 | 
|---|
| 111 |       throw std::runtime_error("erep_3center: bs4 not null");
 | 
|---|
| 112 |     }
 | 
|---|
| 113 |   //int shd = 0x11111111; /* a dummy shell that will cause death if used */
 | 
|---|
| 114 |   int shd = 0; // shell = 0 is used so intermediate lookup will work
 | 
|---|
| 115 |   int oldperm = permute();
 | 
|---|
| 116 |   set_permute(0);
 | 
|---|
| 117 |   erep(psh1,psh2,psh3,shd);
 | 
|---|
| 118 |   set_permute(oldperm);
 | 
|---|
| 119 | }
 | 
|---|
| 120 | 
 | 
|---|
| 121 | /* This is an alternate interface to int_erep3.  It takes
 | 
|---|
| 122 |  * as arguments the flags, an integer vector of shell numbers
 | 
|---|
| 123 |  * and an integer vector which will be filled in with size
 | 
|---|
| 124 |  * information, if it is non-NULL. */
 | 
|---|
| 125 | void
 | 
|---|
| 126 | Int2eV3::erep_3center(int *shells, int  *sizes)
 | 
|---|
| 127 | {
 | 
|---|
| 128 |   erep_3center(shells[0],shells[1],shells[2]);
 | 
|---|
| 129 |   if (sizes) {
 | 
|---|
| 130 |       sizes[0] = bs1_->shell(shells[0]).nfunction();
 | 
|---|
| 131 |       sizes[1] = bs2_->shell(shells[1]).nfunction();
 | 
|---|
| 132 |       sizes[2] = bs3_->shell(shells[2]).nfunction();
 | 
|---|
| 133 |     }
 | 
|---|
| 134 | }
 | 
|---|
| 135 | 
 | 
|---|
| 136 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 137 | 
 | 
|---|
| 138 | // Local Variables:
 | 
|---|
| 139 | // mode: c++
 | 
|---|
| 140 | // c-file-style: "CLJ"
 | 
|---|
| 141 | // End:
 | 
|---|