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_g_f_f_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_f_f_p)8 int ostei_g_f_f_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__g_f_f_p)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__g_f_f_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__g_s_f_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__g_s_g_s = work + (SIMINT_NSHELL_SIMD * 150);
31     double * const INT__h_s_f_s = work + (SIMINT_NSHELL_SIMD * 375);
32     double * const INT__h_s_g_s = work + (SIMINT_NSHELL_SIMD * 585);
33     double * const INT__i_s_f_s = work + (SIMINT_NSHELL_SIMD * 900);
34     double * const INT__i_s_g_s = work + (SIMINT_NSHELL_SIMD * 1180);
35     double * const INT__k_s_f_s = work + (SIMINT_NSHELL_SIMD * 1600);
36     double * const INT__k_s_g_s = work + (SIMINT_NSHELL_SIMD * 1960);
37     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*2500);
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 + 12;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 45;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 81;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 141;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 213;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 321;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 411;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 531;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 711;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 911;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 1031;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 1211;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 1481;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 1781;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 2006;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 2153;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 2405;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 2783;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 3203;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 3518;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 3686;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 4022;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 4526;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_g_s = primwork + 5086;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_s_s = primwork + 5506;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_p_s = primwork + 5686;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_d_s = primwork + 6118;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_f_s = primwork + 6766;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_g_s = primwork + 7486;
68     double * const hrrwork = (double *)(primwork + 8026);
69     double * const HRR_INT__g_p_f_s = hrrwork + 0;
70     double * const HRR_INT__g_p_g_s = hrrwork + 450;
71     double * const HRR_INT__g_d_f_s = hrrwork + 1125;
72     double * const HRR_INT__g_d_g_s = hrrwork + 2025;
73     double * const HRR_INT__g_f_f_s = hrrwork + 3375;
74     double * const HRR_INT__g_f_g_s = hrrwork + 4875;
75     double * const HRR_INT__h_p_f_s = hrrwork + 7125;
76     double * const HRR_INT__h_p_g_s = hrrwork + 7755;
77     double * const HRR_INT__h_d_f_s = hrrwork + 8700;
78     double * const HRR_INT__h_d_g_s = hrrwork + 9960;
79     double * const HRR_INT__i_p_f_s = hrrwork + 11850;
80     double * const HRR_INT__i_p_g_s = hrrwork + 12690;
81 
82 
83     // Create constants
84     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
85     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
86     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
87     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
88     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
89     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
90     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
91     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
92 
93 
94     ////////////////////////////////////////
95     // Loop over shells and primitives
96     ////////////////////////////////////////
97 
98     real_abcd = 0;
99     istart = 0;
100     for(ab = 0; ab < P.nshell12_clip; ++ab)
101     {
102         const int iend = istart + P.nprim12[ab];
103 
104         cd = 0;
105         jstart = 0;
106 
107         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
108         {
109             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
110             int jend = jstart;
111             for(i = 0; i < nshellbatch; i++)
112                 jend += Q.nprim12[cd+i];
113 
114             // Clear the beginning of the workspace (where we are accumulating integrals)
115             memset(work, 0, SIMINT_NSHELL_SIMD * 2500 * sizeof(double));
116             abcd = 0;
117 
118 
119             for(i = istart; i < iend; ++i)
120             {
121                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
122 
123                 if(check_screen)
124                 {
125                     // Skip this whole thing if always insignificant
126                     if((P.screen[i] * Q.screen_max) < screen_tol)
127                         continue;
128                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
129                 }
130 
131                 icd = 0;
132                 iprimcd = 0;
133                 nprim_icd = Q.nprim12[cd];
134                 double * restrict PRIM_PTR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
135                 double * restrict PRIM_PTR_INT__g_s_g_s = INT__g_s_g_s + abcd * 225;
136                 double * restrict PRIM_PTR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
137                 double * restrict PRIM_PTR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
138                 double * restrict PRIM_PTR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
139                 double * restrict PRIM_PTR_INT__i_s_g_s = INT__i_s_g_s + abcd * 420;
140                 double * restrict PRIM_PTR_INT__k_s_f_s = INT__k_s_f_s + abcd * 360;
141                 double * restrict PRIM_PTR_INT__k_s_g_s = INT__k_s_g_s + abcd * 540;
142 
143 
144 
145                 // Load these one per loop over i
146                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
147                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
148                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
149 
150                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
151 
152                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
153                 {
154                     // calculate the shell offsets
155                     // these are the offset from the shell pointed to by cd
156                     // for each element
157                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
158                     int lastoffset = 0;
159                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
160 
161                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
162                     {
163                         // Handle if the first element of the vector is a new shell
164                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
165                         {
166                             nprim_icd += Q.nprim12[cd + (++icd)];
167                             PRIM_PTR_INT__g_s_f_s += 150;
168                             PRIM_PTR_INT__g_s_g_s += 225;
169                             PRIM_PTR_INT__h_s_f_s += 210;
170                             PRIM_PTR_INT__h_s_g_s += 315;
171                             PRIM_PTR_INT__i_s_f_s += 280;
172                             PRIM_PTR_INT__i_s_g_s += 420;
173                             PRIM_PTR_INT__k_s_f_s += 360;
174                             PRIM_PTR_INT__k_s_g_s += 540;
175                         }
176                         iprimcd++;
177                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
178                         {
179                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
180                             {
181                                 shelloffsets[n] = shelloffsets[n-1] + 1;
182                                 lastoffset++;
183                                 nprim_icd += Q.nprim12[cd + (++icd)];
184                             }
185                             else
186                                 shelloffsets[n] = shelloffsets[n-1];
187                             iprimcd++;
188                         }
189                     }
190                     else
191                         iprimcd += SIMINT_SIMD_LEN;
192 
193                     // Do we have to compute this vector (or has it been screened out)?
194                     // (not_screened != 0 means we have to do this vector)
195                     if(check_screen)
196                     {
197                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
198                         if(vmax < screen_tol)
199                         {
200                             PRIM_PTR_INT__g_s_f_s += lastoffset*150;
201                             PRIM_PTR_INT__g_s_g_s += lastoffset*225;
202                             PRIM_PTR_INT__h_s_f_s += lastoffset*210;
203                             PRIM_PTR_INT__h_s_g_s += lastoffset*315;
204                             PRIM_PTR_INT__i_s_f_s += lastoffset*280;
205                             PRIM_PTR_INT__i_s_g_s += lastoffset*420;
206                             PRIM_PTR_INT__k_s_f_s += lastoffset*360;
207                             PRIM_PTR_INT__k_s_g_s += lastoffset*540;
208                             continue;
209                         }
210                     }
211 
212                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
213                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
214                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
215                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
216 
217 
218                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
219                     SIMINT_DBLTYPE PQ[3];
220                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
221                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
222                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
223                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
224                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
225                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
226 
227                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
228                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
229                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
230                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
231                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
232                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
233                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
234 
235                     // NOTE: Minus sign!
236                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
237                     SIMINT_DBLTYPE aop_PQ[3];
238                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
239                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
240                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
241 
242                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
243                     SIMINT_DBLTYPE aoq_PQ[3];
244                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
245                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
246                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
247                     // Put a minus sign here so we don't have to in RR routines
248                     a_over_q = SIMINT_NEG(a_over_q);
249 
250 
251                     //////////////////////////////////////////////
252                     // Fjt function section
253                     // Maximum v value: 11
254                     //////////////////////////////////////////////
255                     // The parameter to the Fjt function
256                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
257 
258 
259                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
260 
261 
262                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 11);
263                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
264                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
265                     for(n = 0; n <= 11; n++)
266                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
267 
268                     //////////////////////////////////////////////
269                     // Primitive integrals: Vertical recurrance
270                     //////////////////////////////////////////////
271 
272                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
273                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
274                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
275                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
276                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
277                     const SIMINT_DBLTYPE vrr_const_6_over_2p = SIMINT_MUL(const_6, one_over_2p);
278                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
279                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
280                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
281                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
282                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
283                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
284                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
285                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
286                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
287                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
288 
289 
290 
291                     // Forming PRIM_INT__p_s_s_s[11 * 3];
292                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
293                     {
294 
295                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
296                         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]);
297 
298                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
299                         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]);
300 
301                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
302                         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]);
303 
304                     }
305 
306 
307 
308                     // Forming PRIM_INT__d_s_s_s[10 * 6];
309                     for(n = 0; n < 10; ++n)  // loop over orders of auxiliary function
310                     {
311 
312                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
313                         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]);
314                         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]);
315 
316                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
317                         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]);
318 
319                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
320                         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]);
321 
322                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
323                         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]);
324                         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]);
325 
326                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
327                         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]);
328 
329                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
330                         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]);
331                         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]);
332 
333                     }
334 
335 
336 
337                     // Forming PRIM_INT__f_s_s_s[9 * 10];
338                     for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
339                     {
340 
341                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
342                         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]);
343                         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]);
344 
345                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
346                         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]);
347 
348                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
349                         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]);
350 
351                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
352                         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]);
353 
354                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
355                         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]);
356 
357                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
358                         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]);
359 
360                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
361                         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]);
362                         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]);
363 
364                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
365                         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]);
366 
367                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
368                         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]);
369 
370                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
371                         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]);
372                         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]);
373 
374                     }
375 
376 
377                     VRR_I_g_s_s_s(
378                             PRIM_INT__g_s_s_s,
379                             PRIM_INT__f_s_s_s,
380                             PRIM_INT__d_s_s_s,
381                             P_PA,
382                             a_over_p,
383                             aop_PQ,
384                             one_over_2p,
385                             8);
386 
387 
388                     VRR_K_g_s_p_s(
389                             PRIM_INT__g_s_p_s,
390                             PRIM_INT__g_s_s_s,
391                             PRIM_INT__f_s_s_s,
392                             Q_PA,
393                             aoq_PQ,
394                             one_over_2pq,
395                             4);
396 
397 
398                     VRR_K_f_s_p_s(
399                             PRIM_INT__f_s_p_s,
400                             PRIM_INT__f_s_s_s,
401                             PRIM_INT__d_s_s_s,
402                             Q_PA,
403                             aoq_PQ,
404                             one_over_2pq,
405                             4);
406 
407 
408                     ostei_general_vrr_K(4, 0, 2, 0, 3,
409                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
410                             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);
411 
412 
413 
414                     // Forming PRIM_INT__d_s_p_s[4 * 18];
415                     for(n = 0; n < 4; ++n)  // loop over orders of auxiliary function
416                     {
417 
418                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
419                         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]);
420                         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]);
421 
422                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
423                         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]);
424 
425                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
426                         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]);
427 
428                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
429                         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]);
430                         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]);
431 
432                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
433                         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]);
434                         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]);
435 
436                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
437                         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]);
438 
439                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
440                         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]);
441                         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]);
442 
443                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
444                         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]);
445 
446                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
447                         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]);
448                         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]);
449 
450                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
451                         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]);
452 
453                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
454                         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]);
455                         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]);
456 
457                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
458                         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]);
459 
460                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
461                         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]);
462 
463                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
464                         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]);
465                         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]);
466 
467                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
468                         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]);
469                         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]);
470 
471                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
472                         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]);
473 
474                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
475                         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]);
476 
477                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
478                         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]);
479                         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]);
480 
481                     }
482 
483 
484                     VRR_K_f_s_d_s(
485                             PRIM_INT__f_s_d_s,
486                             PRIM_INT__f_s_p_s,
487                             PRIM_INT__f_s_s_s,
488                             PRIM_INT__d_s_p_s,
489                             Q_PA,
490                             a_over_q,
491                             aoq_PQ,
492                             one_over_2pq,
493                             one_over_2q,
494                             3);
495 
496 
497                     ostei_general_vrr_K(4, 0, 3, 0, 2,
498                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
499                             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);
500 
501 
502 
503                     // Forming PRIM_INT__p_s_p_s[4 * 9];
504                     for(n = 0; n < 4; ++n)  // loop over orders of auxiliary function
505                     {
506 
507                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
508                         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]);
509                         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]);
510 
511                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
512                         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]);
513 
514                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
515                         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]);
516 
517                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 1]);
518                         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]);
519 
520                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
521                         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]);
522                         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]);
523 
524                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
525                         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]);
526 
527                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 2]);
528                         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]);
529 
530                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 2]);
531                         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]);
532 
533                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
534                         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]);
535                         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]);
536 
537                     }
538 
539 
540                     VRR_K_d_s_d_s(
541                             PRIM_INT__d_s_d_s,
542                             PRIM_INT__d_s_p_s,
543                             PRIM_INT__d_s_s_s,
544                             PRIM_INT__p_s_p_s,
545                             Q_PA,
546                             a_over_q,
547                             aoq_PQ,
548                             one_over_2pq,
549                             one_over_2q,
550                             3);
551 
552 
553                     ostei_general_vrr_K(3, 0, 3, 0, 2,
554                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
555                             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);
556 
557 
558                     ostei_general_vrr_K(4, 0, 4, 0, 1,
559                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
560                             PRIM_INT__g_s_f_s, PRIM_INT__g_s_d_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);
561 
562 
563                     VRR_I_h_s_s_s(
564                             PRIM_INT__h_s_s_s,
565                             PRIM_INT__g_s_s_s,
566                             PRIM_INT__f_s_s_s,
567                             P_PA,
568                             a_over_p,
569                             aop_PQ,
570                             one_over_2p,
571                             7);
572 
573 
574                     ostei_general_vrr_K(5, 0, 1, 0, 4,
575                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
576                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
577 
578 
579                     ostei_general_vrr_K(5, 0, 2, 0, 3,
580                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
581                             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);
582 
583 
584                     ostei_general_vrr_K(5, 0, 3, 0, 2,
585                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
586                             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);
587 
588 
589                     ostei_general_vrr_K(5, 0, 4, 0, 1,
590                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
591                             PRIM_INT__h_s_f_s, PRIM_INT__h_s_d_s, NULL, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_g_s);
592 
593 
594                     ostei_general_vrr1_I(6, 6,
595                             one_over_2p, a_over_p, aop_PQ, P_PA,
596                             PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
597 
598 
599                     ostei_general_vrr_K(6, 0, 1, 0, 4,
600                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
601                             PRIM_INT__i_s_s_s, NULL, NULL, PRIM_INT__h_s_s_s, NULL, PRIM_INT__i_s_p_s);
602 
603 
604                     ostei_general_vrr_K(6, 0, 2, 0, 3,
605                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
606                             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);
607 
608 
609                     ostei_general_vrr_K(6, 0, 3, 0, 2,
610                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
611                             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);
612 
613 
614                     ostei_general_vrr_K(6, 0, 4, 0, 1,
615                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
616                             PRIM_INT__i_s_f_s, PRIM_INT__i_s_d_s, NULL, PRIM_INT__h_s_f_s, NULL, PRIM_INT__i_s_g_s);
617 
618 
619                     ostei_general_vrr1_I(7, 5,
620                             one_over_2p, a_over_p, aop_PQ, P_PA,
621                             PRIM_INT__i_s_s_s, PRIM_INT__h_s_s_s, PRIM_INT__k_s_s_s);
622 
623 
624                     ostei_general_vrr_K(7, 0, 1, 0, 4,
625                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
626                             PRIM_INT__k_s_s_s, NULL, NULL, PRIM_INT__i_s_s_s, NULL, PRIM_INT__k_s_p_s);
627 
628 
629                     ostei_general_vrr_K(7, 0, 2, 0, 3,
630                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
631                             PRIM_INT__k_s_p_s, PRIM_INT__k_s_s_s, NULL, PRIM_INT__i_s_p_s, NULL, PRIM_INT__k_s_d_s);
632 
633 
634                     ostei_general_vrr_K(7, 0, 3, 0, 2,
635                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
636                             PRIM_INT__k_s_d_s, PRIM_INT__k_s_p_s, NULL, PRIM_INT__i_s_d_s, NULL, PRIM_INT__k_s_f_s);
637 
638 
639                     ostei_general_vrr_K(7, 0, 4, 0, 1,
640                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
641                             PRIM_INT__k_s_f_s, PRIM_INT__k_s_d_s, NULL, PRIM_INT__i_s_f_s, NULL, PRIM_INT__k_s_g_s);
642 
643 
644 
645 
646                     ////////////////////////////////////
647                     // Accumulate contracted integrals
648                     ////////////////////////////////////
649                     if(lastoffset == 0)
650                     {
651                         contract_all(150, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
652                         contract_all(225, PRIM_INT__g_s_g_s, PRIM_PTR_INT__g_s_g_s);
653                         contract_all(210, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
654                         contract_all(315, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
655                         contract_all(280, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
656                         contract_all(420, PRIM_INT__i_s_g_s, PRIM_PTR_INT__i_s_g_s);
657                         contract_all(360, PRIM_INT__k_s_f_s, PRIM_PTR_INT__k_s_f_s);
658                         contract_all(540, PRIM_INT__k_s_g_s, PRIM_PTR_INT__k_s_g_s);
659                     }
660                     else
661                     {
662                         contract(150, shelloffsets, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
663                         contract(225, shelloffsets, PRIM_INT__g_s_g_s, PRIM_PTR_INT__g_s_g_s);
664                         contract(210, shelloffsets, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
665                         contract(315, shelloffsets, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
666                         contract(280, shelloffsets, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
667                         contract(420, shelloffsets, PRIM_INT__i_s_g_s, PRIM_PTR_INT__i_s_g_s);
668                         contract(360, shelloffsets, PRIM_INT__k_s_f_s, PRIM_PTR_INT__k_s_f_s);
669                         contract(540, shelloffsets, PRIM_INT__k_s_g_s, PRIM_PTR_INT__k_s_g_s);
670                         PRIM_PTR_INT__g_s_f_s += lastoffset*150;
671                         PRIM_PTR_INT__g_s_g_s += lastoffset*225;
672                         PRIM_PTR_INT__h_s_f_s += lastoffset*210;
673                         PRIM_PTR_INT__h_s_g_s += lastoffset*315;
674                         PRIM_PTR_INT__i_s_f_s += lastoffset*280;
675                         PRIM_PTR_INT__i_s_g_s += lastoffset*420;
676                         PRIM_PTR_INT__k_s_f_s += lastoffset*360;
677                         PRIM_PTR_INT__k_s_g_s += lastoffset*540;
678                     }
679 
680                 }  // close loop over j
681             }  // close loop over i
682 
683             //Advance to the next batch
684             jstart = SIMINT_SIMD_ROUND(jend);
685 
686             //////////////////////////////////////////////
687             // Contracted integrals: Horizontal recurrance
688             //////////////////////////////////////////////
689 
690 
691             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
692 
693 
694             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
695             {
696                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
697 
698                 // set up HRR pointers
699                 double const * restrict HRR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
700                 double const * restrict HRR_INT__g_s_g_s = INT__g_s_g_s + abcd * 225;
701                 double const * restrict HRR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
702                 double const * restrict HRR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
703                 double const * restrict HRR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
704                 double const * restrict HRR_INT__i_s_g_s = INT__i_s_g_s + abcd * 420;
705                 double const * restrict HRR_INT__k_s_f_s = INT__k_s_f_s + abcd * 360;
706                 double const * restrict HRR_INT__k_s_g_s = INT__k_s_g_s + abcd * 540;
707                 double * restrict HRR_INT__g_f_f_p = INT__g_f_f_p + real_abcd * 4500;
708 
709                 // form INT__g_p_f_s
710                 HRR_J_g_p(
711                     HRR_INT__g_p_f_s,
712                     HRR_INT__g_s_f_s,
713                     HRR_INT__h_s_f_s,
714                     hAB, 10);
715 
716                 // form INT__g_p_g_s
717                 HRR_J_g_p(
718                     HRR_INT__g_p_g_s,
719                     HRR_INT__g_s_g_s,
720                     HRR_INT__h_s_g_s,
721                     hAB, 15);
722 
723                 // form INT__h_p_f_s
724                 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);
725 
726                 // form INT__h_p_g_s
727                 ostei_general_hrr_J(5, 1, 4, 0, hAB, HRR_INT__i_s_g_s, HRR_INT__h_s_g_s, HRR_INT__h_p_g_s);
728 
729                 // form INT__i_p_f_s
730                 ostei_general_hrr_J(6, 1, 3, 0, hAB, HRR_INT__k_s_f_s, HRR_INT__i_s_f_s, HRR_INT__i_p_f_s);
731 
732                 // form INT__i_p_g_s
733                 ostei_general_hrr_J(6, 1, 4, 0, hAB, HRR_INT__k_s_g_s, HRR_INT__i_s_g_s, HRR_INT__i_p_g_s);
734 
735                 // form INT__g_d_f_s
736                 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);
737 
738                 // form INT__g_d_g_s
739                 ostei_general_hrr_J(4, 2, 4, 0, hAB, HRR_INT__h_p_g_s, HRR_INT__g_p_g_s, HRR_INT__g_d_g_s);
740 
741                 // form INT__h_d_f_s
742                 ostei_general_hrr_J(5, 2, 3, 0, hAB, HRR_INT__i_p_f_s, HRR_INT__h_p_f_s, HRR_INT__h_d_f_s);
743 
744                 // form INT__h_d_g_s
745                 ostei_general_hrr_J(5, 2, 4, 0, hAB, HRR_INT__i_p_g_s, HRR_INT__h_p_g_s, HRR_INT__h_d_g_s);
746 
747                 // form INT__g_f_f_s
748                 ostei_general_hrr_J(4, 3, 3, 0, hAB, HRR_INT__h_d_f_s, HRR_INT__g_d_f_s, HRR_INT__g_f_f_s);
749 
750                 // form INT__g_f_g_s
751                 ostei_general_hrr_J(4, 3, 4, 0, hAB, HRR_INT__h_d_g_s, HRR_INT__g_d_g_s, HRR_INT__g_f_g_s);
752 
753                 // form INT__g_f_f_p
754                 HRR_L_f_p(
755                     HRR_INT__g_f_f_p,
756                     HRR_INT__g_f_f_s,
757                     HRR_INT__g_f_g_s,
758                     hCD, 150);
759 
760 
761             }  // close HRR loop
762 
763 
764         }   // close loop cdbatch
765 
766         istart = iend;
767     }  // close loop over ab
768 
769     return P.nshell12_clip * Q.nshell12_clip;
770 }
771 
ostei_f_g_f_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_g_f_p)772 int ostei_f_g_f_p(struct simint_multi_shellpair const P,
773                   struct simint_multi_shellpair const Q,
774                   double screen_tol,
775                   double * const restrict work,
776                   double * const restrict INT__f_g_f_p)
777 {
778     double P_AB[3*P.nshell12];
779     struct simint_multi_shellpair P_tmp = P;
780     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
781     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
782     P_tmp.AB_x = P_AB;
783     P_tmp.AB_y = P_AB + P.nshell12;
784     P_tmp.AB_z = P_AB + 2*P.nshell12;
785 
786     for(int i = 0; i < P.nshell12; i++)
787     {
788         P_tmp.AB_x[i] = -P.AB_x[i];
789         P_tmp.AB_y[i] = -P.AB_y[i];
790         P_tmp.AB_z[i] = -P.AB_z[i];
791     }
792 
793     int ret = ostei_g_f_f_p(P_tmp, Q, screen_tol, work, INT__f_g_f_p);
794     double buffer[4500] SIMINT_ALIGN_ARRAY_DBL;
795 
796     for(int q = 0; q < ret; q++)
797     {
798         int idx = 0;
799         for(int a = 0; a < 10; ++a)
800         for(int b = 0; b < 15; ++b)
801         for(int c = 0; c < 10; ++c)
802         for(int d = 0; d < 3; ++d)
803             buffer[idx++] = INT__f_g_f_p[q*4500+b*300+a*30+c*3+d];
804 
805         memcpy(INT__f_g_f_p+q*4500, buffer, 4500*sizeof(double));
806     }
807 
808     return ret;
809 }
810 
ostei_g_f_p_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_f_p_f)811 int ostei_g_f_p_f(struct simint_multi_shellpair const P,
812                   struct simint_multi_shellpair const Q,
813                   double screen_tol,
814                   double * const restrict work,
815                   double * const restrict INT__g_f_p_f)
816 {
817     double Q_AB[3*Q.nshell12];
818     struct simint_multi_shellpair Q_tmp = Q;
819     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
820     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
821     Q_tmp.AB_x = Q_AB;
822     Q_tmp.AB_y = Q_AB + Q.nshell12;
823     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
824 
825     for(int i = 0; i < Q.nshell12; i++)
826     {
827         Q_tmp.AB_x[i] = -Q.AB_x[i];
828         Q_tmp.AB_y[i] = -Q.AB_y[i];
829         Q_tmp.AB_z[i] = -Q.AB_z[i];
830     }
831 
832     int ret = ostei_g_f_f_p(P, Q_tmp, screen_tol, work, INT__g_f_p_f);
833     double buffer[4500] SIMINT_ALIGN_ARRAY_DBL;
834 
835     for(int q = 0; q < ret; q++)
836     {
837         int idx = 0;
838         for(int a = 0; a < 15; ++a)
839         for(int b = 0; b < 10; ++b)
840         for(int c = 0; c < 3; ++c)
841         for(int d = 0; d < 10; ++d)
842             buffer[idx++] = INT__g_f_p_f[q*4500+a*300+b*30+d*3+c];
843 
844         memcpy(INT__g_f_p_f+q*4500, buffer, 4500*sizeof(double));
845     }
846 
847     return ret;
848 }
849 
ostei_f_g_p_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_g_p_f)850 int ostei_f_g_p_f(struct simint_multi_shellpair const P,
851                   struct simint_multi_shellpair const Q,
852                   double screen_tol,
853                   double * const restrict work,
854                   double * const restrict INT__f_g_p_f)
855 {
856     double P_AB[3*P.nshell12];
857     struct simint_multi_shellpair P_tmp = P;
858     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
859     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
860     P_tmp.AB_x = P_AB;
861     P_tmp.AB_y = P_AB + P.nshell12;
862     P_tmp.AB_z = P_AB + 2*P.nshell12;
863 
864     for(int i = 0; i < P.nshell12; i++)
865     {
866         P_tmp.AB_x[i] = -P.AB_x[i];
867         P_tmp.AB_y[i] = -P.AB_y[i];
868         P_tmp.AB_z[i] = -P.AB_z[i];
869     }
870 
871     double Q_AB[3*Q.nshell12];
872     struct simint_multi_shellpair Q_tmp = Q;
873     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
874     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
875     Q_tmp.AB_x = Q_AB;
876     Q_tmp.AB_y = Q_AB + Q.nshell12;
877     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
878 
879     for(int i = 0; i < Q.nshell12; i++)
880     {
881         Q_tmp.AB_x[i] = -Q.AB_x[i];
882         Q_tmp.AB_y[i] = -Q.AB_y[i];
883         Q_tmp.AB_z[i] = -Q.AB_z[i];
884     }
885 
886     int ret = ostei_g_f_f_p(P_tmp, Q_tmp, screen_tol, work, INT__f_g_p_f);
887     double buffer[4500] SIMINT_ALIGN_ARRAY_DBL;
888 
889     for(int q = 0; q < ret; q++)
890     {
891         int idx = 0;
892         for(int a = 0; a < 10; ++a)
893         for(int b = 0; b < 15; ++b)
894         for(int c = 0; c < 3; ++c)
895         for(int d = 0; d < 10; ++d)
896             buffer[idx++] = INT__f_g_p_f[q*4500+b*300+a*30+d*3+c];
897 
898         memcpy(INT__f_g_p_f+q*4500, buffer, 4500*sizeof(double));
899     }
900 
901     return ret;
902 }
903 
904