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_h_g_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__h_h_g_p)8 int ostei_h_h_g_p(struct simint_multi_shellpair const P,
9                   struct simint_multi_shellpair const Q,
10                   double screen_tol,
11                   double * const restrict work,
12                   double * const restrict INT__h_h_g_p)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__h_h_g_p);
17     int ab, cd, abcd;
18     int istart, jstart;
19     int iprimcd, nprim_icd, icd;
20     const int check_screen = (screen_tol > 0.0);
21     int i, j;
22     int n;
23     int not_screened;
24     int real_abcd;
25     int iket;
26     int ibra;
27 
28     // partition workspace
29     double * const INT__h_s_g_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__h_s_h_s = work + (SIMINT_NSHELL_SIMD * 315);
31     double * const INT__i_s_g_s = work + (SIMINT_NSHELL_SIMD * 756);
32     double * const INT__i_s_h_s = work + (SIMINT_NSHELL_SIMD * 1176);
33     double * const INT__k_s_g_s = work + (SIMINT_NSHELL_SIMD * 1764);
34     double * const INT__k_s_h_s = work + (SIMINT_NSHELL_SIMD * 2304);
35     double * const INT__l_s_g_s = work + (SIMINT_NSHELL_SIMD * 3060);
36     double * const INT__l_s_h_s = work + (SIMINT_NSHELL_SIMD * 3735);
37     double * const INT__m_s_g_s = work + (SIMINT_NSHELL_SIMD * 4680);
38     double * const INT__m_s_h_s = work + (SIMINT_NSHELL_SIMD * 5505);
39     double * const INT__n_s_g_s = work + (SIMINT_NSHELL_SIMD * 6660);
40     double * const INT__n_s_h_s = work + (SIMINT_NSHELL_SIMD * 7650);
41     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*9036);
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 16;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 61;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 106;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 190;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 280;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 424;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 554;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 704;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 944;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 1244;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 1424;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 1649;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 2009;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 2459;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 2909;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 3140;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 3455;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 3959;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 4589;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 5219;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 5660;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 5940;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 6360;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 7032;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_g_s = primwork + 7872;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_h_s = primwork + 8712;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_s_s = primwork + 9300;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_p_s = primwork + 9624;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_d_s = primwork + 10164;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_f_s = primwork + 11028;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_g_s = primwork + 12108;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_h_s = primwork + 13188;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_s_s = primwork + 13944;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_p_s = primwork + 14304;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_d_s = primwork + 14979;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_f_s = primwork + 16059;
79     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_g_s = primwork + 17409;
80     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_h_s = primwork + 18759;
81     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_s_s = primwork + 19704;
82     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_p_s = primwork + 20089;
83     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_d_s = primwork + 20914;
84     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_f_s = primwork + 22234;
85     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_g_s = primwork + 23884;
86     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_h_s = primwork + 25534;
87     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_s_s = primwork + 26689;
88     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_p_s = primwork + 27085;
89     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_d_s = primwork + 28075;
90     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_f_s = primwork + 29659;
91     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_g_s = primwork + 31639;
92     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_h_s = primwork + 33619;
93     double * const hrrwork = (double *)(primwork + 35005);
94     double * const HRR_INT__h_p_g_s = hrrwork + 0;
95     double * const HRR_INT__h_p_h_s = hrrwork + 945;
96     double * const HRR_INT__h_d_g_s = hrrwork + 2268;
97     double * const HRR_INT__h_d_h_s = hrrwork + 4158;
98     double * const HRR_INT__h_f_g_s = hrrwork + 6804;
99     double * const HRR_INT__h_f_h_s = hrrwork + 9954;
100     double * const HRR_INT__h_g_g_s = hrrwork + 14364;
101     double * const HRR_INT__h_g_h_s = hrrwork + 19089;
102     double * const HRR_INT__h_h_g_s = hrrwork + 25704;
103     double * const HRR_INT__h_h_h_s = hrrwork + 32319;
104     double * const HRR_INT__i_p_g_s = hrrwork + 41580;
105     double * const HRR_INT__i_p_h_s = hrrwork + 42840;
106     double * const HRR_INT__i_d_g_s = hrrwork + 44604;
107     double * const HRR_INT__i_d_h_s = hrrwork + 47124;
108     double * const HRR_INT__i_f_g_s = hrrwork + 50652;
109     double * const HRR_INT__i_f_h_s = hrrwork + 54852;
110     double * const HRR_INT__i_g_g_s = hrrwork + 60732;
111     double * const HRR_INT__i_g_h_s = hrrwork + 67032;
112     double * const HRR_INT__k_p_g_s = hrrwork + 75852;
113     double * const HRR_INT__k_p_h_s = hrrwork + 77472;
114     double * const HRR_INT__k_d_g_s = hrrwork + 79740;
115     double * const HRR_INT__k_d_h_s = hrrwork + 82980;
116     double * const HRR_INT__k_f_g_s = hrrwork + 87516;
117     double * const HRR_INT__k_f_h_s = hrrwork + 92916;
118     double * const HRR_INT__l_p_g_s = hrrwork + 100476;
119     double * const HRR_INT__l_p_h_s = hrrwork + 102501;
120     double * const HRR_INT__l_d_g_s = hrrwork + 105336;
121     double * const HRR_INT__l_d_h_s = hrrwork + 109386;
122     double * const HRR_INT__m_p_g_s = hrrwork + 115056;
123     double * const HRR_INT__m_p_h_s = hrrwork + 117531;
124 
125 
126     // Create constants
127     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
128     const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
129     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
130     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
131     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
132     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
133     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
134     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
135     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
136     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
137     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
138 
139 
140     ////////////////////////////////////////
141     // Loop over shells and primitives
142     ////////////////////////////////////////
143 
144     real_abcd = 0;
145     istart = 0;
146     for(ab = 0; ab < P.nshell12_clip; ++ab)
147     {
148         const int iend = istart + P.nprim12[ab];
149 
150         cd = 0;
151         jstart = 0;
152 
153         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
154         {
155             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
156             int jend = jstart;
157             for(i = 0; i < nshellbatch; i++)
158                 jend += Q.nprim12[cd+i];
159 
160             // Clear the beginning of the workspace (where we are accumulating integrals)
161             memset(work, 0, SIMINT_NSHELL_SIMD * 9036 * sizeof(double));
162             abcd = 0;
163 
164 
165             for(i = istart; i < iend; ++i)
166             {
167                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
168 
169                 if(check_screen)
170                 {
171                     // Skip this whole thing if always insignificant
172                     if((P.screen[i] * Q.screen_max) < screen_tol)
173                         continue;
174                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
175                 }
176 
177                 icd = 0;
178                 iprimcd = 0;
179                 nprim_icd = Q.nprim12[cd];
180                 double * restrict PRIM_PTR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
181                 double * restrict PRIM_PTR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
182                 double * restrict PRIM_PTR_INT__i_s_g_s = INT__i_s_g_s + abcd * 420;
183                 double * restrict PRIM_PTR_INT__i_s_h_s = INT__i_s_h_s + abcd * 588;
184                 double * restrict PRIM_PTR_INT__k_s_g_s = INT__k_s_g_s + abcd * 540;
185                 double * restrict PRIM_PTR_INT__k_s_h_s = INT__k_s_h_s + abcd * 756;
186                 double * restrict PRIM_PTR_INT__l_s_g_s = INT__l_s_g_s + abcd * 675;
187                 double * restrict PRIM_PTR_INT__l_s_h_s = INT__l_s_h_s + abcd * 945;
188                 double * restrict PRIM_PTR_INT__m_s_g_s = INT__m_s_g_s + abcd * 825;
189                 double * restrict PRIM_PTR_INT__m_s_h_s = INT__m_s_h_s + abcd * 1155;
190                 double * restrict PRIM_PTR_INT__n_s_g_s = INT__n_s_g_s + abcd * 990;
191                 double * restrict PRIM_PTR_INT__n_s_h_s = INT__n_s_h_s + abcd * 1386;
192 
193 
194 
195                 // Load these one per loop over i
196                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
197                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
198                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
199 
200                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
201 
202                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
203                 {
204                     // calculate the shell offsets
205                     // these are the offset from the shell pointed to by cd
206                     // for each element
207                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
208                     int lastoffset = 0;
209                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
210 
211                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
212                     {
213                         // Handle if the first element of the vector is a new shell
214                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
215                         {
216                             nprim_icd += Q.nprim12[cd + (++icd)];
217                             PRIM_PTR_INT__h_s_g_s += 315;
218                             PRIM_PTR_INT__h_s_h_s += 441;
219                             PRIM_PTR_INT__i_s_g_s += 420;
220                             PRIM_PTR_INT__i_s_h_s += 588;
221                             PRIM_PTR_INT__k_s_g_s += 540;
222                             PRIM_PTR_INT__k_s_h_s += 756;
223                             PRIM_PTR_INT__l_s_g_s += 675;
224                             PRIM_PTR_INT__l_s_h_s += 945;
225                             PRIM_PTR_INT__m_s_g_s += 825;
226                             PRIM_PTR_INT__m_s_h_s += 1155;
227                             PRIM_PTR_INT__n_s_g_s += 990;
228                             PRIM_PTR_INT__n_s_h_s += 1386;
229                         }
230                         iprimcd++;
231                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
232                         {
233                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
234                             {
235                                 shelloffsets[n] = shelloffsets[n-1] + 1;
236                                 lastoffset++;
237                                 nprim_icd += Q.nprim12[cd + (++icd)];
238                             }
239                             else
240                                 shelloffsets[n] = shelloffsets[n-1];
241                             iprimcd++;
242                         }
243                     }
244                     else
245                         iprimcd += SIMINT_SIMD_LEN;
246 
247                     // Do we have to compute this vector (or has it been screened out)?
248                     // (not_screened != 0 means we have to do this vector)
249                     if(check_screen)
250                     {
251                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
252                         if(vmax < screen_tol)
253                         {
254                             PRIM_PTR_INT__h_s_g_s += lastoffset*315;
255                             PRIM_PTR_INT__h_s_h_s += lastoffset*441;
256                             PRIM_PTR_INT__i_s_g_s += lastoffset*420;
257                             PRIM_PTR_INT__i_s_h_s += lastoffset*588;
258                             PRIM_PTR_INT__k_s_g_s += lastoffset*540;
259                             PRIM_PTR_INT__k_s_h_s += lastoffset*756;
260                             PRIM_PTR_INT__l_s_g_s += lastoffset*675;
261                             PRIM_PTR_INT__l_s_h_s += lastoffset*945;
262                             PRIM_PTR_INT__m_s_g_s += lastoffset*825;
263                             PRIM_PTR_INT__m_s_h_s += lastoffset*1155;
264                             PRIM_PTR_INT__n_s_g_s += lastoffset*990;
265                             PRIM_PTR_INT__n_s_h_s += lastoffset*1386;
266                             continue;
267                         }
268                     }
269 
270                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
271                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
272                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
273                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
274 
275 
276                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
277                     SIMINT_DBLTYPE PQ[3];
278                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
279                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
280                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
281                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
282                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
283                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
284 
285                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
286                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
287                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
288                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
289                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
290                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
291                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
292 
293                     // NOTE: Minus sign!
294                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
295                     SIMINT_DBLTYPE aop_PQ[3];
296                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
297                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
298                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
299 
300                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
301                     SIMINT_DBLTYPE aoq_PQ[3];
302                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
303                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
304                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
305                     // Put a minus sign here so we don't have to in RR routines
306                     a_over_q = SIMINT_NEG(a_over_q);
307 
308 
309                     //////////////////////////////////////////////
310                     // Fjt function section
311                     // Maximum v value: 15
312                     //////////////////////////////////////////////
313                     // The parameter to the Fjt function
314                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
315 
316 
317                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
318 
319 
320                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 15);
321                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
322                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
323                     for(n = 0; n <= 15; n++)
324                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
325 
326                     //////////////////////////////////////////////
327                     // Primitive integrals: Vertical recurrance
328                     //////////////////////////////////////////////
329 
330                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
331                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
332                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
333                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
334                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
335                     const SIMINT_DBLTYPE vrr_const_6_over_2p = SIMINT_MUL(const_6, one_over_2p);
336                     const SIMINT_DBLTYPE vrr_const_7_over_2p = SIMINT_MUL(const_7, one_over_2p);
337                     const SIMINT_DBLTYPE vrr_const_8_over_2p = SIMINT_MUL(const_8, one_over_2p);
338                     const SIMINT_DBLTYPE vrr_const_9_over_2p = SIMINT_MUL(const_9, one_over_2p);
339                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
340                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
341                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
342                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
343                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
344                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
345                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
346                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
347                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
348                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
349                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
350                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
351                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
352                     const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
353 
354 
355 
356                     // Forming PRIM_INT__p_s_s_s[15 * 3];
357                     for(n = 0; n < 15; ++n)  // loop over orders of auxiliary function
358                     {
359 
360                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
361                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]);
362 
363                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
364                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 1]);
365 
366                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
367                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 2]);
368 
369                     }
370 
371 
372 
373                     // Forming PRIM_INT__d_s_s_s[14 * 6];
374                     for(n = 0; n < 14; ++n)  // loop over orders of auxiliary function
375                     {
376 
377                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
378                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 0]);
379                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 0]);
380 
381                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
382                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 1]);
383 
384                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
385                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 2]);
386 
387                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
388                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_s[n * 6 + 3]);
389                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 3]);
390 
391                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
392                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_s[n * 6 + 4]);
393 
394                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
395                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_s_s[n * 6 + 5]);
396                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 5]);
397 
398                     }
399 
400 
401 
402                     // Forming PRIM_INT__f_s_s_s[13 * 10];
403                     for(n = 0; n < 13; ++n)  // loop over orders of auxiliary function
404                     {
405 
406                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
407                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 0]);
408                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__f_s_s_s[n * 10 + 0]);
409 
410                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
411                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 1]);
412 
413                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
414                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 2]);
415 
416                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
417                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 3]);
418 
419                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
420                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__f_s_s_s[n * 10 + 4]);
421 
422                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
423                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 5]);
424 
425                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
426                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 6]);
427                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__f_s_s_s[n * 10 + 6]);
428 
429                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
430                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 7]);
431 
432                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
433                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 8]);
434 
435                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
436                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 9]);
437                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__f_s_s_s[n * 10 + 9]);
438 
439                     }
440 
441 
442                     VRR_I_g_s_s_s(
443                             PRIM_INT__g_s_s_s,
444                             PRIM_INT__f_s_s_s,
445                             PRIM_INT__d_s_s_s,
446                             P_PA,
447                             a_over_p,
448                             aop_PQ,
449                             one_over_2p,
450                             12);
451 
452 
453                     VRR_I_h_s_s_s(
454                             PRIM_INT__h_s_s_s,
455                             PRIM_INT__g_s_s_s,
456                             PRIM_INT__f_s_s_s,
457                             P_PA,
458                             a_over_p,
459                             aop_PQ,
460                             one_over_2p,
461                             11);
462 
463 
464                     ostei_general_vrr_K(5, 0, 1, 0, 5,
465                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
466                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
467 
468 
469                     VRR_K_g_s_p_s(
470                             PRIM_INT__g_s_p_s,
471                             PRIM_INT__g_s_s_s,
472                             PRIM_INT__f_s_s_s,
473                             Q_PA,
474                             aoq_PQ,
475                             one_over_2pq,
476                             5);
477 
478 
479                     ostei_general_vrr_K(5, 0, 2, 0, 4,
480                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
481                             PRIM_INT__h_s_p_s, PRIM_INT__h_s_s_s, NULL, PRIM_INT__g_s_p_s, NULL, PRIM_INT__h_s_d_s);
482 
483 
484                     VRR_K_f_s_p_s(
485                             PRIM_INT__f_s_p_s,
486                             PRIM_INT__f_s_s_s,
487                             PRIM_INT__d_s_s_s,
488                             Q_PA,
489                             aoq_PQ,
490                             one_over_2pq,
491                             5);
492 
493 
494                     ostei_general_vrr_K(4, 0, 2, 0, 4,
495                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
496                             PRIM_INT__g_s_p_s, PRIM_INT__g_s_s_s, NULL, PRIM_INT__f_s_p_s, NULL, PRIM_INT__g_s_d_s);
497 
498 
499                     ostei_general_vrr_K(5, 0, 3, 0, 3,
500                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
501                             PRIM_INT__h_s_d_s, PRIM_INT__h_s_p_s, NULL, PRIM_INT__g_s_d_s, NULL, PRIM_INT__h_s_f_s);
502 
503 
504 
505                     // Forming PRIM_INT__d_s_p_s[5 * 18];
506                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
507                     {
508 
509                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
510                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
511                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
512 
513                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
514                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 1]);
515 
516                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
517                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 2]);
518 
519                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
520                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 3]);
521                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 3]);
522 
523                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
524                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 4]);
525                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 4]);
526 
527                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
528                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 5]);
529 
530                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
531                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 6]);
532                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 6]);
533 
534                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
535                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 7]);
536 
537                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
538                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 8]);
539                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 8]);
540 
541                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
542                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);
543 
544                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
545                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 10]);
546                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 10]);
547 
548                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
549                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 11]);
550 
551                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
552                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 12]);
553 
554                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
555                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 13]);
556                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 13]);
557 
558                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
559                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 14]);
560                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 14]);
561 
562                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
563                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 15]);
564 
565                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
566                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 16]);
567 
568                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
569                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 17]);
570                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 17]);
571 
572                     }
573 
574 
575                     VRR_K_f_s_d_s(
576                             PRIM_INT__f_s_d_s,
577                             PRIM_INT__f_s_p_s,
578                             PRIM_INT__f_s_s_s,
579                             PRIM_INT__d_s_p_s,
580                             Q_PA,
581                             a_over_q,
582                             aoq_PQ,
583                             one_over_2pq,
584                             one_over_2q,
585                             4);
586 
587 
588                     ostei_general_vrr_K(4, 0, 3, 0, 3,
589                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
590                             PRIM_INT__g_s_d_s, PRIM_INT__g_s_p_s, NULL, PRIM_INT__f_s_d_s, NULL, PRIM_INT__g_s_f_s);
591 
592 
593                     ostei_general_vrr_K(5, 0, 4, 0, 2,
594                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
595                             PRIM_INT__h_s_f_s, PRIM_INT__h_s_d_s, NULL, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_g_s);
596 
597 
598 
599                     // Forming PRIM_INT__p_s_p_s[5 * 9];
600                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
601                     {
602 
603                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
604                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);
605                         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]);
606 
607                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
608                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 1]);
609 
610                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
611                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 2]);
612 
613                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 1]);
614                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 3]);
615 
616                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
617                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 4]);
618                         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]);
619 
620                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
621                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 5]);
622 
623                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 2]);
624                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 6]);
625 
626                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 2]);
627                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 7]);
628 
629                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
630                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 8]);
631                         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]);
632 
633                     }
634 
635 
636                     VRR_K_d_s_d_s(
637                             PRIM_INT__d_s_d_s,
638                             PRIM_INT__d_s_p_s,
639                             PRIM_INT__d_s_s_s,
640                             PRIM_INT__p_s_p_s,
641                             Q_PA,
642                             a_over_q,
643                             aoq_PQ,
644                             one_over_2pq,
645                             one_over_2q,
646                             4);
647 
648 
649                     ostei_general_vrr_K(3, 0, 3, 0, 3,
650                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
651                             PRIM_INT__f_s_d_s, PRIM_INT__f_s_p_s, NULL, PRIM_INT__d_s_d_s, NULL, PRIM_INT__f_s_f_s);
652 
653 
654                     ostei_general_vrr_K(4, 0, 4, 0, 2,
655                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
656                             PRIM_INT__g_s_f_s, PRIM_INT__g_s_d_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);
657 
658 
659                     ostei_general_vrr_K(5, 0, 5, 0, 1,
660                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
661                             PRIM_INT__h_s_g_s, PRIM_INT__h_s_f_s, NULL, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_h_s);
662 
663 
664                     ostei_general_vrr1_I(6, 10,
665                             one_over_2p, a_over_p, aop_PQ, P_PA,
666                             PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
667 
668 
669                     ostei_general_vrr_K(6, 0, 1, 0, 5,
670                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
671                             PRIM_INT__i_s_s_s, NULL, NULL, PRIM_INT__h_s_s_s, NULL, PRIM_INT__i_s_p_s);
672 
673 
674                     ostei_general_vrr_K(6, 0, 2, 0, 4,
675                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
676                             PRIM_INT__i_s_p_s, PRIM_INT__i_s_s_s, NULL, PRIM_INT__h_s_p_s, NULL, PRIM_INT__i_s_d_s);
677 
678 
679                     ostei_general_vrr_K(6, 0, 3, 0, 3,
680                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
681                             PRIM_INT__i_s_d_s, PRIM_INT__i_s_p_s, NULL, PRIM_INT__h_s_d_s, NULL, PRIM_INT__i_s_f_s);
682 
683 
684                     ostei_general_vrr_K(6, 0, 4, 0, 2,
685                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
686                             PRIM_INT__i_s_f_s, PRIM_INT__i_s_d_s, NULL, PRIM_INT__h_s_f_s, NULL, PRIM_INT__i_s_g_s);
687 
688 
689                     ostei_general_vrr_K(6, 0, 5, 0, 1,
690                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
691                             PRIM_INT__i_s_g_s, PRIM_INT__i_s_f_s, NULL, PRIM_INT__h_s_g_s, NULL, PRIM_INT__i_s_h_s);
692 
693 
694                     ostei_general_vrr1_I(7, 9,
695                             one_over_2p, a_over_p, aop_PQ, P_PA,
696                             PRIM_INT__i_s_s_s, PRIM_INT__h_s_s_s, PRIM_INT__k_s_s_s);
697 
698 
699                     ostei_general_vrr_K(7, 0, 1, 0, 5,
700                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
701                             PRIM_INT__k_s_s_s, NULL, NULL, PRIM_INT__i_s_s_s, NULL, PRIM_INT__k_s_p_s);
702 
703 
704                     ostei_general_vrr_K(7, 0, 2, 0, 4,
705                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
706                             PRIM_INT__k_s_p_s, PRIM_INT__k_s_s_s, NULL, PRIM_INT__i_s_p_s, NULL, PRIM_INT__k_s_d_s);
707 
708 
709                     ostei_general_vrr_K(7, 0, 3, 0, 3,
710                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
711                             PRIM_INT__k_s_d_s, PRIM_INT__k_s_p_s, NULL, PRIM_INT__i_s_d_s, NULL, PRIM_INT__k_s_f_s);
712 
713 
714                     ostei_general_vrr_K(7, 0, 4, 0, 2,
715                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
716                             PRIM_INT__k_s_f_s, PRIM_INT__k_s_d_s, NULL, PRIM_INT__i_s_f_s, NULL, PRIM_INT__k_s_g_s);
717 
718 
719                     ostei_general_vrr_K(7, 0, 5, 0, 1,
720                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
721                             PRIM_INT__k_s_g_s, PRIM_INT__k_s_f_s, NULL, PRIM_INT__i_s_g_s, NULL, PRIM_INT__k_s_h_s);
722 
723 
724                     ostei_general_vrr1_I(8, 8,
725                             one_over_2p, a_over_p, aop_PQ, P_PA,
726                             PRIM_INT__k_s_s_s, PRIM_INT__i_s_s_s, PRIM_INT__l_s_s_s);
727 
728 
729                     ostei_general_vrr_K(8, 0, 1, 0, 5,
730                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
731                             PRIM_INT__l_s_s_s, NULL, NULL, PRIM_INT__k_s_s_s, NULL, PRIM_INT__l_s_p_s);
732 
733 
734                     ostei_general_vrr_K(8, 0, 2, 0, 4,
735                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
736                             PRIM_INT__l_s_p_s, PRIM_INT__l_s_s_s, NULL, PRIM_INT__k_s_p_s, NULL, PRIM_INT__l_s_d_s);
737 
738 
739                     ostei_general_vrr_K(8, 0, 3, 0, 3,
740                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
741                             PRIM_INT__l_s_d_s, PRIM_INT__l_s_p_s, NULL, PRIM_INT__k_s_d_s, NULL, PRIM_INT__l_s_f_s);
742 
743 
744                     ostei_general_vrr_K(8, 0, 4, 0, 2,
745                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
746                             PRIM_INT__l_s_f_s, PRIM_INT__l_s_d_s, NULL, PRIM_INT__k_s_f_s, NULL, PRIM_INT__l_s_g_s);
747 
748 
749                     ostei_general_vrr_K(8, 0, 5, 0, 1,
750                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
751                             PRIM_INT__l_s_g_s, PRIM_INT__l_s_f_s, NULL, PRIM_INT__k_s_g_s, NULL, PRIM_INT__l_s_h_s);
752 
753 
754                     ostei_general_vrr1_I(9, 7,
755                             one_over_2p, a_over_p, aop_PQ, P_PA,
756                             PRIM_INT__l_s_s_s, PRIM_INT__k_s_s_s, PRIM_INT__m_s_s_s);
757 
758 
759                     ostei_general_vrr_K(9, 0, 1, 0, 5,
760                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
761                             PRIM_INT__m_s_s_s, NULL, NULL, PRIM_INT__l_s_s_s, NULL, PRIM_INT__m_s_p_s);
762 
763 
764                     ostei_general_vrr_K(9, 0, 2, 0, 4,
765                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
766                             PRIM_INT__m_s_p_s, PRIM_INT__m_s_s_s, NULL, PRIM_INT__l_s_p_s, NULL, PRIM_INT__m_s_d_s);
767 
768 
769                     ostei_general_vrr_K(9, 0, 3, 0, 3,
770                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
771                             PRIM_INT__m_s_d_s, PRIM_INT__m_s_p_s, NULL, PRIM_INT__l_s_d_s, NULL, PRIM_INT__m_s_f_s);
772 
773 
774                     ostei_general_vrr_K(9, 0, 4, 0, 2,
775                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
776                             PRIM_INT__m_s_f_s, PRIM_INT__m_s_d_s, NULL, PRIM_INT__l_s_f_s, NULL, PRIM_INT__m_s_g_s);
777 
778 
779                     ostei_general_vrr_K(9, 0, 5, 0, 1,
780                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
781                             PRIM_INT__m_s_g_s, PRIM_INT__m_s_f_s, NULL, PRIM_INT__l_s_g_s, NULL, PRIM_INT__m_s_h_s);
782 
783 
784                     ostei_general_vrr1_I(10, 6,
785                             one_over_2p, a_over_p, aop_PQ, P_PA,
786                             PRIM_INT__m_s_s_s, PRIM_INT__l_s_s_s, PRIM_INT__n_s_s_s);
787 
788 
789                     ostei_general_vrr_K(10, 0, 1, 0, 5,
790                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
791                             PRIM_INT__n_s_s_s, NULL, NULL, PRIM_INT__m_s_s_s, NULL, PRIM_INT__n_s_p_s);
792 
793 
794                     ostei_general_vrr_K(10, 0, 2, 0, 4,
795                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
796                             PRIM_INT__n_s_p_s, PRIM_INT__n_s_s_s, NULL, PRIM_INT__m_s_p_s, NULL, PRIM_INT__n_s_d_s);
797 
798 
799                     ostei_general_vrr_K(10, 0, 3, 0, 3,
800                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
801                             PRIM_INT__n_s_d_s, PRIM_INT__n_s_p_s, NULL, PRIM_INT__m_s_d_s, NULL, PRIM_INT__n_s_f_s);
802 
803 
804                     ostei_general_vrr_K(10, 0, 4, 0, 2,
805                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
806                             PRIM_INT__n_s_f_s, PRIM_INT__n_s_d_s, NULL, PRIM_INT__m_s_f_s, NULL, PRIM_INT__n_s_g_s);
807 
808 
809                     ostei_general_vrr_K(10, 0, 5, 0, 1,
810                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
811                             PRIM_INT__n_s_g_s, PRIM_INT__n_s_f_s, NULL, PRIM_INT__m_s_g_s, NULL, PRIM_INT__n_s_h_s);
812 
813 
814 
815 
816                     ////////////////////////////////////
817                     // Accumulate contracted integrals
818                     ////////////////////////////////////
819                     if(lastoffset == 0)
820                     {
821                         contract_all(315, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
822                         contract_all(441, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
823                         contract_all(420, PRIM_INT__i_s_g_s, PRIM_PTR_INT__i_s_g_s);
824                         contract_all(588, PRIM_INT__i_s_h_s, PRIM_PTR_INT__i_s_h_s);
825                         contract_all(540, PRIM_INT__k_s_g_s, PRIM_PTR_INT__k_s_g_s);
826                         contract_all(756, PRIM_INT__k_s_h_s, PRIM_PTR_INT__k_s_h_s);
827                         contract_all(675, PRIM_INT__l_s_g_s, PRIM_PTR_INT__l_s_g_s);
828                         contract_all(945, PRIM_INT__l_s_h_s, PRIM_PTR_INT__l_s_h_s);
829                         contract_all(825, PRIM_INT__m_s_g_s, PRIM_PTR_INT__m_s_g_s);
830                         contract_all(1155, PRIM_INT__m_s_h_s, PRIM_PTR_INT__m_s_h_s);
831                         contract_all(990, PRIM_INT__n_s_g_s, PRIM_PTR_INT__n_s_g_s);
832                         contract_all(1386, PRIM_INT__n_s_h_s, PRIM_PTR_INT__n_s_h_s);
833                     }
834                     else
835                     {
836                         contract(315, shelloffsets, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
837                         contract(441, shelloffsets, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
838                         contract(420, shelloffsets, PRIM_INT__i_s_g_s, PRIM_PTR_INT__i_s_g_s);
839                         contract(588, shelloffsets, PRIM_INT__i_s_h_s, PRIM_PTR_INT__i_s_h_s);
840                         contract(540, shelloffsets, PRIM_INT__k_s_g_s, PRIM_PTR_INT__k_s_g_s);
841                         contract(756, shelloffsets, PRIM_INT__k_s_h_s, PRIM_PTR_INT__k_s_h_s);
842                         contract(675, shelloffsets, PRIM_INT__l_s_g_s, PRIM_PTR_INT__l_s_g_s);
843                         contract(945, shelloffsets, PRIM_INT__l_s_h_s, PRIM_PTR_INT__l_s_h_s);
844                         contract(825, shelloffsets, PRIM_INT__m_s_g_s, PRIM_PTR_INT__m_s_g_s);
845                         contract(1155, shelloffsets, PRIM_INT__m_s_h_s, PRIM_PTR_INT__m_s_h_s);
846                         contract(990, shelloffsets, PRIM_INT__n_s_g_s, PRIM_PTR_INT__n_s_g_s);
847                         contract(1386, shelloffsets, PRIM_INT__n_s_h_s, PRIM_PTR_INT__n_s_h_s);
848                         PRIM_PTR_INT__h_s_g_s += lastoffset*315;
849                         PRIM_PTR_INT__h_s_h_s += lastoffset*441;
850                         PRIM_PTR_INT__i_s_g_s += lastoffset*420;
851                         PRIM_PTR_INT__i_s_h_s += lastoffset*588;
852                         PRIM_PTR_INT__k_s_g_s += lastoffset*540;
853                         PRIM_PTR_INT__k_s_h_s += lastoffset*756;
854                         PRIM_PTR_INT__l_s_g_s += lastoffset*675;
855                         PRIM_PTR_INT__l_s_h_s += lastoffset*945;
856                         PRIM_PTR_INT__m_s_g_s += lastoffset*825;
857                         PRIM_PTR_INT__m_s_h_s += lastoffset*1155;
858                         PRIM_PTR_INT__n_s_g_s += lastoffset*990;
859                         PRIM_PTR_INT__n_s_h_s += lastoffset*1386;
860                     }
861 
862                 }  // close loop over j
863             }  // close loop over i
864 
865             //Advance to the next batch
866             jstart = SIMINT_SIMD_ROUND(jend);
867 
868             //////////////////////////////////////////////
869             // Contracted integrals: Horizontal recurrance
870             //////////////////////////////////////////////
871 
872 
873             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
874 
875 
876             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
877             {
878                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
879 
880                 // set up HRR pointers
881                 double const * restrict HRR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
882                 double const * restrict HRR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
883                 double const * restrict HRR_INT__i_s_g_s = INT__i_s_g_s + abcd * 420;
884                 double const * restrict HRR_INT__i_s_h_s = INT__i_s_h_s + abcd * 588;
885                 double const * restrict HRR_INT__k_s_g_s = INT__k_s_g_s + abcd * 540;
886                 double const * restrict HRR_INT__k_s_h_s = INT__k_s_h_s + abcd * 756;
887                 double const * restrict HRR_INT__l_s_g_s = INT__l_s_g_s + abcd * 675;
888                 double const * restrict HRR_INT__l_s_h_s = INT__l_s_h_s + abcd * 945;
889                 double const * restrict HRR_INT__m_s_g_s = INT__m_s_g_s + abcd * 825;
890                 double const * restrict HRR_INT__m_s_h_s = INT__m_s_h_s + abcd * 1155;
891                 double const * restrict HRR_INT__n_s_g_s = INT__n_s_g_s + abcd * 990;
892                 double const * restrict HRR_INT__n_s_h_s = INT__n_s_h_s + abcd * 1386;
893                 double * restrict HRR_INT__h_h_g_p = INT__h_h_g_p + real_abcd * 19845;
894 
895                 // form INT__h_p_g_s
896                 ostei_general_hrr_J(5, 1, 4, 0, hAB, HRR_INT__i_s_g_s, HRR_INT__h_s_g_s, HRR_INT__h_p_g_s);
897 
898                 // form INT__h_p_h_s
899                 ostei_general_hrr_J(5, 1, 5, 0, hAB, HRR_INT__i_s_h_s, HRR_INT__h_s_h_s, HRR_INT__h_p_h_s);
900 
901                 // form INT__i_p_g_s
902                 ostei_general_hrr_J(6, 1, 4, 0, hAB, HRR_INT__k_s_g_s, HRR_INT__i_s_g_s, HRR_INT__i_p_g_s);
903 
904                 // form INT__i_p_h_s
905                 ostei_general_hrr_J(6, 1, 5, 0, hAB, HRR_INT__k_s_h_s, HRR_INT__i_s_h_s, HRR_INT__i_p_h_s);
906 
907                 // form INT__k_p_g_s
908                 ostei_general_hrr_J(7, 1, 4, 0, hAB, HRR_INT__l_s_g_s, HRR_INT__k_s_g_s, HRR_INT__k_p_g_s);
909 
910                 // form INT__k_p_h_s
911                 ostei_general_hrr_J(7, 1, 5, 0, hAB, HRR_INT__l_s_h_s, HRR_INT__k_s_h_s, HRR_INT__k_p_h_s);
912 
913                 // form INT__l_p_g_s
914                 ostei_general_hrr_J(8, 1, 4, 0, hAB, HRR_INT__m_s_g_s, HRR_INT__l_s_g_s, HRR_INT__l_p_g_s);
915 
916                 // form INT__l_p_h_s
917                 ostei_general_hrr_J(8, 1, 5, 0, hAB, HRR_INT__m_s_h_s, HRR_INT__l_s_h_s, HRR_INT__l_p_h_s);
918 
919                 // form INT__m_p_g_s
920                 ostei_general_hrr_J(9, 1, 4, 0, hAB, HRR_INT__n_s_g_s, HRR_INT__m_s_g_s, HRR_INT__m_p_g_s);
921 
922                 // form INT__m_p_h_s
923                 ostei_general_hrr_J(9, 1, 5, 0, hAB, HRR_INT__n_s_h_s, HRR_INT__m_s_h_s, HRR_INT__m_p_h_s);
924 
925                 // form INT__h_d_g_s
926                 ostei_general_hrr_J(5, 2, 4, 0, hAB, HRR_INT__i_p_g_s, HRR_INT__h_p_g_s, HRR_INT__h_d_g_s);
927 
928                 // form INT__h_d_h_s
929                 ostei_general_hrr_J(5, 2, 5, 0, hAB, HRR_INT__i_p_h_s, HRR_INT__h_p_h_s, HRR_INT__h_d_h_s);
930 
931                 // form INT__i_d_g_s
932                 ostei_general_hrr_J(6, 2, 4, 0, hAB, HRR_INT__k_p_g_s, HRR_INT__i_p_g_s, HRR_INT__i_d_g_s);
933 
934                 // form INT__i_d_h_s
935                 ostei_general_hrr_J(6, 2, 5, 0, hAB, HRR_INT__k_p_h_s, HRR_INT__i_p_h_s, HRR_INT__i_d_h_s);
936 
937                 // form INT__k_d_g_s
938                 ostei_general_hrr_J(7, 2, 4, 0, hAB, HRR_INT__l_p_g_s, HRR_INT__k_p_g_s, HRR_INT__k_d_g_s);
939 
940                 // form INT__k_d_h_s
941                 ostei_general_hrr_J(7, 2, 5, 0, hAB, HRR_INT__l_p_h_s, HRR_INT__k_p_h_s, HRR_INT__k_d_h_s);
942 
943                 // form INT__l_d_g_s
944                 ostei_general_hrr_J(8, 2, 4, 0, hAB, HRR_INT__m_p_g_s, HRR_INT__l_p_g_s, HRR_INT__l_d_g_s);
945 
946                 // form INT__l_d_h_s
947                 ostei_general_hrr_J(8, 2, 5, 0, hAB, HRR_INT__m_p_h_s, HRR_INT__l_p_h_s, HRR_INT__l_d_h_s);
948 
949                 // form INT__h_f_g_s
950                 ostei_general_hrr_J(5, 3, 4, 0, hAB, HRR_INT__i_d_g_s, HRR_INT__h_d_g_s, HRR_INT__h_f_g_s);
951 
952                 // form INT__h_f_h_s
953                 ostei_general_hrr_J(5, 3, 5, 0, hAB, HRR_INT__i_d_h_s, HRR_INT__h_d_h_s, HRR_INT__h_f_h_s);
954 
955                 // form INT__i_f_g_s
956                 ostei_general_hrr_J(6, 3, 4, 0, hAB, HRR_INT__k_d_g_s, HRR_INT__i_d_g_s, HRR_INT__i_f_g_s);
957 
958                 // form INT__i_f_h_s
959                 ostei_general_hrr_J(6, 3, 5, 0, hAB, HRR_INT__k_d_h_s, HRR_INT__i_d_h_s, HRR_INT__i_f_h_s);
960 
961                 // form INT__k_f_g_s
962                 ostei_general_hrr_J(7, 3, 4, 0, hAB, HRR_INT__l_d_g_s, HRR_INT__k_d_g_s, HRR_INT__k_f_g_s);
963 
964                 // form INT__k_f_h_s
965                 ostei_general_hrr_J(7, 3, 5, 0, hAB, HRR_INT__l_d_h_s, HRR_INT__k_d_h_s, HRR_INT__k_f_h_s);
966 
967                 // form INT__h_g_g_s
968                 ostei_general_hrr_J(5, 4, 4, 0, hAB, HRR_INT__i_f_g_s, HRR_INT__h_f_g_s, HRR_INT__h_g_g_s);
969 
970                 // form INT__h_g_h_s
971                 ostei_general_hrr_J(5, 4, 5, 0, hAB, HRR_INT__i_f_h_s, HRR_INT__h_f_h_s, HRR_INT__h_g_h_s);
972 
973                 // form INT__i_g_g_s
974                 ostei_general_hrr_J(6, 4, 4, 0, hAB, HRR_INT__k_f_g_s, HRR_INT__i_f_g_s, HRR_INT__i_g_g_s);
975 
976                 // form INT__i_g_h_s
977                 ostei_general_hrr_J(6, 4, 5, 0, hAB, HRR_INT__k_f_h_s, HRR_INT__i_f_h_s, HRR_INT__i_g_h_s);
978 
979                 // form INT__h_h_g_s
980                 ostei_general_hrr_J(5, 5, 4, 0, hAB, HRR_INT__i_g_g_s, HRR_INT__h_g_g_s, HRR_INT__h_h_g_s);
981 
982                 // form INT__h_h_h_s
983                 ostei_general_hrr_J(5, 5, 5, 0, hAB, HRR_INT__i_g_h_s, HRR_INT__h_g_h_s, HRR_INT__h_h_h_s);
984 
985                 // form INT__h_h_g_p
986                 HRR_L_g_p(
987                     HRR_INT__h_h_g_p,
988                     HRR_INT__h_h_g_s,
989                     HRR_INT__h_h_h_s,
990                     hCD, 441);
991 
992 
993             }  // close HRR loop
994 
995 
996         }   // close loop cdbatch
997 
998         istart = iend;
999     }  // close loop over ab
1000 
1001     return P.nshell12_clip * Q.nshell12_clip;
1002 }
1003 
ostei_h_h_p_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_h_p_g)1004 int ostei_h_h_p_g(struct simint_multi_shellpair const P,
1005                   struct simint_multi_shellpair const Q,
1006                   double screen_tol,
1007                   double * const restrict work,
1008                   double * const restrict INT__h_h_p_g)
1009 {
1010     double Q_AB[3*Q.nshell12];
1011     struct simint_multi_shellpair Q_tmp = Q;
1012     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1013     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1014     Q_tmp.AB_x = Q_AB;
1015     Q_tmp.AB_y = Q_AB + Q.nshell12;
1016     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1017 
1018     for(int i = 0; i < Q.nshell12; i++)
1019     {
1020         Q_tmp.AB_x[i] = -Q.AB_x[i];
1021         Q_tmp.AB_y[i] = -Q.AB_y[i];
1022         Q_tmp.AB_z[i] = -Q.AB_z[i];
1023     }
1024 
1025     int ret = ostei_h_h_g_p(P, Q_tmp, screen_tol, work, INT__h_h_p_g);
1026     double buffer[19845] SIMINT_ALIGN_ARRAY_DBL;
1027 
1028     for(int q = 0; q < ret; q++)
1029     {
1030         int idx = 0;
1031         for(int a = 0; a < 21; ++a)
1032         for(int b = 0; b < 21; ++b)
1033         for(int c = 0; c < 3; ++c)
1034         for(int d = 0; d < 15; ++d)
1035             buffer[idx++] = INT__h_h_p_g[q*19845+a*945+b*45+d*3+c];
1036 
1037         memcpy(INT__h_h_p_g+q*19845, buffer, 19845*sizeof(double));
1038     }
1039 
1040     return ret;
1041 }
1042 
1043