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_f_d_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_f_d_p)8 int ostei_f_f_d_p(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_f_d_p)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__f_f_d_p);
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_d_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__f_s_f_s = work + (SIMINT_NSHELL_SIMD * 60);
31     double * const INT__g_s_d_s = work + (SIMINT_NSHELL_SIMD * 160);
32     double * const INT__g_s_f_s = work + (SIMINT_NSHELL_SIMD * 250);
33     double * const INT__h_s_d_s = work + (SIMINT_NSHELL_SIMD * 400);
34     double * const INT__h_s_f_s = work + (SIMINT_NSHELL_SIMD * 526);
35     double * const INT__i_s_d_s = work + (SIMINT_NSHELL_SIMD * 736);
36     double * const INT__i_s_f_s = work + (SIMINT_NSHELL_SIMD * 904);
37     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*1184);
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 10;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 37;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 64;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 112;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 166;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 238;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 308;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 398;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 518;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 618;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 708;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 843;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 1023;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 1173;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 1278;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 1467;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 1719;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 1929;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 2041;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 2293;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 2629;
60     double * const hrrwork = (double *)(primwork + 2909);
61     double * const HRR_INT__f_p_d_s = hrrwork + 0;
62     double * const HRR_INT__f_p_f_s = hrrwork + 180;
63     double * const HRR_INT__f_d_d_s = hrrwork + 480;
64     double * const HRR_INT__f_d_f_s = hrrwork + 840;
65     double * const HRR_INT__f_f_d_s = hrrwork + 1440;
66     double * const HRR_INT__f_f_f_s = hrrwork + 2040;
67     double * const HRR_INT__g_p_d_s = hrrwork + 3040;
68     double * const HRR_INT__g_p_f_s = hrrwork + 3310;
69     double * const HRR_INT__g_d_d_s = hrrwork + 3760;
70     double * const HRR_INT__g_d_f_s = hrrwork + 4300;
71     double * const HRR_INT__h_p_d_s = hrrwork + 5200;
72     double * const HRR_INT__h_p_f_s = hrrwork + 5578;
73 
74 
75     // Create constants
76     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
77     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
78     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
79     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
80     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
81     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
82     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
83 
84 
85     ////////////////////////////////////////
86     // Loop over shells and primitives
87     ////////////////////////////////////////
88 
89     real_abcd = 0;
90     istart = 0;
91     for(ab = 0; ab < P.nshell12_clip; ++ab)
92     {
93         const int iend = istart + P.nprim12[ab];
94 
95         cd = 0;
96         jstart = 0;
97 
98         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
99         {
100             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
101             int jend = jstart;
102             for(i = 0; i < nshellbatch; i++)
103                 jend += Q.nprim12[cd+i];
104 
105             // Clear the beginning of the workspace (where we are accumulating integrals)
106             memset(work, 0, SIMINT_NSHELL_SIMD * 1184 * sizeof(double));
107             abcd = 0;
108 
109 
110             for(i = istart; i < iend; ++i)
111             {
112                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
113 
114                 if(check_screen)
115                 {
116                     // Skip this whole thing if always insignificant
117                     if((P.screen[i] * Q.screen_max) < screen_tol)
118                         continue;
119                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
120                 }
121 
122                 icd = 0;
123                 iprimcd = 0;
124                 nprim_icd = Q.nprim12[cd];
125                 double * restrict PRIM_PTR_INT__f_s_d_s = INT__f_s_d_s + abcd * 60;
126                 double * restrict PRIM_PTR_INT__f_s_f_s = INT__f_s_f_s + abcd * 100;
127                 double * restrict PRIM_PTR_INT__g_s_d_s = INT__g_s_d_s + abcd * 90;
128                 double * restrict PRIM_PTR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
129                 double * restrict PRIM_PTR_INT__h_s_d_s = INT__h_s_d_s + abcd * 126;
130                 double * restrict PRIM_PTR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
131                 double * restrict PRIM_PTR_INT__i_s_d_s = INT__i_s_d_s + abcd * 168;
132                 double * restrict PRIM_PTR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
133 
134 
135 
136                 // Load these one per loop over i
137                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
138                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
139                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
140 
141                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
142 
143                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
144                 {
145                     // calculate the shell offsets
146                     // these are the offset from the shell pointed to by cd
147                     // for each element
148                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
149                     int lastoffset = 0;
150                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
151 
152                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
153                     {
154                         // Handle if the first element of the vector is a new shell
155                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
156                         {
157                             nprim_icd += Q.nprim12[cd + (++icd)];
158                             PRIM_PTR_INT__f_s_d_s += 60;
159                             PRIM_PTR_INT__f_s_f_s += 100;
160                             PRIM_PTR_INT__g_s_d_s += 90;
161                             PRIM_PTR_INT__g_s_f_s += 150;
162                             PRIM_PTR_INT__h_s_d_s += 126;
163                             PRIM_PTR_INT__h_s_f_s += 210;
164                             PRIM_PTR_INT__i_s_d_s += 168;
165                             PRIM_PTR_INT__i_s_f_s += 280;
166                         }
167                         iprimcd++;
168                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
169                         {
170                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
171                             {
172                                 shelloffsets[n] = shelloffsets[n-1] + 1;
173                                 lastoffset++;
174                                 nprim_icd += Q.nprim12[cd + (++icd)];
175                             }
176                             else
177                                 shelloffsets[n] = shelloffsets[n-1];
178                             iprimcd++;
179                         }
180                     }
181                     else
182                         iprimcd += SIMINT_SIMD_LEN;
183 
184                     // Do we have to compute this vector (or has it been screened out)?
185                     // (not_screened != 0 means we have to do this vector)
186                     if(check_screen)
187                     {
188                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
189                         if(vmax < screen_tol)
190                         {
191                             PRIM_PTR_INT__f_s_d_s += lastoffset*60;
192                             PRIM_PTR_INT__f_s_f_s += lastoffset*100;
193                             PRIM_PTR_INT__g_s_d_s += lastoffset*90;
194                             PRIM_PTR_INT__g_s_f_s += lastoffset*150;
195                             PRIM_PTR_INT__h_s_d_s += lastoffset*126;
196                             PRIM_PTR_INT__h_s_f_s += lastoffset*210;
197                             PRIM_PTR_INT__i_s_d_s += lastoffset*168;
198                             PRIM_PTR_INT__i_s_f_s += lastoffset*280;
199                             continue;
200                         }
201                     }
202 
203                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
204                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
205                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
206                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
207 
208 
209                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
210                     SIMINT_DBLTYPE PQ[3];
211                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
212                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
213                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
214                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
215                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
216                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
217 
218                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
219                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
220                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
221                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
222                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
223                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
224                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
225 
226                     // NOTE: Minus sign!
227                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
228                     SIMINT_DBLTYPE aop_PQ[3];
229                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
230                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
231                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
232 
233                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
234                     SIMINT_DBLTYPE aoq_PQ[3];
235                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
236                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
237                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
238                     // Put a minus sign here so we don't have to in RR routines
239                     a_over_q = SIMINT_NEG(a_over_q);
240 
241 
242                     //////////////////////////////////////////////
243                     // Fjt function section
244                     // Maximum v value: 9
245                     //////////////////////////////////////////////
246                     // The parameter to the Fjt function
247                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
248 
249 
250                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
251 
252 
253                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 9);
254                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
255                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
256                     for(n = 0; n <= 9; n++)
257                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
258 
259                     //////////////////////////////////////////////
260                     // Primitive integrals: Vertical recurrance
261                     //////////////////////////////////////////////
262 
263                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
264                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
265                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
266                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
267                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
268                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
269                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
270                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
271                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
272                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
273                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
274                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
275                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
276 
277 
278 
279                     // Forming PRIM_INT__p_s_s_s[9 * 3];
280                     for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
281                     {
282 
283                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
284                         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]);
285 
286                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
287                         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]);
288 
289                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
290                         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]);
291 
292                     }
293 
294 
295 
296                     // Forming PRIM_INT__d_s_s_s[8 * 6];
297                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
298                     {
299 
300                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
301                         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]);
302                         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]);
303 
304                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
305                         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]);
306 
307                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
308                         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]);
309 
310                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
311                         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]);
312                         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]);
313 
314                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
315                         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]);
316 
317                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
318                         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]);
319                         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]);
320 
321                     }
322 
323 
324 
325                     // Forming PRIM_INT__f_s_s_s[7 * 10];
326                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
327                     {
328 
329                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
330                         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]);
331                         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]);
332 
333                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
334                         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]);
335 
336                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
337                         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]);
338 
339                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
340                         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]);
341 
342                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
343                         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]);
344 
345                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
346                         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]);
347 
348                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
349                         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]);
350                         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]);
351 
352                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
353                         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]);
354 
355                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
356                         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]);
357 
358                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
359                         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]);
360                         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]);
361 
362                     }
363 
364 
365                     VRR_K_f_s_p_s(
366                             PRIM_INT__f_s_p_s,
367                             PRIM_INT__f_s_s_s,
368                             PRIM_INT__d_s_s_s,
369                             Q_PA,
370                             aoq_PQ,
371                             one_over_2pq,
372                             3);
373 
374 
375 
376                     // Forming PRIM_INT__d_s_p_s[3 * 18];
377                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
378                     {
379 
380                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
381                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
382                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
383 
384                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
385                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 1]);
386 
387                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
388                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 2]);
389 
390                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
391                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 3]);
392                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 3]);
393 
394                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
395                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 4]);
396                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 4]);
397 
398                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
399                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 5]);
400 
401                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
402                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 6]);
403                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 6]);
404 
405                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
406                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 7]);
407 
408                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
409                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 8]);
410                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 8]);
411 
412                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
413                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);
414 
415                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
416                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 10]);
417                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 10]);
418 
419                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
420                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 11]);
421 
422                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
423                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 12]);
424 
425                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
426                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 13]);
427                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 13]);
428 
429                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
430                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 14]);
431                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 14]);
432 
433                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
434                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 15]);
435 
436                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
437                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 16]);
438 
439                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
440                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 17]);
441                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 17]);
442 
443                     }
444 
445 
446                     VRR_K_f_s_d_s(
447                             PRIM_INT__f_s_d_s,
448                             PRIM_INT__f_s_p_s,
449                             PRIM_INT__f_s_s_s,
450                             PRIM_INT__d_s_p_s,
451                             Q_PA,
452                             a_over_q,
453                             aoq_PQ,
454                             one_over_2pq,
455                             one_over_2q,
456                             2);
457 
458 
459 
460                     // Forming PRIM_INT__p_s_p_s[3 * 9];
461                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
462                     {
463 
464                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
465                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);
466                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);
467 
468                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
469                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 1]);
470 
471                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
472                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 2]);
473 
474                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 1]);
475                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 3]);
476 
477                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
478                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 4]);
479                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_p_s[n * 9 + 4]);
480 
481                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
482                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 5]);
483 
484                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 2]);
485                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 6]);
486 
487                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 2]);
488                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 7]);
489 
490                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
491                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 8]);
492                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_p_s[n * 9 + 8]);
493 
494                     }
495 
496 
497                     VRR_K_d_s_d_s(
498                             PRIM_INT__d_s_d_s,
499                             PRIM_INT__d_s_p_s,
500                             PRIM_INT__d_s_s_s,
501                             PRIM_INT__p_s_p_s,
502                             Q_PA,
503                             a_over_q,
504                             aoq_PQ,
505                             one_over_2pq,
506                             one_over_2q,
507                             2);
508 
509 
510                     ostei_general_vrr_K(3, 0, 3, 0, 1,
511                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
512                             PRIM_INT__f_s_d_s, PRIM_INT__f_s_p_s, NULL, PRIM_INT__d_s_d_s, NULL, PRIM_INT__f_s_f_s);
513 
514 
515                     VRR_I_g_s_s_s(
516                             PRIM_INT__g_s_s_s,
517                             PRIM_INT__f_s_s_s,
518                             PRIM_INT__d_s_s_s,
519                             P_PA,
520                             a_over_p,
521                             aop_PQ,
522                             one_over_2p,
523                             6);
524 
525 
526                     VRR_K_g_s_p_s(
527                             PRIM_INT__g_s_p_s,
528                             PRIM_INT__g_s_s_s,
529                             PRIM_INT__f_s_s_s,
530                             Q_PA,
531                             aoq_PQ,
532                             one_over_2pq,
533                             3);
534 
535 
536                     ostei_general_vrr_K(4, 0, 2, 0, 2,
537                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
538                             PRIM_INT__g_s_p_s, PRIM_INT__g_s_s_s, NULL, PRIM_INT__f_s_p_s, NULL, PRIM_INT__g_s_d_s);
539 
540 
541                     ostei_general_vrr_K(4, 0, 3, 0, 1,
542                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
543                             PRIM_INT__g_s_d_s, PRIM_INT__g_s_p_s, NULL, PRIM_INT__f_s_d_s, NULL, PRIM_INT__g_s_f_s);
544 
545 
546                     VRR_I_h_s_s_s(
547                             PRIM_INT__h_s_s_s,
548                             PRIM_INT__g_s_s_s,
549                             PRIM_INT__f_s_s_s,
550                             P_PA,
551                             a_over_p,
552                             aop_PQ,
553                             one_over_2p,
554                             5);
555 
556 
557                     ostei_general_vrr_K(5, 0, 1, 0, 3,
558                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
559                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
560 
561 
562                     ostei_general_vrr_K(5, 0, 2, 0, 2,
563                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
564                             PRIM_INT__h_s_p_s, PRIM_INT__h_s_s_s, NULL, PRIM_INT__g_s_p_s, NULL, PRIM_INT__h_s_d_s);
565 
566 
567                     ostei_general_vrr_K(5, 0, 3, 0, 1,
568                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
569                             PRIM_INT__h_s_d_s, PRIM_INT__h_s_p_s, NULL, PRIM_INT__g_s_d_s, NULL, PRIM_INT__h_s_f_s);
570 
571 
572                     ostei_general_vrr1_I(6, 4,
573                             one_over_2p, a_over_p, aop_PQ, P_PA,
574                             PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
575 
576 
577                     ostei_general_vrr_K(6, 0, 1, 0, 3,
578                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
579                             PRIM_INT__i_s_s_s, NULL, NULL, PRIM_INT__h_s_s_s, NULL, PRIM_INT__i_s_p_s);
580 
581 
582                     ostei_general_vrr_K(6, 0, 2, 0, 2,
583                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
584                             PRIM_INT__i_s_p_s, PRIM_INT__i_s_s_s, NULL, PRIM_INT__h_s_p_s, NULL, PRIM_INT__i_s_d_s);
585 
586 
587                     ostei_general_vrr_K(6, 0, 3, 0, 1,
588                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
589                             PRIM_INT__i_s_d_s, PRIM_INT__i_s_p_s, NULL, PRIM_INT__h_s_d_s, NULL, PRIM_INT__i_s_f_s);
590 
591 
592 
593 
594                     ////////////////////////////////////
595                     // Accumulate contracted integrals
596                     ////////////////////////////////////
597                     if(lastoffset == 0)
598                     {
599                         contract_all(60, PRIM_INT__f_s_d_s, PRIM_PTR_INT__f_s_d_s);
600                         contract_all(100, PRIM_INT__f_s_f_s, PRIM_PTR_INT__f_s_f_s);
601                         contract_all(90, PRIM_INT__g_s_d_s, PRIM_PTR_INT__g_s_d_s);
602                         contract_all(150, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
603                         contract_all(126, PRIM_INT__h_s_d_s, PRIM_PTR_INT__h_s_d_s);
604                         contract_all(210, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
605                         contract_all(168, PRIM_INT__i_s_d_s, PRIM_PTR_INT__i_s_d_s);
606                         contract_all(280, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
607                     }
608                     else
609                     {
610                         contract(60, shelloffsets, PRIM_INT__f_s_d_s, PRIM_PTR_INT__f_s_d_s);
611                         contract(100, shelloffsets, PRIM_INT__f_s_f_s, PRIM_PTR_INT__f_s_f_s);
612                         contract(90, shelloffsets, PRIM_INT__g_s_d_s, PRIM_PTR_INT__g_s_d_s);
613                         contract(150, shelloffsets, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
614                         contract(126, shelloffsets, PRIM_INT__h_s_d_s, PRIM_PTR_INT__h_s_d_s);
615                         contract(210, shelloffsets, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
616                         contract(168, shelloffsets, PRIM_INT__i_s_d_s, PRIM_PTR_INT__i_s_d_s);
617                         contract(280, shelloffsets, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
618                         PRIM_PTR_INT__f_s_d_s += lastoffset*60;
619                         PRIM_PTR_INT__f_s_f_s += lastoffset*100;
620                         PRIM_PTR_INT__g_s_d_s += lastoffset*90;
621                         PRIM_PTR_INT__g_s_f_s += lastoffset*150;
622                         PRIM_PTR_INT__h_s_d_s += lastoffset*126;
623                         PRIM_PTR_INT__h_s_f_s += lastoffset*210;
624                         PRIM_PTR_INT__i_s_d_s += lastoffset*168;
625                         PRIM_PTR_INT__i_s_f_s += lastoffset*280;
626                     }
627 
628                 }  // close loop over j
629             }  // close loop over i
630 
631             //Advance to the next batch
632             jstart = SIMINT_SIMD_ROUND(jend);
633 
634             //////////////////////////////////////////////
635             // Contracted integrals: Horizontal recurrance
636             //////////////////////////////////////////////
637 
638 
639             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
640 
641 
642             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
643             {
644                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
645 
646                 // set up HRR pointers
647                 double const * restrict HRR_INT__f_s_d_s = INT__f_s_d_s + abcd * 60;
648                 double const * restrict HRR_INT__f_s_f_s = INT__f_s_f_s + abcd * 100;
649                 double const * restrict HRR_INT__g_s_d_s = INT__g_s_d_s + abcd * 90;
650                 double const * restrict HRR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
651                 double const * restrict HRR_INT__h_s_d_s = INT__h_s_d_s + abcd * 126;
652                 double const * restrict HRR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
653                 double const * restrict HRR_INT__i_s_d_s = INT__i_s_d_s + abcd * 168;
654                 double const * restrict HRR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
655                 double * restrict HRR_INT__f_f_d_p = INT__f_f_d_p + real_abcd * 1800;
656 
657                 // form INT__f_p_d_s
658                 HRR_J_f_p(
659                     HRR_INT__f_p_d_s,
660                     HRR_INT__f_s_d_s,
661                     HRR_INT__g_s_d_s,
662                     hAB, 6);
663 
664                 // form INT__f_p_f_s
665                 HRR_J_f_p(
666                     HRR_INT__f_p_f_s,
667                     HRR_INT__f_s_f_s,
668                     HRR_INT__g_s_f_s,
669                     hAB, 10);
670 
671                 // form INT__g_p_d_s
672                 HRR_J_g_p(
673                     HRR_INT__g_p_d_s,
674                     HRR_INT__g_s_d_s,
675                     HRR_INT__h_s_d_s,
676                     hAB, 6);
677 
678                 // form INT__g_p_f_s
679                 HRR_J_g_p(
680                     HRR_INT__g_p_f_s,
681                     HRR_INT__g_s_f_s,
682                     HRR_INT__h_s_f_s,
683                     hAB, 10);
684 
685                 // form INT__h_p_d_s
686                 ostei_general_hrr_J(5, 1, 2, 0, hAB, HRR_INT__i_s_d_s, HRR_INT__h_s_d_s, HRR_INT__h_p_d_s);
687 
688                 // form INT__h_p_f_s
689                 ostei_general_hrr_J(5, 1, 3, 0, hAB, HRR_INT__i_s_f_s, HRR_INT__h_s_f_s, HRR_INT__h_p_f_s);
690 
691                 // form INT__f_d_d_s
692                 HRR_J_f_d(
693                     HRR_INT__f_d_d_s,
694                     HRR_INT__f_p_d_s,
695                     HRR_INT__g_p_d_s,
696                     hAB, 6);
697 
698                 // form INT__f_d_f_s
699                 HRR_J_f_d(
700                     HRR_INT__f_d_f_s,
701                     HRR_INT__f_p_f_s,
702                     HRR_INT__g_p_f_s,
703                     hAB, 10);
704 
705                 // form INT__g_d_d_s
706                 ostei_general_hrr_J(4, 2, 2, 0, hAB, HRR_INT__h_p_d_s, HRR_INT__g_p_d_s, HRR_INT__g_d_d_s);
707 
708                 // form INT__g_d_f_s
709                 ostei_general_hrr_J(4, 2, 3, 0, hAB, HRR_INT__h_p_f_s, HRR_INT__g_p_f_s, HRR_INT__g_d_f_s);
710 
711                 // form INT__f_f_d_s
712                 ostei_general_hrr_J(3, 3, 2, 0, hAB, HRR_INT__g_d_d_s, HRR_INT__f_d_d_s, HRR_INT__f_f_d_s);
713 
714                 // form INT__f_f_f_s
715                 ostei_general_hrr_J(3, 3, 3, 0, hAB, HRR_INT__g_d_f_s, HRR_INT__f_d_f_s, HRR_INT__f_f_f_s);
716 
717                 // form INT__f_f_d_p
718                 for(ibra = 0; ibra < 100; ++ibra)
719                 {
720                     HRR_INT__f_f_d_p[ibra * 18 + 0] = HRR_INT__f_f_f_s[ibra * 10 + 0] + ( hCD[0] * HRR_INT__f_f_d_s[ibra * 6 + 0] );
721 
722                     HRR_INT__f_f_d_p[ibra * 18 + 1] = HRR_INT__f_f_f_s[ibra * 10 + 1] + ( hCD[1] * HRR_INT__f_f_d_s[ibra * 6 + 0] );
723 
724                     HRR_INT__f_f_d_p[ibra * 18 + 2] = HRR_INT__f_f_f_s[ibra * 10 + 2] + ( hCD[2] * HRR_INT__f_f_d_s[ibra * 6 + 0] );
725 
726                     HRR_INT__f_f_d_p[ibra * 18 + 3] = HRR_INT__f_f_f_s[ibra * 10 + 1] + ( hCD[0] * HRR_INT__f_f_d_s[ibra * 6 + 1] );
727 
728                     HRR_INT__f_f_d_p[ibra * 18 + 4] = HRR_INT__f_f_f_s[ibra * 10 + 3] + ( hCD[1] * HRR_INT__f_f_d_s[ibra * 6 + 1] );
729 
730                     HRR_INT__f_f_d_p[ibra * 18 + 5] = HRR_INT__f_f_f_s[ibra * 10 + 4] + ( hCD[2] * HRR_INT__f_f_d_s[ibra * 6 + 1] );
731 
732                     HRR_INT__f_f_d_p[ibra * 18 + 6] = HRR_INT__f_f_f_s[ibra * 10 + 2] + ( hCD[0] * HRR_INT__f_f_d_s[ibra * 6 + 2] );
733 
734                     HRR_INT__f_f_d_p[ibra * 18 + 7] = HRR_INT__f_f_f_s[ibra * 10 + 4] + ( hCD[1] * HRR_INT__f_f_d_s[ibra * 6 + 2] );
735 
736                     HRR_INT__f_f_d_p[ibra * 18 + 8] = HRR_INT__f_f_f_s[ibra * 10 + 5] + ( hCD[2] * HRR_INT__f_f_d_s[ibra * 6 + 2] );
737 
738                     HRR_INT__f_f_d_p[ibra * 18 + 9] = HRR_INT__f_f_f_s[ibra * 10 + 3] + ( hCD[0] * HRR_INT__f_f_d_s[ibra * 6 + 3] );
739 
740                     HRR_INT__f_f_d_p[ibra * 18 + 10] = HRR_INT__f_f_f_s[ibra * 10 + 6] + ( hCD[1] * HRR_INT__f_f_d_s[ibra * 6 + 3] );
741 
742                     HRR_INT__f_f_d_p[ibra * 18 + 11] = HRR_INT__f_f_f_s[ibra * 10 + 7] + ( hCD[2] * HRR_INT__f_f_d_s[ibra * 6 + 3] );
743 
744                     HRR_INT__f_f_d_p[ibra * 18 + 12] = HRR_INT__f_f_f_s[ibra * 10 + 4] + ( hCD[0] * HRR_INT__f_f_d_s[ibra * 6 + 4] );
745 
746                     HRR_INT__f_f_d_p[ibra * 18 + 13] = HRR_INT__f_f_f_s[ibra * 10 + 7] + ( hCD[1] * HRR_INT__f_f_d_s[ibra * 6 + 4] );
747 
748                     HRR_INT__f_f_d_p[ibra * 18 + 14] = HRR_INT__f_f_f_s[ibra * 10 + 8] + ( hCD[2] * HRR_INT__f_f_d_s[ibra * 6 + 4] );
749 
750                     HRR_INT__f_f_d_p[ibra * 18 + 15] = HRR_INT__f_f_f_s[ibra * 10 + 5] + ( hCD[0] * HRR_INT__f_f_d_s[ibra * 6 + 5] );
751 
752                     HRR_INT__f_f_d_p[ibra * 18 + 16] = HRR_INT__f_f_f_s[ibra * 10 + 8] + ( hCD[1] * HRR_INT__f_f_d_s[ibra * 6 + 5] );
753 
754                     HRR_INT__f_f_d_p[ibra * 18 + 17] = HRR_INT__f_f_f_s[ibra * 10 + 9] + ( hCD[2] * HRR_INT__f_f_d_s[ibra * 6 + 5] );
755 
756                 }
757 
758 
759             }  // close HRR loop
760 
761 
762         }   // close loop cdbatch
763 
764         istart = iend;
765     }  // close loop over ab
766 
767     return P.nshell12_clip * Q.nshell12_clip;
768 }
769 
770