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