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_f_d_p_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_d_p_d)8 int ostei_f_d_p_d(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__f_d_p_d)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__f_d_p_d);
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     int ibra;
27 
28     // partition workspace
29     double * const INT__f_s_s_d = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__f_s_s_f = work + (SIMINT_NSHELL_SIMD * 60);
31     double * const INT__g_s_s_d = work + (SIMINT_NSHELL_SIMD * 160);
32     double * const INT__g_s_s_f = work + (SIMINT_NSHELL_SIMD * 250);
33     double * const INT__h_s_s_d = work + (SIMINT_NSHELL_SIMD * 400);
34     double * const INT__h_s_s_f = work + (SIMINT_NSHELL_SIMD * 526);
35     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*736);
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 9;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_p = primwork + 33;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 60;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_p = primwork + 102;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_d = primwork + 156;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 228;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_p = primwork + 288;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_d = primwork + 378;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_f = primwork + 498;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 598;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_p = primwork + 673;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_d = primwork + 808;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_f = primwork + 988;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 1138;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_p = primwork + 1222;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_d = primwork + 1411;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_f = primwork + 1663;
54     double * const hrrwork = (double *)(primwork + 1873);
55     double * const HRR_INT__f_p_s_d = hrrwork + 0;
56     double * const HRR_INT__f_p_s_f = hrrwork + 180;
57     double * const HRR_INT__f_d_s_d = hrrwork + 480;
58     double * const HRR_INT__f_d_s_f = hrrwork + 840;
59     double * const HRR_INT__g_p_s_d = hrrwork + 1440;
60     double * const HRR_INT__g_p_s_f = hrrwork + 1710;
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 one_half = SIMINT_DBLSET1(0.5);
70 
71 
72     ////////////////////////////////////////
73     // Loop over shells and primitives
74     ////////////////////////////////////////
75 
76     real_abcd = 0;
77     istart = 0;
78     for(ab = 0; ab < P.nshell12_clip; ++ab)
79     {
80         const int iend = istart + P.nprim12[ab];
81 
82         cd = 0;
83         jstart = 0;
84 
85         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
86         {
87             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
88             int jend = jstart;
89             for(i = 0; i < nshellbatch; i++)
90                 jend += Q.nprim12[cd+i];
91 
92             // Clear the beginning of the workspace (where we are accumulating integrals)
93             memset(work, 0, SIMINT_NSHELL_SIMD * 736 * sizeof(double));
94             abcd = 0;
95 
96 
97             for(i = istart; i < iend; ++i)
98             {
99                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
100 
101                 if(check_screen)
102                 {
103                     // Skip this whole thing if always insignificant
104                     if((P.screen[i] * Q.screen_max) < screen_tol)
105                         continue;
106                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
107                 }
108 
109                 icd = 0;
110                 iprimcd = 0;
111                 nprim_icd = Q.nprim12[cd];
112                 double * restrict PRIM_PTR_INT__f_s_s_d = INT__f_s_s_d + abcd * 60;
113                 double * restrict PRIM_PTR_INT__f_s_s_f = INT__f_s_s_f + abcd * 100;
114                 double * restrict PRIM_PTR_INT__g_s_s_d = INT__g_s_s_d + abcd * 90;
115                 double * restrict PRIM_PTR_INT__g_s_s_f = INT__g_s_s_f + abcd * 150;
116                 double * restrict PRIM_PTR_INT__h_s_s_d = INT__h_s_s_d + abcd * 126;
117                 double * restrict PRIM_PTR_INT__h_s_s_f = INT__h_s_s_f + abcd * 210;
118 
119 
120 
121                 // Load these one per loop over i
122                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
123                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
124                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
125 
126                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
127 
128                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
129                 {
130                     // calculate the shell offsets
131                     // these are the offset from the shell pointed to by cd
132                     // for each element
133                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
134                     int lastoffset = 0;
135                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
136 
137                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
138                     {
139                         // Handle if the first element of the vector is a new shell
140                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
141                         {
142                             nprim_icd += Q.nprim12[cd + (++icd)];
143                             PRIM_PTR_INT__f_s_s_d += 60;
144                             PRIM_PTR_INT__f_s_s_f += 100;
145                             PRIM_PTR_INT__g_s_s_d += 90;
146                             PRIM_PTR_INT__g_s_s_f += 150;
147                             PRIM_PTR_INT__h_s_s_d += 126;
148                             PRIM_PTR_INT__h_s_s_f += 210;
149                         }
150                         iprimcd++;
151                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
152                         {
153                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
154                             {
155                                 shelloffsets[n] = shelloffsets[n-1] + 1;
156                                 lastoffset++;
157                                 nprim_icd += Q.nprim12[cd + (++icd)];
158                             }
159                             else
160                                 shelloffsets[n] = shelloffsets[n-1];
161                             iprimcd++;
162                         }
163                     }
164                     else
165                         iprimcd += SIMINT_SIMD_LEN;
166 
167                     // Do we have to compute this vector (or has it been screened out)?
168                     // (not_screened != 0 means we have to do this vector)
169                     if(check_screen)
170                     {
171                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
172                         if(vmax < screen_tol)
173                         {
174                             PRIM_PTR_INT__f_s_s_d += lastoffset*60;
175                             PRIM_PTR_INT__f_s_s_f += lastoffset*100;
176                             PRIM_PTR_INT__g_s_s_d += lastoffset*90;
177                             PRIM_PTR_INT__g_s_s_f += lastoffset*150;
178                             PRIM_PTR_INT__h_s_s_d += lastoffset*126;
179                             PRIM_PTR_INT__h_s_s_f += lastoffset*210;
180                             continue;
181                         }
182                     }
183 
184                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
185                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
186                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
187                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
188 
189 
190                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
191                     SIMINT_DBLTYPE PQ[3];
192                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
193                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
194                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
195                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
196                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
197                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
198 
199                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
200                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
201                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
202                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
203                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
204                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
205                     const SIMINT_DBLTYPE Q_PB[3] = { SIMINT_DBLLOAD(Q.PB_x, j), SIMINT_DBLLOAD(Q.PB_y, j), SIMINT_DBLLOAD(Q.PB_z, j) };
206 
207                     // NOTE: Minus sign!
208                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
209                     SIMINT_DBLTYPE aop_PQ[3];
210                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
211                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
212                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
213 
214                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
215                     SIMINT_DBLTYPE aoq_PQ[3];
216                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
217                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
218                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
219                     // Put a minus sign here so we don't have to in RR routines
220                     a_over_q = SIMINT_NEG(a_over_q);
221 
222 
223                     //////////////////////////////////////////////
224                     // Fjt function section
225                     // Maximum v value: 8
226                     //////////////////////////////////////////////
227                     // The parameter to the Fjt function
228                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
229 
230 
231                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
232 
233 
234                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 8);
235                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
236                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
237                     for(n = 0; n <= 8; n++)
238                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
239 
240                     //////////////////////////////////////////////
241                     // Primitive integrals: Vertical recurrance
242                     //////////////////////////////////////////////
243 
244                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
245                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
246                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
247                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
248                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
249                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
250                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
251                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
252                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
253                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
254                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
255 
256 
257 
258                     // Forming PRIM_INT__p_s_s_s[8 * 3];
259                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
260                     {
261 
262                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
263                         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]);
264 
265                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
266                         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]);
267 
268                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
269                         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]);
270 
271                     }
272 
273 
274 
275                     // Forming PRIM_INT__d_s_s_s[7 * 6];
276                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
277                     {
278 
279                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
280                         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]);
281                         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]);
282 
283                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
284                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 1]);
285 
286                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
287                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 2]);
288 
289                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
290                         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]);
291                         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]);
292 
293                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
294                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_s[n * 6 + 4]);
295 
296                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
297                         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]);
298                         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]);
299 
300                     }
301 
302 
303 
304                     // Forming PRIM_INT__f_s_s_s[6 * 10];
305                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
306                     {
307 
308                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
309                         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]);
310                         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]);
311 
312                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
313                         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]);
314 
315                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
316                         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]);
317 
318                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
319                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 3]);
320 
321                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
322                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__f_s_s_s[n * 10 + 4]);
323 
324                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
325                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 5]);
326 
327                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
328                         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]);
329                         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]);
330 
331                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
332                         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]);
333 
334                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
335                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 8]);
336 
337                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
338                         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]);
339                         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]);
340 
341                     }
342 
343 
344                     VRR_L_f_s_s_p(
345                             PRIM_INT__f_s_s_p,
346                             PRIM_INT__f_s_s_s,
347                             PRIM_INT__d_s_s_s,
348                             Q_PB,
349                             aoq_PQ,
350                             one_over_2pq,
351                             3);
352 
353 
354 
355                     // Forming PRIM_INT__d_s_s_p[3 * 18];
356                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
357                     {
358 
359                         PRIM_INT__d_s_s_p[n * 18 + 0] = SIMINT_MUL(Q_PB[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
360                         PRIM_INT__d_s_s_p[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_p[n * 18 + 0]);
361                         PRIM_INT__d_s_s_p[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_p[n * 18 + 0]);
362 
363                         PRIM_INT__d_s_s_p[n * 18 + 1] = SIMINT_MUL(Q_PB[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
364                         PRIM_INT__d_s_s_p[n * 18 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_p[n * 18 + 1]);
365 
366                         PRIM_INT__d_s_s_p[n * 18 + 2] = SIMINT_MUL(Q_PB[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
367                         PRIM_INT__d_s_s_p[n * 18 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_p[n * 18 + 2]);
368 
369                         PRIM_INT__d_s_s_p[n * 18 + 3] = SIMINT_MUL(Q_PB[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
370                         PRIM_INT__d_s_s_p[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_s_p[n * 18 + 3]);
371                         PRIM_INT__d_s_s_p[n * 18 + 3] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_p[n * 18 + 3]);
372 
373                         PRIM_INT__d_s_s_p[n * 18 + 4] = SIMINT_MUL(Q_PB[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
374                         PRIM_INT__d_s_s_p[n * 18 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_s_p[n * 18 + 4]);
375                         PRIM_INT__d_s_s_p[n * 18 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_p[n * 18 + 4]);
376 
377                         PRIM_INT__d_s_s_p[n * 18 + 5] = SIMINT_MUL(Q_PB[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
378                         PRIM_INT__d_s_s_p[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_s_p[n * 18 + 5]);
379 
380                         PRIM_INT__d_s_s_p[n * 18 + 6] = SIMINT_MUL(Q_PB[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
381                         PRIM_INT__d_s_s_p[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_s_p[n * 18 + 6]);
382                         PRIM_INT__d_s_s_p[n * 18 + 6] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_s_p[n * 18 + 6]);
383 
384                         PRIM_INT__d_s_s_p[n * 18 + 7] = SIMINT_MUL(Q_PB[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
385                         PRIM_INT__d_s_s_p[n * 18 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_s_p[n * 18 + 7]);
386 
387                         PRIM_INT__d_s_s_p[n * 18 + 8] = SIMINT_MUL(Q_PB[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
388                         PRIM_INT__d_s_s_p[n * 18 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_s_p[n * 18 + 8]);
389                         PRIM_INT__d_s_s_p[n * 18 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_p[n * 18 + 8]);
390 
391                         PRIM_INT__d_s_s_p[n * 18 + 9] = SIMINT_MUL(Q_PB[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
392                         PRIM_INT__d_s_s_p[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_s_p[n * 18 + 9]);
393 
394                         PRIM_INT__d_s_s_p[n * 18 + 10] = SIMINT_MUL(Q_PB[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
395                         PRIM_INT__d_s_s_p[n * 18 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_s_p[n * 18 + 10]);
396                         PRIM_INT__d_s_s_p[n * 18 + 10] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_p[n * 18 + 10]);
397 
398                         PRIM_INT__d_s_s_p[n * 18 + 11] = SIMINT_MUL(Q_PB[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
399                         PRIM_INT__d_s_s_p[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_s_p[n * 18 + 11]);
400 
401                         PRIM_INT__d_s_s_p[n * 18 + 12] = SIMINT_MUL(Q_PB[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
402                         PRIM_INT__d_s_s_p[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_s_p[n * 18 + 12]);
403 
404                         PRIM_INT__d_s_s_p[n * 18 + 13] = SIMINT_MUL(Q_PB[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
405                         PRIM_INT__d_s_s_p[n * 18 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_s_p[n * 18 + 13]);
406                         PRIM_INT__d_s_s_p[n * 18 + 13] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_s_p[n * 18 + 13]);
407 
408                         PRIM_INT__d_s_s_p[n * 18 + 14] = SIMINT_MUL(Q_PB[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
409                         PRIM_INT__d_s_s_p[n * 18 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_s_p[n * 18 + 14]);
410                         PRIM_INT__d_s_s_p[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_p[n * 18 + 14]);
411 
412                         PRIM_INT__d_s_s_p[n * 18 + 15] = SIMINT_MUL(Q_PB[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
413                         PRIM_INT__d_s_s_p[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_s_p[n * 18 + 15]);
414 
415                         PRIM_INT__d_s_s_p[n * 18 + 16] = SIMINT_MUL(Q_PB[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
416                         PRIM_INT__d_s_s_p[n * 18 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_s_p[n * 18 + 16]);
417 
418                         PRIM_INT__d_s_s_p[n * 18 + 17] = SIMINT_MUL(Q_PB[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
419                         PRIM_INT__d_s_s_p[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_s_p[n * 18 + 17]);
420                         PRIM_INT__d_s_s_p[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_s_p[n * 18 + 17]);
421 
422                     }
423 
424 
425                     VRR_L_f_s_s_d(
426                             PRIM_INT__f_s_s_d,
427                             PRIM_INT__f_s_s_p,
428                             PRIM_INT__f_s_s_s,
429                             PRIM_INT__d_s_s_p,
430                             Q_PB,
431                             a_over_q,
432                             aoq_PQ,
433                             one_over_2pq,
434                             one_over_2q,
435                             2);
436 
437 
438 
439                     // Forming PRIM_INT__p_s_s_p[3 * 9];
440                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
441                     {
442 
443                         PRIM_INT__p_s_s_p[n * 9 + 0] = SIMINT_MUL(Q_PB[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
444                         PRIM_INT__p_s_s_p[n * 9 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_p[n * 9 + 0]);
445                         PRIM_INT__p_s_s_p[n * 9 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_p[n * 9 + 0]);
446 
447                         PRIM_INT__p_s_s_p[n * 9 + 1] = SIMINT_MUL(Q_PB[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
448                         PRIM_INT__p_s_s_p[n * 9 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_p[n * 9 + 1]);
449 
450                         PRIM_INT__p_s_s_p[n * 9 + 2] = SIMINT_MUL(Q_PB[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
451                         PRIM_INT__p_s_s_p[n * 9 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_p[n * 9 + 2]);
452 
453                         PRIM_INT__p_s_s_p[n * 9 + 3] = SIMINT_MUL(Q_PB[0], PRIM_INT__p_s_s_s[n * 3 + 1]);
454                         PRIM_INT__p_s_s_p[n * 9 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_p[n * 9 + 3]);
455 
456                         PRIM_INT__p_s_s_p[n * 9 + 4] = SIMINT_MUL(Q_PB[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
457                         PRIM_INT__p_s_s_p[n * 9 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_p[n * 9 + 4]);
458                         PRIM_INT__p_s_s_p[n * 9 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_p[n * 9 + 4]);
459 
460                         PRIM_INT__p_s_s_p[n * 9 + 5] = SIMINT_MUL(Q_PB[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
461                         PRIM_INT__p_s_s_p[n * 9 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_p[n * 9 + 5]);
462 
463                         PRIM_INT__p_s_s_p[n * 9 + 6] = SIMINT_MUL(Q_PB[0], PRIM_INT__p_s_s_s[n * 3 + 2]);
464                         PRIM_INT__p_s_s_p[n * 9 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_p[n * 9 + 6]);
465 
466                         PRIM_INT__p_s_s_p[n * 9 + 7] = SIMINT_MUL(Q_PB[1], PRIM_INT__p_s_s_s[n * 3 + 2]);
467                         PRIM_INT__p_s_s_p[n * 9 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_p[n * 9 + 7]);
468 
469                         PRIM_INT__p_s_s_p[n * 9 + 8] = SIMINT_MUL(Q_PB[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
470                         PRIM_INT__p_s_s_p[n * 9 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_p[n * 9 + 8]);
471                         PRIM_INT__p_s_s_p[n * 9 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_p[n * 9 + 8]);
472 
473                     }
474 
475 
476                     VRR_L_d_s_s_d(
477                             PRIM_INT__d_s_s_d,
478                             PRIM_INT__d_s_s_p,
479                             PRIM_INT__d_s_s_s,
480                             PRIM_INT__p_s_s_p,
481                             Q_PB,
482                             a_over_q,
483                             aoq_PQ,
484                             one_over_2pq,
485                             one_over_2q,
486                             2);
487 
488 
489                     ostei_general_vrr_L(3, 0, 0, 3, 1,
490                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PB,
491                             PRIM_INT__f_s_s_d, NULL, PRIM_INT__f_s_s_p, PRIM_INT__d_s_s_d, NULL, PRIM_INT__f_s_s_f);
492 
493 
494                     VRR_I_g_s_s_s(
495                             PRIM_INT__g_s_s_s,
496                             PRIM_INT__f_s_s_s,
497                             PRIM_INT__d_s_s_s,
498                             P_PA,
499                             a_over_p,
500                             aop_PQ,
501                             one_over_2p,
502                             5);
503 
504 
505                     VRR_L_g_s_s_p(
506                             PRIM_INT__g_s_s_p,
507                             PRIM_INT__g_s_s_s,
508                             PRIM_INT__f_s_s_s,
509                             Q_PB,
510                             aoq_PQ,
511                             one_over_2pq,
512                             3);
513 
514 
515                     ostei_general_vrr_L(4, 0, 0, 2, 2,
516                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PB,
517                             PRIM_INT__g_s_s_p, NULL, PRIM_INT__g_s_s_s, PRIM_INT__f_s_s_p, NULL, PRIM_INT__g_s_s_d);
518 
519 
520                     ostei_general_vrr_L(4, 0, 0, 3, 1,
521                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PB,
522                             PRIM_INT__g_s_s_d, NULL, PRIM_INT__g_s_s_p, PRIM_INT__f_s_s_d, NULL, PRIM_INT__g_s_s_f);
523 
524 
525                     VRR_I_h_s_s_s(
526                             PRIM_INT__h_s_s_s,
527                             PRIM_INT__g_s_s_s,
528                             PRIM_INT__f_s_s_s,
529                             P_PA,
530                             a_over_p,
531                             aop_PQ,
532                             one_over_2p,
533                             4);
534 
535 
536                     ostei_general_vrr_L(5, 0, 0, 1, 3,
537                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PB,
538                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_s_p);
539 
540 
541                     ostei_general_vrr_L(5, 0, 0, 2, 2,
542                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PB,
543                             PRIM_INT__h_s_s_p, NULL, PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_p, NULL, PRIM_INT__h_s_s_d);
544 
545 
546                     ostei_general_vrr_L(5, 0, 0, 3, 1,
547                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PB,
548                             PRIM_INT__h_s_s_d, NULL, PRIM_INT__h_s_s_p, PRIM_INT__g_s_s_d, NULL, PRIM_INT__h_s_s_f);
549 
550 
551 
552 
553                     ////////////////////////////////////
554                     // Accumulate contracted integrals
555                     ////////////////////////////////////
556                     if(lastoffset == 0)
557                     {
558                         contract_all(60, PRIM_INT__f_s_s_d, PRIM_PTR_INT__f_s_s_d);
559                         contract_all(100, PRIM_INT__f_s_s_f, PRIM_PTR_INT__f_s_s_f);
560                         contract_all(90, PRIM_INT__g_s_s_d, PRIM_PTR_INT__g_s_s_d);
561                         contract_all(150, PRIM_INT__g_s_s_f, PRIM_PTR_INT__g_s_s_f);
562                         contract_all(126, PRIM_INT__h_s_s_d, PRIM_PTR_INT__h_s_s_d);
563                         contract_all(210, PRIM_INT__h_s_s_f, PRIM_PTR_INT__h_s_s_f);
564                     }
565                     else
566                     {
567                         contract(60, shelloffsets, PRIM_INT__f_s_s_d, PRIM_PTR_INT__f_s_s_d);
568                         contract(100, shelloffsets, PRIM_INT__f_s_s_f, PRIM_PTR_INT__f_s_s_f);
569                         contract(90, shelloffsets, PRIM_INT__g_s_s_d, PRIM_PTR_INT__g_s_s_d);
570                         contract(150, shelloffsets, PRIM_INT__g_s_s_f, PRIM_PTR_INT__g_s_s_f);
571                         contract(126, shelloffsets, PRIM_INT__h_s_s_d, PRIM_PTR_INT__h_s_s_d);
572                         contract(210, shelloffsets, PRIM_INT__h_s_s_f, PRIM_PTR_INT__h_s_s_f);
573                         PRIM_PTR_INT__f_s_s_d += lastoffset*60;
574                         PRIM_PTR_INT__f_s_s_f += lastoffset*100;
575                         PRIM_PTR_INT__g_s_s_d += lastoffset*90;
576                         PRIM_PTR_INT__g_s_s_f += lastoffset*150;
577                         PRIM_PTR_INT__h_s_s_d += lastoffset*126;
578                         PRIM_PTR_INT__h_s_s_f += lastoffset*210;
579                     }
580 
581                 }  // close loop over j
582             }  // close loop over i
583 
584             //Advance to the next batch
585             jstart = SIMINT_SIMD_ROUND(jend);
586 
587             //////////////////////////////////////////////
588             // Contracted integrals: Horizontal recurrance
589             //////////////////////////////////////////////
590 
591 
592             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
593 
594 
595             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
596             {
597                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
598 
599                 // set up HRR pointers
600                 double const * restrict HRR_INT__f_s_s_d = INT__f_s_s_d + abcd * 60;
601                 double const * restrict HRR_INT__f_s_s_f = INT__f_s_s_f + abcd * 100;
602                 double const * restrict HRR_INT__g_s_s_d = INT__g_s_s_d + abcd * 90;
603                 double const * restrict HRR_INT__g_s_s_f = INT__g_s_s_f + abcd * 150;
604                 double const * restrict HRR_INT__h_s_s_d = INT__h_s_s_d + abcd * 126;
605                 double const * restrict HRR_INT__h_s_s_f = INT__h_s_s_f + abcd * 210;
606                 double * restrict HRR_INT__f_d_p_d = INT__f_d_p_d + real_abcd * 1080;
607 
608                 // form INT__f_p_s_d
609                 HRR_J_f_p(
610                     HRR_INT__f_p_s_d,
611                     HRR_INT__f_s_s_d,
612                     HRR_INT__g_s_s_d,
613                     hAB, 6);
614 
615                 // form INT__f_p_s_f
616                 HRR_J_f_p(
617                     HRR_INT__f_p_s_f,
618                     HRR_INT__f_s_s_f,
619                     HRR_INT__g_s_s_f,
620                     hAB, 10);
621 
622                 // form INT__g_p_s_d
623                 HRR_J_g_p(
624                     HRR_INT__g_p_s_d,
625                     HRR_INT__g_s_s_d,
626                     HRR_INT__h_s_s_d,
627                     hAB, 6);
628 
629                 // form INT__g_p_s_f
630                 HRR_J_g_p(
631                     HRR_INT__g_p_s_f,
632                     HRR_INT__g_s_s_f,
633                     HRR_INT__h_s_s_f,
634                     hAB, 10);
635 
636                 // form INT__f_d_s_d
637                 HRR_J_f_d(
638                     HRR_INT__f_d_s_d,
639                     HRR_INT__f_p_s_d,
640                     HRR_INT__g_p_s_d,
641                     hAB, 6);
642 
643                 // form INT__f_d_s_f
644                 HRR_J_f_d(
645                     HRR_INT__f_d_s_f,
646                     HRR_INT__f_p_s_f,
647                     HRR_INT__g_p_s_f,
648                     hAB, 10);
649 
650                 // form INT__f_d_p_d
651                 for(ibra = 0; ibra < 60; ++ibra)
652                 {
653                     HRR_INT__f_d_p_d[ibra * 18 + 0] = HRR_INT__f_d_s_f[ibra * 10 + 0] - ( hCD[0] * HRR_INT__f_d_s_d[ibra * 6 + 0] );
654 
655                     HRR_INT__f_d_p_d[ibra * 18 + 1] = HRR_INT__f_d_s_f[ibra * 10 + 1] - ( hCD[0] * HRR_INT__f_d_s_d[ibra * 6 + 1] );
656 
657                     HRR_INT__f_d_p_d[ibra * 18 + 2] = HRR_INT__f_d_s_f[ibra * 10 + 2] - ( hCD[0] * HRR_INT__f_d_s_d[ibra * 6 + 2] );
658 
659                     HRR_INT__f_d_p_d[ibra * 18 + 3] = HRR_INT__f_d_s_f[ibra * 10 + 3] - ( hCD[0] * HRR_INT__f_d_s_d[ibra * 6 + 3] );
660 
661                     HRR_INT__f_d_p_d[ibra * 18 + 4] = HRR_INT__f_d_s_f[ibra * 10 + 4] - ( hCD[0] * HRR_INT__f_d_s_d[ibra * 6 + 4] );
662 
663                     HRR_INT__f_d_p_d[ibra * 18 + 5] = HRR_INT__f_d_s_f[ibra * 10 + 5] - ( hCD[0] * HRR_INT__f_d_s_d[ibra * 6 + 5] );
664 
665                     HRR_INT__f_d_p_d[ibra * 18 + 6] = HRR_INT__f_d_s_f[ibra * 10 + 1] - ( hCD[1] * HRR_INT__f_d_s_d[ibra * 6 + 0] );
666 
667                     HRR_INT__f_d_p_d[ibra * 18 + 7] = HRR_INT__f_d_s_f[ibra * 10 + 3] - ( hCD[1] * HRR_INT__f_d_s_d[ibra * 6 + 1] );
668 
669                     HRR_INT__f_d_p_d[ibra * 18 + 8] = HRR_INT__f_d_s_f[ibra * 10 + 4] - ( hCD[1] * HRR_INT__f_d_s_d[ibra * 6 + 2] );
670 
671                     HRR_INT__f_d_p_d[ibra * 18 + 9] = HRR_INT__f_d_s_f[ibra * 10 + 6] - ( hCD[1] * HRR_INT__f_d_s_d[ibra * 6 + 3] );
672 
673                     HRR_INT__f_d_p_d[ibra * 18 + 10] = HRR_INT__f_d_s_f[ibra * 10 + 7] - ( hCD[1] * HRR_INT__f_d_s_d[ibra * 6 + 4] );
674 
675                     HRR_INT__f_d_p_d[ibra * 18 + 11] = HRR_INT__f_d_s_f[ibra * 10 + 8] - ( hCD[1] * HRR_INT__f_d_s_d[ibra * 6 + 5] );
676 
677                     HRR_INT__f_d_p_d[ibra * 18 + 12] = HRR_INT__f_d_s_f[ibra * 10 + 2] - ( hCD[2] * HRR_INT__f_d_s_d[ibra * 6 + 0] );
678 
679                     HRR_INT__f_d_p_d[ibra * 18 + 13] = HRR_INT__f_d_s_f[ibra * 10 + 4] - ( hCD[2] * HRR_INT__f_d_s_d[ibra * 6 + 1] );
680 
681                     HRR_INT__f_d_p_d[ibra * 18 + 14] = HRR_INT__f_d_s_f[ibra * 10 + 5] - ( hCD[2] * HRR_INT__f_d_s_d[ibra * 6 + 2] );
682 
683                     HRR_INT__f_d_p_d[ibra * 18 + 15] = HRR_INT__f_d_s_f[ibra * 10 + 7] - ( hCD[2] * HRR_INT__f_d_s_d[ibra * 6 + 3] );
684 
685                     HRR_INT__f_d_p_d[ibra * 18 + 16] = HRR_INT__f_d_s_f[ibra * 10 + 8] - ( hCD[2] * HRR_INT__f_d_s_d[ibra * 6 + 4] );
686 
687                     HRR_INT__f_d_p_d[ibra * 18 + 17] = HRR_INT__f_d_s_f[ibra * 10 + 9] - ( hCD[2] * HRR_INT__f_d_s_d[ibra * 6 + 5] );
688 
689                 }
690 
691 
692             }  // close HRR loop
693 
694 
695         }   // close loop cdbatch
696 
697         istart = iend;
698     }  // close loop over ab
699 
700     return P.nshell12_clip * Q.nshell12_clip;
701 }
702 
703