1 #include "simint/boys/boys.h"
2 #include "simint/ostei/gen/ostei_generated.h"
3 #include "simint/vectorization/vectorization.h"
4 #include <math.h>
5 #include <string.h>
6 
7 
ostei_h_h_s_s(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__h_h_s_s)8 int ostei_h_h_s_s(struct simint_multi_shellpair const P,
9                   struct simint_multi_shellpair const Q,
10                   double screen_tol,
11                   double * const restrict work,
12                   double * const restrict INT__h_h_s_s)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__h_h_s_s);
17     int ab, cd, abcd;
18     int istart, jstart;
19     int iprimcd, nprim_icd, icd;
20     const int check_screen = (screen_tol > 0.0);
21     int i, j;
22     int n;
23     int not_screened;
24     int real_abcd;
25     int iket;
26 
27     // partition workspace
28     double * const INT__h_s_s_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__i_s_s_s = work + (SIMINT_NSHELL_SIMD * 21);
30     double * const INT__k_s_s_s = work + (SIMINT_NSHELL_SIMD * 49);
31     double * const INT__l_s_s_s = work + (SIMINT_NSHELL_SIMD * 85);
32     double * const INT__m_s_s_s = work + (SIMINT_NSHELL_SIMD * 130);
33     double * const INT__n_s_s_s = work + (SIMINT_NSHELL_SIMD * 185);
34     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*251);
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 11;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 41;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 95;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 175;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 280;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 406;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_s_s = primwork + 546;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_s_s = primwork + 690;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_s_s = primwork + 825;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_s_s = primwork + 935;
46     double * const hrrwork = (double *)(primwork + 1001);
47     double * const HRR_INT__h_p_s_s = hrrwork + 0;
48     double * const HRR_INT__h_d_s_s = hrrwork + 63;
49     double * const HRR_INT__h_f_s_s = hrrwork + 189;
50     double * const HRR_INT__h_g_s_s = hrrwork + 399;
51     double * const HRR_INT__i_p_s_s = hrrwork + 714;
52     double * const HRR_INT__i_d_s_s = hrrwork + 798;
53     double * const HRR_INT__i_f_s_s = hrrwork + 966;
54     double * const HRR_INT__i_g_s_s = hrrwork + 1246;
55     double * const HRR_INT__k_p_s_s = hrrwork + 1666;
56     double * const HRR_INT__k_d_s_s = hrrwork + 1774;
57     double * const HRR_INT__k_f_s_s = hrrwork + 1990;
58     double * const HRR_INT__l_p_s_s = hrrwork + 2350;
59     double * const HRR_INT__l_d_s_s = hrrwork + 2485;
60     double * const HRR_INT__m_p_s_s = hrrwork + 2755;
61 
62 
63     // Create constants
64     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
65     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
66     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
67     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
68     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
69     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
70     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
71     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
72     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
73     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
74 
75 
76     ////////////////////////////////////////
77     // Loop over shells and primitives
78     ////////////////////////////////////////
79 
80     real_abcd = 0;
81     istart = 0;
82     for(ab = 0; ab < P.nshell12_clip; ++ab)
83     {
84         const int iend = istart + P.nprim12[ab];
85 
86         cd = 0;
87         jstart = 0;
88 
89         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
90         {
91             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
92             int jend = jstart;
93             for(i = 0; i < nshellbatch; i++)
94                 jend += Q.nprim12[cd+i];
95 
96             // Clear the beginning of the workspace (where we are accumulating integrals)
97             memset(work, 0, SIMINT_NSHELL_SIMD * 251 * sizeof(double));
98             abcd = 0;
99 
100 
101             for(i = istart; i < iend; ++i)
102             {
103                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
104 
105                 if(check_screen)
106                 {
107                     // Skip this whole thing if always insignificant
108                     if((P.screen[i] * Q.screen_max) < screen_tol)
109                         continue;
110                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
111                 }
112 
113                 icd = 0;
114                 iprimcd = 0;
115                 nprim_icd = Q.nprim12[cd];
116                 double * restrict PRIM_PTR_INT__h_s_s_s = INT__h_s_s_s + abcd * 21;
117                 double * restrict PRIM_PTR_INT__i_s_s_s = INT__i_s_s_s + abcd * 28;
118                 double * restrict PRIM_PTR_INT__k_s_s_s = INT__k_s_s_s + abcd * 36;
119                 double * restrict PRIM_PTR_INT__l_s_s_s = INT__l_s_s_s + abcd * 45;
120                 double * restrict PRIM_PTR_INT__m_s_s_s = INT__m_s_s_s + abcd * 55;
121                 double * restrict PRIM_PTR_INT__n_s_s_s = INT__n_s_s_s + abcd * 66;
122 
123 
124 
125                 // Load these one per loop over i
126                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
127                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
128                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
129 
130                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
131 
132                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
133                 {
134                     // calculate the shell offsets
135                     // these are the offset from the shell pointed to by cd
136                     // for each element
137                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
138                     int lastoffset = 0;
139                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
140 
141                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
142                     {
143                         // Handle if the first element of the vector is a new shell
144                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
145                         {
146                             nprim_icd += Q.nprim12[cd + (++icd)];
147                             PRIM_PTR_INT__h_s_s_s += 21;
148                             PRIM_PTR_INT__i_s_s_s += 28;
149                             PRIM_PTR_INT__k_s_s_s += 36;
150                             PRIM_PTR_INT__l_s_s_s += 45;
151                             PRIM_PTR_INT__m_s_s_s += 55;
152                             PRIM_PTR_INT__n_s_s_s += 66;
153                         }
154                         iprimcd++;
155                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
156                         {
157                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
158                             {
159                                 shelloffsets[n] = shelloffsets[n-1] + 1;
160                                 lastoffset++;
161                                 nprim_icd += Q.nprim12[cd + (++icd)];
162                             }
163                             else
164                                 shelloffsets[n] = shelloffsets[n-1];
165                             iprimcd++;
166                         }
167                     }
168                     else
169                         iprimcd += SIMINT_SIMD_LEN;
170 
171                     // Do we have to compute this vector (or has it been screened out)?
172                     // (not_screened != 0 means we have to do this vector)
173                     if(check_screen)
174                     {
175                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
176                         if(vmax < screen_tol)
177                         {
178                             PRIM_PTR_INT__h_s_s_s += lastoffset*21;
179                             PRIM_PTR_INT__i_s_s_s += lastoffset*28;
180                             PRIM_PTR_INT__k_s_s_s += lastoffset*36;
181                             PRIM_PTR_INT__l_s_s_s += lastoffset*45;
182                             PRIM_PTR_INT__m_s_s_s += lastoffset*55;
183                             PRIM_PTR_INT__n_s_s_s += lastoffset*66;
184                             continue;
185                         }
186                     }
187 
188                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
189                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
190                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
191                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
192 
193 
194                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
195                     SIMINT_DBLTYPE PQ[3];
196                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
197                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
198                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
199                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
200                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
201                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
202 
203                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
204                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
205                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
206                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
207                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
208                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
209 
210                     // NOTE: Minus sign!
211                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
212                     SIMINT_DBLTYPE aop_PQ[3];
213                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
214                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
215                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
216 
217 
218                     //////////////////////////////////////////////
219                     // Fjt function section
220                     // Maximum v value: 10
221                     //////////////////////////////////////////////
222                     // The parameter to the Fjt function
223                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
224 
225 
226                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
227 
228 
229                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 10);
230                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
231                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
232                     for(n = 0; n <= 10; n++)
233                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
234 
235                     //////////////////////////////////////////////
236                     // Primitive integrals: Vertical recurrance
237                     //////////////////////////////////////////////
238 
239                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
240                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
241                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
242                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
243                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
244                     const SIMINT_DBLTYPE vrr_const_6_over_2p = SIMINT_MUL(const_6, one_over_2p);
245                     const SIMINT_DBLTYPE vrr_const_7_over_2p = SIMINT_MUL(const_7, one_over_2p);
246                     const SIMINT_DBLTYPE vrr_const_8_over_2p = SIMINT_MUL(const_8, one_over_2p);
247                     const SIMINT_DBLTYPE vrr_const_9_over_2p = SIMINT_MUL(const_9, one_over_2p);
248 
249 
250 
251                     // Forming PRIM_INT__p_s_s_s[10 * 3];
252                     for(n = 0; n < 10; ++n)  // loop over orders of auxiliary function
253                     {
254 
255                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
256                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]);
257 
258                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
259                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 1]);
260 
261                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
262                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 2]);
263 
264                     }
265 
266 
267 
268                     // Forming PRIM_INT__d_s_s_s[9 * 6];
269                     for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
270                     {
271 
272                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
273                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 0]);
274                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 0]);
275 
276                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
277                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_s[n * 6 + 3]);
278                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 3]);
279 
280                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
281                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_s_s[n * 6 + 5]);
282                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 5]);
283 
284                     }
285 
286 
287 
288                     // Forming PRIM_INT__f_s_s_s[8 * 10];
289                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
290                     {
291 
292                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
293                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 0]);
294                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__f_s_s_s[n * 10 + 0]);
295 
296                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
297                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 1]);
298 
299                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
300                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 2]);
301 
302                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
303                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 6]);
304                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__f_s_s_s[n * 10 + 6]);
305 
306                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
307                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 7]);
308 
309                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
310                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 9]);
311                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__f_s_s_s[n * 10 + 9]);
312 
313                     }
314 
315 
316                     VRR_I_g_s_s_s(
317                             PRIM_INT__g_s_s_s,
318                             PRIM_INT__f_s_s_s,
319                             PRIM_INT__d_s_s_s,
320                             P_PA,
321                             a_over_p,
322                             aop_PQ,
323                             one_over_2p,
324                             7);
325 
326 
327                     VRR_I_h_s_s_s(
328                             PRIM_INT__h_s_s_s,
329                             PRIM_INT__g_s_s_s,
330                             PRIM_INT__f_s_s_s,
331                             P_PA,
332                             a_over_p,
333                             aop_PQ,
334                             one_over_2p,
335                             6);
336 
337 
338                     ostei_general_vrr1_I(6, 5,
339                             one_over_2p, a_over_p, aop_PQ, P_PA,
340                             PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
341 
342 
343                     ostei_general_vrr1_I(7, 4,
344                             one_over_2p, a_over_p, aop_PQ, P_PA,
345                             PRIM_INT__i_s_s_s, PRIM_INT__h_s_s_s, PRIM_INT__k_s_s_s);
346 
347 
348                     ostei_general_vrr1_I(8, 3,
349                             one_over_2p, a_over_p, aop_PQ, P_PA,
350                             PRIM_INT__k_s_s_s, PRIM_INT__i_s_s_s, PRIM_INT__l_s_s_s);
351 
352 
353                     ostei_general_vrr1_I(9, 2,
354                             one_over_2p, a_over_p, aop_PQ, P_PA,
355                             PRIM_INT__l_s_s_s, PRIM_INT__k_s_s_s, PRIM_INT__m_s_s_s);
356 
357 
358                     ostei_general_vrr1_I(10, 1,
359                             one_over_2p, a_over_p, aop_PQ, P_PA,
360                             PRIM_INT__m_s_s_s, PRIM_INT__l_s_s_s, PRIM_INT__n_s_s_s);
361 
362 
363 
364 
365                     ////////////////////////////////////
366                     // Accumulate contracted integrals
367                     ////////////////////////////////////
368                     if(lastoffset == 0)
369                     {
370                         contract_all(21, PRIM_INT__h_s_s_s, PRIM_PTR_INT__h_s_s_s);
371                         contract_all(28, PRIM_INT__i_s_s_s, PRIM_PTR_INT__i_s_s_s);
372                         contract_all(36, PRIM_INT__k_s_s_s, PRIM_PTR_INT__k_s_s_s);
373                         contract_all(45, PRIM_INT__l_s_s_s, PRIM_PTR_INT__l_s_s_s);
374                         contract_all(55, PRIM_INT__m_s_s_s, PRIM_PTR_INT__m_s_s_s);
375                         contract_all(66, PRIM_INT__n_s_s_s, PRIM_PTR_INT__n_s_s_s);
376                     }
377                     else
378                     {
379                         contract(21, shelloffsets, PRIM_INT__h_s_s_s, PRIM_PTR_INT__h_s_s_s);
380                         contract(28, shelloffsets, PRIM_INT__i_s_s_s, PRIM_PTR_INT__i_s_s_s);
381                         contract(36, shelloffsets, PRIM_INT__k_s_s_s, PRIM_PTR_INT__k_s_s_s);
382                         contract(45, shelloffsets, PRIM_INT__l_s_s_s, PRIM_PTR_INT__l_s_s_s);
383                         contract(55, shelloffsets, PRIM_INT__m_s_s_s, PRIM_PTR_INT__m_s_s_s);
384                         contract(66, shelloffsets, PRIM_INT__n_s_s_s, PRIM_PTR_INT__n_s_s_s);
385                         PRIM_PTR_INT__h_s_s_s += lastoffset*21;
386                         PRIM_PTR_INT__i_s_s_s += lastoffset*28;
387                         PRIM_PTR_INT__k_s_s_s += lastoffset*36;
388                         PRIM_PTR_INT__l_s_s_s += lastoffset*45;
389                         PRIM_PTR_INT__m_s_s_s += lastoffset*55;
390                         PRIM_PTR_INT__n_s_s_s += lastoffset*66;
391                     }
392 
393                 }  // close loop over j
394             }  // close loop over i
395 
396             //Advance to the next batch
397             jstart = SIMINT_SIMD_ROUND(jend);
398 
399             //////////////////////////////////////////////
400             // Contracted integrals: Horizontal recurrance
401             //////////////////////////////////////////////
402 
403 
404             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
405 
406 
407             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
408             {
409 
410                 // set up HRR pointers
411                 double const * restrict HRR_INT__h_s_s_s = INT__h_s_s_s + abcd * 21;
412                 double const * restrict HRR_INT__i_s_s_s = INT__i_s_s_s + abcd * 28;
413                 double const * restrict HRR_INT__k_s_s_s = INT__k_s_s_s + abcd * 36;
414                 double const * restrict HRR_INT__l_s_s_s = INT__l_s_s_s + abcd * 45;
415                 double const * restrict HRR_INT__m_s_s_s = INT__m_s_s_s + abcd * 55;
416                 double const * restrict HRR_INT__n_s_s_s = INT__n_s_s_s + abcd * 66;
417                 double * restrict HRR_INT__h_h_s_s = INT__h_h_s_s + real_abcd * 441;
418 
419                 // form INT__h_p_s_s
420                 ostei_general_hrr_J(5, 1, 0, 0, hAB, HRR_INT__i_s_s_s, HRR_INT__h_s_s_s, HRR_INT__h_p_s_s);
421 
422                 // form INT__i_p_s_s
423                 ostei_general_hrr_J(6, 1, 0, 0, hAB, HRR_INT__k_s_s_s, HRR_INT__i_s_s_s, HRR_INT__i_p_s_s);
424 
425                 // form INT__k_p_s_s
426                 ostei_general_hrr_J(7, 1, 0, 0, hAB, HRR_INT__l_s_s_s, HRR_INT__k_s_s_s, HRR_INT__k_p_s_s);
427 
428                 // form INT__l_p_s_s
429                 ostei_general_hrr_J(8, 1, 0, 0, hAB, HRR_INT__m_s_s_s, HRR_INT__l_s_s_s, HRR_INT__l_p_s_s);
430 
431                 // form INT__m_p_s_s
432                 ostei_general_hrr_J(9, 1, 0, 0, hAB, HRR_INT__n_s_s_s, HRR_INT__m_s_s_s, HRR_INT__m_p_s_s);
433 
434                 // form INT__h_d_s_s
435                 ostei_general_hrr_J(5, 2, 0, 0, hAB, HRR_INT__i_p_s_s, HRR_INT__h_p_s_s, HRR_INT__h_d_s_s);
436 
437                 // form INT__i_d_s_s
438                 ostei_general_hrr_J(6, 2, 0, 0, hAB, HRR_INT__k_p_s_s, HRR_INT__i_p_s_s, HRR_INT__i_d_s_s);
439 
440                 // form INT__k_d_s_s
441                 ostei_general_hrr_J(7, 2, 0, 0, hAB, HRR_INT__l_p_s_s, HRR_INT__k_p_s_s, HRR_INT__k_d_s_s);
442 
443                 // form INT__l_d_s_s
444                 ostei_general_hrr_J(8, 2, 0, 0, hAB, HRR_INT__m_p_s_s, HRR_INT__l_p_s_s, HRR_INT__l_d_s_s);
445 
446                 // form INT__h_f_s_s
447                 ostei_general_hrr_J(5, 3, 0, 0, hAB, HRR_INT__i_d_s_s, HRR_INT__h_d_s_s, HRR_INT__h_f_s_s);
448 
449                 // form INT__i_f_s_s
450                 ostei_general_hrr_J(6, 3, 0, 0, hAB, HRR_INT__k_d_s_s, HRR_INT__i_d_s_s, HRR_INT__i_f_s_s);
451 
452                 // form INT__k_f_s_s
453                 ostei_general_hrr_J(7, 3, 0, 0, hAB, HRR_INT__l_d_s_s, HRR_INT__k_d_s_s, HRR_INT__k_f_s_s);
454 
455                 // form INT__h_g_s_s
456                 ostei_general_hrr_J(5, 4, 0, 0, hAB, HRR_INT__i_f_s_s, HRR_INT__h_f_s_s, HRR_INT__h_g_s_s);
457 
458                 // form INT__i_g_s_s
459                 ostei_general_hrr_J(6, 4, 0, 0, hAB, HRR_INT__k_f_s_s, HRR_INT__i_f_s_s, HRR_INT__i_g_s_s);
460 
461                 // form INT__h_h_s_s
462                 ostei_general_hrr_J(5, 5, 0, 0, hAB, HRR_INT__i_g_s_s, HRR_INT__h_g_s_s, HRR_INT__h_h_s_s);
463 
464 
465             }  // close HRR loop
466 
467 
468         }   // close loop cdbatch
469 
470         istart = iend;
471     }  // close loop over ab
472 
473     return P.nshell12_clip * Q.nshell12_clip;
474 }
475 
476