MPQC  3.0.0-alpha
tform.timpl.h
1 //
2 // tform.timpl.h
3 //
4 // Copyright (C) 2011 Edward Valeev
5 //
6 // Author: Edward Valeev <evaleev@vt.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 #ifndef _mpqc_src_lib_chemistry_qc_libint2_tformtimpl_h
29 #define _mpqc_src_lib_chemistry_qc_libint2_tformtimpl_h
30 
31 #include <chemistry/qc/libint2/int1e.h>
32 #include <chemistry/qc/libint2/int2e.h>
33 #include <chemistry/qc/libint2/gto.h>
34 
35 namespace sc {
36 
37  template <unsigned int ntypes> void
38  Int1eLibint2::norm_contrcart_(double *data)
39  {
40  const GaussianShell& sh1 = *int_shell1_;
41  const GaussianShell& sh2 = *int_shell2_;
42 
43  // if there are no cartesian functions, no need to re-normalize -- spherical harmonics are always normalized
44  if (!sh1.has_cartesian() && !sh2.has_cartesian())
45  return;
46 
47  const Ref<GTOInfo>& gto = GTOInfo::instance();
48 
49  for (int gc1=0; gc1<sh1.ncontraction(); gc1++) {
50  const unsigned int am1 = sh1.am(gc1);
51  const unsigned int n1 = sh1.nfunction(gc1);
52  const int is_pure1 = sh1.is_pure(gc1);
53  const double* ptr1 = is_pure1 ? gto->fp1() : gto->norm(am1);
54 
55  for (int gc2=0; gc2<sh2.ncontraction(); gc2++) {
56  const unsigned int am2 = sh2.am(gc2);
57  const unsigned int n2 = sh2.nfunction(gc2);
58  const int is_pure2 = sh2.is_pure(gc2);
59  if ( (am1 <= 1 && am2 <= 1) || (is_pure1 && is_pure2) ) {
60  data += n1*n2*ntypes;
61  continue;
62  }
63  const double* ptr2 = is_pure2 ? gto->fp1() : gto->norm(am2);
64 
65  /*------------------------------------------------------------------------------------
66  Normalize contracted integrals - right here each cartesian component in the shell
67  has the same normalization coefficient so that only components with radial parts of
68  x^l, y^l, and z^l are normalized to unity. After this block of code all basis
69  functions are normalized to unity. Needed this so that integrals in terms of
70  puream i-functions were computed properly.
71  ------------------------------------------------------------------------------------*/
72  for (unsigned ii = 0; ii < n1; ii++) {
73  const double norm_i = (is_pure1 ? 1.0 : ptr1[ii]);
74  for (unsigned jj = 0; jj < n2; jj++) {
75  const double norm_ij = norm_i * (is_pure2 ? 1.0 : ptr2[jj]);
76  for (unsigned int t = 0; t < ntypes; ++t)
77  *(data++) *= norm_ij;
78  }
79  }
80 
81  }} // end of gen contr loops
82 
83  }
84 
85  template <unsigned int ntypes>
86  void
87  Int2eLibint2::norm_contrcart_(double *data)
88  {
89  const GaussianShell& sh1 = *int_shell1_;
90  const GaussianShell& sh2 = *int_shell2_;
91  const GaussianShell& sh3 = *int_shell3_;
92  const GaussianShell& sh4 = *int_shell4_;
93 
94  const Ref<GTOInfo>& gto = GTOInfo::instance();
95 
96  for (int gc1=0; gc1<sh1.ncontraction(); gc1++) {
97  const unsigned int am1 = sh1.am(gc1);
98  const unsigned int n1 = sh1.nfunction(gc1);
99  const int is_pure1 = sh1.is_pure(gc1);
100  const double* ptr1 = is_pure1 ? gto->fp1() : gto->norm(am1);
101 
102  for (int gc2=0; gc2<sh2.ncontraction(); gc2++) {
103  const unsigned int am2 = sh2.am(gc2);
104  const unsigned int n2 = sh2.nfunction(gc2);
105  const int is_pure2 = sh2.is_pure(gc2);
106  const double* ptr2 = is_pure2 ? gto->fp1() : gto->norm(am2);
107 
108  for (int gc3=0; gc3<sh3.ncontraction(); gc3++) {
109  const unsigned int am3 = sh3.am(gc3);
110  const unsigned int n3 = sh3.nfunction(gc3);
111  const int is_pure3 = sh3.is_pure(gc3);
112  const double* ptr3 = is_pure3 ? gto->fp1() : gto->norm(am3);
113 
114  for (int gc4=0; gc4<sh4.ncontraction(); gc4++) {
115  const unsigned int am4 = sh4.am(gc4);
116  const unsigned int n4 = sh4.nfunction(gc4);
117  const int is_pure4 = sh4.is_pure(gc4);
118  const double* ptr4 = is_pure4 ? gto->fp1() : gto->norm(am4);
119 
120  if (is_pure1 && is_pure2 && is_pure3 && is_pure4) {
121  data += n1*n2*n3*n4*ntypes;
122  continue;
123  }
124 
125  /*------------------------------------------------------------------------------------
126  Normalize contracted integrals - right here each cartesian component in the shell
127  has the same normalization coefficient so that only components with radial parts of
128  x^l, y^l, and z^l are normalized to unity. After this block of code all basis
129  functions are normalized to unity. Needed this so that integrals in terms of
130  puream i-functions were computed properly.
131  ------------------------------------------------------------------------------------*/
132  for (unsigned ii = 0; ii < n1; ii++) {
133  const double norm_i = is_pure1 ? 1.0 : ptr1[ii];
134  for (unsigned jj = 0; jj < n2; jj++) {
135  const double norm_ij = norm_i * (is_pure2 ? 1.0 : ptr2[jj]);
136  for (unsigned kk = 0; kk < n3; kk++) {
137  const double norm_ijk = norm_ij * (is_pure3 ? 1.0 : ptr3[kk]);
138  for (unsigned ll = 0; ll < n4; ll++) {
139  const double norm_ijkl = norm_ijk * (is_pure4 ? 1.0 : ptr4[ll]);
140  for(unsigned int t=0; t<ntypes; ++t)
141  *(data++) *= norm_ijkl;
142  }
143  }
144  }
145  }
146 
147  }}}} // end of gen contr loops
148 
149  }
150 
151 } // end of namespace sc
152 
153 #endif // end of header guard
154 
155 // Local Variables:
156 // mode: c++
157 // c-file-style: "CLJ-CONDENSED"
158 // End:
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:23:58 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.