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