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_i_s_i_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__i_s_i_h)8 int ostei_i_s_i_h(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__i_s_i_h)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__i_s_i_h);
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__i_s_i_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__i_s_k_s = work + (SIMINT_NSHELL_SIMD * 784);
30     double * const INT__i_s_l_s = work + (SIMINT_NSHELL_SIMD * 1792);
31     double * const INT__i_s_m_s = work + (SIMINT_NSHELL_SIMD * 3052);
32     double * const INT__i_s_n_s = work + (SIMINT_NSHELL_SIMD * 4592);
33     double * const INT__i_s_o_s = work + (SIMINT_NSHELL_SIMD * 6440);
34     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*8624);
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 18;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 69;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 165;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 315;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 525;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 798;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 1134;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1530;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 1980;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_n_s = primwork + 2475;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_o_s = primwork + 3003;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 3549;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 3603;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 3711;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 3891;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 4161;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 4539;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 5043;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 5691;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 6501;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_n_s = primwork + 7491;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_o_s = primwork + 8679;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 10083;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 10263;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 10563;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 11013;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 11643;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 12483;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 13563;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 14913;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_n_s = primwork + 16563;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_o_s = primwork + 18543;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 20883;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 21283;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 21883;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 22723;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 23843;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 25283;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 27083;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_n_s = primwork + 29283;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_o_s = primwork + 31923;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 35043;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 35718;
79     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 36663;
80     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 37923;
81     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 39543;
82     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_m_s = primwork + 41568;
83     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_n_s = primwork + 44043;
84     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_o_s = primwork + 47013;
85     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 50523;
86     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 51405;
87     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 52581;
88     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_l_s = primwork + 54093;
89     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_m_s = primwork + 55983;
90     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_n_s = primwork + 58293;
91     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_o_s = primwork + 61065;
92     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_i_s = primwork + 64341;
93     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_k_s = primwork + 65125;
94     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_l_s = primwork + 66133;
95     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_m_s = primwork + 67393;
96     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_n_s = primwork + 68933;
97     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_o_s = primwork + 70781;
98     double * const hrrwork = (double *)(primwork + 72965);
99     double * const HRR_INT__i_s_i_p = hrrwork + 0;
100     double * const HRR_INT__i_s_i_d = hrrwork + 2352;
101     double * const HRR_INT__i_s_i_f = hrrwork + 7056;
102     double * const HRR_INT__i_s_i_g = hrrwork + 14896;
103     double * const HRR_INT__i_s_k_p = hrrwork + 26656;
104     double * const HRR_INT__i_s_k_d = hrrwork + 29680;
105     double * const HRR_INT__i_s_k_f = hrrwork + 35728;
106     double * const HRR_INT__i_s_k_g = hrrwork + 45808;
107     double * const HRR_INT__i_s_l_p = hrrwork + 60928;
108     double * const HRR_INT__i_s_l_d = hrrwork + 64708;
109     double * const HRR_INT__i_s_l_f = hrrwork + 72268;
110     double * const HRR_INT__i_s_m_p = hrrwork + 84868;
111     double * const HRR_INT__i_s_m_d = hrrwork + 89488;
112     double * const HRR_INT__i_s_n_p = hrrwork + 98728;
113 
114 
115     // Create constants
116     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
117     const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
118     const SIMINT_DBLTYPE const_11 = SIMINT_DBLSET1(11);
119     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
120     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
121     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
122     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
123     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
124     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
125     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
126     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
127     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
128 
129 
130     ////////////////////////////////////////
131     // Loop over shells and primitives
132     ////////////////////////////////////////
133 
134     real_abcd = 0;
135     istart = 0;
136     for(ab = 0; ab < P.nshell12_clip; ++ab)
137     {
138         const int iend = istart + P.nprim12[ab];
139 
140         cd = 0;
141         jstart = 0;
142 
143         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
144         {
145             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
146             int jend = jstart;
147             for(i = 0; i < nshellbatch; i++)
148                 jend += Q.nprim12[cd+i];
149 
150             // Clear the beginning of the workspace (where we are accumulating integrals)
151             memset(work, 0, SIMINT_NSHELL_SIMD * 8624 * sizeof(double));
152             abcd = 0;
153 
154 
155             for(i = istart; i < iend; ++i)
156             {
157                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
158 
159                 if(check_screen)
160                 {
161                     // Skip this whole thing if always insignificant
162                     if((P.screen[i] * Q.screen_max) < screen_tol)
163                         continue;
164                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
165                 }
166 
167                 icd = 0;
168                 iprimcd = 0;
169                 nprim_icd = Q.nprim12[cd];
170                 double * restrict PRIM_PTR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
171                 double * restrict PRIM_PTR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
172                 double * restrict PRIM_PTR_INT__i_s_l_s = INT__i_s_l_s + abcd * 1260;
173                 double * restrict PRIM_PTR_INT__i_s_m_s = INT__i_s_m_s + abcd * 1540;
174                 double * restrict PRIM_PTR_INT__i_s_n_s = INT__i_s_n_s + abcd * 1848;
175                 double * restrict PRIM_PTR_INT__i_s_o_s = INT__i_s_o_s + abcd * 2184;
176 
177 
178 
179                 // Load these one per loop over i
180                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
181                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
182                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
183 
184                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
185 
186                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
187                 {
188                     // calculate the shell offsets
189                     // these are the offset from the shell pointed to by cd
190                     // for each element
191                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
192                     int lastoffset = 0;
193                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
194 
195                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
196                     {
197                         // Handle if the first element of the vector is a new shell
198                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
199                         {
200                             nprim_icd += Q.nprim12[cd + (++icd)];
201                             PRIM_PTR_INT__i_s_i_s += 784;
202                             PRIM_PTR_INT__i_s_k_s += 1008;
203                             PRIM_PTR_INT__i_s_l_s += 1260;
204                             PRIM_PTR_INT__i_s_m_s += 1540;
205                             PRIM_PTR_INT__i_s_n_s += 1848;
206                             PRIM_PTR_INT__i_s_o_s += 2184;
207                         }
208                         iprimcd++;
209                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
210                         {
211                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
212                             {
213                                 shelloffsets[n] = shelloffsets[n-1] + 1;
214                                 lastoffset++;
215                                 nprim_icd += Q.nprim12[cd + (++icd)];
216                             }
217                             else
218                                 shelloffsets[n] = shelloffsets[n-1];
219                             iprimcd++;
220                         }
221                     }
222                     else
223                         iprimcd += SIMINT_SIMD_LEN;
224 
225                     // Do we have to compute this vector (or has it been screened out)?
226                     // (not_screened != 0 means we have to do this vector)
227                     if(check_screen)
228                     {
229                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
230                         if(vmax < screen_tol)
231                         {
232                             PRIM_PTR_INT__i_s_i_s += lastoffset*784;
233                             PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
234                             PRIM_PTR_INT__i_s_l_s += lastoffset*1260;
235                             PRIM_PTR_INT__i_s_m_s += lastoffset*1540;
236                             PRIM_PTR_INT__i_s_n_s += lastoffset*1848;
237                             PRIM_PTR_INT__i_s_o_s += lastoffset*2184;
238                             continue;
239                         }
240                     }
241 
242                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
243                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
244                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
245                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
246 
247 
248                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
249                     SIMINT_DBLTYPE PQ[3];
250                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
251                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
252                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
253                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
254                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
255                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
256 
257                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
258                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
259                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
260                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
261                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
262                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
263                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
264 
265                     // NOTE: Minus sign!
266                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
267                     SIMINT_DBLTYPE aop_PQ[3];
268                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
269                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
270                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
271 
272                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
273                     SIMINT_DBLTYPE aoq_PQ[3];
274                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
275                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
276                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
277                     // Put a minus sign here so we don't have to in RR routines
278                     a_over_q = SIMINT_NEG(a_over_q);
279 
280 
281                     //////////////////////////////////////////////
282                     // Fjt function section
283                     // Maximum v value: 17
284                     //////////////////////////////////////////////
285                     // The parameter to the Fjt function
286                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
287 
288 
289                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
290 
291 
292                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 17);
293                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
294                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
295                     for(n = 0; n <= 17; n++)
296                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
297 
298                     //////////////////////////////////////////////
299                     // Primitive integrals: Vertical recurrance
300                     //////////////////////////////////////////////
301 
302                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
303                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
304                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
305                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
306                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
307                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
308                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
309                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
310                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
311                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
312                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
313                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
314                     const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
315                     const SIMINT_DBLTYPE vrr_const_9_over_2q = SIMINT_MUL(const_9, one_over_2q);
316                     const SIMINT_DBLTYPE vrr_const_10_over_2q = SIMINT_MUL(const_10, one_over_2q);
317                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
318                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
319                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
320                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
321                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
322                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
323                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
324                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
325                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
326                     const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
327                     const SIMINT_DBLTYPE vrr_const_11_over_2pq = SIMINT_MUL(const_11, one_over_2pq);
328 
329 
330 
331                     // Forming PRIM_INT__s_s_p_s[17 * 3];
332                     for(n = 0; n < 17; ++n)  // loop over orders of auxiliary function
333                     {
334 
335                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
336                         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]);
337 
338                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
339                         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]);
340 
341                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
342                         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]);
343 
344                     }
345 
346 
347 
348                     // Forming PRIM_INT__s_s_d_s[16 * 6];
349                     for(n = 0; n < 16; ++n)  // loop over orders of auxiliary function
350                     {
351 
352                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
353                         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]);
354                         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]);
355 
356                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
357                         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]);
358 
359                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
360                         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]);
361 
362                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
363                         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]);
364                         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]);
365 
366                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
367                         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]);
368 
369                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
370                         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]);
371                         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]);
372 
373                     }
374 
375 
376 
377                     // Forming PRIM_INT__s_s_f_s[15 * 10];
378                     for(n = 0; n < 15; ++n)  // loop over orders of auxiliary function
379                     {
380 
381                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
382                         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]);
383                         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]);
384 
385                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
386                         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]);
387 
388                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
389                         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]);
390 
391                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
392                         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]);
393 
394                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
395                         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]);
396 
397                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
398                         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]);
399 
400                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
401                         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]);
402                         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]);
403 
404                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
405                         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]);
406 
407                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
408                         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]);
409 
410                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
411                         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]);
412                         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]);
413 
414                     }
415 
416 
417                     VRR_K_s_s_g_s(
418                             PRIM_INT__s_s_g_s,
419                             PRIM_INT__s_s_f_s,
420                             PRIM_INT__s_s_d_s,
421                             Q_PA,
422                             a_over_q,
423                             aoq_PQ,
424                             one_over_2q,
425                             14);
426 
427 
428                     VRR_K_s_s_h_s(
429                             PRIM_INT__s_s_h_s,
430                             PRIM_INT__s_s_g_s,
431                             PRIM_INT__s_s_f_s,
432                             Q_PA,
433                             a_over_q,
434                             aoq_PQ,
435                             one_over_2q,
436                             13);
437 
438 
439                     ostei_general_vrr1_K(6, 12,
440                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
441                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
442 
443 
444                     ostei_general_vrr_I(1, 0, 6, 0, 6,
445                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
446                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
447 
448 
449                     ostei_general_vrr_I(1, 0, 5, 0, 6,
450                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
451                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
452 
453 
454                     ostei_general_vrr_I(2, 0, 6, 0, 5,
455                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
456                             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);
457 
458 
459                     VRR_I_p_s_g_s(
460                             PRIM_INT__p_s_g_s,
461                             PRIM_INT__s_s_g_s,
462                             PRIM_INT__s_s_f_s,
463                             P_PA,
464                             aop_PQ,
465                             one_over_2pq,
466                             6);
467 
468 
469                     ostei_general_vrr_I(2, 0, 5, 0, 5,
470                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
471                             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);
472 
473 
474                     ostei_general_vrr_I(3, 0, 6, 0, 4,
475                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
476                             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);
477 
478 
479                     VRR_I_p_s_f_s(
480                             PRIM_INT__p_s_f_s,
481                             PRIM_INT__s_s_f_s,
482                             PRIM_INT__s_s_d_s,
483                             P_PA,
484                             aop_PQ,
485                             one_over_2pq,
486                             6);
487 
488 
489                     ostei_general_vrr_I(2, 0, 4, 0, 5,
490                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
491                             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);
492 
493 
494                     ostei_general_vrr_I(3, 0, 5, 0, 4,
495                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
496                             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);
497 
498 
499                     ostei_general_vrr_I(4, 0, 6, 0, 3,
500                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
501                             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);
502 
503 
504 
505                     // Forming PRIM_INT__p_s_d_s[6 * 18];
506                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
507                     {
508 
509                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
510                         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]);
511                         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]);
512 
513                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
514                         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]);
515                         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]);
516 
517                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
518                         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]);
519                         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]);
520 
521                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
522                         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]);
523 
524                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
525                         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]);
526 
527                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
528                         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]);
529 
530                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
531                         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]);
532 
533                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
534                         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]);
535                         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]);
536 
537                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
538                         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]);
539 
540                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
541                         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]);
542                         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]);
543 
544                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
545                         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]);
546                         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]);
547 
548                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
549                         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]);
550 
551                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
552                         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]);
553 
554                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
555                         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]);
556 
557                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
558                         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]);
559                         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]);
560 
561                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
562                         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]);
563 
564                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
565                         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]);
566                         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]);
567 
568                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
569                         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]);
570                         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]);
571 
572                     }
573 
574 
575                     VRR_I_d_s_f_s(
576                             PRIM_INT__d_s_f_s,
577                             PRIM_INT__p_s_f_s,
578                             PRIM_INT__s_s_f_s,
579                             PRIM_INT__p_s_d_s,
580                             P_PA,
581                             a_over_p,
582                             aop_PQ,
583                             one_over_2p,
584                             one_over_2pq,
585                             5);
586 
587 
588                     ostei_general_vrr_I(3, 0, 4, 0, 4,
589                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
590                             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);
591 
592 
593                     ostei_general_vrr_I(4, 0, 5, 0, 3,
594                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
595                             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);
596 
597 
598                     ostei_general_vrr_I(5, 0, 6, 0, 2,
599                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
600                             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);
601 
602 
603 
604                     // Forming PRIM_INT__p_s_p_s[6 * 9];
605                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
606                     {
607 
608                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
609                         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]);
610                         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]);
611 
612                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
613                         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]);
614 
615                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
616                         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]);
617 
618                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
619                         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]);
620 
621                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
622                         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]);
623                         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]);
624 
625                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
626                         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]);
627 
628                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
629                         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]);
630 
631                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
632                         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]);
633 
634                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
635                         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]);
636                         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]);
637 
638                     }
639 
640 
641                     VRR_I_d_s_d_s(
642                             PRIM_INT__d_s_d_s,
643                             PRIM_INT__p_s_d_s,
644                             PRIM_INT__s_s_d_s,
645                             PRIM_INT__p_s_p_s,
646                             P_PA,
647                             a_over_p,
648                             aop_PQ,
649                             one_over_2p,
650                             one_over_2pq,
651                             5);
652 
653 
654                     ostei_general_vrr_I(3, 0, 3, 0, 4,
655                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
656                             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);
657 
658 
659                     ostei_general_vrr_I(4, 0, 4, 0, 3,
660                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
661                             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);
662 
663 
664                     ostei_general_vrr_I(5, 0, 5, 0, 2,
665                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
666                             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);
667 
668 
669                     ostei_general_vrr_I(6, 0, 6, 0, 1,
670                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
671                             PRIM_INT__h_s_i_s, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_i_s);
672 
673 
674                     ostei_general_vrr1_K(7, 11,
675                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
676                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
677 
678 
679                     ostei_general_vrr_I(1, 0, 7, 0, 6,
680                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
681                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
682 
683 
684                     ostei_general_vrr_I(2, 0, 7, 0, 5,
685                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
686                             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);
687 
688 
689                     ostei_general_vrr_I(3, 0, 7, 0, 4,
690                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
691                             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);
692 
693 
694                     ostei_general_vrr_I(4, 0, 7, 0, 3,
695                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
696                             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);
697 
698 
699                     ostei_general_vrr_I(5, 0, 7, 0, 2,
700                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
701                             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);
702 
703 
704                     ostei_general_vrr_I(6, 0, 7, 0, 1,
705                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
706                             PRIM_INT__h_s_k_s, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_k_s);
707 
708 
709                     ostei_general_vrr1_K(8, 10,
710                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
711                             PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
712 
713 
714                     ostei_general_vrr_I(1, 0, 8, 0, 6,
715                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
716                             PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
717 
718 
719                     ostei_general_vrr_I(2, 0, 8, 0, 5,
720                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
721                             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);
722 
723 
724                     ostei_general_vrr_I(3, 0, 8, 0, 4,
725                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
726                             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);
727 
728 
729                     ostei_general_vrr_I(4, 0, 8, 0, 3,
730                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
731                             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);
732 
733 
734                     ostei_general_vrr_I(5, 0, 8, 0, 2,
735                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
736                             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);
737 
738 
739                     ostei_general_vrr_I(6, 0, 8, 0, 1,
740                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
741                             PRIM_INT__h_s_l_s, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_k_s, NULL, PRIM_INT__i_s_l_s);
742 
743 
744                     ostei_general_vrr1_K(9, 9,
745                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
746                             PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);
747 
748 
749                     ostei_general_vrr_I(1, 0, 9, 0, 6,
750                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
751                             PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);
752 
753 
754                     ostei_general_vrr_I(2, 0, 9, 0, 5,
755                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
756                             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);
757 
758 
759                     ostei_general_vrr_I(3, 0, 9, 0, 4,
760                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
761                             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);
762 
763 
764                     ostei_general_vrr_I(4, 0, 9, 0, 3,
765                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
766                             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);
767 
768 
769                     ostei_general_vrr_I(5, 0, 9, 0, 2,
770                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
771                             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);
772 
773 
774                     ostei_general_vrr_I(6, 0, 9, 0, 1,
775                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
776                             PRIM_INT__h_s_m_s, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_l_s, NULL, PRIM_INT__i_s_m_s);
777 
778 
779                     ostei_general_vrr1_K(10, 8,
780                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
781                             PRIM_INT__s_s_m_s, PRIM_INT__s_s_l_s, PRIM_INT__s_s_n_s);
782 
783 
784                     ostei_general_vrr_I(1, 0, 10, 0, 6,
785                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
786                             PRIM_INT__s_s_n_s, NULL, NULL, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_n_s);
787 
788 
789                     ostei_general_vrr_I(2, 0, 10, 0, 5,
790                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
791                             PRIM_INT__p_s_n_s, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_n_s);
792 
793 
794                     ostei_general_vrr_I(3, 0, 10, 0, 4,
795                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
796                             PRIM_INT__d_s_n_s, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_n_s);
797 
798 
799                     ostei_general_vrr_I(4, 0, 10, 0, 3,
800                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
801                             PRIM_INT__f_s_n_s, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_n_s);
802 
803 
804                     ostei_general_vrr_I(5, 0, 10, 0, 2,
805                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
806                             PRIM_INT__g_s_n_s, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_n_s);
807 
808 
809                     ostei_general_vrr_I(6, 0, 10, 0, 1,
810                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
811                             PRIM_INT__h_s_n_s, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_m_s, NULL, PRIM_INT__i_s_n_s);
812 
813 
814                     ostei_general_vrr1_K(11, 7,
815                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
816                             PRIM_INT__s_s_n_s, PRIM_INT__s_s_m_s, PRIM_INT__s_s_o_s);
817 
818 
819                     ostei_general_vrr_I(1, 0, 11, 0, 6,
820                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
821                             PRIM_INT__s_s_o_s, NULL, NULL, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_o_s);
822 
823 
824                     ostei_general_vrr_I(2, 0, 11, 0, 5,
825                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
826                             PRIM_INT__p_s_o_s, PRIM_INT__s_s_o_s, NULL, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_o_s);
827 
828 
829                     ostei_general_vrr_I(3, 0, 11, 0, 4,
830                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
831                             PRIM_INT__d_s_o_s, PRIM_INT__p_s_o_s, NULL, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_o_s);
832 
833 
834                     ostei_general_vrr_I(4, 0, 11, 0, 3,
835                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
836                             PRIM_INT__f_s_o_s, PRIM_INT__d_s_o_s, NULL, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_o_s);
837 
838 
839                     ostei_general_vrr_I(5, 0, 11, 0, 2,
840                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
841                             PRIM_INT__g_s_o_s, PRIM_INT__f_s_o_s, NULL, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_o_s);
842 
843 
844                     ostei_general_vrr_I(6, 0, 11, 0, 1,
845                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
846                             PRIM_INT__h_s_o_s, PRIM_INT__g_s_o_s, NULL, PRIM_INT__h_s_n_s, NULL, PRIM_INT__i_s_o_s);
847 
848 
849 
850 
851                     ////////////////////////////////////
852                     // Accumulate contracted integrals
853                     ////////////////////////////////////
854                     if(lastoffset == 0)
855                     {
856                         contract_all(784, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
857                         contract_all(1008, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
858                         contract_all(1260, PRIM_INT__i_s_l_s, PRIM_PTR_INT__i_s_l_s);
859                         contract_all(1540, PRIM_INT__i_s_m_s, PRIM_PTR_INT__i_s_m_s);
860                         contract_all(1848, PRIM_INT__i_s_n_s, PRIM_PTR_INT__i_s_n_s);
861                         contract_all(2184, PRIM_INT__i_s_o_s, PRIM_PTR_INT__i_s_o_s);
862                     }
863                     else
864                     {
865                         contract(784, shelloffsets, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
866                         contract(1008, shelloffsets, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
867                         contract(1260, shelloffsets, PRIM_INT__i_s_l_s, PRIM_PTR_INT__i_s_l_s);
868                         contract(1540, shelloffsets, PRIM_INT__i_s_m_s, PRIM_PTR_INT__i_s_m_s);
869                         contract(1848, shelloffsets, PRIM_INT__i_s_n_s, PRIM_PTR_INT__i_s_n_s);
870                         contract(2184, shelloffsets, PRIM_INT__i_s_o_s, PRIM_PTR_INT__i_s_o_s);
871                         PRIM_PTR_INT__i_s_i_s += lastoffset*784;
872                         PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
873                         PRIM_PTR_INT__i_s_l_s += lastoffset*1260;
874                         PRIM_PTR_INT__i_s_m_s += lastoffset*1540;
875                         PRIM_PTR_INT__i_s_n_s += lastoffset*1848;
876                         PRIM_PTR_INT__i_s_o_s += lastoffset*2184;
877                     }
878 
879                 }  // close loop over j
880             }  // close loop over i
881 
882             //Advance to the next batch
883             jstart = SIMINT_SIMD_ROUND(jend);
884 
885             //////////////////////////////////////////////
886             // Contracted integrals: Horizontal recurrance
887             //////////////////////////////////////////////
888 
889 
890 
891 
892             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
893             {
894                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
895 
896                 // set up HRR pointers
897                 double const * restrict HRR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
898                 double const * restrict HRR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
899                 double const * restrict HRR_INT__i_s_l_s = INT__i_s_l_s + abcd * 1260;
900                 double const * restrict HRR_INT__i_s_m_s = INT__i_s_m_s + abcd * 1540;
901                 double const * restrict HRR_INT__i_s_n_s = INT__i_s_n_s + abcd * 1848;
902                 double const * restrict HRR_INT__i_s_o_s = INT__i_s_o_s + abcd * 2184;
903                 double * restrict HRR_INT__i_s_i_h = INT__i_s_i_h + real_abcd * 16464;
904 
905                 // form INT__i_s_i_p
906                 ostei_general_hrr_L(6, 0, 6, 1, hCD, HRR_INT__i_s_k_s, HRR_INT__i_s_i_s, HRR_INT__i_s_i_p);
907 
908                 // form INT__i_s_k_p
909                 ostei_general_hrr_L(6, 0, 7, 1, hCD, HRR_INT__i_s_l_s, HRR_INT__i_s_k_s, HRR_INT__i_s_k_p);
910 
911                 // form INT__i_s_l_p
912                 ostei_general_hrr_L(6, 0, 8, 1, hCD, HRR_INT__i_s_m_s, HRR_INT__i_s_l_s, HRR_INT__i_s_l_p);
913 
914                 // form INT__i_s_m_p
915                 ostei_general_hrr_L(6, 0, 9, 1, hCD, HRR_INT__i_s_n_s, HRR_INT__i_s_m_s, HRR_INT__i_s_m_p);
916 
917                 // form INT__i_s_n_p
918                 ostei_general_hrr_L(6, 0, 10, 1, hCD, HRR_INT__i_s_o_s, HRR_INT__i_s_n_s, HRR_INT__i_s_n_p);
919 
920                 // form INT__i_s_i_d
921                 ostei_general_hrr_L(6, 0, 6, 2, hCD, HRR_INT__i_s_k_p, HRR_INT__i_s_i_p, HRR_INT__i_s_i_d);
922 
923                 // form INT__i_s_k_d
924                 ostei_general_hrr_L(6, 0, 7, 2, hCD, HRR_INT__i_s_l_p, HRR_INT__i_s_k_p, HRR_INT__i_s_k_d);
925 
926                 // form INT__i_s_l_d
927                 ostei_general_hrr_L(6, 0, 8, 2, hCD, HRR_INT__i_s_m_p, HRR_INT__i_s_l_p, HRR_INT__i_s_l_d);
928 
929                 // form INT__i_s_m_d
930                 ostei_general_hrr_L(6, 0, 9, 2, hCD, HRR_INT__i_s_n_p, HRR_INT__i_s_m_p, HRR_INT__i_s_m_d);
931 
932                 // form INT__i_s_i_f
933                 ostei_general_hrr_L(6, 0, 6, 3, hCD, HRR_INT__i_s_k_d, HRR_INT__i_s_i_d, HRR_INT__i_s_i_f);
934 
935                 // form INT__i_s_k_f
936                 ostei_general_hrr_L(6, 0, 7, 3, hCD, HRR_INT__i_s_l_d, HRR_INT__i_s_k_d, HRR_INT__i_s_k_f);
937 
938                 // form INT__i_s_l_f
939                 ostei_general_hrr_L(6, 0, 8, 3, hCD, HRR_INT__i_s_m_d, HRR_INT__i_s_l_d, HRR_INT__i_s_l_f);
940 
941                 // form INT__i_s_i_g
942                 ostei_general_hrr_L(6, 0, 6, 4, hCD, HRR_INT__i_s_k_f, HRR_INT__i_s_i_f, HRR_INT__i_s_i_g);
943 
944                 // form INT__i_s_k_g
945                 ostei_general_hrr_L(6, 0, 7, 4, hCD, HRR_INT__i_s_l_f, HRR_INT__i_s_k_f, HRR_INT__i_s_k_g);
946 
947                 // form INT__i_s_i_h
948                 ostei_general_hrr_L(6, 0, 6, 5, hCD, HRR_INT__i_s_k_g, HRR_INT__i_s_i_g, HRR_INT__i_s_i_h);
949 
950 
951             }  // close HRR loop
952 
953 
954         }   // close loop cdbatch
955 
956         istart = iend;
957     }  // close loop over ab
958 
959     return P.nshell12_clip * Q.nshell12_clip;
960 }
961 
ostei_s_i_i_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_i_i_h)962 int ostei_s_i_i_h(struct simint_multi_shellpair const P,
963                   struct simint_multi_shellpair const Q,
964                   double screen_tol,
965                   double * const restrict work,
966                   double * const restrict INT__s_i_i_h)
967 {
968     double P_AB[3*P.nshell12];
969     struct simint_multi_shellpair P_tmp = P;
970     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
971     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
972     P_tmp.AB_x = P_AB;
973     P_tmp.AB_y = P_AB + P.nshell12;
974     P_tmp.AB_z = P_AB + 2*P.nshell12;
975 
976     for(int i = 0; i < P.nshell12; i++)
977     {
978         P_tmp.AB_x[i] = -P.AB_x[i];
979         P_tmp.AB_y[i] = -P.AB_y[i];
980         P_tmp.AB_z[i] = -P.AB_z[i];
981     }
982 
983     int ret = ostei_i_s_i_h(P_tmp, Q, screen_tol, work, INT__s_i_i_h);
984     double buffer[16464] SIMINT_ALIGN_ARRAY_DBL;
985 
986     for(int q = 0; q < ret; q++)
987     {
988         int idx = 0;
989         for(int a = 0; a < 1; ++a)
990         for(int b = 0; b < 28; ++b)
991         for(int c = 0; c < 28; ++c)
992         for(int d = 0; d < 21; ++d)
993             buffer[idx++] = INT__s_i_i_h[q*16464+b*588+a*588+c*21+d];
994 
995         memcpy(INT__s_i_i_h+q*16464, buffer, 16464*sizeof(double));
996     }
997 
998     return ret;
999 }
1000 
ostei_i_s_h_i(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__i_s_h_i)1001 int ostei_i_s_h_i(struct simint_multi_shellpair const P,
1002                   struct simint_multi_shellpair const Q,
1003                   double screen_tol,
1004                   double * const restrict work,
1005                   double * const restrict INT__i_s_h_i)
1006 {
1007     double Q_AB[3*Q.nshell12];
1008     struct simint_multi_shellpair Q_tmp = Q;
1009     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1010     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1011     Q_tmp.AB_x = Q_AB;
1012     Q_tmp.AB_y = Q_AB + Q.nshell12;
1013     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1014 
1015     for(int i = 0; i < Q.nshell12; i++)
1016     {
1017         Q_tmp.AB_x[i] = -Q.AB_x[i];
1018         Q_tmp.AB_y[i] = -Q.AB_y[i];
1019         Q_tmp.AB_z[i] = -Q.AB_z[i];
1020     }
1021 
1022     int ret = ostei_i_s_i_h(P, Q_tmp, screen_tol, work, INT__i_s_h_i);
1023     double buffer[16464] SIMINT_ALIGN_ARRAY_DBL;
1024 
1025     for(int q = 0; q < ret; q++)
1026     {
1027         int idx = 0;
1028         for(int a = 0; a < 28; ++a)
1029         for(int b = 0; b < 1; ++b)
1030         for(int c = 0; c < 21; ++c)
1031         for(int d = 0; d < 28; ++d)
1032             buffer[idx++] = INT__i_s_h_i[q*16464+a*588+b*588+d*21+c];
1033 
1034         memcpy(INT__i_s_h_i+q*16464, buffer, 16464*sizeof(double));
1035     }
1036 
1037     return ret;
1038 }
1039 
ostei_s_i_h_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_i_h_i)1040 int ostei_s_i_h_i(struct simint_multi_shellpair const P,
1041                   struct simint_multi_shellpair const Q,
1042                   double screen_tol,
1043                   double * const restrict work,
1044                   double * const restrict INT__s_i_h_i)
1045 {
1046     double P_AB[3*P.nshell12];
1047     struct simint_multi_shellpair P_tmp = P;
1048     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
1049     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
1050     P_tmp.AB_x = P_AB;
1051     P_tmp.AB_y = P_AB + P.nshell12;
1052     P_tmp.AB_z = P_AB + 2*P.nshell12;
1053 
1054     for(int i = 0; i < P.nshell12; i++)
1055     {
1056         P_tmp.AB_x[i] = -P.AB_x[i];
1057         P_tmp.AB_y[i] = -P.AB_y[i];
1058         P_tmp.AB_z[i] = -P.AB_z[i];
1059     }
1060 
1061     double Q_AB[3*Q.nshell12];
1062     struct simint_multi_shellpair Q_tmp = Q;
1063     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1064     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1065     Q_tmp.AB_x = Q_AB;
1066     Q_tmp.AB_y = Q_AB + Q.nshell12;
1067     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1068 
1069     for(int i = 0; i < Q.nshell12; i++)
1070     {
1071         Q_tmp.AB_x[i] = -Q.AB_x[i];
1072         Q_tmp.AB_y[i] = -Q.AB_y[i];
1073         Q_tmp.AB_z[i] = -Q.AB_z[i];
1074     }
1075 
1076     int ret = ostei_i_s_i_h(P_tmp, Q_tmp, screen_tol, work, INT__s_i_h_i);
1077     double buffer[16464] SIMINT_ALIGN_ARRAY_DBL;
1078 
1079     for(int q = 0; q < ret; q++)
1080     {
1081         int idx = 0;
1082         for(int a = 0; a < 1; ++a)
1083         for(int b = 0; b < 28; ++b)
1084         for(int c = 0; c < 21; ++c)
1085         for(int d = 0; d < 28; ++d)
1086             buffer[idx++] = INT__s_i_h_i[q*16464+b*588+a*588+d*21+c];
1087 
1088         memcpy(INT__s_i_h_i+q*16464, buffer, 16464*sizeof(double));
1089     }
1090 
1091     return ret;
1092 }
1093 
1094