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