1      Subroutine hf2oi(E,Sab,Nints,NPP,La,Lb,Li,canAB)
2c $Id$
3
4      Implicit none
5
6      integer Nints,NPP,La,Lb,Li
7      logical canAB
8
9c--> Hermite Linear Expansion Coefficients
10
11      double precision E(3,NPP,0:((La+Li)+(Lb+Li)),0:(La+Li),0:(Lb+Li))
12
13c--> 2-Center Overlap Integrals
14
15      double precision Sab(Nints)
16
17      integer Nxyz(3)
18
19c--> Local variables
20
21      integer nn,ma,mb,mb_limit,mp,La2,Lb2
22      integer Ia,Ja,Ka, Ib,Jb,Kb
23      double precision sabval
24c
25c Compute the 2-ctr overlap integrals.
26c
27c     formula:
28c
29c             Ia,Ib   Ja,Jb   Ka,Kb
30c     Sab = Ex      Ey      Ez
31c             0       0       0
32c
33c******************************************************************************
34
35c Initialize the block of integrals
36
37
38c Define the number of shell components on each center.
39
40      La2 = ((La+1)*(La+2))/2
41      Lb2 = ((Lb+1)*(Lb+2))/2
42
43c Loop over shell components.
44
45      nn = 0
46
47      do ma = 1,La2
48
49c Define the angular momentum indices for shell "A".
50
51        call getNxyz(La,ma,Nxyz)
52
53        Ia = Nxyz(1)
54        Ja = Nxyz(2)
55        Ka = Nxyz(3)
56
57        if( canAB )then
58          mb_limit = ma
59        else
60          mb_limit = Lb2
61        end if
62
63        do mb = 1,mb_limit
64
65c Define the angular momentum indices for shell "B".
66
67          call getNxyz(Lb,mb,Nxyz)
68
69          Ib = Nxyz(1)
70          Jb = Nxyz(2)
71          Kb = Nxyz(3)
72
73
74          sabval=0d0
75          do mp = 1,NPP
76            sabval = sabval + E(1,mp,0,Ia,Ib)*
77     &                          E(2,mp,0,Ja,Jb)*
78     &                          E(3,mp,0,Ka,Kb)
79          end do
80          nn = nn + 1
81          Sab(nn) = sabval
82
83        end do
84
85      end do
86
87      end
88************************************************************************
89      Subroutine hf2oi_gc(E,Sab,SabP,SabH,Acoefs,Bcoefs,ipairp,
90     &    NPA,NPB,NCA,NCB,NPP,La,Lb,La2,Lb2,Li,canAB)
91c
92      implicit none
93
94      integer NPA,NPB,NCA,NCB,NPP,La,Lb,La2,Lb2,Li
95      logical canAB
96
97c--> Hermite Linear Expansion Coefficients
98
99      double precision E(3,NPP,0:((La+Li)+(Lb+Li)),0:(La+Li),0:(Lb+Li))
100
101c--> Index of primitives
102
103      integer ipairp(2,NPP)
104
105c--> Kinetic Energy Integrals
106
107      double precision Sab(Lb2,ncb,La2,nca)
108      double precision SabP(NPP)
109      double precision SabH(NPA,NCB)
110
111c--> general contraction matrices
112
113      double precision Acoefs(NPA,NCA)
114      double precision Bcoefs(NPB,NCB)
115
116c--> Scratch Space
117
118      integer Nxyz(3)
119
120c--> Local variables
121
122      integer ma,mb,mp, ica,icb,icb_limit,ipa,ipb
123      integer Ia,Ja,Ka, Ib,Jb,Kb
124c
125c Compute the 2-ctr overlap integrals.
126c
127c     formula:
128c
129c             Ia,Ib   Ja,Jb   Ka,Kb
130c     Sab = Ex      Ey      Ez
131c             0       0       0
132c
133c******************************************************************************
134
135c Initialize the block of integrals
136
137      call dfill(La2*Lb2*nca*ncb,0.0d00,Sab,1)
138
139c Loop over shell components.
140
141      do ma = 1,La2
142
143c Define the angular momentum indices for shell "A".
144
145        call getNxyz(La,ma,Nxyz)
146
147        Ia = Nxyz(1)
148        Ja = Nxyz(2)
149        Ka = Nxyz(3)
150
151        do mb = 1,Lb2
152
153c Define the angular momentum indices for shell "B".
154
155          call getNxyz(Lb,mb,Nxyz)
156
157          Ib = Nxyz(1)
158          Jb = Nxyz(2)
159          Kb = Nxyz(3)
160
161          do mp = 1,NPP
162            SabP(mp) = E(1,mp,0,Ia,Ib)*E(2,mp,0,Ja,Jb)*E(3,mp,0,Ka,Kb)
163          end do
164
165c Contract over B shell
166
167          call dfill(NCB*NPA,0.0d00,SabH,1)
168          do icb = 1,NCB
169            do mp = 1,NPP
170              ipa = ipairp(1,mp)
171              ipb = ipairp(2,mp)
172              SabH(ipa,icb) = SabH(ipa,icb)+SabP(mp)*Bcoefs(ipb,icb)
173            end do
174          end do
175
176c Contract over A shell
177
178          do ica = 1,NCA
179            if( canAB )then
180              icb_limit = ica
181            else
182              icb_limit = NCB
183            end if
184            do icb = 1,icb_limit
185              do ipa = 1,NPA
186                Sab(mb,icb,ma,ica) = Sab(mb,icb,ma,ica) +
187     &              SabH(ipa,icb)*Acoefs(ipa,ica)
188              end do
189            end do
190          end do
191
192        end do
193
194      end do
195
196      if (canAB) call canon_ab(Sab,Sab,Lb2*NCB,La2*NCA)
197
198      end
199