1 #include "simint/boys/boys.h"
2 #include "simint/ostei/gen/ostei_generated.h"
3 #include "simint/vectorization/vectorization.h"
4 #include <math.h>
5 #include <string.h>
6 
7 
ostei_f_d_g_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_d_g_f)8 int ostei_f_d_g_f(struct simint_multi_shellpair const P,
9                   struct simint_multi_shellpair const Q,
10                   double screen_tol,
11                   double * const restrict work,
12                   double * const restrict INT__f_d_g_f)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__f_d_g_f);
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_g_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__f_s_h_s = work + (SIMINT_NSHELL_SIMD * 150);
31     double * const INT__f_s_i_s = work + (SIMINT_NSHELL_SIMD * 360);
32     double * const INT__f_s_k_s = work + (SIMINT_NSHELL_SIMD * 640);
33     double * const INT__g_s_g_s = work + (SIMINT_NSHELL_SIMD * 1000);
34     double * const INT__g_s_h_s = work + (SIMINT_NSHELL_SIMD * 1225);
35     double * const INT__g_s_i_s = work + (SIMINT_NSHELL_SIMD * 1540);
36     double * const INT__g_s_k_s = work + (SIMINT_NSHELL_SIMD * 1960);
37     double * const INT__h_s_g_s = work + (SIMINT_NSHELL_SIMD * 2500);
38     double * const INT__h_s_h_s = work + (SIMINT_NSHELL_SIMD * 2815);
39     double * const INT__h_s_i_s = work + (SIMINT_NSHELL_SIMD * 3256);
40     double * const INT__h_s_k_s = work + (SIMINT_NSHELL_SIMD * 3844);
41     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*4600);
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 13;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 49;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 115;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 215;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 350;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 518;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 714;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 930;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 945;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 990;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 1080;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1230;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 1455;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 1770;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 2190;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 2730;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 2802;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 2946;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 3186;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 3546;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 4050;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 4722;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 5586;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 5766;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 6066;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 6516;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 7146;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 7986;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 9066;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 9366;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 9816;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 10446;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 11286;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 12366;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 12681;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 13122;
79     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 13710;
80     double * const hrrwork = (double *)(primwork + 14466);
81     double * const HRR_INT__f_p_g_s = hrrwork + 0;
82     double * const HRR_INT__f_p_h_s = hrrwork + 450;
83     double * const HRR_INT__f_p_i_s = hrrwork + 1080;
84     double * const HRR_INT__f_p_k_s = hrrwork + 1920;
85     double * const HRR_INT__f_d_g_s = hrrwork + 3000;
86     double * const HRR_INT__f_d_g_p = hrrwork + 3900;
87     double * const HRR_INT__f_d_g_d = hrrwork + 6600;
88     double * const HRR_INT__f_d_h_s = hrrwork + 12000;
89     double * const HRR_INT__f_d_h_p = hrrwork + 13260;
90     double * const HRR_INT__f_d_h_d = hrrwork + 17040;
91     double * const HRR_INT__f_d_i_s = hrrwork + 24600;
92     double * const HRR_INT__f_d_i_p = hrrwork + 26280;
93     double * const HRR_INT__f_d_k_s = hrrwork + 31320;
94     double * const HRR_INT__g_p_g_s = hrrwork + 33480;
95     double * const HRR_INT__g_p_h_s = hrrwork + 34155;
96     double * const HRR_INT__g_p_i_s = hrrwork + 35100;
97     double * const HRR_INT__g_p_k_s = hrrwork + 36360;
98 
99 
100     // Create constants
101     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
102     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
103     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
104     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
105     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
106     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
107     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
108     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
109 
110 
111     ////////////////////////////////////////
112     // Loop over shells and primitives
113     ////////////////////////////////////////
114 
115     real_abcd = 0;
116     istart = 0;
117     for(ab = 0; ab < P.nshell12_clip; ++ab)
118     {
119         const int iend = istart + P.nprim12[ab];
120 
121         cd = 0;
122         jstart = 0;
123 
124         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
125         {
126             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
127             int jend = jstart;
128             for(i = 0; i < nshellbatch; i++)
129                 jend += Q.nprim12[cd+i];
130 
131             // Clear the beginning of the workspace (where we are accumulating integrals)
132             memset(work, 0, SIMINT_NSHELL_SIMD * 4600 * sizeof(double));
133             abcd = 0;
134 
135 
136             for(i = istart; i < iend; ++i)
137             {
138                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
139 
140                 if(check_screen)
141                 {
142                     // Skip this whole thing if always insignificant
143                     if((P.screen[i] * Q.screen_max) < screen_tol)
144                         continue;
145                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
146                 }
147 
148                 icd = 0;
149                 iprimcd = 0;
150                 nprim_icd = Q.nprim12[cd];
151                 double * restrict PRIM_PTR_INT__f_s_g_s = INT__f_s_g_s + abcd * 150;
152                 double * restrict PRIM_PTR_INT__f_s_h_s = INT__f_s_h_s + abcd * 210;
153                 double * restrict PRIM_PTR_INT__f_s_i_s = INT__f_s_i_s + abcd * 280;
154                 double * restrict PRIM_PTR_INT__f_s_k_s = INT__f_s_k_s + abcd * 360;
155                 double * restrict PRIM_PTR_INT__g_s_g_s = INT__g_s_g_s + abcd * 225;
156                 double * restrict PRIM_PTR_INT__g_s_h_s = INT__g_s_h_s + abcd * 315;
157                 double * restrict PRIM_PTR_INT__g_s_i_s = INT__g_s_i_s + abcd * 420;
158                 double * restrict PRIM_PTR_INT__g_s_k_s = INT__g_s_k_s + abcd * 540;
159                 double * restrict PRIM_PTR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
160                 double * restrict PRIM_PTR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
161                 double * restrict PRIM_PTR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
162                 double * restrict PRIM_PTR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
163 
164 
165 
166                 // Load these one per loop over i
167                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
168                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
169                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
170 
171                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
172 
173                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
174                 {
175                     // calculate the shell offsets
176                     // these are the offset from the shell pointed to by cd
177                     // for each element
178                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
179                     int lastoffset = 0;
180                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
181 
182                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
183                     {
184                         // Handle if the first element of the vector is a new shell
185                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
186                         {
187                             nprim_icd += Q.nprim12[cd + (++icd)];
188                             PRIM_PTR_INT__f_s_g_s += 150;
189                             PRIM_PTR_INT__f_s_h_s += 210;
190                             PRIM_PTR_INT__f_s_i_s += 280;
191                             PRIM_PTR_INT__f_s_k_s += 360;
192                             PRIM_PTR_INT__g_s_g_s += 225;
193                             PRIM_PTR_INT__g_s_h_s += 315;
194                             PRIM_PTR_INT__g_s_i_s += 420;
195                             PRIM_PTR_INT__g_s_k_s += 540;
196                             PRIM_PTR_INT__h_s_g_s += 315;
197                             PRIM_PTR_INT__h_s_h_s += 441;
198                             PRIM_PTR_INT__h_s_i_s += 588;
199                             PRIM_PTR_INT__h_s_k_s += 756;
200                         }
201                         iprimcd++;
202                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
203                         {
204                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
205                             {
206                                 shelloffsets[n] = shelloffsets[n-1] + 1;
207                                 lastoffset++;
208                                 nprim_icd += Q.nprim12[cd + (++icd)];
209                             }
210                             else
211                                 shelloffsets[n] = shelloffsets[n-1];
212                             iprimcd++;
213                         }
214                     }
215                     else
216                         iprimcd += SIMINT_SIMD_LEN;
217 
218                     // Do we have to compute this vector (or has it been screened out)?
219                     // (not_screened != 0 means we have to do this vector)
220                     if(check_screen)
221                     {
222                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
223                         if(vmax < screen_tol)
224                         {
225                             PRIM_PTR_INT__f_s_g_s += lastoffset*150;
226                             PRIM_PTR_INT__f_s_h_s += lastoffset*210;
227                             PRIM_PTR_INT__f_s_i_s += lastoffset*280;
228                             PRIM_PTR_INT__f_s_k_s += lastoffset*360;
229                             PRIM_PTR_INT__g_s_g_s += lastoffset*225;
230                             PRIM_PTR_INT__g_s_h_s += lastoffset*315;
231                             PRIM_PTR_INT__g_s_i_s += lastoffset*420;
232                             PRIM_PTR_INT__g_s_k_s += lastoffset*540;
233                             PRIM_PTR_INT__h_s_g_s += lastoffset*315;
234                             PRIM_PTR_INT__h_s_h_s += lastoffset*441;
235                             PRIM_PTR_INT__h_s_i_s += lastoffset*588;
236                             PRIM_PTR_INT__h_s_k_s += lastoffset*756;
237                             continue;
238                         }
239                     }
240 
241                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
242                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
243                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
244                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
245 
246 
247                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
248                     SIMINT_DBLTYPE PQ[3];
249                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
250                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
251                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
252                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
253                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
254                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
255 
256                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
257                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
258                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
259                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
260                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
261                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
262                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
263 
264                     // NOTE: Minus sign!
265                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
266                     SIMINT_DBLTYPE aop_PQ[3];
267                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
268                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
269                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
270 
271                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
272                     SIMINT_DBLTYPE aoq_PQ[3];
273                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
274                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
275                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
276                     // Put a minus sign here so we don't have to in RR routines
277                     a_over_q = SIMINT_NEG(a_over_q);
278 
279 
280                     //////////////////////////////////////////////
281                     // Fjt function section
282                     // Maximum v value: 12
283                     //////////////////////////////////////////////
284                     // The parameter to the Fjt function
285                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
286 
287 
288                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
289 
290 
291                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 12);
292                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
293                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
294                     for(n = 0; n <= 12; n++)
295                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
296 
297                     //////////////////////////////////////////////
298                     // Primitive integrals: Vertical recurrance
299                     //////////////////////////////////////////////
300 
301                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
302                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
303                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
304                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
305                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
306                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
307                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
308                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
309                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
310                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
311                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
312                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
313                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
314                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
315                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
316                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
317                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
318 
319 
320 
321                     // Forming PRIM_INT__s_s_p_s[12 * 3];
322                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
323                     {
324 
325                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
326                         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]);
327 
328                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
329                         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]);
330 
331                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
332                         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]);
333 
334                     }
335 
336 
337 
338                     // Forming PRIM_INT__s_s_d_s[11 * 6];
339                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
340                     {
341 
342                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
343                         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]);
344                         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]);
345 
346                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
347                         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]);
348 
349                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
350                         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]);
351 
352                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
353                         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]);
354                         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]);
355 
356                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
357                         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]);
358 
359                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
360                         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]);
361                         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]);
362 
363                     }
364 
365 
366 
367                     // Forming PRIM_INT__s_s_f_s[10 * 10];
368                     for(n = 0; n < 10; ++n)  // loop over orders of auxiliary function
369                     {
370 
371                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
372                         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]);
373                         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]);
374 
375                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
376                         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]);
377 
378                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
379                         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]);
380 
381                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
382                         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]);
383 
384                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
385                         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]);
386 
387                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
388                         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]);
389 
390                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
391                         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]);
392                         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]);
393 
394                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
395                         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]);
396 
397                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
398                         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]);
399 
400                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
401                         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]);
402                         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]);
403 
404                     }
405 
406 
407                     VRR_K_s_s_g_s(
408                             PRIM_INT__s_s_g_s,
409                             PRIM_INT__s_s_f_s,
410                             PRIM_INT__s_s_d_s,
411                             Q_PA,
412                             a_over_q,
413                             aoq_PQ,
414                             one_over_2q,
415                             9);
416 
417 
418                     VRR_I_p_s_g_s(
419                             PRIM_INT__p_s_g_s,
420                             PRIM_INT__s_s_g_s,
421                             PRIM_INT__s_s_f_s,
422                             P_PA,
423                             aop_PQ,
424                             one_over_2pq,
425                             5);
426 
427 
428                     VRR_I_p_s_f_s(
429                             PRIM_INT__p_s_f_s,
430                             PRIM_INT__s_s_f_s,
431                             PRIM_INT__s_s_d_s,
432                             P_PA,
433                             aop_PQ,
434                             one_over_2pq,
435                             5);
436 
437 
438                     ostei_general_vrr_I(2, 0, 4, 0, 4,
439                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
440                             PRIM_INT__p_s_g_s, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_g_s);
441 
442 
443 
444                     // Forming PRIM_INT__p_s_d_s[5 * 18];
445                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
446                     {
447 
448                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
449                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
450                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
451 
452                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
453                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
454                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
455 
456                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
457                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
458                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
459 
460                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
461                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 3]);
462 
463                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
464                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 4]);
465 
466                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
467                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 5]);
468 
469                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
470                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 6]);
471 
472                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
473                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 7]);
474                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 7]);
475 
476                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
477                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 8]);
478 
479                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
480                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 9]);
481                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 9]);
482 
483                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
484                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 10]);
485                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 10]);
486 
487                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
488                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 11]);
489 
490                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
491                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 12]);
492 
493                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
494                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 13]);
495 
496                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
497                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 14]);
498                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 14]);
499 
500                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
501                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 15]);
502 
503                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
504                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 16]);
505                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 16]);
506 
507                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
508                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 17]);
509                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 17]);
510 
511                     }
512 
513 
514                     VRR_I_d_s_f_s(
515                             PRIM_INT__d_s_f_s,
516                             PRIM_INT__p_s_f_s,
517                             PRIM_INT__s_s_f_s,
518                             PRIM_INT__p_s_d_s,
519                             P_PA,
520                             a_over_p,
521                             aop_PQ,
522                             one_over_2p,
523                             one_over_2pq,
524                             4);
525 
526 
527                     ostei_general_vrr_I(3, 0, 4, 0, 3,
528                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
529                             PRIM_INT__d_s_g_s, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_g_s);
530 
531 
532                     VRR_K_s_s_h_s(
533                             PRIM_INT__s_s_h_s,
534                             PRIM_INT__s_s_g_s,
535                             PRIM_INT__s_s_f_s,
536                             Q_PA,
537                             a_over_q,
538                             aoq_PQ,
539                             one_over_2q,
540                             8);
541 
542 
543                     ostei_general_vrr_I(1, 0, 5, 0, 5,
544                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
545                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
546 
547 
548                     ostei_general_vrr_I(2, 0, 5, 0, 4,
549                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
550                             PRIM_INT__p_s_h_s, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_h_s);
551 
552 
553                     ostei_general_vrr_I(3, 0, 5, 0, 3,
554                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
555                             PRIM_INT__d_s_h_s, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);
556 
557 
558 
559                     // Forming PRIM_INT__p_s_p_s[5 * 9];
560                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
561                     {
562 
563                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
564                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);
565                         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]);
566 
567                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
568                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 1]);
569 
570                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
571                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 2]);
572 
573                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
574                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 3]);
575 
576                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
577                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 4]);
578                         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]);
579 
580                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
581                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 5]);
582 
583                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
584                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 6]);
585 
586                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
587                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 7]);
588 
589                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
590                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 8]);
591                         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]);
592 
593                     }
594 
595 
596                     VRR_I_d_s_d_s(
597                             PRIM_INT__d_s_d_s,
598                             PRIM_INT__p_s_d_s,
599                             PRIM_INT__s_s_d_s,
600                             PRIM_INT__p_s_p_s,
601                             P_PA,
602                             a_over_p,
603                             aop_PQ,
604                             one_over_2p,
605                             one_over_2pq,
606                             4);
607 
608 
609                     ostei_general_vrr_I(3, 0, 3, 0, 3,
610                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
611                             PRIM_INT__d_s_f_s, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_d_s, NULL, PRIM_INT__f_s_f_s);
612 
613 
614                     ostei_general_vrr_I(4, 0, 4, 0, 2,
615                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
616                             PRIM_INT__f_s_g_s, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);
617 
618 
619                     ostei_general_vrr1_K(6, 7,
620                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
621                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
622 
623 
624                     ostei_general_vrr_I(1, 0, 6, 0, 5,
625                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
626                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
627 
628 
629                     ostei_general_vrr_I(2, 0, 6, 0, 4,
630                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
631                             PRIM_INT__p_s_i_s, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);
632 
633 
634                     ostei_general_vrr_I(3, 0, 6, 0, 3,
635                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
636                             PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);
637 
638 
639                     ostei_general_vrr_I(4, 0, 5, 0, 2,
640                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
641                             PRIM_INT__f_s_h_s, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);
642 
643 
644 
645                     // Forming PRIM_INT__p_s_s_s[5 * 3];
646                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
647                     {
648 
649                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
650                         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]);
651 
652                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
653                         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]);
654 
655                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
656                         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]);
657 
658                     }
659 
660 
661 
662                     // Forming PRIM_INT__d_s_p_s[4 * 18];
663                     for(n = 0; n < 4; ++n)  // loop over orders of auxiliary function
664                     {
665 
666                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 0]);
667                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
668                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 0]);
669                         PRIM_INT__d_s_p_s[n * 18 + 0] = 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 + 0]);
670 
671                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 1]);
672                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__d_s_p_s[n * 18 + 1]);
673                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 1]);
674 
675                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 2]);
676                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__d_s_p_s[n * 18 + 2]);
677                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 2]);
678 
679                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 3]);
680                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);
681                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 9]);
682 
683                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 4]);
684                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__d_s_p_s[n * 18 + 10]);
685                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 10]);
686                         PRIM_INT__d_s_p_s[n * 18 + 10] = 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 + 10]);
687 
688                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 5]);
689                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__d_s_p_s[n * 18 + 11]);
690                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 11]);
691 
692                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 6]);
693                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__d_s_p_s[n * 18 + 15]);
694                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 15]);
695 
696                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 7]);
697                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__d_s_p_s[n * 18 + 16]);
698                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 16]);
699 
700                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 8]);
701                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__d_s_p_s[n * 18 + 17]);
702                         PRIM_INT__d_s_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__d_s_p_s[n * 18 + 17]);
703                         PRIM_INT__d_s_p_s[n * 18 + 17] = 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 + 17]);
704 
705                     }
706 
707 
708                     VRR_I_f_s_d_s(
709                             PRIM_INT__f_s_d_s,
710                             PRIM_INT__d_s_d_s,
711                             PRIM_INT__p_s_d_s,
712                             PRIM_INT__d_s_p_s,
713                             P_PA,
714                             a_over_p,
715                             aop_PQ,
716                             one_over_2p,
717                             one_over_2pq,
718                             3);
719 
720 
721                     ostei_general_vrr_I(4, 0, 3, 0, 2,
722                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
723                             PRIM_INT__f_s_f_s, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_d_s, NULL, PRIM_INT__g_s_f_s);
724 
725 
726                     ostei_general_vrr_I(5, 0, 4, 0, 1,
727                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
728                             PRIM_INT__g_s_g_s, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_g_s);
729 
730 
731                     ostei_general_vrr1_K(7, 6,
732                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
733                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
734 
735 
736                     ostei_general_vrr_I(1, 0, 7, 0, 5,
737                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
738                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
739 
740 
741                     ostei_general_vrr_I(2, 0, 7, 0, 4,
742                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
743                             PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);
744 
745 
746                     ostei_general_vrr_I(3, 0, 7, 0, 3,
747                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
748                             PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);
749 
750 
751                     ostei_general_vrr_I(4, 0, 6, 0, 2,
752                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
753                             PRIM_INT__f_s_i_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);
754 
755 
756                     ostei_general_vrr_I(5, 0, 5, 0, 1,
757                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
758                             PRIM_INT__g_s_h_s, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_h_s);
759 
760 
761                     ostei_general_vrr_I(4, 0, 7, 0, 2,
762                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
763                             PRIM_INT__f_s_k_s, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);
764 
765 
766                     ostei_general_vrr_I(5, 0, 6, 0, 1,
767                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
768                             PRIM_INT__g_s_i_s, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);
769 
770 
771                     ostei_general_vrr_I(5, 0, 7, 0, 1,
772                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
773                             PRIM_INT__g_s_k_s, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);
774 
775 
776 
777 
778                     ////////////////////////////////////
779                     // Accumulate contracted integrals
780                     ////////////////////////////////////
781                     if(lastoffset == 0)
782                     {
783                         contract_all(150, PRIM_INT__f_s_g_s, PRIM_PTR_INT__f_s_g_s);
784                         contract_all(210, PRIM_INT__f_s_h_s, PRIM_PTR_INT__f_s_h_s);
785                         contract_all(280, PRIM_INT__f_s_i_s, PRIM_PTR_INT__f_s_i_s);
786                         contract_all(360, PRIM_INT__f_s_k_s, PRIM_PTR_INT__f_s_k_s);
787                         contract_all(225, PRIM_INT__g_s_g_s, PRIM_PTR_INT__g_s_g_s);
788                         contract_all(315, PRIM_INT__g_s_h_s, PRIM_PTR_INT__g_s_h_s);
789                         contract_all(420, PRIM_INT__g_s_i_s, PRIM_PTR_INT__g_s_i_s);
790                         contract_all(540, PRIM_INT__g_s_k_s, PRIM_PTR_INT__g_s_k_s);
791                         contract_all(315, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
792                         contract_all(441, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
793                         contract_all(588, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
794                         contract_all(756, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
795                     }
796                     else
797                     {
798                         contract(150, shelloffsets, PRIM_INT__f_s_g_s, PRIM_PTR_INT__f_s_g_s);
799                         contract(210, shelloffsets, PRIM_INT__f_s_h_s, PRIM_PTR_INT__f_s_h_s);
800                         contract(280, shelloffsets, PRIM_INT__f_s_i_s, PRIM_PTR_INT__f_s_i_s);
801                         contract(360, shelloffsets, PRIM_INT__f_s_k_s, PRIM_PTR_INT__f_s_k_s);
802                         contract(225, shelloffsets, PRIM_INT__g_s_g_s, PRIM_PTR_INT__g_s_g_s);
803                         contract(315, shelloffsets, PRIM_INT__g_s_h_s, PRIM_PTR_INT__g_s_h_s);
804                         contract(420, shelloffsets, PRIM_INT__g_s_i_s, PRIM_PTR_INT__g_s_i_s);
805                         contract(540, shelloffsets, PRIM_INT__g_s_k_s, PRIM_PTR_INT__g_s_k_s);
806                         contract(315, shelloffsets, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
807                         contract(441, shelloffsets, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
808                         contract(588, shelloffsets, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
809                         contract(756, shelloffsets, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
810                         PRIM_PTR_INT__f_s_g_s += lastoffset*150;
811                         PRIM_PTR_INT__f_s_h_s += lastoffset*210;
812                         PRIM_PTR_INT__f_s_i_s += lastoffset*280;
813                         PRIM_PTR_INT__f_s_k_s += lastoffset*360;
814                         PRIM_PTR_INT__g_s_g_s += lastoffset*225;
815                         PRIM_PTR_INT__g_s_h_s += lastoffset*315;
816                         PRIM_PTR_INT__g_s_i_s += lastoffset*420;
817                         PRIM_PTR_INT__g_s_k_s += lastoffset*540;
818                         PRIM_PTR_INT__h_s_g_s += lastoffset*315;
819                         PRIM_PTR_INT__h_s_h_s += lastoffset*441;
820                         PRIM_PTR_INT__h_s_i_s += lastoffset*588;
821                         PRIM_PTR_INT__h_s_k_s += lastoffset*756;
822                     }
823 
824                 }  // close loop over j
825             }  // close loop over i
826 
827             //Advance to the next batch
828             jstart = SIMINT_SIMD_ROUND(jend);
829 
830             //////////////////////////////////////////////
831             // Contracted integrals: Horizontal recurrance
832             //////////////////////////////////////////////
833 
834 
835             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
836 
837 
838             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
839             {
840                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
841 
842                 // set up HRR pointers
843                 double const * restrict HRR_INT__f_s_g_s = INT__f_s_g_s + abcd * 150;
844                 double const * restrict HRR_INT__f_s_h_s = INT__f_s_h_s + abcd * 210;
845                 double const * restrict HRR_INT__f_s_i_s = INT__f_s_i_s + abcd * 280;
846                 double const * restrict HRR_INT__f_s_k_s = INT__f_s_k_s + abcd * 360;
847                 double const * restrict HRR_INT__g_s_g_s = INT__g_s_g_s + abcd * 225;
848                 double const * restrict HRR_INT__g_s_h_s = INT__g_s_h_s + abcd * 315;
849                 double const * restrict HRR_INT__g_s_i_s = INT__g_s_i_s + abcd * 420;
850                 double const * restrict HRR_INT__g_s_k_s = INT__g_s_k_s + abcd * 540;
851                 double const * restrict HRR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
852                 double const * restrict HRR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
853                 double const * restrict HRR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
854                 double const * restrict HRR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
855                 double * restrict HRR_INT__f_d_g_f = INT__f_d_g_f + real_abcd * 9000;
856 
857                 // form INT__f_p_g_s
858                 HRR_J_f_p(
859                     HRR_INT__f_p_g_s,
860                     HRR_INT__f_s_g_s,
861                     HRR_INT__g_s_g_s,
862                     hAB, 15);
863 
864                 // form INT__f_p_h_s
865                 HRR_J_f_p(
866                     HRR_INT__f_p_h_s,
867                     HRR_INT__f_s_h_s,
868                     HRR_INT__g_s_h_s,
869                     hAB, 21);
870 
871                 // form INT__f_p_i_s
872                 HRR_J_f_p(
873                     HRR_INT__f_p_i_s,
874                     HRR_INT__f_s_i_s,
875                     HRR_INT__g_s_i_s,
876                     hAB, 28);
877 
878                 // form INT__f_p_k_s
879                 HRR_J_f_p(
880                     HRR_INT__f_p_k_s,
881                     HRR_INT__f_s_k_s,
882                     HRR_INT__g_s_k_s,
883                     hAB, 36);
884 
885                 // form INT__g_p_g_s
886                 HRR_J_g_p(
887                     HRR_INT__g_p_g_s,
888                     HRR_INT__g_s_g_s,
889                     HRR_INT__h_s_g_s,
890                     hAB, 15);
891 
892                 // form INT__g_p_h_s
893                 HRR_J_g_p(
894                     HRR_INT__g_p_h_s,
895                     HRR_INT__g_s_h_s,
896                     HRR_INT__h_s_h_s,
897                     hAB, 21);
898 
899                 // form INT__g_p_i_s
900                 HRR_J_g_p(
901                     HRR_INT__g_p_i_s,
902                     HRR_INT__g_s_i_s,
903                     HRR_INT__h_s_i_s,
904                     hAB, 28);
905 
906                 // form INT__g_p_k_s
907                 HRR_J_g_p(
908                     HRR_INT__g_p_k_s,
909                     HRR_INT__g_s_k_s,
910                     HRR_INT__h_s_k_s,
911                     hAB, 36);
912 
913                 // form INT__f_d_g_s
914                 HRR_J_f_d(
915                     HRR_INT__f_d_g_s,
916                     HRR_INT__f_p_g_s,
917                     HRR_INT__g_p_g_s,
918                     hAB, 15);
919 
920                 // form INT__f_d_h_s
921                 HRR_J_f_d(
922                     HRR_INT__f_d_h_s,
923                     HRR_INT__f_p_h_s,
924                     HRR_INT__g_p_h_s,
925                     hAB, 21);
926 
927                 // form INT__f_d_i_s
928                 HRR_J_f_d(
929                     HRR_INT__f_d_i_s,
930                     HRR_INT__f_p_i_s,
931                     HRR_INT__g_p_i_s,
932                     hAB, 28);
933 
934                 // form INT__f_d_k_s
935                 HRR_J_f_d(
936                     HRR_INT__f_d_k_s,
937                     HRR_INT__f_p_k_s,
938                     HRR_INT__g_p_k_s,
939                     hAB, 36);
940 
941                 // form INT__f_d_g_p
942                 HRR_L_g_p(
943                     HRR_INT__f_d_g_p,
944                     HRR_INT__f_d_g_s,
945                     HRR_INT__f_d_h_s,
946                     hCD, 60);
947 
948                 // form INT__f_d_h_p
949                 ostei_general_hrr_L(3, 2, 5, 1, hCD, HRR_INT__f_d_i_s, HRR_INT__f_d_h_s, HRR_INT__f_d_h_p);
950 
951                 // form INT__f_d_i_p
952                 ostei_general_hrr_L(3, 2, 6, 1, hCD, HRR_INT__f_d_k_s, HRR_INT__f_d_i_s, HRR_INT__f_d_i_p);
953 
954                 // form INT__f_d_g_d
955                 ostei_general_hrr_L(3, 2, 4, 2, hCD, HRR_INT__f_d_h_p, HRR_INT__f_d_g_p, HRR_INT__f_d_g_d);
956 
957                 // form INT__f_d_h_d
958                 ostei_general_hrr_L(3, 2, 5, 2, hCD, HRR_INT__f_d_i_p, HRR_INT__f_d_h_p, HRR_INT__f_d_h_d);
959 
960                 // form INT__f_d_g_f
961                 ostei_general_hrr_L(3, 2, 4, 3, hCD, HRR_INT__f_d_h_d, HRR_INT__f_d_g_d, HRR_INT__f_d_g_f);
962 
963 
964             }  // close HRR loop
965 
966 
967         }   // close loop cdbatch
968 
969         istart = iend;
970     }  // close loop over ab
971 
972     return P.nshell12_clip * Q.nshell12_clip;
973 }
974 
ostei_d_f_g_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_f_g_f)975 int ostei_d_f_g_f(struct simint_multi_shellpair const P,
976                   struct simint_multi_shellpair const Q,
977                   double screen_tol,
978                   double * const restrict work,
979                   double * const restrict INT__d_f_g_f)
980 {
981     double P_AB[3*P.nshell12];
982     struct simint_multi_shellpair P_tmp = P;
983     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
984     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
985     P_tmp.AB_x = P_AB;
986     P_tmp.AB_y = P_AB + P.nshell12;
987     P_tmp.AB_z = P_AB + 2*P.nshell12;
988 
989     for(int i = 0; i < P.nshell12; i++)
990     {
991         P_tmp.AB_x[i] = -P.AB_x[i];
992         P_tmp.AB_y[i] = -P.AB_y[i];
993         P_tmp.AB_z[i] = -P.AB_z[i];
994     }
995 
996     int ret = ostei_f_d_g_f(P_tmp, Q, screen_tol, work, INT__d_f_g_f);
997     double buffer[9000] SIMINT_ALIGN_ARRAY_DBL;
998 
999     for(int q = 0; q < ret; q++)
1000     {
1001         int idx = 0;
1002         for(int a = 0; a < 6; ++a)
1003         for(int b = 0; b < 10; ++b)
1004         for(int c = 0; c < 15; ++c)
1005         for(int d = 0; d < 10; ++d)
1006             buffer[idx++] = INT__d_f_g_f[q*9000+b*900+a*150+c*10+d];
1007 
1008         memcpy(INT__d_f_g_f+q*9000, buffer, 9000*sizeof(double));
1009     }
1010 
1011     return ret;
1012 }
1013 
ostei_f_d_f_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_d_f_g)1014 int ostei_f_d_f_g(struct simint_multi_shellpair const P,
1015                   struct simint_multi_shellpair const Q,
1016                   double screen_tol,
1017                   double * const restrict work,
1018                   double * const restrict INT__f_d_f_g)
1019 {
1020     double Q_AB[3*Q.nshell12];
1021     struct simint_multi_shellpair Q_tmp = Q;
1022     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1023     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1024     Q_tmp.AB_x = Q_AB;
1025     Q_tmp.AB_y = Q_AB + Q.nshell12;
1026     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1027 
1028     for(int i = 0; i < Q.nshell12; i++)
1029     {
1030         Q_tmp.AB_x[i] = -Q.AB_x[i];
1031         Q_tmp.AB_y[i] = -Q.AB_y[i];
1032         Q_tmp.AB_z[i] = -Q.AB_z[i];
1033     }
1034 
1035     int ret = ostei_f_d_g_f(P, Q_tmp, screen_tol, work, INT__f_d_f_g);
1036     double buffer[9000] SIMINT_ALIGN_ARRAY_DBL;
1037 
1038     for(int q = 0; q < ret; q++)
1039     {
1040         int idx = 0;
1041         for(int a = 0; a < 10; ++a)
1042         for(int b = 0; b < 6; ++b)
1043         for(int c = 0; c < 10; ++c)
1044         for(int d = 0; d < 15; ++d)
1045             buffer[idx++] = INT__f_d_f_g[q*9000+a*900+b*150+d*10+c];
1046 
1047         memcpy(INT__f_d_f_g+q*9000, buffer, 9000*sizeof(double));
1048     }
1049 
1050     return ret;
1051 }
1052 
ostei_d_f_f_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_f_f_g)1053 int ostei_d_f_f_g(struct simint_multi_shellpair const P,
1054                   struct simint_multi_shellpair const Q,
1055                   double screen_tol,
1056                   double * const restrict work,
1057                   double * const restrict INT__d_f_f_g)
1058 {
1059     double P_AB[3*P.nshell12];
1060     struct simint_multi_shellpair P_tmp = P;
1061     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
1062     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
1063     P_tmp.AB_x = P_AB;
1064     P_tmp.AB_y = P_AB + P.nshell12;
1065     P_tmp.AB_z = P_AB + 2*P.nshell12;
1066 
1067     for(int i = 0; i < P.nshell12; i++)
1068     {
1069         P_tmp.AB_x[i] = -P.AB_x[i];
1070         P_tmp.AB_y[i] = -P.AB_y[i];
1071         P_tmp.AB_z[i] = -P.AB_z[i];
1072     }
1073 
1074     double Q_AB[3*Q.nshell12];
1075     struct simint_multi_shellpair Q_tmp = Q;
1076     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1077     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1078     Q_tmp.AB_x = Q_AB;
1079     Q_tmp.AB_y = Q_AB + Q.nshell12;
1080     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1081 
1082     for(int i = 0; i < Q.nshell12; i++)
1083     {
1084         Q_tmp.AB_x[i] = -Q.AB_x[i];
1085         Q_tmp.AB_y[i] = -Q.AB_y[i];
1086         Q_tmp.AB_z[i] = -Q.AB_z[i];
1087     }
1088 
1089     int ret = ostei_f_d_g_f(P_tmp, Q_tmp, screen_tol, work, INT__d_f_f_g);
1090     double buffer[9000] SIMINT_ALIGN_ARRAY_DBL;
1091 
1092     for(int q = 0; q < ret; q++)
1093     {
1094         int idx = 0;
1095         for(int a = 0; a < 6; ++a)
1096         for(int b = 0; b < 10; ++b)
1097         for(int c = 0; c < 10; ++c)
1098         for(int d = 0; d < 15; ++d)
1099             buffer[idx++] = INT__d_f_f_g[q*9000+b*900+a*150+d*10+c];
1100 
1101         memcpy(INT__d_f_f_g+q*9000, buffer, 9000*sizeof(double));
1102     }
1103 
1104     return ret;
1105 }
1106 
1107