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_p_d_d_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__p_d_d_d)8 int ostei_p_d_d_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__p_d_d_d)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__p_d_d_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__s_d_d_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__s_d_f_s = work + (SIMINT_NSHELL_SIMD * 36);
31     double * const INT__s_d_g_s = work + (SIMINT_NSHELL_SIMD * 96);
32     double * const INT__s_f_d_s = work + (SIMINT_NSHELL_SIMD * 186);
33     double * const INT__s_f_f_s = work + (SIMINT_NSHELL_SIMD * 246);
34     double * const INT__s_f_g_s = work + (SIMINT_NSHELL_SIMD * 346);
35     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*496);
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 8;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 29;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 65;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 115;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_s_s = primwork + 175;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_p_s = primwork + 184;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_d_s = primwork + 211;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_f_s = primwork + 265;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_g_s = primwork + 355;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_p_s = primwork + 490;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_d_s = primwork + 526;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_f_s = primwork + 598;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_g_s = primwork + 718;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__s_f_d_s = primwork + 898;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__s_f_f_s = primwork + 958;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__s_f_g_s = primwork + 1058;
53     double * const hrrwork = (double *)(primwork + 1208);
54     double * const HRR_INT__p_d_d_s = hrrwork + 0;
55     double * const HRR_INT__p_d_d_p = hrrwork + 108;
56     double * const HRR_INT__p_d_f_s = hrrwork + 432;
57     double * const HRR_INT__p_d_f_p = hrrwork + 612;
58     double * const HRR_INT__p_d_g_s = hrrwork + 1152;
59 
60 
61     // Create constants
62     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
63     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
64     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
65     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
66     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
67 
68 
69     ////////////////////////////////////////
70     // Loop over shells and primitives
71     ////////////////////////////////////////
72 
73     real_abcd = 0;
74     istart = 0;
75     for(ab = 0; ab < P.nshell12_clip; ++ab)
76     {
77         const int iend = istart + P.nprim12[ab];
78 
79         cd = 0;
80         jstart = 0;
81 
82         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
83         {
84             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
85             int jend = jstart;
86             for(i = 0; i < nshellbatch; i++)
87                 jend += Q.nprim12[cd+i];
88 
89             // Clear the beginning of the workspace (where we are accumulating integrals)
90             memset(work, 0, SIMINT_NSHELL_SIMD * 496 * sizeof(double));
91             abcd = 0;
92 
93 
94             for(i = istart; i < iend; ++i)
95             {
96                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
97 
98                 if(check_screen)
99                 {
100                     // Skip this whole thing if always insignificant
101                     if((P.screen[i] * Q.screen_max) < screen_tol)
102                         continue;
103                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
104                 }
105 
106                 icd = 0;
107                 iprimcd = 0;
108                 nprim_icd = Q.nprim12[cd];
109                 double * restrict PRIM_PTR_INT__s_d_d_s = INT__s_d_d_s + abcd * 36;
110                 double * restrict PRIM_PTR_INT__s_d_f_s = INT__s_d_f_s + abcd * 60;
111                 double * restrict PRIM_PTR_INT__s_d_g_s = INT__s_d_g_s + abcd * 90;
112                 double * restrict PRIM_PTR_INT__s_f_d_s = INT__s_f_d_s + abcd * 60;
113                 double * restrict PRIM_PTR_INT__s_f_f_s = INT__s_f_f_s + abcd * 100;
114                 double * restrict PRIM_PTR_INT__s_f_g_s = INT__s_f_g_s + abcd * 150;
115 
116 
117 
118                 // Load these one per loop over i
119                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
120                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
121                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
122 
123                 const SIMINT_DBLTYPE P_PB[3] = { SIMINT_DBLSET1(P.PB_x[i]), SIMINT_DBLSET1(P.PB_y[i]), SIMINT_DBLSET1(P.PB_z[i]) };
124 
125                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
126                 {
127                     // calculate the shell offsets
128                     // these are the offset from the shell pointed to by cd
129                     // for each element
130                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
131                     int lastoffset = 0;
132                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
133 
134                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
135                     {
136                         // Handle if the first element of the vector is a new shell
137                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
138                         {
139                             nprim_icd += Q.nprim12[cd + (++icd)];
140                             PRIM_PTR_INT__s_d_d_s += 36;
141                             PRIM_PTR_INT__s_d_f_s += 60;
142                             PRIM_PTR_INT__s_d_g_s += 90;
143                             PRIM_PTR_INT__s_f_d_s += 60;
144                             PRIM_PTR_INT__s_f_f_s += 100;
145                             PRIM_PTR_INT__s_f_g_s += 150;
146                         }
147                         iprimcd++;
148                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
149                         {
150                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
151                             {
152                                 shelloffsets[n] = shelloffsets[n-1] + 1;
153                                 lastoffset++;
154                                 nprim_icd += Q.nprim12[cd + (++icd)];
155                             }
156                             else
157                                 shelloffsets[n] = shelloffsets[n-1];
158                             iprimcd++;
159                         }
160                     }
161                     else
162                         iprimcd += SIMINT_SIMD_LEN;
163 
164                     // Do we have to compute this vector (or has it been screened out)?
165                     // (not_screened != 0 means we have to do this vector)
166                     if(check_screen)
167                     {
168                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
169                         if(vmax < screen_tol)
170                         {
171                             PRIM_PTR_INT__s_d_d_s += lastoffset*36;
172                             PRIM_PTR_INT__s_d_f_s += lastoffset*60;
173                             PRIM_PTR_INT__s_d_g_s += lastoffset*90;
174                             PRIM_PTR_INT__s_f_d_s += lastoffset*60;
175                             PRIM_PTR_INT__s_f_f_s += lastoffset*100;
176                             PRIM_PTR_INT__s_f_g_s += lastoffset*150;
177                             continue;
178                         }
179                     }
180 
181                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
182                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
183                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
184                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
185 
186 
187                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
188                     SIMINT_DBLTYPE PQ[3];
189                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
190                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
191                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
192                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
193                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
194                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
195 
196                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
197                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
198                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
199                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
200                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
201                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
202                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
203 
204                     // NOTE: Minus sign!
205                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
206                     SIMINT_DBLTYPE aop_PQ[3];
207                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
208                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
209                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
210 
211                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
212                     SIMINT_DBLTYPE aoq_PQ[3];
213                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
214                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
215                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
216                     // Put a minus sign here so we don't have to in RR routines
217                     a_over_q = SIMINT_NEG(a_over_q);
218 
219 
220                     //////////////////////////////////////////////
221                     // Fjt function section
222                     // Maximum v value: 7
223                     //////////////////////////////////////////////
224                     // The parameter to the Fjt function
225                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
226 
227 
228                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
229 
230 
231                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 7);
232                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
233                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
234                     for(n = 0; n <= 7; n++)
235                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
236 
237                     //////////////////////////////////////////////
238                     // Primitive integrals: Vertical recurrance
239                     //////////////////////////////////////////////
240 
241                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
242                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
243                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
244                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
245                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
246                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
247                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
248                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
249                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
250 
251 
252 
253                     // Forming PRIM_INT__s_s_p_s[7 * 3];
254                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
255                     {
256 
257                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
258                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]);
259 
260                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
261                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 1]);
262 
263                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
264                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 2]);
265 
266                     }
267 
268 
269 
270                     // Forming PRIM_INT__s_s_d_s[6 * 6];
271                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
272                     {
273 
274                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
275                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]);
276                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 0]);
277 
278                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
279                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 1]);
280 
281                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
282                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 2]);
283 
284                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
285                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 3]);
286                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 3]);
287 
288                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
289                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 4]);
290 
291                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
292                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_d_s[n * 6 + 5]);
293                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 5]);
294 
295                     }
296 
297 
298 
299                     // Forming PRIM_INT__s_p_d_s[3 * 18];
300                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
301                     {
302 
303                         PRIM_INT__s_p_d_s[n * 18 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
304                         PRIM_INT__s_p_d_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_p_d_s[n * 18 + 0]);
305                         PRIM_INT__s_p_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_p_d_s[n * 18 + 0]);
306 
307                         PRIM_INT__s_p_d_s[n * 18 + 1] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
308                         PRIM_INT__s_p_d_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_p_d_s[n * 18 + 1]);
309                         PRIM_INT__s_p_d_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_p_d_s[n * 18 + 1]);
310 
311                         PRIM_INT__s_p_d_s[n * 18 + 2] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
312                         PRIM_INT__s_p_d_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__s_p_d_s[n * 18 + 2]);
313                         PRIM_INT__s_p_d_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_p_d_s[n * 18 + 2]);
314 
315                         PRIM_INT__s_p_d_s[n * 18 + 3] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
316                         PRIM_INT__s_p_d_s[n * 18 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_p_d_s[n * 18 + 3]);
317 
318                         PRIM_INT__s_p_d_s[n * 18 + 4] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
319                         PRIM_INT__s_p_d_s[n * 18 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__s_p_d_s[n * 18 + 4]);
320 
321                         PRIM_INT__s_p_d_s[n * 18 + 5] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
322                         PRIM_INT__s_p_d_s[n * 18 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_p_d_s[n * 18 + 5]);
323 
324                         PRIM_INT__s_p_d_s[n * 18 + 6] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
325                         PRIM_INT__s_p_d_s[n * 18 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_p_d_s[n * 18 + 6]);
326 
327                         PRIM_INT__s_p_d_s[n * 18 + 7] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
328                         PRIM_INT__s_p_d_s[n * 18 + 7] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_p_d_s[n * 18 + 7]);
329                         PRIM_INT__s_p_d_s[n * 18 + 7] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_p_d_s[n * 18 + 7]);
330 
331                         PRIM_INT__s_p_d_s[n * 18 + 8] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
332                         PRIM_INT__s_p_d_s[n * 18 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__s_p_d_s[n * 18 + 8]);
333 
334                         PRIM_INT__s_p_d_s[n * 18 + 9] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
335                         PRIM_INT__s_p_d_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_p_d_s[n * 18 + 9]);
336                         PRIM_INT__s_p_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_p_d_s[n * 18 + 9]);
337 
338                         PRIM_INT__s_p_d_s[n * 18 + 10] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
339                         PRIM_INT__s_p_d_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__s_p_d_s[n * 18 + 10]);
340                         PRIM_INT__s_p_d_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_p_d_s[n * 18 + 10]);
341 
342                         PRIM_INT__s_p_d_s[n * 18 + 11] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
343                         PRIM_INT__s_p_d_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_p_d_s[n * 18 + 11]);
344 
345                         PRIM_INT__s_p_d_s[n * 18 + 12] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
346                         PRIM_INT__s_p_d_s[n * 18 + 12] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_p_d_s[n * 18 + 12]);
347 
348                         PRIM_INT__s_p_d_s[n * 18 + 13] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
349                         PRIM_INT__s_p_d_s[n * 18 + 13] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_p_d_s[n * 18 + 13]);
350 
351                         PRIM_INT__s_p_d_s[n * 18 + 14] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
352                         PRIM_INT__s_p_d_s[n * 18 + 14] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__s_p_d_s[n * 18 + 14]);
353                         PRIM_INT__s_p_d_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_p_d_s[n * 18 + 14]);
354 
355                         PRIM_INT__s_p_d_s[n * 18 + 15] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
356                         PRIM_INT__s_p_d_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_p_d_s[n * 18 + 15]);
357 
358                         PRIM_INT__s_p_d_s[n * 18 + 16] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
359                         PRIM_INT__s_p_d_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__s_p_d_s[n * 18 + 16]);
360                         PRIM_INT__s_p_d_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_p_d_s[n * 18 + 16]);
361 
362                         PRIM_INT__s_p_d_s[n * 18 + 17] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
363                         PRIM_INT__s_p_d_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_p_d_s[n * 18 + 17]);
364                         PRIM_INT__s_p_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_p_d_s[n * 18 + 17]);
365 
366                     }
367 
368 
369 
370                     // Forming PRIM_INT__s_p_p_s[3 * 9];
371                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
372                     {
373 
374                         PRIM_INT__s_p_p_s[n * 9 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
375                         PRIM_INT__s_p_p_s[n * 9 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_p_p_s[n * 9 + 0]);
376                         PRIM_INT__s_p_p_s[n * 9 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_p_s[n * 9 + 0]);
377 
378                         PRIM_INT__s_p_p_s[n * 9 + 1] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
379                         PRIM_INT__s_p_p_s[n * 9 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_p_p_s[n * 9 + 1]);
380 
381                         PRIM_INT__s_p_p_s[n * 9 + 2] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
382                         PRIM_INT__s_p_p_s[n * 9 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_p_p_s[n * 9 + 2]);
383 
384                         PRIM_INT__s_p_p_s[n * 9 + 3] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
385                         PRIM_INT__s_p_p_s[n * 9 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_p_p_s[n * 9 + 3]);
386 
387                         PRIM_INT__s_p_p_s[n * 9 + 4] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
388                         PRIM_INT__s_p_p_s[n * 9 + 4] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_p_p_s[n * 9 + 4]);
389                         PRIM_INT__s_p_p_s[n * 9 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_p_s[n * 9 + 4]);
390 
391                         PRIM_INT__s_p_p_s[n * 9 + 5] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
392                         PRIM_INT__s_p_p_s[n * 9 + 5] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_p_p_s[n * 9 + 5]);
393 
394                         PRIM_INT__s_p_p_s[n * 9 + 6] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
395                         PRIM_INT__s_p_p_s[n * 9 + 6] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_p_p_s[n * 9 + 6]);
396 
397                         PRIM_INT__s_p_p_s[n * 9 + 7] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
398                         PRIM_INT__s_p_p_s[n * 9 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_p_p_s[n * 9 + 7]);
399 
400                         PRIM_INT__s_p_p_s[n * 9 + 8] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
401                         PRIM_INT__s_p_p_s[n * 9 + 8] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_p_p_s[n * 9 + 8]);
402                         PRIM_INT__s_p_p_s[n * 9 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_p_s[n * 9 + 8]);
403 
404                     }
405 
406 
407                     VRR_J_s_d_d_s(
408                             PRIM_INT__s_d_d_s,
409                             PRIM_INT__s_p_d_s,
410                             PRIM_INT__s_s_d_s,
411                             PRIM_INT__s_p_p_s,
412                             P_PB,
413                             a_over_p,
414                             aop_PQ,
415                             one_over_2p,
416                             one_over_2pq,
417                             2);
418 
419 
420 
421                     // Forming PRIM_INT__s_s_f_s[5 * 10];
422                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
423                     {
424 
425                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
426                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 0]);
427                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_s_f_s[n * 10 + 0]);
428 
429                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
430                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 1]);
431 
432                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
433                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 2]);
434 
435                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
436                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 3]);
437 
438                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
439                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_f_s[n * 10 + 4]);
440 
441                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
442                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 5]);
443 
444                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
445                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 6]);
446                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_s_f_s[n * 10 + 6]);
447 
448                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
449                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 7]);
450 
451                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
452                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 8]);
453 
454                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
455                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 9]);
456                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_s_f_s[n * 10 + 9]);
457 
458                     }
459 
460 
461                     VRR_J_s_p_f_s(
462                             PRIM_INT__s_p_f_s,
463                             PRIM_INT__s_s_f_s,
464                             PRIM_INT__s_s_d_s,
465                             P_PB,
466                             aop_PQ,
467                             one_over_2pq,
468                             3);
469 
470 
471                     VRR_J_s_d_f_s(
472                             PRIM_INT__s_d_f_s,
473                             PRIM_INT__s_p_f_s,
474                             PRIM_INT__s_s_f_s,
475                             PRIM_INT__s_p_d_s,
476                             P_PB,
477                             a_over_p,
478                             aop_PQ,
479                             one_over_2p,
480                             one_over_2pq,
481                             2);
482 
483 
484 
485                     // Forming PRIM_INT__s_p_s_s[3 * 3];
486                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
487                     {
488 
489                         PRIM_INT__s_p_s_s[n * 3 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
490                         PRIM_INT__s_p_s_s[n * 3 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 0]);
491 
492                         PRIM_INT__s_p_s_s[n * 3 + 1] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
493                         PRIM_INT__s_p_s_s[n * 3 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 1]);
494 
495                         PRIM_INT__s_p_s_s[n * 3 + 2] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
496                         PRIM_INT__s_p_s_s[n * 3 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 2]);
497 
498                     }
499 
500 
501 
502                     // Forming PRIM_INT__s_d_p_s[2 * 18];
503                     for(n = 0; n < 2; ++n)  // loop over orders of auxiliary function
504                     {
505 
506                         PRIM_INT__s_d_p_s[n * 18 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_p_p_s[n * 9 + 0]);
507                         PRIM_INT__s_d_p_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_p_p_s[(n+1) * 9 + 0], PRIM_INT__s_d_p_s[n * 18 + 0]);
508                         PRIM_INT__s_d_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_d_p_s[n * 18 + 0]);
509                         PRIM_INT__s_d_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_p_s[n * 18 + 0]);
510 
511                         PRIM_INT__s_d_p_s[n * 18 + 1] = SIMINT_MUL(P_PB[0], PRIM_INT__s_p_p_s[n * 9 + 1]);
512                         PRIM_INT__s_d_p_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_p_p_s[(n+1) * 9 + 1], PRIM_INT__s_d_p_s[n * 18 + 1]);
513                         PRIM_INT__s_d_p_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_d_p_s[n * 18 + 1]);
514 
515                         PRIM_INT__s_d_p_s[n * 18 + 2] = SIMINT_MUL(P_PB[0], PRIM_INT__s_p_p_s[n * 9 + 2]);
516                         PRIM_INT__s_d_p_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_p_p_s[(n+1) * 9 + 2], PRIM_INT__s_d_p_s[n * 18 + 2]);
517                         PRIM_INT__s_d_p_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_d_p_s[n * 18 + 2]);
518 
519                         PRIM_INT__s_d_p_s[n * 18 + 3] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_p_s[n * 9 + 0]);
520                         PRIM_INT__s_d_p_s[n * 18 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_p_s[(n+1) * 9 + 0], PRIM_INT__s_d_p_s[n * 18 + 3]);
521 
522                         PRIM_INT__s_d_p_s[n * 18 + 4] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_p_s[n * 9 + 1]);
523                         PRIM_INT__s_d_p_s[n * 18 + 4] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_p_s[(n+1) * 9 + 1], PRIM_INT__s_d_p_s[n * 18 + 4]);
524                         PRIM_INT__s_d_p_s[n * 18 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_p_s[n * 18 + 4]);
525 
526                         PRIM_INT__s_d_p_s[n * 18 + 5] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_p_s[n * 9 + 2]);
527                         PRIM_INT__s_d_p_s[n * 18 + 5] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_p_s[(n+1) * 9 + 2], PRIM_INT__s_d_p_s[n * 18 + 5]);
528 
529                         PRIM_INT__s_d_p_s[n * 18 + 9] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_p_s[n * 9 + 3]);
530                         PRIM_INT__s_d_p_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_p_s[(n+1) * 9 + 3], PRIM_INT__s_d_p_s[n * 18 + 9]);
531                         PRIM_INT__s_d_p_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_d_p_s[n * 18 + 9]);
532 
533                         PRIM_INT__s_d_p_s[n * 18 + 10] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_p_s[n * 9 + 4]);
534                         PRIM_INT__s_d_p_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_p_s[(n+1) * 9 + 4], PRIM_INT__s_d_p_s[n * 18 + 10]);
535                         PRIM_INT__s_d_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_d_p_s[n * 18 + 10]);
536                         PRIM_INT__s_d_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_p_s[n * 18 + 10]);
537 
538                         PRIM_INT__s_d_p_s[n * 18 + 11] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_p_s[n * 9 + 5]);
539                         PRIM_INT__s_d_p_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_p_s[(n+1) * 9 + 5], PRIM_INT__s_d_p_s[n * 18 + 11]);
540                         PRIM_INT__s_d_p_s[n * 18 + 11] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_d_p_s[n * 18 + 11]);
541 
542                         PRIM_INT__s_d_p_s[n * 18 + 15] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_p_s[n * 9 + 6]);
543                         PRIM_INT__s_d_p_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_p_s[(n+1) * 9 + 6], PRIM_INT__s_d_p_s[n * 18 + 15]);
544                         PRIM_INT__s_d_p_s[n * 18 + 15] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_d_p_s[n * 18 + 15]);
545 
546                         PRIM_INT__s_d_p_s[n * 18 + 16] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_p_s[n * 9 + 7]);
547                         PRIM_INT__s_d_p_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_p_s[(n+1) * 9 + 7], PRIM_INT__s_d_p_s[n * 18 + 16]);
548                         PRIM_INT__s_d_p_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_d_p_s[n * 18 + 16]);
549 
550                         PRIM_INT__s_d_p_s[n * 18 + 17] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_p_s[n * 9 + 8]);
551                         PRIM_INT__s_d_p_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_p_s[(n+1) * 9 + 8], PRIM_INT__s_d_p_s[n * 18 + 17]);
552                         PRIM_INT__s_d_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_d_p_s[n * 18 + 17]);
553                         PRIM_INT__s_d_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_d_p_s[n * 18 + 17]);
554 
555                     }
556 
557 
558                     VRR_J_s_f_d_s(
559                             PRIM_INT__s_f_d_s,
560                             PRIM_INT__s_d_d_s,
561                             PRIM_INT__s_p_d_s,
562                             PRIM_INT__s_d_p_s,
563                             P_PB,
564                             a_over_p,
565                             aop_PQ,
566                             one_over_2p,
567                             one_over_2pq,
568                             1);
569 
570 
571                     VRR_K_s_s_g_s(
572                             PRIM_INT__s_s_g_s,
573                             PRIM_INT__s_s_f_s,
574                             PRIM_INT__s_s_d_s,
575                             Q_PA,
576                             a_over_q,
577                             aoq_PQ,
578                             one_over_2q,
579                             4);
580 
581 
582                     VRR_J_s_p_g_s(
583                             PRIM_INT__s_p_g_s,
584                             PRIM_INT__s_s_g_s,
585                             PRIM_INT__s_s_f_s,
586                             P_PB,
587                             aop_PQ,
588                             one_over_2pq,
589                             3);
590 
591 
592                     ostei_general_vrr_J(0, 2, 4, 0, 2,
593                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PB,
594                             PRIM_INT__s_p_g_s, NULL, PRIM_INT__s_s_g_s, PRIM_INT__s_p_f_s, NULL, PRIM_INT__s_d_g_s);
595 
596 
597                     ostei_general_vrr_J(0, 3, 3, 0, 1,
598                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PB,
599                             PRIM_INT__s_d_f_s, NULL, PRIM_INT__s_p_f_s, PRIM_INT__s_d_d_s, NULL, PRIM_INT__s_f_f_s);
600 
601 
602                     ostei_general_vrr_J(0, 3, 4, 0, 1,
603                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PB,
604                             PRIM_INT__s_d_g_s, NULL, PRIM_INT__s_p_g_s, PRIM_INT__s_d_f_s, NULL, PRIM_INT__s_f_g_s);
605 
606 
607 
608 
609                     ////////////////////////////////////
610                     // Accumulate contracted integrals
611                     ////////////////////////////////////
612                     if(lastoffset == 0)
613                     {
614                         contract_all(36, PRIM_INT__s_d_d_s, PRIM_PTR_INT__s_d_d_s);
615                         contract_all(60, PRIM_INT__s_d_f_s, PRIM_PTR_INT__s_d_f_s);
616                         contract_all(90, PRIM_INT__s_d_g_s, PRIM_PTR_INT__s_d_g_s);
617                         contract_all(60, PRIM_INT__s_f_d_s, PRIM_PTR_INT__s_f_d_s);
618                         contract_all(100, PRIM_INT__s_f_f_s, PRIM_PTR_INT__s_f_f_s);
619                         contract_all(150, PRIM_INT__s_f_g_s, PRIM_PTR_INT__s_f_g_s);
620                     }
621                     else
622                     {
623                         contract(36, shelloffsets, PRIM_INT__s_d_d_s, PRIM_PTR_INT__s_d_d_s);
624                         contract(60, shelloffsets, PRIM_INT__s_d_f_s, PRIM_PTR_INT__s_d_f_s);
625                         contract(90, shelloffsets, PRIM_INT__s_d_g_s, PRIM_PTR_INT__s_d_g_s);
626                         contract(60, shelloffsets, PRIM_INT__s_f_d_s, PRIM_PTR_INT__s_f_d_s);
627                         contract(100, shelloffsets, PRIM_INT__s_f_f_s, PRIM_PTR_INT__s_f_f_s);
628                         contract(150, shelloffsets, PRIM_INT__s_f_g_s, PRIM_PTR_INT__s_f_g_s);
629                         PRIM_PTR_INT__s_d_d_s += lastoffset*36;
630                         PRIM_PTR_INT__s_d_f_s += lastoffset*60;
631                         PRIM_PTR_INT__s_d_g_s += lastoffset*90;
632                         PRIM_PTR_INT__s_f_d_s += lastoffset*60;
633                         PRIM_PTR_INT__s_f_f_s += lastoffset*100;
634                         PRIM_PTR_INT__s_f_g_s += lastoffset*150;
635                     }
636 
637                 }  // close loop over j
638             }  // close loop over i
639 
640             //Advance to the next batch
641             jstart = SIMINT_SIMD_ROUND(jend);
642 
643             //////////////////////////////////////////////
644             // Contracted integrals: Horizontal recurrance
645             //////////////////////////////////////////////
646 
647 
648             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
649 
650 
651             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
652             {
653                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
654 
655                 // set up HRR pointers
656                 double const * restrict HRR_INT__s_d_d_s = INT__s_d_d_s + abcd * 36;
657                 double const * restrict HRR_INT__s_d_f_s = INT__s_d_f_s + abcd * 60;
658                 double const * restrict HRR_INT__s_d_g_s = INT__s_d_g_s + abcd * 90;
659                 double const * restrict HRR_INT__s_f_d_s = INT__s_f_d_s + abcd * 60;
660                 double const * restrict HRR_INT__s_f_f_s = INT__s_f_f_s + abcd * 100;
661                 double const * restrict HRR_INT__s_f_g_s = INT__s_f_g_s + abcd * 150;
662                 double * restrict HRR_INT__p_d_d_d = INT__p_d_d_d + real_abcd * 648;
663 
664                 // form INT__p_d_d_s
665                 for(iket = 0; iket < 6; ++iket)
666                 {
667                     HRR_INT__p_d_d_s[0 * 6 + iket] = HRR_INT__s_f_d_s[0 * 6 + iket] - ( hAB[0] * HRR_INT__s_d_d_s[0 * 6 + iket] );
668 
669                     HRR_INT__p_d_d_s[1 * 6 + iket] = HRR_INT__s_f_d_s[1 * 6 + iket] - ( hAB[0] * HRR_INT__s_d_d_s[1 * 6 + iket] );
670 
671                     HRR_INT__p_d_d_s[2 * 6 + iket] = HRR_INT__s_f_d_s[2 * 6 + iket] - ( hAB[0] * HRR_INT__s_d_d_s[2 * 6 + iket] );
672 
673                     HRR_INT__p_d_d_s[3 * 6 + iket] = HRR_INT__s_f_d_s[3 * 6 + iket] - ( hAB[0] * HRR_INT__s_d_d_s[3 * 6 + iket] );
674 
675                     HRR_INT__p_d_d_s[4 * 6 + iket] = HRR_INT__s_f_d_s[4 * 6 + iket] - ( hAB[0] * HRR_INT__s_d_d_s[4 * 6 + iket] );
676 
677                     HRR_INT__p_d_d_s[5 * 6 + iket] = HRR_INT__s_f_d_s[5 * 6 + iket] - ( hAB[0] * HRR_INT__s_d_d_s[5 * 6 + iket] );
678 
679                     HRR_INT__p_d_d_s[6 * 6 + iket] = HRR_INT__s_f_d_s[1 * 6 + iket] - ( hAB[1] * HRR_INT__s_d_d_s[0 * 6 + iket] );
680 
681                     HRR_INT__p_d_d_s[7 * 6 + iket] = HRR_INT__s_f_d_s[3 * 6 + iket] - ( hAB[1] * HRR_INT__s_d_d_s[1 * 6 + iket] );
682 
683                     HRR_INT__p_d_d_s[8 * 6 + iket] = HRR_INT__s_f_d_s[4 * 6 + iket] - ( hAB[1] * HRR_INT__s_d_d_s[2 * 6 + iket] );
684 
685                     HRR_INT__p_d_d_s[9 * 6 + iket] = HRR_INT__s_f_d_s[6 * 6 + iket] - ( hAB[1] * HRR_INT__s_d_d_s[3 * 6 + iket] );
686 
687                     HRR_INT__p_d_d_s[10 * 6 + iket] = HRR_INT__s_f_d_s[7 * 6 + iket] - ( hAB[1] * HRR_INT__s_d_d_s[4 * 6 + iket] );
688 
689                     HRR_INT__p_d_d_s[11 * 6 + iket] = HRR_INT__s_f_d_s[8 * 6 + iket] - ( hAB[1] * HRR_INT__s_d_d_s[5 * 6 + iket] );
690 
691                     HRR_INT__p_d_d_s[12 * 6 + iket] = HRR_INT__s_f_d_s[2 * 6 + iket] - ( hAB[2] * HRR_INT__s_d_d_s[0 * 6 + iket] );
692 
693                     HRR_INT__p_d_d_s[13 * 6 + iket] = HRR_INT__s_f_d_s[4 * 6 + iket] - ( hAB[2] * HRR_INT__s_d_d_s[1 * 6 + iket] );
694 
695                     HRR_INT__p_d_d_s[14 * 6 + iket] = HRR_INT__s_f_d_s[5 * 6 + iket] - ( hAB[2] * HRR_INT__s_d_d_s[2 * 6 + iket] );
696 
697                     HRR_INT__p_d_d_s[15 * 6 + iket] = HRR_INT__s_f_d_s[7 * 6 + iket] - ( hAB[2] * HRR_INT__s_d_d_s[3 * 6 + iket] );
698 
699                     HRR_INT__p_d_d_s[16 * 6 + iket] = HRR_INT__s_f_d_s[8 * 6 + iket] - ( hAB[2] * HRR_INT__s_d_d_s[4 * 6 + iket] );
700 
701                     HRR_INT__p_d_d_s[17 * 6 + iket] = HRR_INT__s_f_d_s[9 * 6 + iket] - ( hAB[2] * HRR_INT__s_d_d_s[5 * 6 + iket] );
702 
703                 }
704 
705 
706                 // form INT__p_d_f_s
707                 for(iket = 0; iket < 10; ++iket)
708                 {
709                     HRR_INT__p_d_f_s[0 * 10 + iket] = HRR_INT__s_f_f_s[0 * 10 + iket] - ( hAB[0] * HRR_INT__s_d_f_s[0 * 10 + iket] );
710 
711                     HRR_INT__p_d_f_s[1 * 10 + iket] = HRR_INT__s_f_f_s[1 * 10 + iket] - ( hAB[0] * HRR_INT__s_d_f_s[1 * 10 + iket] );
712 
713                     HRR_INT__p_d_f_s[2 * 10 + iket] = HRR_INT__s_f_f_s[2 * 10 + iket] - ( hAB[0] * HRR_INT__s_d_f_s[2 * 10 + iket] );
714 
715                     HRR_INT__p_d_f_s[3 * 10 + iket] = HRR_INT__s_f_f_s[3 * 10 + iket] - ( hAB[0] * HRR_INT__s_d_f_s[3 * 10 + iket] );
716 
717                     HRR_INT__p_d_f_s[4 * 10 + iket] = HRR_INT__s_f_f_s[4 * 10 + iket] - ( hAB[0] * HRR_INT__s_d_f_s[4 * 10 + iket] );
718 
719                     HRR_INT__p_d_f_s[5 * 10 + iket] = HRR_INT__s_f_f_s[5 * 10 + iket] - ( hAB[0] * HRR_INT__s_d_f_s[5 * 10 + iket] );
720 
721                     HRR_INT__p_d_f_s[6 * 10 + iket] = HRR_INT__s_f_f_s[1 * 10 + iket] - ( hAB[1] * HRR_INT__s_d_f_s[0 * 10 + iket] );
722 
723                     HRR_INT__p_d_f_s[7 * 10 + iket] = HRR_INT__s_f_f_s[3 * 10 + iket] - ( hAB[1] * HRR_INT__s_d_f_s[1 * 10 + iket] );
724 
725                     HRR_INT__p_d_f_s[8 * 10 + iket] = HRR_INT__s_f_f_s[4 * 10 + iket] - ( hAB[1] * HRR_INT__s_d_f_s[2 * 10 + iket] );
726 
727                     HRR_INT__p_d_f_s[9 * 10 + iket] = HRR_INT__s_f_f_s[6 * 10 + iket] - ( hAB[1] * HRR_INT__s_d_f_s[3 * 10 + iket] );
728 
729                     HRR_INT__p_d_f_s[10 * 10 + iket] = HRR_INT__s_f_f_s[7 * 10 + iket] - ( hAB[1] * HRR_INT__s_d_f_s[4 * 10 + iket] );
730 
731                     HRR_INT__p_d_f_s[11 * 10 + iket] = HRR_INT__s_f_f_s[8 * 10 + iket] - ( hAB[1] * HRR_INT__s_d_f_s[5 * 10 + iket] );
732 
733                     HRR_INT__p_d_f_s[12 * 10 + iket] = HRR_INT__s_f_f_s[2 * 10 + iket] - ( hAB[2] * HRR_INT__s_d_f_s[0 * 10 + iket] );
734 
735                     HRR_INT__p_d_f_s[13 * 10 + iket] = HRR_INT__s_f_f_s[4 * 10 + iket] - ( hAB[2] * HRR_INT__s_d_f_s[1 * 10 + iket] );
736 
737                     HRR_INT__p_d_f_s[14 * 10 + iket] = HRR_INT__s_f_f_s[5 * 10 + iket] - ( hAB[2] * HRR_INT__s_d_f_s[2 * 10 + iket] );
738 
739                     HRR_INT__p_d_f_s[15 * 10 + iket] = HRR_INT__s_f_f_s[7 * 10 + iket] - ( hAB[2] * HRR_INT__s_d_f_s[3 * 10 + iket] );
740 
741                     HRR_INT__p_d_f_s[16 * 10 + iket] = HRR_INT__s_f_f_s[8 * 10 + iket] - ( hAB[2] * HRR_INT__s_d_f_s[4 * 10 + iket] );
742 
743                     HRR_INT__p_d_f_s[17 * 10 + iket] = HRR_INT__s_f_f_s[9 * 10 + iket] - ( hAB[2] * HRR_INT__s_d_f_s[5 * 10 + iket] );
744 
745                 }
746 
747 
748                 // form INT__p_d_g_s
749                 for(iket = 0; iket < 15; ++iket)
750                 {
751                     HRR_INT__p_d_g_s[0 * 15 + iket] = HRR_INT__s_f_g_s[0 * 15 + iket] - ( hAB[0] * HRR_INT__s_d_g_s[0 * 15 + iket] );
752 
753                     HRR_INT__p_d_g_s[1 * 15 + iket] = HRR_INT__s_f_g_s[1 * 15 + iket] - ( hAB[0] * HRR_INT__s_d_g_s[1 * 15 + iket] );
754 
755                     HRR_INT__p_d_g_s[2 * 15 + iket] = HRR_INT__s_f_g_s[2 * 15 + iket] - ( hAB[0] * HRR_INT__s_d_g_s[2 * 15 + iket] );
756 
757                     HRR_INT__p_d_g_s[3 * 15 + iket] = HRR_INT__s_f_g_s[3 * 15 + iket] - ( hAB[0] * HRR_INT__s_d_g_s[3 * 15 + iket] );
758 
759                     HRR_INT__p_d_g_s[4 * 15 + iket] = HRR_INT__s_f_g_s[4 * 15 + iket] - ( hAB[0] * HRR_INT__s_d_g_s[4 * 15 + iket] );
760 
761                     HRR_INT__p_d_g_s[5 * 15 + iket] = HRR_INT__s_f_g_s[5 * 15 + iket] - ( hAB[0] * HRR_INT__s_d_g_s[5 * 15 + iket] );
762 
763                     HRR_INT__p_d_g_s[6 * 15 + iket] = HRR_INT__s_f_g_s[1 * 15 + iket] - ( hAB[1] * HRR_INT__s_d_g_s[0 * 15 + iket] );
764 
765                     HRR_INT__p_d_g_s[7 * 15 + iket] = HRR_INT__s_f_g_s[3 * 15 + iket] - ( hAB[1] * HRR_INT__s_d_g_s[1 * 15 + iket] );
766 
767                     HRR_INT__p_d_g_s[8 * 15 + iket] = HRR_INT__s_f_g_s[4 * 15 + iket] - ( hAB[1] * HRR_INT__s_d_g_s[2 * 15 + iket] );
768 
769                     HRR_INT__p_d_g_s[9 * 15 + iket] = HRR_INT__s_f_g_s[6 * 15 + iket] - ( hAB[1] * HRR_INT__s_d_g_s[3 * 15 + iket] );
770 
771                     HRR_INT__p_d_g_s[10 * 15 + iket] = HRR_INT__s_f_g_s[7 * 15 + iket] - ( hAB[1] * HRR_INT__s_d_g_s[4 * 15 + iket] );
772 
773                     HRR_INT__p_d_g_s[11 * 15 + iket] = HRR_INT__s_f_g_s[8 * 15 + iket] - ( hAB[1] * HRR_INT__s_d_g_s[5 * 15 + iket] );
774 
775                     HRR_INT__p_d_g_s[12 * 15 + iket] = HRR_INT__s_f_g_s[2 * 15 + iket] - ( hAB[2] * HRR_INT__s_d_g_s[0 * 15 + iket] );
776 
777                     HRR_INT__p_d_g_s[13 * 15 + iket] = HRR_INT__s_f_g_s[4 * 15 + iket] - ( hAB[2] * HRR_INT__s_d_g_s[1 * 15 + iket] );
778 
779                     HRR_INT__p_d_g_s[14 * 15 + iket] = HRR_INT__s_f_g_s[5 * 15 + iket] - ( hAB[2] * HRR_INT__s_d_g_s[2 * 15 + iket] );
780 
781                     HRR_INT__p_d_g_s[15 * 15 + iket] = HRR_INT__s_f_g_s[7 * 15 + iket] - ( hAB[2] * HRR_INT__s_d_g_s[3 * 15 + iket] );
782 
783                     HRR_INT__p_d_g_s[16 * 15 + iket] = HRR_INT__s_f_g_s[8 * 15 + iket] - ( hAB[2] * HRR_INT__s_d_g_s[4 * 15 + iket] );
784 
785                     HRR_INT__p_d_g_s[17 * 15 + iket] = HRR_INT__s_f_g_s[9 * 15 + iket] - ( hAB[2] * HRR_INT__s_d_g_s[5 * 15 + iket] );
786 
787                 }
788 
789 
790                 // form INT__p_d_d_p
791                 for(ibra = 0; ibra < 18; ++ibra)
792                 {
793                     HRR_INT__p_d_d_p[ibra * 18 + 0] = HRR_INT__p_d_f_s[ibra * 10 + 0] + ( hCD[0] * HRR_INT__p_d_d_s[ibra * 6 + 0] );
794 
795                     HRR_INT__p_d_d_p[ibra * 18 + 1] = HRR_INT__p_d_f_s[ibra * 10 + 1] + ( hCD[1] * HRR_INT__p_d_d_s[ibra * 6 + 0] );
796 
797                     HRR_INT__p_d_d_p[ibra * 18 + 2] = HRR_INT__p_d_f_s[ibra * 10 + 2] + ( hCD[2] * HRR_INT__p_d_d_s[ibra * 6 + 0] );
798 
799                     HRR_INT__p_d_d_p[ibra * 18 + 3] = HRR_INT__p_d_f_s[ibra * 10 + 1] + ( hCD[0] * HRR_INT__p_d_d_s[ibra * 6 + 1] );
800 
801                     HRR_INT__p_d_d_p[ibra * 18 + 4] = HRR_INT__p_d_f_s[ibra * 10 + 3] + ( hCD[1] * HRR_INT__p_d_d_s[ibra * 6 + 1] );
802 
803                     HRR_INT__p_d_d_p[ibra * 18 + 5] = HRR_INT__p_d_f_s[ibra * 10 + 4] + ( hCD[2] * HRR_INT__p_d_d_s[ibra * 6 + 1] );
804 
805                     HRR_INT__p_d_d_p[ibra * 18 + 6] = HRR_INT__p_d_f_s[ibra * 10 + 2] + ( hCD[0] * HRR_INT__p_d_d_s[ibra * 6 + 2] );
806 
807                     HRR_INT__p_d_d_p[ibra * 18 + 7] = HRR_INT__p_d_f_s[ibra * 10 + 4] + ( hCD[1] * HRR_INT__p_d_d_s[ibra * 6 + 2] );
808 
809                     HRR_INT__p_d_d_p[ibra * 18 + 8] = HRR_INT__p_d_f_s[ibra * 10 + 5] + ( hCD[2] * HRR_INT__p_d_d_s[ibra * 6 + 2] );
810 
811                     HRR_INT__p_d_d_p[ibra * 18 + 9] = HRR_INT__p_d_f_s[ibra * 10 + 3] + ( hCD[0] * HRR_INT__p_d_d_s[ibra * 6 + 3] );
812 
813                     HRR_INT__p_d_d_p[ibra * 18 + 10] = HRR_INT__p_d_f_s[ibra * 10 + 6] + ( hCD[1] * HRR_INT__p_d_d_s[ibra * 6 + 3] );
814 
815                     HRR_INT__p_d_d_p[ibra * 18 + 11] = HRR_INT__p_d_f_s[ibra * 10 + 7] + ( hCD[2] * HRR_INT__p_d_d_s[ibra * 6 + 3] );
816 
817                     HRR_INT__p_d_d_p[ibra * 18 + 12] = HRR_INT__p_d_f_s[ibra * 10 + 4] + ( hCD[0] * HRR_INT__p_d_d_s[ibra * 6 + 4] );
818 
819                     HRR_INT__p_d_d_p[ibra * 18 + 13] = HRR_INT__p_d_f_s[ibra * 10 + 7] + ( hCD[1] * HRR_INT__p_d_d_s[ibra * 6 + 4] );
820 
821                     HRR_INT__p_d_d_p[ibra * 18 + 14] = HRR_INT__p_d_f_s[ibra * 10 + 8] + ( hCD[2] * HRR_INT__p_d_d_s[ibra * 6 + 4] );
822 
823                     HRR_INT__p_d_d_p[ibra * 18 + 15] = HRR_INT__p_d_f_s[ibra * 10 + 5] + ( hCD[0] * HRR_INT__p_d_d_s[ibra * 6 + 5] );
824 
825                     HRR_INT__p_d_d_p[ibra * 18 + 16] = HRR_INT__p_d_f_s[ibra * 10 + 8] + ( hCD[1] * HRR_INT__p_d_d_s[ibra * 6 + 5] );
826 
827                     HRR_INT__p_d_d_p[ibra * 18 + 17] = HRR_INT__p_d_f_s[ibra * 10 + 9] + ( hCD[2] * HRR_INT__p_d_d_s[ibra * 6 + 5] );
828 
829                 }
830 
831                 // form INT__p_d_f_p
832                 HRR_L_f_p(
833                     HRR_INT__p_d_f_p,
834                     HRR_INT__p_d_f_s,
835                     HRR_INT__p_d_g_s,
836                     hCD, 18);
837 
838                 // form INT__p_d_d_d
839                 HRR_L_d_d(
840                     HRR_INT__p_d_d_d,
841                     HRR_INT__p_d_d_p,
842                     HRR_INT__p_d_f_p,
843                     hCD, 18);
844 
845 
846             }  // close HRR loop
847 
848 
849         }   // close loop cdbatch
850 
851         istart = iend;
852     }  // close loop over ab
853 
854     return P.nshell12_clip * Q.nshell12_clip;
855 }
856 
857