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