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_s_h_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__h_s_h_g)8 int ostei_h_s_h_g(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_s_h_g)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__h_s_h_g);
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__h_s_h_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__h_s_i_s = work + (SIMINT_NSHELL_SIMD * 441);
30     double * const INT__h_s_k_s = work + (SIMINT_NSHELL_SIMD * 1029);
31     double * const INT__h_s_l_s = work + (SIMINT_NSHELL_SIMD * 1785);
32     double * const INT__h_s_m_s = work + (SIMINT_NSHELL_SIMD * 2730);
33     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*3885);
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 15;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 57;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 135;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 255;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 420;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 630;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 882;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1170;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 1485;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 1815;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 1860;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 1950;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 2100;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 2325;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 2640;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 3060;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 3600;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 4275;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 5100;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 5244;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 5484;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 5844;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 6348;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 7020;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 7884;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 8964;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 10284;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 10584;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 11034;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 11664;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 12504;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 13584;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 14934;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 16584;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 17034;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 17664;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 18504;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 19584;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_m_s = primwork + 20934;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 22584;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 23025;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 23613;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_l_s = primwork + 24369;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_m_s = primwork + 25314;
79     double * const hrrwork = (double *)(primwork + 26469);
80     double * const HRR_INT__h_s_h_p = hrrwork + 0;
81     double * const HRR_INT__h_s_h_d = hrrwork + 1323;
82     double * const HRR_INT__h_s_h_f = hrrwork + 3969;
83     double * const HRR_INT__h_s_i_p = hrrwork + 8379;
84     double * const HRR_INT__h_s_i_d = hrrwork + 10143;
85     double * const HRR_INT__h_s_i_f = hrrwork + 13671;
86     double * const HRR_INT__h_s_k_p = hrrwork + 19551;
87     double * const HRR_INT__h_s_k_d = hrrwork + 21819;
88     double * const HRR_INT__h_s_l_p = hrrwork + 26355;
89 
90 
91     // Create constants
92     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
93     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
94     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
95     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
96     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
97     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
98     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
99     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
100     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
101     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
102 
103 
104     ////////////////////////////////////////
105     // Loop over shells and primitives
106     ////////////////////////////////////////
107 
108     real_abcd = 0;
109     istart = 0;
110     for(ab = 0; ab < P.nshell12_clip; ++ab)
111     {
112         const int iend = istart + P.nprim12[ab];
113 
114         cd = 0;
115         jstart = 0;
116 
117         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
118         {
119             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
120             int jend = jstart;
121             for(i = 0; i < nshellbatch; i++)
122                 jend += Q.nprim12[cd+i];
123 
124             // Clear the beginning of the workspace (where we are accumulating integrals)
125             memset(work, 0, SIMINT_NSHELL_SIMD * 3885 * sizeof(double));
126             abcd = 0;
127 
128 
129             for(i = istart; i < iend; ++i)
130             {
131                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
132 
133                 if(check_screen)
134                 {
135                     // Skip this whole thing if always insignificant
136                     if((P.screen[i] * Q.screen_max) < screen_tol)
137                         continue;
138                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
139                 }
140 
141                 icd = 0;
142                 iprimcd = 0;
143                 nprim_icd = Q.nprim12[cd];
144                 double * restrict PRIM_PTR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
145                 double * restrict PRIM_PTR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
146                 double * restrict PRIM_PTR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
147                 double * restrict PRIM_PTR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
148                 double * restrict PRIM_PTR_INT__h_s_m_s = INT__h_s_m_s + abcd * 1155;
149 
150 
151 
152                 // Load these one per loop over i
153                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
154                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
155                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
156 
157                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
158 
159                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
160                 {
161                     // calculate the shell offsets
162                     // these are the offset from the shell pointed to by cd
163                     // for each element
164                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
165                     int lastoffset = 0;
166                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
167 
168                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
169                     {
170                         // Handle if the first element of the vector is a new shell
171                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
172                         {
173                             nprim_icd += Q.nprim12[cd + (++icd)];
174                             PRIM_PTR_INT__h_s_h_s += 441;
175                             PRIM_PTR_INT__h_s_i_s += 588;
176                             PRIM_PTR_INT__h_s_k_s += 756;
177                             PRIM_PTR_INT__h_s_l_s += 945;
178                             PRIM_PTR_INT__h_s_m_s += 1155;
179                         }
180                         iprimcd++;
181                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
182                         {
183                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
184                             {
185                                 shelloffsets[n] = shelloffsets[n-1] + 1;
186                                 lastoffset++;
187                                 nprim_icd += Q.nprim12[cd + (++icd)];
188                             }
189                             else
190                                 shelloffsets[n] = shelloffsets[n-1];
191                             iprimcd++;
192                         }
193                     }
194                     else
195                         iprimcd += SIMINT_SIMD_LEN;
196 
197                     // Do we have to compute this vector (or has it been screened out)?
198                     // (not_screened != 0 means we have to do this vector)
199                     if(check_screen)
200                     {
201                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
202                         if(vmax < screen_tol)
203                         {
204                             PRIM_PTR_INT__h_s_h_s += lastoffset*441;
205                             PRIM_PTR_INT__h_s_i_s += lastoffset*588;
206                             PRIM_PTR_INT__h_s_k_s += lastoffset*756;
207                             PRIM_PTR_INT__h_s_l_s += lastoffset*945;
208                             PRIM_PTR_INT__h_s_m_s += lastoffset*1155;
209                             continue;
210                         }
211                     }
212 
213                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
214                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
215                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
216                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
217 
218 
219                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
220                     SIMINT_DBLTYPE PQ[3];
221                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
222                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
223                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
224                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
225                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
226                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
227 
228                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
229                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
230                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
231                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
232                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
233                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
234                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
235 
236                     // NOTE: Minus sign!
237                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
238                     SIMINT_DBLTYPE aop_PQ[3];
239                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
240                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
241                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
242 
243                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
244                     SIMINT_DBLTYPE aoq_PQ[3];
245                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
246                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
247                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
248                     // Put a minus sign here so we don't have to in RR routines
249                     a_over_q = SIMINT_NEG(a_over_q);
250 
251 
252                     //////////////////////////////////////////////
253                     // Fjt function section
254                     // Maximum v value: 14
255                     //////////////////////////////////////////////
256                     // The parameter to the Fjt function
257                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
258 
259 
260                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
261 
262 
263                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 14);
264                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
265                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
266                     for(n = 0; n <= 14; n++)
267                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
268 
269                     //////////////////////////////////////////////
270                     // Primitive integrals: Vertical recurrance
271                     //////////////////////////////////////////////
272 
273                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
274                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
275                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
276                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
277                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
278                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
279                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
280                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
281                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
282                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
283                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
284                     const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
285                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
286                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
287                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
288                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
289                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
290                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
291                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
292                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
293                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
294 
295 
296 
297                     // Forming PRIM_INT__s_s_p_s[14 * 3];
298                     for(n = 0; n < 14; ++n)  // loop over orders of auxiliary function
299                     {
300 
301                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
302                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]);
303 
304                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
305                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 1]);
306 
307                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
308                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 2]);
309 
310                     }
311 
312 
313 
314                     // Forming PRIM_INT__s_s_d_s[13 * 6];
315                     for(n = 0; n < 13; ++n)  // loop over orders of auxiliary function
316                     {
317 
318                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
319                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]);
320                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 0]);
321 
322                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
323                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 1]);
324 
325                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
326                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 2]);
327 
328                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
329                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 3]);
330                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 3]);
331 
332                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
333                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 4]);
334 
335                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
336                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_d_s[n * 6 + 5]);
337                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 5]);
338 
339                     }
340 
341 
342 
343                     // Forming PRIM_INT__s_s_f_s[12 * 10];
344                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
345                     {
346 
347                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
348                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 0]);
349                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_s_f_s[n * 10 + 0]);
350 
351                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
352                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 1]);
353 
354                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
355                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 2]);
356 
357                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
358                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 3]);
359 
360                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
361                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_f_s[n * 10 + 4]);
362 
363                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
364                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 5]);
365 
366                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
367                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 6]);
368                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_s_f_s[n * 10 + 6]);
369 
370                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
371                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 7]);
372 
373                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
374                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 8]);
375 
376                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
377                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 9]);
378                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_s_f_s[n * 10 + 9]);
379 
380                     }
381 
382 
383                     VRR_K_s_s_g_s(
384                             PRIM_INT__s_s_g_s,
385                             PRIM_INT__s_s_f_s,
386                             PRIM_INT__s_s_d_s,
387                             Q_PA,
388                             a_over_q,
389                             aoq_PQ,
390                             one_over_2q,
391                             11);
392 
393 
394                     VRR_K_s_s_h_s(
395                             PRIM_INT__s_s_h_s,
396                             PRIM_INT__s_s_g_s,
397                             PRIM_INT__s_s_f_s,
398                             Q_PA,
399                             a_over_q,
400                             aoq_PQ,
401                             one_over_2q,
402                             10);
403 
404 
405                     ostei_general_vrr_I(1, 0, 5, 0, 5,
406                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
407                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
408 
409 
410                     VRR_I_p_s_g_s(
411                             PRIM_INT__p_s_g_s,
412                             PRIM_INT__s_s_g_s,
413                             PRIM_INT__s_s_f_s,
414                             P_PA,
415                             aop_PQ,
416                             one_over_2pq,
417                             5);
418 
419 
420                     ostei_general_vrr_I(2, 0, 5, 0, 4,
421                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
422                             PRIM_INT__p_s_h_s, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_h_s);
423 
424 
425                     VRR_I_p_s_f_s(
426                             PRIM_INT__p_s_f_s,
427                             PRIM_INT__s_s_f_s,
428                             PRIM_INT__s_s_d_s,
429                             P_PA,
430                             aop_PQ,
431                             one_over_2pq,
432                             5);
433 
434 
435                     ostei_general_vrr_I(2, 0, 4, 0, 4,
436                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
437                             PRIM_INT__p_s_g_s, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_g_s);
438 
439 
440                     ostei_general_vrr_I(3, 0, 5, 0, 3,
441                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
442                             PRIM_INT__d_s_h_s, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);
443 
444 
445 
446                     // Forming PRIM_INT__p_s_d_s[5 * 18];
447                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
448                     {
449 
450                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
451                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
452                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
453 
454                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
455                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
456                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
457 
458                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
459                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
460                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
461 
462                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
463                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 3]);
464 
465                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
466                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 4]);
467 
468                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
469                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 5]);
470 
471                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
472                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 6]);
473 
474                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
475                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 7]);
476                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 7]);
477 
478                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
479                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 8]);
480 
481                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
482                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 9]);
483                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 9]);
484 
485                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
486                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 10]);
487                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 10]);
488 
489                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
490                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 11]);
491 
492                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
493                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 12]);
494 
495                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
496                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 13]);
497 
498                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
499                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 14]);
500                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 14]);
501 
502                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
503                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 15]);
504 
505                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
506                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 16]);
507                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 16]);
508 
509                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
510                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 17]);
511                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 17]);
512 
513                     }
514 
515 
516                     VRR_I_d_s_f_s(
517                             PRIM_INT__d_s_f_s,
518                             PRIM_INT__p_s_f_s,
519                             PRIM_INT__s_s_f_s,
520                             PRIM_INT__p_s_d_s,
521                             P_PA,
522                             a_over_p,
523                             aop_PQ,
524                             one_over_2p,
525                             one_over_2pq,
526                             4);
527 
528 
529                     ostei_general_vrr_I(3, 0, 4, 0, 3,
530                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
531                             PRIM_INT__d_s_g_s, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_g_s);
532 
533 
534                     ostei_general_vrr_I(4, 0, 5, 0, 2,
535                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
536                             PRIM_INT__f_s_h_s, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);
537 
538 
539 
540                     // Forming PRIM_INT__p_s_p_s[5 * 9];
541                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
542                     {
543 
544                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
545                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);
546                         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]);
547 
548                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
549                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 1]);
550 
551                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
552                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 2]);
553 
554                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
555                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 3]);
556 
557                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
558                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 4]);
559                         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]);
560 
561                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
562                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 5]);
563 
564                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
565                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 6]);
566 
567                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
568                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 7]);
569 
570                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
571                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 8]);
572                         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]);
573 
574                     }
575 
576 
577                     VRR_I_d_s_d_s(
578                             PRIM_INT__d_s_d_s,
579                             PRIM_INT__p_s_d_s,
580                             PRIM_INT__s_s_d_s,
581                             PRIM_INT__p_s_p_s,
582                             P_PA,
583                             a_over_p,
584                             aop_PQ,
585                             one_over_2p,
586                             one_over_2pq,
587                             4);
588 
589 
590                     ostei_general_vrr_I(3, 0, 3, 0, 3,
591                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
592                             PRIM_INT__d_s_f_s, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_d_s, NULL, PRIM_INT__f_s_f_s);
593 
594 
595                     ostei_general_vrr_I(4, 0, 4, 0, 2,
596                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
597                             PRIM_INT__f_s_g_s, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);
598 
599 
600                     ostei_general_vrr_I(5, 0, 5, 0, 1,
601                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
602                             PRIM_INT__g_s_h_s, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_h_s);
603 
604 
605                     ostei_general_vrr1_K(6, 9,
606                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
607                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
608 
609 
610                     ostei_general_vrr_I(1, 0, 6, 0, 5,
611                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
612                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
613 
614 
615                     ostei_general_vrr_I(2, 0, 6, 0, 4,
616                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
617                             PRIM_INT__p_s_i_s, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);
618 
619 
620                     ostei_general_vrr_I(3, 0, 6, 0, 3,
621                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
622                             PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);
623 
624 
625                     ostei_general_vrr_I(4, 0, 6, 0, 2,
626                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
627                             PRIM_INT__f_s_i_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);
628 
629 
630                     ostei_general_vrr_I(5, 0, 6, 0, 1,
631                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
632                             PRIM_INT__g_s_i_s, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);
633 
634 
635                     ostei_general_vrr1_K(7, 8,
636                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
637                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
638 
639 
640                     ostei_general_vrr_I(1, 0, 7, 0, 5,
641                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
642                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
643 
644 
645                     ostei_general_vrr_I(2, 0, 7, 0, 4,
646                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
647                             PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);
648 
649 
650                     ostei_general_vrr_I(3, 0, 7, 0, 3,
651                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
652                             PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);
653 
654 
655                     ostei_general_vrr_I(4, 0, 7, 0, 2,
656                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
657                             PRIM_INT__f_s_k_s, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);
658 
659 
660                     ostei_general_vrr_I(5, 0, 7, 0, 1,
661                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
662                             PRIM_INT__g_s_k_s, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);
663 
664 
665                     ostei_general_vrr1_K(8, 7,
666                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
667                             PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
668 
669 
670                     ostei_general_vrr_I(1, 0, 8, 0, 5,
671                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
672                             PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
673 
674 
675                     ostei_general_vrr_I(2, 0, 8, 0, 4,
676                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
677                             PRIM_INT__p_s_l_s, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_l_s);
678 
679 
680                     ostei_general_vrr_I(3, 0, 8, 0, 3,
681                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
682                             PRIM_INT__d_s_l_s, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_l_s);
683 
684 
685                     ostei_general_vrr_I(4, 0, 8, 0, 2,
686                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
687                             PRIM_INT__f_s_l_s, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_l_s);
688 
689 
690                     ostei_general_vrr_I(5, 0, 8, 0, 1,
691                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
692                             PRIM_INT__g_s_l_s, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_l_s);
693 
694 
695                     ostei_general_vrr1_K(9, 6,
696                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
697                             PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);
698 
699 
700                     ostei_general_vrr_I(1, 0, 9, 0, 5,
701                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
702                             PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);
703 
704 
705                     ostei_general_vrr_I(2, 0, 9, 0, 4,
706                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
707                             PRIM_INT__p_s_m_s, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_m_s);
708 
709 
710                     ostei_general_vrr_I(3, 0, 9, 0, 3,
711                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
712                             PRIM_INT__d_s_m_s, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_m_s);
713 
714 
715                     ostei_general_vrr_I(4, 0, 9, 0, 2,
716                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
717                             PRIM_INT__f_s_m_s, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_m_s);
718 
719 
720                     ostei_general_vrr_I(5, 0, 9, 0, 1,
721                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
722                             PRIM_INT__g_s_m_s, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_m_s);
723 
724 
725 
726 
727                     ////////////////////////////////////
728                     // Accumulate contracted integrals
729                     ////////////////////////////////////
730                     if(lastoffset == 0)
731                     {
732                         contract_all(441, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
733                         contract_all(588, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
734                         contract_all(756, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
735                         contract_all(945, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
736                         contract_all(1155, PRIM_INT__h_s_m_s, PRIM_PTR_INT__h_s_m_s);
737                     }
738                     else
739                     {
740                         contract(441, shelloffsets, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
741                         contract(588, shelloffsets, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
742                         contract(756, shelloffsets, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
743                         contract(945, shelloffsets, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
744                         contract(1155, shelloffsets, PRIM_INT__h_s_m_s, PRIM_PTR_INT__h_s_m_s);
745                         PRIM_PTR_INT__h_s_h_s += lastoffset*441;
746                         PRIM_PTR_INT__h_s_i_s += lastoffset*588;
747                         PRIM_PTR_INT__h_s_k_s += lastoffset*756;
748                         PRIM_PTR_INT__h_s_l_s += lastoffset*945;
749                         PRIM_PTR_INT__h_s_m_s += lastoffset*1155;
750                     }
751 
752                 }  // close loop over j
753             }  // close loop over i
754 
755             //Advance to the next batch
756             jstart = SIMINT_SIMD_ROUND(jend);
757 
758             //////////////////////////////////////////////
759             // Contracted integrals: Horizontal recurrance
760             //////////////////////////////////////////////
761 
762 
763 
764 
765             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
766             {
767                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
768 
769                 // set up HRR pointers
770                 double const * restrict HRR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
771                 double const * restrict HRR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
772                 double const * restrict HRR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
773                 double const * restrict HRR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
774                 double const * restrict HRR_INT__h_s_m_s = INT__h_s_m_s + abcd * 1155;
775                 double * restrict HRR_INT__h_s_h_g = INT__h_s_h_g + real_abcd * 6615;
776 
777                 // form INT__h_s_h_p
778                 ostei_general_hrr_L(5, 0, 5, 1, hCD, HRR_INT__h_s_i_s, HRR_INT__h_s_h_s, HRR_INT__h_s_h_p);
779 
780                 // form INT__h_s_i_p
781                 ostei_general_hrr_L(5, 0, 6, 1, hCD, HRR_INT__h_s_k_s, HRR_INT__h_s_i_s, HRR_INT__h_s_i_p);
782 
783                 // form INT__h_s_k_p
784                 ostei_general_hrr_L(5, 0, 7, 1, hCD, HRR_INT__h_s_l_s, HRR_INT__h_s_k_s, HRR_INT__h_s_k_p);
785 
786                 // form INT__h_s_l_p
787                 ostei_general_hrr_L(5, 0, 8, 1, hCD, HRR_INT__h_s_m_s, HRR_INT__h_s_l_s, HRR_INT__h_s_l_p);
788 
789                 // form INT__h_s_h_d
790                 ostei_general_hrr_L(5, 0, 5, 2, hCD, HRR_INT__h_s_i_p, HRR_INT__h_s_h_p, HRR_INT__h_s_h_d);
791 
792                 // form INT__h_s_i_d
793                 ostei_general_hrr_L(5, 0, 6, 2, hCD, HRR_INT__h_s_k_p, HRR_INT__h_s_i_p, HRR_INT__h_s_i_d);
794 
795                 // form INT__h_s_k_d
796                 ostei_general_hrr_L(5, 0, 7, 2, hCD, HRR_INT__h_s_l_p, HRR_INT__h_s_k_p, HRR_INT__h_s_k_d);
797 
798                 // form INT__h_s_h_f
799                 ostei_general_hrr_L(5, 0, 5, 3, hCD, HRR_INT__h_s_i_d, HRR_INT__h_s_h_d, HRR_INT__h_s_h_f);
800 
801                 // form INT__h_s_i_f
802                 ostei_general_hrr_L(5, 0, 6, 3, hCD, HRR_INT__h_s_k_d, HRR_INT__h_s_i_d, HRR_INT__h_s_i_f);
803 
804                 // form INT__h_s_h_g
805                 ostei_general_hrr_L(5, 0, 5, 4, hCD, HRR_INT__h_s_i_f, HRR_INT__h_s_h_f, HRR_INT__h_s_h_g);
806 
807 
808             }  // close HRR loop
809 
810 
811         }   // close loop cdbatch
812 
813         istart = iend;
814     }  // close loop over ab
815 
816     return P.nshell12_clip * Q.nshell12_clip;
817 }
818 
ostei_s_h_h_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_h_h_g)819 int ostei_s_h_h_g(struct simint_multi_shellpair const P,
820                   struct simint_multi_shellpair const Q,
821                   double screen_tol,
822                   double * const restrict work,
823                   double * const restrict INT__s_h_h_g)
824 {
825     double P_AB[3*P.nshell12];
826     struct simint_multi_shellpair P_tmp = P;
827     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
828     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
829     P_tmp.AB_x = P_AB;
830     P_tmp.AB_y = P_AB + P.nshell12;
831     P_tmp.AB_z = P_AB + 2*P.nshell12;
832 
833     for(int i = 0; i < P.nshell12; i++)
834     {
835         P_tmp.AB_x[i] = -P.AB_x[i];
836         P_tmp.AB_y[i] = -P.AB_y[i];
837         P_tmp.AB_z[i] = -P.AB_z[i];
838     }
839 
840     int ret = ostei_h_s_h_g(P_tmp, Q, screen_tol, work, INT__s_h_h_g);
841     double buffer[6615] SIMINT_ALIGN_ARRAY_DBL;
842 
843     for(int q = 0; q < ret; q++)
844     {
845         int idx = 0;
846         for(int a = 0; a < 1; ++a)
847         for(int b = 0; b < 21; ++b)
848         for(int c = 0; c < 21; ++c)
849         for(int d = 0; d < 15; ++d)
850             buffer[idx++] = INT__s_h_h_g[q*6615+b*315+a*315+c*15+d];
851 
852         memcpy(INT__s_h_h_g+q*6615, buffer, 6615*sizeof(double));
853     }
854 
855     return ret;
856 }
857 
ostei_h_s_g_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_s_g_h)858 int ostei_h_s_g_h(struct simint_multi_shellpair const P,
859                   struct simint_multi_shellpair const Q,
860                   double screen_tol,
861                   double * const restrict work,
862                   double * const restrict INT__h_s_g_h)
863 {
864     double Q_AB[3*Q.nshell12];
865     struct simint_multi_shellpair Q_tmp = Q;
866     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
867     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
868     Q_tmp.AB_x = Q_AB;
869     Q_tmp.AB_y = Q_AB + Q.nshell12;
870     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
871 
872     for(int i = 0; i < Q.nshell12; i++)
873     {
874         Q_tmp.AB_x[i] = -Q.AB_x[i];
875         Q_tmp.AB_y[i] = -Q.AB_y[i];
876         Q_tmp.AB_z[i] = -Q.AB_z[i];
877     }
878 
879     int ret = ostei_h_s_h_g(P, Q_tmp, screen_tol, work, INT__h_s_g_h);
880     double buffer[6615] SIMINT_ALIGN_ARRAY_DBL;
881 
882     for(int q = 0; q < ret; q++)
883     {
884         int idx = 0;
885         for(int a = 0; a < 21; ++a)
886         for(int b = 0; b < 1; ++b)
887         for(int c = 0; c < 15; ++c)
888         for(int d = 0; d < 21; ++d)
889             buffer[idx++] = INT__h_s_g_h[q*6615+a*315+b*315+d*15+c];
890 
891         memcpy(INT__h_s_g_h+q*6615, buffer, 6615*sizeof(double));
892     }
893 
894     return ret;
895 }
896 
ostei_s_h_g_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_h_g_h)897 int ostei_s_h_g_h(struct simint_multi_shellpair const P,
898                   struct simint_multi_shellpair const Q,
899                   double screen_tol,
900                   double * const restrict work,
901                   double * const restrict INT__s_h_g_h)
902 {
903     double P_AB[3*P.nshell12];
904     struct simint_multi_shellpair P_tmp = P;
905     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
906     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
907     P_tmp.AB_x = P_AB;
908     P_tmp.AB_y = P_AB + P.nshell12;
909     P_tmp.AB_z = P_AB + 2*P.nshell12;
910 
911     for(int i = 0; i < P.nshell12; i++)
912     {
913         P_tmp.AB_x[i] = -P.AB_x[i];
914         P_tmp.AB_y[i] = -P.AB_y[i];
915         P_tmp.AB_z[i] = -P.AB_z[i];
916     }
917 
918     double Q_AB[3*Q.nshell12];
919     struct simint_multi_shellpair Q_tmp = Q;
920     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
921     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
922     Q_tmp.AB_x = Q_AB;
923     Q_tmp.AB_y = Q_AB + Q.nshell12;
924     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
925 
926     for(int i = 0; i < Q.nshell12; i++)
927     {
928         Q_tmp.AB_x[i] = -Q.AB_x[i];
929         Q_tmp.AB_y[i] = -Q.AB_y[i];
930         Q_tmp.AB_z[i] = -Q.AB_z[i];
931     }
932 
933     int ret = ostei_h_s_h_g(P_tmp, Q_tmp, screen_tol, work, INT__s_h_g_h);
934     double buffer[6615] SIMINT_ALIGN_ARRAY_DBL;
935 
936     for(int q = 0; q < ret; q++)
937     {
938         int idx = 0;
939         for(int a = 0; a < 1; ++a)
940         for(int b = 0; b < 21; ++b)
941         for(int c = 0; c < 15; ++c)
942         for(int d = 0; d < 21; ++d)
943             buffer[idx++] = INT__s_h_g_h[q*6615+b*315+a*315+d*15+c];
944 
945         memcpy(INT__s_h_g_h+q*6615, buffer, 6615*sizeof(double));
946     }
947 
948     return ret;
949 }
950 
951