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_g_h_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__i_g_h_f)8 int ostei_i_g_h_f(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_g_h_f)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__i_g_h_f);
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__i_s_h_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__i_s_i_s = work + (SIMINT_NSHELL_SIMD * 588);
31     double * const INT__i_s_k_s = work + (SIMINT_NSHELL_SIMD * 1372);
32     double * const INT__i_s_l_s = work + (SIMINT_NSHELL_SIMD * 2380);
33     double * const INT__k_s_h_s = work + (SIMINT_NSHELL_SIMD * 3640);
34     double * const INT__k_s_i_s = work + (SIMINT_NSHELL_SIMD * 4396);
35     double * const INT__k_s_k_s = work + (SIMINT_NSHELL_SIMD * 5404);
36     double * const INT__k_s_l_s = work + (SIMINT_NSHELL_SIMD * 6700);
37     double * const INT__l_s_h_s = work + (SIMINT_NSHELL_SIMD * 8320);
38     double * const INT__l_s_i_s = work + (SIMINT_NSHELL_SIMD * 9265);
39     double * const INT__l_s_k_s = work + (SIMINT_NSHELL_SIMD * 10525);
40     double * const INT__l_s_l_s = work + (SIMINT_NSHELL_SIMD * 12145);
41     double * const INT__m_s_h_s = work + (SIMINT_NSHELL_SIMD * 14170);
42     double * const INT__m_s_i_s = work + (SIMINT_NSHELL_SIMD * 15325);
43     double * const INT__m_s_k_s = work + (SIMINT_NSHELL_SIMD * 16865);
44     double * const INT__m_s_l_s = work + (SIMINT_NSHELL_SIMD * 18845);
45     double * const INT__n_s_h_s = work + (SIMINT_NSHELL_SIMD * 21320);
46     double * const INT__n_s_i_s = work + (SIMINT_NSHELL_SIMD * 22706);
47     double * const INT__n_s_k_s = work + (SIMINT_NSHELL_SIMD * 24554);
48     double * const INT__n_s_l_s = work + (SIMINT_NSHELL_SIMD * 26930);
49     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*29900);
50     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 19;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 43;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 85;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 139;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 211;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 337;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 517;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 619;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 763;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 1015;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 1375;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 1825;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 1985;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 2225;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 2645;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 3245;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 3995;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 4835;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 5060;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 5420;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 6050;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 6950;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 8075;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 9335;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 10595;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 10889;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 11393;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 12275;
79     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 13535;
80     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 15110;
81     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 16874;
82     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 18638;
83     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 20150;
84     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 20514;
85     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 21186;
86     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 22362;
87     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_g_s = primwork + 24042;
88     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_h_s = primwork + 26142;
89     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_i_s = primwork + 28494;
90     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_k_s = primwork + 30846;
91     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_l_s = primwork + 32862;
92     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_s_s = primwork + 34122;
93     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_p_s = primwork + 34554;
94     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_d_s = primwork + 35418;
95     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_f_s = primwork + 36930;
96     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_g_s = primwork + 39090;
97     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_h_s = primwork + 41790;
98     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_i_s = primwork + 44814;
99     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_k_s = primwork + 47838;
100     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_l_s = primwork + 50430;
101     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_s_s = primwork + 52050;
102     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_p_s = primwork + 52545;
103     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_d_s = primwork + 53625;
104     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_f_s = primwork + 55515;
105     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_g_s = primwork + 58215;
106     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_h_s = primwork + 61590;
107     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_i_s = primwork + 65370;
108     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_k_s = primwork + 69150;
109     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_l_s = primwork + 72390;
110     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_s_s = primwork + 74415;
111     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_p_s = primwork + 74965;
112     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_d_s = primwork + 76285;
113     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_f_s = primwork + 78595;
114     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_g_s = primwork + 81895;
115     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_h_s = primwork + 86020;
116     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_i_s = primwork + 90640;
117     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_k_s = primwork + 95260;
118     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_l_s = primwork + 99220;
119     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_s_s = primwork + 101695;
120     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_p_s = primwork + 102289;
121     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_d_s = primwork + 103873;
122     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_f_s = primwork + 106645;
123     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_g_s = primwork + 110605;
124     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_h_s = primwork + 115555;
125     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_i_s = primwork + 121099;
126     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_k_s = primwork + 126643;
127     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_l_s = primwork + 131395;
128     double * const hrrwork = (double *)(primwork + 134365);
129     double * const HRR_INT__i_p_h_s = hrrwork + 0;
130     double * const HRR_INT__i_p_i_s = hrrwork + 1764;
131     double * const HRR_INT__i_p_k_s = hrrwork + 4116;
132     double * const HRR_INT__i_p_l_s = hrrwork + 7140;
133     double * const HRR_INT__i_d_h_s = hrrwork + 10920;
134     double * const HRR_INT__i_d_i_s = hrrwork + 14448;
135     double * const HRR_INT__i_d_k_s = hrrwork + 19152;
136     double * const HRR_INT__i_d_l_s = hrrwork + 25200;
137     double * const HRR_INT__i_f_h_s = hrrwork + 32760;
138     double * const HRR_INT__i_f_i_s = hrrwork + 38640;
139     double * const HRR_INT__i_f_k_s = hrrwork + 46480;
140     double * const HRR_INT__i_f_l_s = hrrwork + 56560;
141     double * const HRR_INT__i_g_h_s = hrrwork + 69160;
142     double * const HRR_INT__i_g_h_p = hrrwork + 77980;
143     double * const HRR_INT__i_g_h_d = hrrwork + 104440;
144     double * const HRR_INT__i_g_i_s = hrrwork + 157360;
145     double * const HRR_INT__i_g_i_p = hrrwork + 169120;
146     double * const HRR_INT__i_g_i_d = hrrwork + 204400;
147     double * const HRR_INT__i_g_k_s = hrrwork + 274960;
148     double * const HRR_INT__i_g_k_p = hrrwork + 290080;
149     double * const HRR_INT__i_g_l_s = hrrwork + 335440;
150     double * const HRR_INT__k_p_h_s = hrrwork + 354340;
151     double * const HRR_INT__k_p_i_s = hrrwork + 356608;
152     double * const HRR_INT__k_p_k_s = hrrwork + 359632;
153     double * const HRR_INT__k_p_l_s = hrrwork + 363520;
154     double * const HRR_INT__k_d_h_s = hrrwork + 368380;
155     double * const HRR_INT__k_d_i_s = hrrwork + 372916;
156     double * const HRR_INT__k_d_k_s = hrrwork + 378964;
157     double * const HRR_INT__k_d_l_s = hrrwork + 386740;
158     double * const HRR_INT__k_f_h_s = hrrwork + 396460;
159     double * const HRR_INT__k_f_i_s = hrrwork + 404020;
160     double * const HRR_INT__k_f_k_s = hrrwork + 414100;
161     double * const HRR_INT__k_f_l_s = hrrwork + 427060;
162     double * const HRR_INT__l_p_h_s = hrrwork + 443260;
163     double * const HRR_INT__l_p_i_s = hrrwork + 446095;
164     double * const HRR_INT__l_p_k_s = hrrwork + 449875;
165     double * const HRR_INT__l_p_l_s = hrrwork + 454735;
166     double * const HRR_INT__l_d_h_s = hrrwork + 460810;
167     double * const HRR_INT__l_d_i_s = hrrwork + 466480;
168     double * const HRR_INT__l_d_k_s = hrrwork + 474040;
169     double * const HRR_INT__l_d_l_s = hrrwork + 483760;
170     double * const HRR_INT__m_p_h_s = hrrwork + 495910;
171     double * const HRR_INT__m_p_i_s = hrrwork + 499375;
172     double * const HRR_INT__m_p_k_s = hrrwork + 503995;
173     double * const HRR_INT__m_p_l_s = hrrwork + 509935;
174 
175 
176     // Create constants
177     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
178     const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
179     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
180     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
181     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
182     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
183     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
184     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
185     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
186     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
187     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
188 
189 
190     ////////////////////////////////////////
191     // Loop over shells and primitives
192     ////////////////////////////////////////
193 
194     real_abcd = 0;
195     istart = 0;
196     for(ab = 0; ab < P.nshell12_clip; ++ab)
197     {
198         const int iend = istart + P.nprim12[ab];
199 
200         cd = 0;
201         jstart = 0;
202 
203         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
204         {
205             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
206             int jend = jstart;
207             for(i = 0; i < nshellbatch; i++)
208                 jend += Q.nprim12[cd+i];
209 
210             // Clear the beginning of the workspace (where we are accumulating integrals)
211             memset(work, 0, SIMINT_NSHELL_SIMD * 29900 * sizeof(double));
212             abcd = 0;
213 
214 
215             for(i = istart; i < iend; ++i)
216             {
217                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
218 
219                 if(check_screen)
220                 {
221                     // Skip this whole thing if always insignificant
222                     if((P.screen[i] * Q.screen_max) < screen_tol)
223                         continue;
224                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
225                 }
226 
227                 icd = 0;
228                 iprimcd = 0;
229                 nprim_icd = Q.nprim12[cd];
230                 double * restrict PRIM_PTR_INT__i_s_h_s = INT__i_s_h_s + abcd * 588;
231                 double * restrict PRIM_PTR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
232                 double * restrict PRIM_PTR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
233                 double * restrict PRIM_PTR_INT__i_s_l_s = INT__i_s_l_s + abcd * 1260;
234                 double * restrict PRIM_PTR_INT__k_s_h_s = INT__k_s_h_s + abcd * 756;
235                 double * restrict PRIM_PTR_INT__k_s_i_s = INT__k_s_i_s + abcd * 1008;
236                 double * restrict PRIM_PTR_INT__k_s_k_s = INT__k_s_k_s + abcd * 1296;
237                 double * restrict PRIM_PTR_INT__k_s_l_s = INT__k_s_l_s + abcd * 1620;
238                 double * restrict PRIM_PTR_INT__l_s_h_s = INT__l_s_h_s + abcd * 945;
239                 double * restrict PRIM_PTR_INT__l_s_i_s = INT__l_s_i_s + abcd * 1260;
240                 double * restrict PRIM_PTR_INT__l_s_k_s = INT__l_s_k_s + abcd * 1620;
241                 double * restrict PRIM_PTR_INT__l_s_l_s = INT__l_s_l_s + abcd * 2025;
242                 double * restrict PRIM_PTR_INT__m_s_h_s = INT__m_s_h_s + abcd * 1155;
243                 double * restrict PRIM_PTR_INT__m_s_i_s = INT__m_s_i_s + abcd * 1540;
244                 double * restrict PRIM_PTR_INT__m_s_k_s = INT__m_s_k_s + abcd * 1980;
245                 double * restrict PRIM_PTR_INT__m_s_l_s = INT__m_s_l_s + abcd * 2475;
246                 double * restrict PRIM_PTR_INT__n_s_h_s = INT__n_s_h_s + abcd * 1386;
247                 double * restrict PRIM_PTR_INT__n_s_i_s = INT__n_s_i_s + abcd * 1848;
248                 double * restrict PRIM_PTR_INT__n_s_k_s = INT__n_s_k_s + abcd * 2376;
249                 double * restrict PRIM_PTR_INT__n_s_l_s = INT__n_s_l_s + abcd * 2970;
250 
251 
252 
253                 // Load these one per loop over i
254                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
255                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
256                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
257 
258                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
259 
260                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
261                 {
262                     // calculate the shell offsets
263                     // these are the offset from the shell pointed to by cd
264                     // for each element
265                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
266                     int lastoffset = 0;
267                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
268 
269                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
270                     {
271                         // Handle if the first element of the vector is a new shell
272                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
273                         {
274                             nprim_icd += Q.nprim12[cd + (++icd)];
275                             PRIM_PTR_INT__i_s_h_s += 588;
276                             PRIM_PTR_INT__i_s_i_s += 784;
277                             PRIM_PTR_INT__i_s_k_s += 1008;
278                             PRIM_PTR_INT__i_s_l_s += 1260;
279                             PRIM_PTR_INT__k_s_h_s += 756;
280                             PRIM_PTR_INT__k_s_i_s += 1008;
281                             PRIM_PTR_INT__k_s_k_s += 1296;
282                             PRIM_PTR_INT__k_s_l_s += 1620;
283                             PRIM_PTR_INT__l_s_h_s += 945;
284                             PRIM_PTR_INT__l_s_i_s += 1260;
285                             PRIM_PTR_INT__l_s_k_s += 1620;
286                             PRIM_PTR_INT__l_s_l_s += 2025;
287                             PRIM_PTR_INT__m_s_h_s += 1155;
288                             PRIM_PTR_INT__m_s_i_s += 1540;
289                             PRIM_PTR_INT__m_s_k_s += 1980;
290                             PRIM_PTR_INT__m_s_l_s += 2475;
291                             PRIM_PTR_INT__n_s_h_s += 1386;
292                             PRIM_PTR_INT__n_s_i_s += 1848;
293                             PRIM_PTR_INT__n_s_k_s += 2376;
294                             PRIM_PTR_INT__n_s_l_s += 2970;
295                         }
296                         iprimcd++;
297                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
298                         {
299                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
300                             {
301                                 shelloffsets[n] = shelloffsets[n-1] + 1;
302                                 lastoffset++;
303                                 nprim_icd += Q.nprim12[cd + (++icd)];
304                             }
305                             else
306                                 shelloffsets[n] = shelloffsets[n-1];
307                             iprimcd++;
308                         }
309                     }
310                     else
311                         iprimcd += SIMINT_SIMD_LEN;
312 
313                     // Do we have to compute this vector (or has it been screened out)?
314                     // (not_screened != 0 means we have to do this vector)
315                     if(check_screen)
316                     {
317                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
318                         if(vmax < screen_tol)
319                         {
320                             PRIM_PTR_INT__i_s_h_s += lastoffset*588;
321                             PRIM_PTR_INT__i_s_i_s += lastoffset*784;
322                             PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
323                             PRIM_PTR_INT__i_s_l_s += lastoffset*1260;
324                             PRIM_PTR_INT__k_s_h_s += lastoffset*756;
325                             PRIM_PTR_INT__k_s_i_s += lastoffset*1008;
326                             PRIM_PTR_INT__k_s_k_s += lastoffset*1296;
327                             PRIM_PTR_INT__k_s_l_s += lastoffset*1620;
328                             PRIM_PTR_INT__l_s_h_s += lastoffset*945;
329                             PRIM_PTR_INT__l_s_i_s += lastoffset*1260;
330                             PRIM_PTR_INT__l_s_k_s += lastoffset*1620;
331                             PRIM_PTR_INT__l_s_l_s += lastoffset*2025;
332                             PRIM_PTR_INT__m_s_h_s += lastoffset*1155;
333                             PRIM_PTR_INT__m_s_i_s += lastoffset*1540;
334                             PRIM_PTR_INT__m_s_k_s += lastoffset*1980;
335                             PRIM_PTR_INT__m_s_l_s += lastoffset*2475;
336                             PRIM_PTR_INT__n_s_h_s += lastoffset*1386;
337                             PRIM_PTR_INT__n_s_i_s += lastoffset*1848;
338                             PRIM_PTR_INT__n_s_k_s += lastoffset*2376;
339                             PRIM_PTR_INT__n_s_l_s += lastoffset*2970;
340                             continue;
341                         }
342                     }
343 
344                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
345                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
346                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
347                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
348 
349 
350                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
351                     SIMINT_DBLTYPE PQ[3];
352                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
353                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
354                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
355                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
356                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
357                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
358 
359                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
360                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
361                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
362                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
363                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
364                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
365                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
366 
367                     // NOTE: Minus sign!
368                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
369                     SIMINT_DBLTYPE aop_PQ[3];
370                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
371                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
372                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
373 
374                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
375                     SIMINT_DBLTYPE aoq_PQ[3];
376                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
377                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
378                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
379                     // Put a minus sign here so we don't have to in RR routines
380                     a_over_q = SIMINT_NEG(a_over_q);
381 
382 
383                     //////////////////////////////////////////////
384                     // Fjt function section
385                     // Maximum v value: 18
386                     //////////////////////////////////////////////
387                     // The parameter to the Fjt function
388                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
389 
390 
391                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
392 
393 
394                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 18);
395                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
396                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
397                     for(n = 0; n <= 18; n++)
398                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
399 
400                     //////////////////////////////////////////////
401                     // Primitive integrals: Vertical recurrance
402                     //////////////////////////////////////////////
403 
404                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
405                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
406                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
407                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
408                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
409                     const SIMINT_DBLTYPE vrr_const_6_over_2p = SIMINT_MUL(const_6, one_over_2p);
410                     const SIMINT_DBLTYPE vrr_const_7_over_2p = SIMINT_MUL(const_7, one_over_2p);
411                     const SIMINT_DBLTYPE vrr_const_8_over_2p = SIMINT_MUL(const_8, one_over_2p);
412                     const SIMINT_DBLTYPE vrr_const_9_over_2p = SIMINT_MUL(const_9, one_over_2p);
413                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
414                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
415                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
416                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
417                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
418                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
419                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
420                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
421                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
422                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
423                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
424                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
425                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
426                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
427                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
428                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
429                     const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
430 
431 
432 
433                     // Forming PRIM_INT__p_s_s_s[18 * 3];
434                     for(n = 0; n < 18; ++n)  // loop over orders of auxiliary function
435                     {
436 
437                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
438                         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]);
439 
440                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
441                         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]);
442 
443                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
444                         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]);
445 
446                     }
447 
448 
449 
450                     // Forming PRIM_INT__d_s_s_s[17 * 6];
451                     for(n = 0; n < 17; ++n)  // loop over orders of auxiliary function
452                     {
453 
454                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
455                         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]);
456                         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]);
457 
458                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
459                         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]);
460 
461                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
462                         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]);
463 
464                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
465                         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]);
466                         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]);
467 
468                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
469                         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]);
470 
471                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
472                         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]);
473                         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]);
474 
475                     }
476 
477 
478 
479                     // Forming PRIM_INT__f_s_s_s[16 * 10];
480                     for(n = 0; n < 16; ++n)  // loop over orders of auxiliary function
481                     {
482 
483                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
484                         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]);
485                         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]);
486 
487                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
488                         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]);
489 
490                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
491                         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]);
492 
493                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
494                         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]);
495 
496                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
497                         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]);
498 
499                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
500                         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]);
501 
502                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
503                         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]);
504                         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]);
505 
506                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
507                         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]);
508 
509                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
510                         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]);
511 
512                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
513                         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]);
514                         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]);
515 
516                     }
517 
518 
519                     VRR_I_g_s_s_s(
520                             PRIM_INT__g_s_s_s,
521                             PRIM_INT__f_s_s_s,
522                             PRIM_INT__d_s_s_s,
523                             P_PA,
524                             a_over_p,
525                             aop_PQ,
526                             one_over_2p,
527                             15);
528 
529 
530                     VRR_I_h_s_s_s(
531                             PRIM_INT__h_s_s_s,
532                             PRIM_INT__g_s_s_s,
533                             PRIM_INT__f_s_s_s,
534                             P_PA,
535                             a_over_p,
536                             aop_PQ,
537                             one_over_2p,
538                             14);
539 
540 
541                     ostei_general_vrr1_I(6, 13,
542                             one_over_2p, a_over_p, aop_PQ, P_PA,
543                             PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
544 
545 
546                     ostei_general_vrr_K(6, 0, 1, 0, 8,
547                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
548                             PRIM_INT__i_s_s_s, NULL, NULL, PRIM_INT__h_s_s_s, NULL, PRIM_INT__i_s_p_s);
549 
550 
551                     ostei_general_vrr_K(5, 0, 1, 0, 8,
552                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
553                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
554 
555 
556                     ostei_general_vrr_K(6, 0, 2, 0, 7,
557                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
558                             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);
559 
560 
561                     VRR_K_g_s_p_s(
562                             PRIM_INT__g_s_p_s,
563                             PRIM_INT__g_s_s_s,
564                             PRIM_INT__f_s_s_s,
565                             Q_PA,
566                             aoq_PQ,
567                             one_over_2pq,
568                             8);
569 
570 
571                     ostei_general_vrr_K(5, 0, 2, 0, 7,
572                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
573                             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);
574 
575 
576                     ostei_general_vrr_K(6, 0, 3, 0, 6,
577                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
578                             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);
579 
580 
581                     VRR_K_f_s_p_s(
582                             PRIM_INT__f_s_p_s,
583                             PRIM_INT__f_s_s_s,
584                             PRIM_INT__d_s_s_s,
585                             Q_PA,
586                             aoq_PQ,
587                             one_over_2pq,
588                             8);
589 
590 
591                     ostei_general_vrr_K(4, 0, 2, 0, 7,
592                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
593                             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);
594 
595 
596                     ostei_general_vrr_K(5, 0, 3, 0, 6,
597                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
598                             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);
599 
600 
601                     ostei_general_vrr_K(6, 0, 4, 0, 5,
602                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
603                             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);
604 
605 
606 
607                     // Forming PRIM_INT__d_s_p_s[8 * 18];
608                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
609                     {
610 
611                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
612                         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]);
613                         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]);
614 
615                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
616                         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]);
617 
618                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
619                         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]);
620 
621                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
622                         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]);
623                         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]);
624 
625                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
626                         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]);
627                         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]);
628 
629                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
630                         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]);
631 
632                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
633                         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]);
634                         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]);
635 
636                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
637                         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]);
638 
639                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
640                         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]);
641                         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]);
642 
643                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
644                         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]);
645 
646                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
647                         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]);
648                         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]);
649 
650                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
651                         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]);
652 
653                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
654                         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]);
655 
656                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
657                         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]);
658                         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]);
659 
660                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
661                         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]);
662                         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]);
663 
664                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
665                         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]);
666 
667                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
668                         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]);
669 
670                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
671                         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]);
672                         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]);
673 
674                     }
675 
676 
677                     VRR_K_f_s_d_s(
678                             PRIM_INT__f_s_d_s,
679                             PRIM_INT__f_s_p_s,
680                             PRIM_INT__f_s_s_s,
681                             PRIM_INT__d_s_p_s,
682                             Q_PA,
683                             a_over_q,
684                             aoq_PQ,
685                             one_over_2pq,
686                             one_over_2q,
687                             7);
688 
689 
690                     ostei_general_vrr_K(4, 0, 3, 0, 6,
691                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
692                             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);
693 
694 
695                     ostei_general_vrr_K(5, 0, 4, 0, 5,
696                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
697                             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);
698 
699 
700                     ostei_general_vrr_K(6, 0, 5, 0, 4,
701                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
702                             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);
703 
704 
705 
706                     // Forming PRIM_INT__p_s_p_s[8 * 9];
707                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
708                     {
709 
710                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
711                         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]);
712                         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]);
713 
714                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
715                         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]);
716 
717                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
718                         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]);
719 
720                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 1]);
721                         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]);
722 
723                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
724                         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]);
725                         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]);
726 
727                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
728                         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]);
729 
730                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 2]);
731                         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]);
732 
733                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 2]);
734                         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]);
735 
736                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
737                         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]);
738                         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]);
739 
740                     }
741 
742 
743                     VRR_K_d_s_d_s(
744                             PRIM_INT__d_s_d_s,
745                             PRIM_INT__d_s_p_s,
746                             PRIM_INT__d_s_s_s,
747                             PRIM_INT__p_s_p_s,
748                             Q_PA,
749                             a_over_q,
750                             aoq_PQ,
751                             one_over_2pq,
752                             one_over_2q,
753                             7);
754 
755 
756                     ostei_general_vrr_K(3, 0, 3, 0, 6,
757                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
758                             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);
759 
760 
761                     ostei_general_vrr_K(4, 0, 4, 0, 5,
762                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
763                             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);
764 
765 
766                     ostei_general_vrr_K(5, 0, 5, 0, 4,
767                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
768                             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);
769 
770 
771                     ostei_general_vrr_K(6, 0, 6, 0, 3,
772                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
773                             PRIM_INT__i_s_h_s, PRIM_INT__i_s_g_s, NULL, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_i_s);
774 
775 
776                     ostei_general_vrr1_I(7, 12,
777                             one_over_2p, a_over_p, aop_PQ, P_PA,
778                             PRIM_INT__i_s_s_s, PRIM_INT__h_s_s_s, PRIM_INT__k_s_s_s);
779 
780 
781                     ostei_general_vrr_K(7, 0, 1, 0, 8,
782                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
783                             PRIM_INT__k_s_s_s, NULL, NULL, PRIM_INT__i_s_s_s, NULL, PRIM_INT__k_s_p_s);
784 
785 
786                     ostei_general_vrr_K(7, 0, 2, 0, 7,
787                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
788                             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);
789 
790 
791                     ostei_general_vrr_K(7, 0, 3, 0, 6,
792                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
793                             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);
794 
795 
796                     ostei_general_vrr_K(7, 0, 4, 0, 5,
797                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
798                             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);
799 
800 
801                     ostei_general_vrr_K(7, 0, 5, 0, 4,
802                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
803                             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);
804 
805 
806 
807                     // Forming PRIM_INT__s_s_p_s[8 * 3];
808                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
809                     {
810 
811                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
812                         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]);
813 
814                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
815                         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]);
816 
817                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
818                         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]);
819 
820                     }
821 
822 
823 
824                     // Forming PRIM_INT__p_s_d_s[7 * 18];
825                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
826                     {
827 
828                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_p_s[n * 9 + 0]);
829                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
830                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__p_s_d_s[n * 18 + 0]);
831                         PRIM_INT__p_s_d_s[n * 18 + 0] = 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 + 0]);
832 
833                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_p_s[n * 9 + 1]);
834                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__p_s_d_s[n * 18 + 3]);
835                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__p_s_d_s[n * 18 + 3]);
836 
837                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_p_s[n * 9 + 2]);
838                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__p_s_d_s[n * 18 + 5]);
839                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__p_s_d_s[n * 18 + 5]);
840 
841                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_p_s[n * 9 + 3]);
842                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__p_s_d_s[n * 18 + 6]);
843                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__p_s_d_s[n * 18 + 6]);
844 
845                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_p_s[n * 9 + 4]);
846                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__p_s_d_s[n * 18 + 9]);
847                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__p_s_d_s[n * 18 + 9]);
848                         PRIM_INT__p_s_d_s[n * 18 + 9] = 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 + 9]);
849 
850                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_p_s[n * 9 + 5]);
851                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__p_s_d_s[n * 18 + 11]);
852                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__p_s_d_s[n * 18 + 11]);
853 
854                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_p_s[n * 9 + 6]);
855                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__p_s_d_s[n * 18 + 12]);
856                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__p_s_d_s[n * 18 + 12]);
857 
858                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_p_s[n * 9 + 7]);
859                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__p_s_d_s[n * 18 + 15]);
860                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__p_s_d_s[n * 18 + 15]);
861 
862                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_p_s[n * 9 + 8]);
863                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__p_s_d_s[n * 18 + 17]);
864                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__p_s_d_s[n * 18 + 17]);
865                         PRIM_INT__p_s_d_s[n * 18 + 17] = 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 + 17]);
866 
867                     }
868 
869 
870                     VRR_K_d_s_f_s(
871                             PRIM_INT__d_s_f_s,
872                             PRIM_INT__d_s_d_s,
873                             PRIM_INT__d_s_p_s,
874                             PRIM_INT__p_s_d_s,
875                             Q_PA,
876                             a_over_q,
877                             aoq_PQ,
878                             one_over_2pq,
879                             one_over_2q,
880                             6);
881 
882 
883                     ostei_general_vrr_K(3, 0, 4, 0, 5,
884                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
885                             PRIM_INT__f_s_f_s, PRIM_INT__f_s_d_s, NULL, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_g_s);
886 
887 
888                     ostei_general_vrr_K(4, 0, 5, 0, 4,
889                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
890                             PRIM_INT__g_s_g_s, PRIM_INT__g_s_f_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);
891 
892 
893                     ostei_general_vrr_K(5, 0, 6, 0, 3,
894                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
895                             PRIM_INT__h_s_h_s, PRIM_INT__h_s_g_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);
896 
897 
898                     ostei_general_vrr_K(6, 0, 7, 0, 2,
899                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
900                             PRIM_INT__i_s_i_s, PRIM_INT__i_s_h_s, NULL, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_k_s);
901 
902 
903                     ostei_general_vrr_K(7, 0, 6, 0, 3,
904                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
905                             PRIM_INT__k_s_h_s, PRIM_INT__k_s_g_s, NULL, PRIM_INT__i_s_h_s, NULL, PRIM_INT__k_s_i_s);
906 
907 
908                     ostei_general_vrr1_I(8, 11,
909                             one_over_2p, a_over_p, aop_PQ, P_PA,
910                             PRIM_INT__k_s_s_s, PRIM_INT__i_s_s_s, PRIM_INT__l_s_s_s);
911 
912 
913                     ostei_general_vrr_K(8, 0, 1, 0, 8,
914                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
915                             PRIM_INT__l_s_s_s, NULL, NULL, PRIM_INT__k_s_s_s, NULL, PRIM_INT__l_s_p_s);
916 
917 
918                     ostei_general_vrr_K(8, 0, 2, 0, 7,
919                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
920                             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);
921 
922 
923                     ostei_general_vrr_K(8, 0, 3, 0, 6,
924                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
925                             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);
926 
927 
928                     ostei_general_vrr_K(8, 0, 4, 0, 5,
929                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
930                             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);
931 
932 
933                     ostei_general_vrr_K(8, 0, 5, 0, 4,
934                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
935                             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);
936 
937 
938 
939                     // Forming PRIM_INT__s_s_d_s[7 * 6];
940                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
941                     {
942 
943                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
944                         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]);
945                         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]);
946 
947                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
948                         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]);
949                         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]);
950 
951                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
952                         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]);
953                         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]);
954 
955                     }
956 
957 
958                     VRR_K_p_s_f_s(
959                             PRIM_INT__p_s_f_s,
960                             PRIM_INT__p_s_d_s,
961                             PRIM_INT__p_s_p_s,
962                             PRIM_INT__s_s_d_s,
963                             Q_PA,
964                             a_over_q,
965                             aoq_PQ,
966                             one_over_2pq,
967                             one_over_2q,
968                             6);
969 
970 
971                     ostei_general_vrr_K(2, 0, 4, 0, 5,
972                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
973                             PRIM_INT__d_s_f_s, PRIM_INT__d_s_d_s, NULL, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_g_s);
974 
975 
976                     ostei_general_vrr_K(3, 0, 5, 0, 4,
977                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
978                             PRIM_INT__f_s_g_s, PRIM_INT__f_s_f_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);
979 
980 
981                     ostei_general_vrr_K(4, 0, 6, 0, 3,
982                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
983                             PRIM_INT__g_s_h_s, PRIM_INT__g_s_g_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);
984 
985 
986                     ostei_general_vrr_K(5, 0, 7, 0, 2,
987                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
988                             PRIM_INT__h_s_i_s, PRIM_INT__h_s_h_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);
989 
990 
991                     ostei_general_vrr_K(6, 0, 8, 0, 1,
992                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
993                             PRIM_INT__i_s_k_s, PRIM_INT__i_s_i_s, NULL, PRIM_INT__h_s_k_s, NULL, PRIM_INT__i_s_l_s);
994 
995 
996                     ostei_general_vrr_K(7, 0, 7, 0, 2,
997                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
998                             PRIM_INT__k_s_i_s, PRIM_INT__k_s_h_s, NULL, PRIM_INT__i_s_i_s, NULL, PRIM_INT__k_s_k_s);
999 
1000 
1001                     ostei_general_vrr_K(8, 0, 6, 0, 3,
1002                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1003                             PRIM_INT__l_s_h_s, PRIM_INT__l_s_g_s, NULL, PRIM_INT__k_s_h_s, NULL, PRIM_INT__l_s_i_s);
1004 
1005 
1006                     ostei_general_vrr1_I(9, 10,
1007                             one_over_2p, a_over_p, aop_PQ, P_PA,
1008                             PRIM_INT__l_s_s_s, PRIM_INT__k_s_s_s, PRIM_INT__m_s_s_s);
1009 
1010 
1011                     ostei_general_vrr_K(9, 0, 1, 0, 8,
1012                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1013                             PRIM_INT__m_s_s_s, NULL, NULL, PRIM_INT__l_s_s_s, NULL, PRIM_INT__m_s_p_s);
1014 
1015 
1016                     ostei_general_vrr_K(9, 0, 2, 0, 7,
1017                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1018                             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);
1019 
1020 
1021                     ostei_general_vrr_K(9, 0, 3, 0, 6,
1022                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1023                             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);
1024 
1025 
1026                     ostei_general_vrr_K(9, 0, 4, 0, 5,
1027                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1028                             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);
1029 
1030 
1031                     ostei_general_vrr_K(9, 0, 5, 0, 4,
1032                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1033                             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);
1034 
1035 
1036                     ostei_general_vrr_K(7, 0, 8, 0, 1,
1037                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1038                             PRIM_INT__k_s_k_s, PRIM_INT__k_s_i_s, NULL, PRIM_INT__i_s_k_s, NULL, PRIM_INT__k_s_l_s);
1039 
1040 
1041                     ostei_general_vrr_K(8, 0, 7, 0, 2,
1042                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1043                             PRIM_INT__l_s_i_s, PRIM_INT__l_s_h_s, NULL, PRIM_INT__k_s_i_s, NULL, PRIM_INT__l_s_k_s);
1044 
1045 
1046                     ostei_general_vrr_K(9, 0, 6, 0, 3,
1047                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1048                             PRIM_INT__m_s_h_s, PRIM_INT__m_s_g_s, NULL, PRIM_INT__l_s_h_s, NULL, PRIM_INT__m_s_i_s);
1049 
1050 
1051                     ostei_general_vrr1_I(10, 9,
1052                             one_over_2p, a_over_p, aop_PQ, P_PA,
1053                             PRIM_INT__m_s_s_s, PRIM_INT__l_s_s_s, PRIM_INT__n_s_s_s);
1054 
1055 
1056                     ostei_general_vrr_K(10, 0, 1, 0, 8,
1057                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1058                             PRIM_INT__n_s_s_s, NULL, NULL, PRIM_INT__m_s_s_s, NULL, PRIM_INT__n_s_p_s);
1059 
1060 
1061                     ostei_general_vrr_K(10, 0, 2, 0, 7,
1062                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1063                             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);
1064 
1065 
1066                     ostei_general_vrr_K(10, 0, 3, 0, 6,
1067                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1068                             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);
1069 
1070 
1071                     ostei_general_vrr_K(10, 0, 4, 0, 5,
1072                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1073                             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);
1074 
1075 
1076                     ostei_general_vrr_K(10, 0, 5, 0, 4,
1077                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1078                             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);
1079 
1080 
1081                     ostei_general_vrr_K(8, 0, 8, 0, 1,
1082                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1083                             PRIM_INT__l_s_k_s, PRIM_INT__l_s_i_s, NULL, PRIM_INT__k_s_k_s, NULL, PRIM_INT__l_s_l_s);
1084 
1085 
1086                     ostei_general_vrr_K(9, 0, 7, 0, 2,
1087                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1088                             PRIM_INT__m_s_i_s, PRIM_INT__m_s_h_s, NULL, PRIM_INT__l_s_i_s, NULL, PRIM_INT__m_s_k_s);
1089 
1090 
1091                     ostei_general_vrr_K(10, 0, 6, 0, 3,
1092                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1093                             PRIM_INT__n_s_h_s, PRIM_INT__n_s_g_s, NULL, PRIM_INT__m_s_h_s, NULL, PRIM_INT__n_s_i_s);
1094 
1095 
1096                     ostei_general_vrr_K(9, 0, 8, 0, 1,
1097                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1098                             PRIM_INT__m_s_k_s, PRIM_INT__m_s_i_s, NULL, PRIM_INT__l_s_k_s, NULL, PRIM_INT__m_s_l_s);
1099 
1100 
1101                     ostei_general_vrr_K(10, 0, 7, 0, 2,
1102                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1103                             PRIM_INT__n_s_i_s, PRIM_INT__n_s_h_s, NULL, PRIM_INT__m_s_i_s, NULL, PRIM_INT__n_s_k_s);
1104 
1105 
1106                     ostei_general_vrr_K(10, 0, 8, 0, 1,
1107                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
1108                             PRIM_INT__n_s_k_s, PRIM_INT__n_s_i_s, NULL, PRIM_INT__m_s_k_s, NULL, PRIM_INT__n_s_l_s);
1109 
1110 
1111 
1112 
1113                     ////////////////////////////////////
1114                     // Accumulate contracted integrals
1115                     ////////////////////////////////////
1116                     if(lastoffset == 0)
1117                     {
1118                         contract_all(588, PRIM_INT__i_s_h_s, PRIM_PTR_INT__i_s_h_s);
1119                         contract_all(784, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
1120                         contract_all(1008, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
1121                         contract_all(1260, PRIM_INT__i_s_l_s, PRIM_PTR_INT__i_s_l_s);
1122                         contract_all(756, PRIM_INT__k_s_h_s, PRIM_PTR_INT__k_s_h_s);
1123                         contract_all(1008, PRIM_INT__k_s_i_s, PRIM_PTR_INT__k_s_i_s);
1124                         contract_all(1296, PRIM_INT__k_s_k_s, PRIM_PTR_INT__k_s_k_s);
1125                         contract_all(1620, PRIM_INT__k_s_l_s, PRIM_PTR_INT__k_s_l_s);
1126                         contract_all(945, PRIM_INT__l_s_h_s, PRIM_PTR_INT__l_s_h_s);
1127                         contract_all(1260, PRIM_INT__l_s_i_s, PRIM_PTR_INT__l_s_i_s);
1128                         contract_all(1620, PRIM_INT__l_s_k_s, PRIM_PTR_INT__l_s_k_s);
1129                         contract_all(2025, PRIM_INT__l_s_l_s, PRIM_PTR_INT__l_s_l_s);
1130                         contract_all(1155, PRIM_INT__m_s_h_s, PRIM_PTR_INT__m_s_h_s);
1131                         contract_all(1540, PRIM_INT__m_s_i_s, PRIM_PTR_INT__m_s_i_s);
1132                         contract_all(1980, PRIM_INT__m_s_k_s, PRIM_PTR_INT__m_s_k_s);
1133                         contract_all(2475, PRIM_INT__m_s_l_s, PRIM_PTR_INT__m_s_l_s);
1134                         contract_all(1386, PRIM_INT__n_s_h_s, PRIM_PTR_INT__n_s_h_s);
1135                         contract_all(1848, PRIM_INT__n_s_i_s, PRIM_PTR_INT__n_s_i_s);
1136                         contract_all(2376, PRIM_INT__n_s_k_s, PRIM_PTR_INT__n_s_k_s);
1137                         contract_all(2970, PRIM_INT__n_s_l_s, PRIM_PTR_INT__n_s_l_s);
1138                     }
1139                     else
1140                     {
1141                         contract(588, shelloffsets, PRIM_INT__i_s_h_s, PRIM_PTR_INT__i_s_h_s);
1142                         contract(784, shelloffsets, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
1143                         contract(1008, shelloffsets, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
1144                         contract(1260, shelloffsets, PRIM_INT__i_s_l_s, PRIM_PTR_INT__i_s_l_s);
1145                         contract(756, shelloffsets, PRIM_INT__k_s_h_s, PRIM_PTR_INT__k_s_h_s);
1146                         contract(1008, shelloffsets, PRIM_INT__k_s_i_s, PRIM_PTR_INT__k_s_i_s);
1147                         contract(1296, shelloffsets, PRIM_INT__k_s_k_s, PRIM_PTR_INT__k_s_k_s);
1148                         contract(1620, shelloffsets, PRIM_INT__k_s_l_s, PRIM_PTR_INT__k_s_l_s);
1149                         contract(945, shelloffsets, PRIM_INT__l_s_h_s, PRIM_PTR_INT__l_s_h_s);
1150                         contract(1260, shelloffsets, PRIM_INT__l_s_i_s, PRIM_PTR_INT__l_s_i_s);
1151                         contract(1620, shelloffsets, PRIM_INT__l_s_k_s, PRIM_PTR_INT__l_s_k_s);
1152                         contract(2025, shelloffsets, PRIM_INT__l_s_l_s, PRIM_PTR_INT__l_s_l_s);
1153                         contract(1155, shelloffsets, PRIM_INT__m_s_h_s, PRIM_PTR_INT__m_s_h_s);
1154                         contract(1540, shelloffsets, PRIM_INT__m_s_i_s, PRIM_PTR_INT__m_s_i_s);
1155                         contract(1980, shelloffsets, PRIM_INT__m_s_k_s, PRIM_PTR_INT__m_s_k_s);
1156                         contract(2475, shelloffsets, PRIM_INT__m_s_l_s, PRIM_PTR_INT__m_s_l_s);
1157                         contract(1386, shelloffsets, PRIM_INT__n_s_h_s, PRIM_PTR_INT__n_s_h_s);
1158                         contract(1848, shelloffsets, PRIM_INT__n_s_i_s, PRIM_PTR_INT__n_s_i_s);
1159                         contract(2376, shelloffsets, PRIM_INT__n_s_k_s, PRIM_PTR_INT__n_s_k_s);
1160                         contract(2970, shelloffsets, PRIM_INT__n_s_l_s, PRIM_PTR_INT__n_s_l_s);
1161                         PRIM_PTR_INT__i_s_h_s += lastoffset*588;
1162                         PRIM_PTR_INT__i_s_i_s += lastoffset*784;
1163                         PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
1164                         PRIM_PTR_INT__i_s_l_s += lastoffset*1260;
1165                         PRIM_PTR_INT__k_s_h_s += lastoffset*756;
1166                         PRIM_PTR_INT__k_s_i_s += lastoffset*1008;
1167                         PRIM_PTR_INT__k_s_k_s += lastoffset*1296;
1168                         PRIM_PTR_INT__k_s_l_s += lastoffset*1620;
1169                         PRIM_PTR_INT__l_s_h_s += lastoffset*945;
1170                         PRIM_PTR_INT__l_s_i_s += lastoffset*1260;
1171                         PRIM_PTR_INT__l_s_k_s += lastoffset*1620;
1172                         PRIM_PTR_INT__l_s_l_s += lastoffset*2025;
1173                         PRIM_PTR_INT__m_s_h_s += lastoffset*1155;
1174                         PRIM_PTR_INT__m_s_i_s += lastoffset*1540;
1175                         PRIM_PTR_INT__m_s_k_s += lastoffset*1980;
1176                         PRIM_PTR_INT__m_s_l_s += lastoffset*2475;
1177                         PRIM_PTR_INT__n_s_h_s += lastoffset*1386;
1178                         PRIM_PTR_INT__n_s_i_s += lastoffset*1848;
1179                         PRIM_PTR_INT__n_s_k_s += lastoffset*2376;
1180                         PRIM_PTR_INT__n_s_l_s += lastoffset*2970;
1181                     }
1182 
1183                 }  // close loop over j
1184             }  // close loop over i
1185 
1186             //Advance to the next batch
1187             jstart = SIMINT_SIMD_ROUND(jend);
1188 
1189             //////////////////////////////////////////////
1190             // Contracted integrals: Horizontal recurrance
1191             //////////////////////////////////////////////
1192 
1193 
1194             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
1195 
1196 
1197             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
1198             {
1199                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
1200 
1201                 // set up HRR pointers
1202                 double const * restrict HRR_INT__i_s_h_s = INT__i_s_h_s + abcd * 588;
1203                 double const * restrict HRR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
1204                 double const * restrict HRR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
1205                 double const * restrict HRR_INT__i_s_l_s = INT__i_s_l_s + abcd * 1260;
1206                 double const * restrict HRR_INT__k_s_h_s = INT__k_s_h_s + abcd * 756;
1207                 double const * restrict HRR_INT__k_s_i_s = INT__k_s_i_s + abcd * 1008;
1208                 double const * restrict HRR_INT__k_s_k_s = INT__k_s_k_s + abcd * 1296;
1209                 double const * restrict HRR_INT__k_s_l_s = INT__k_s_l_s + abcd * 1620;
1210                 double const * restrict HRR_INT__l_s_h_s = INT__l_s_h_s + abcd * 945;
1211                 double const * restrict HRR_INT__l_s_i_s = INT__l_s_i_s + abcd * 1260;
1212                 double const * restrict HRR_INT__l_s_k_s = INT__l_s_k_s + abcd * 1620;
1213                 double const * restrict HRR_INT__l_s_l_s = INT__l_s_l_s + abcd * 2025;
1214                 double const * restrict HRR_INT__m_s_h_s = INT__m_s_h_s + abcd * 1155;
1215                 double const * restrict HRR_INT__m_s_i_s = INT__m_s_i_s + abcd * 1540;
1216                 double const * restrict HRR_INT__m_s_k_s = INT__m_s_k_s + abcd * 1980;
1217                 double const * restrict HRR_INT__m_s_l_s = INT__m_s_l_s + abcd * 2475;
1218                 double const * restrict HRR_INT__n_s_h_s = INT__n_s_h_s + abcd * 1386;
1219                 double const * restrict HRR_INT__n_s_i_s = INT__n_s_i_s + abcd * 1848;
1220                 double const * restrict HRR_INT__n_s_k_s = INT__n_s_k_s + abcd * 2376;
1221                 double const * restrict HRR_INT__n_s_l_s = INT__n_s_l_s + abcd * 2970;
1222                 double * restrict HRR_INT__i_g_h_f = INT__i_g_h_f + real_abcd * 88200;
1223 
1224                 // form INT__i_p_h_s
1225                 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);
1226 
1227                 // form INT__i_p_i_s
1228                 ostei_general_hrr_J(6, 1, 6, 0, hAB, HRR_INT__k_s_i_s, HRR_INT__i_s_i_s, HRR_INT__i_p_i_s);
1229 
1230                 // form INT__i_p_k_s
1231                 ostei_general_hrr_J(6, 1, 7, 0, hAB, HRR_INT__k_s_k_s, HRR_INT__i_s_k_s, HRR_INT__i_p_k_s);
1232 
1233                 // form INT__i_p_l_s
1234                 ostei_general_hrr_J(6, 1, 8, 0, hAB, HRR_INT__k_s_l_s, HRR_INT__i_s_l_s, HRR_INT__i_p_l_s);
1235 
1236                 // form INT__k_p_h_s
1237                 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);
1238 
1239                 // form INT__k_p_i_s
1240                 ostei_general_hrr_J(7, 1, 6, 0, hAB, HRR_INT__l_s_i_s, HRR_INT__k_s_i_s, HRR_INT__k_p_i_s);
1241 
1242                 // form INT__k_p_k_s
1243                 ostei_general_hrr_J(7, 1, 7, 0, hAB, HRR_INT__l_s_k_s, HRR_INT__k_s_k_s, HRR_INT__k_p_k_s);
1244 
1245                 // form INT__k_p_l_s
1246                 ostei_general_hrr_J(7, 1, 8, 0, hAB, HRR_INT__l_s_l_s, HRR_INT__k_s_l_s, HRR_INT__k_p_l_s);
1247 
1248                 // form INT__l_p_h_s
1249                 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);
1250 
1251                 // form INT__l_p_i_s
1252                 ostei_general_hrr_J(8, 1, 6, 0, hAB, HRR_INT__m_s_i_s, HRR_INT__l_s_i_s, HRR_INT__l_p_i_s);
1253 
1254                 // form INT__l_p_k_s
1255                 ostei_general_hrr_J(8, 1, 7, 0, hAB, HRR_INT__m_s_k_s, HRR_INT__l_s_k_s, HRR_INT__l_p_k_s);
1256 
1257                 // form INT__l_p_l_s
1258                 ostei_general_hrr_J(8, 1, 8, 0, hAB, HRR_INT__m_s_l_s, HRR_INT__l_s_l_s, HRR_INT__l_p_l_s);
1259 
1260                 // form INT__m_p_h_s
1261                 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);
1262 
1263                 // form INT__m_p_i_s
1264                 ostei_general_hrr_J(9, 1, 6, 0, hAB, HRR_INT__n_s_i_s, HRR_INT__m_s_i_s, HRR_INT__m_p_i_s);
1265 
1266                 // form INT__m_p_k_s
1267                 ostei_general_hrr_J(9, 1, 7, 0, hAB, HRR_INT__n_s_k_s, HRR_INT__m_s_k_s, HRR_INT__m_p_k_s);
1268 
1269                 // form INT__m_p_l_s
1270                 ostei_general_hrr_J(9, 1, 8, 0, hAB, HRR_INT__n_s_l_s, HRR_INT__m_s_l_s, HRR_INT__m_p_l_s);
1271 
1272                 // form INT__i_d_h_s
1273                 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);
1274 
1275                 // form INT__i_d_i_s
1276                 ostei_general_hrr_J(6, 2, 6, 0, hAB, HRR_INT__k_p_i_s, HRR_INT__i_p_i_s, HRR_INT__i_d_i_s);
1277 
1278                 // form INT__i_d_k_s
1279                 ostei_general_hrr_J(6, 2, 7, 0, hAB, HRR_INT__k_p_k_s, HRR_INT__i_p_k_s, HRR_INT__i_d_k_s);
1280 
1281                 // form INT__i_d_l_s
1282                 ostei_general_hrr_J(6, 2, 8, 0, hAB, HRR_INT__k_p_l_s, HRR_INT__i_p_l_s, HRR_INT__i_d_l_s);
1283 
1284                 // form INT__k_d_h_s
1285                 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);
1286 
1287                 // form INT__k_d_i_s
1288                 ostei_general_hrr_J(7, 2, 6, 0, hAB, HRR_INT__l_p_i_s, HRR_INT__k_p_i_s, HRR_INT__k_d_i_s);
1289 
1290                 // form INT__k_d_k_s
1291                 ostei_general_hrr_J(7, 2, 7, 0, hAB, HRR_INT__l_p_k_s, HRR_INT__k_p_k_s, HRR_INT__k_d_k_s);
1292 
1293                 // form INT__k_d_l_s
1294                 ostei_general_hrr_J(7, 2, 8, 0, hAB, HRR_INT__l_p_l_s, HRR_INT__k_p_l_s, HRR_INT__k_d_l_s);
1295 
1296                 // form INT__l_d_h_s
1297                 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);
1298 
1299                 // form INT__l_d_i_s
1300                 ostei_general_hrr_J(8, 2, 6, 0, hAB, HRR_INT__m_p_i_s, HRR_INT__l_p_i_s, HRR_INT__l_d_i_s);
1301 
1302                 // form INT__l_d_k_s
1303                 ostei_general_hrr_J(8, 2, 7, 0, hAB, HRR_INT__m_p_k_s, HRR_INT__l_p_k_s, HRR_INT__l_d_k_s);
1304 
1305                 // form INT__l_d_l_s
1306                 ostei_general_hrr_J(8, 2, 8, 0, hAB, HRR_INT__m_p_l_s, HRR_INT__l_p_l_s, HRR_INT__l_d_l_s);
1307 
1308                 // form INT__i_f_h_s
1309                 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);
1310 
1311                 // form INT__i_f_i_s
1312                 ostei_general_hrr_J(6, 3, 6, 0, hAB, HRR_INT__k_d_i_s, HRR_INT__i_d_i_s, HRR_INT__i_f_i_s);
1313 
1314                 // form INT__i_f_k_s
1315                 ostei_general_hrr_J(6, 3, 7, 0, hAB, HRR_INT__k_d_k_s, HRR_INT__i_d_k_s, HRR_INT__i_f_k_s);
1316 
1317                 // form INT__i_f_l_s
1318                 ostei_general_hrr_J(6, 3, 8, 0, hAB, HRR_INT__k_d_l_s, HRR_INT__i_d_l_s, HRR_INT__i_f_l_s);
1319 
1320                 // form INT__k_f_h_s
1321                 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);
1322 
1323                 // form INT__k_f_i_s
1324                 ostei_general_hrr_J(7, 3, 6, 0, hAB, HRR_INT__l_d_i_s, HRR_INT__k_d_i_s, HRR_INT__k_f_i_s);
1325 
1326                 // form INT__k_f_k_s
1327                 ostei_general_hrr_J(7, 3, 7, 0, hAB, HRR_INT__l_d_k_s, HRR_INT__k_d_k_s, HRR_INT__k_f_k_s);
1328 
1329                 // form INT__k_f_l_s
1330                 ostei_general_hrr_J(7, 3, 8, 0, hAB, HRR_INT__l_d_l_s, HRR_INT__k_d_l_s, HRR_INT__k_f_l_s);
1331 
1332                 // form INT__i_g_h_s
1333                 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);
1334 
1335                 // form INT__i_g_i_s
1336                 ostei_general_hrr_J(6, 4, 6, 0, hAB, HRR_INT__k_f_i_s, HRR_INT__i_f_i_s, HRR_INT__i_g_i_s);
1337 
1338                 // form INT__i_g_k_s
1339                 ostei_general_hrr_J(6, 4, 7, 0, hAB, HRR_INT__k_f_k_s, HRR_INT__i_f_k_s, HRR_INT__i_g_k_s);
1340 
1341                 // form INT__i_g_l_s
1342                 ostei_general_hrr_J(6, 4, 8, 0, hAB, HRR_INT__k_f_l_s, HRR_INT__i_f_l_s, HRR_INT__i_g_l_s);
1343 
1344                 // form INT__i_g_h_p
1345                 ostei_general_hrr_L(6, 4, 5, 1, hCD, HRR_INT__i_g_i_s, HRR_INT__i_g_h_s, HRR_INT__i_g_h_p);
1346 
1347                 // form INT__i_g_i_p
1348                 ostei_general_hrr_L(6, 4, 6, 1, hCD, HRR_INT__i_g_k_s, HRR_INT__i_g_i_s, HRR_INT__i_g_i_p);
1349 
1350                 // form INT__i_g_k_p
1351                 ostei_general_hrr_L(6, 4, 7, 1, hCD, HRR_INT__i_g_l_s, HRR_INT__i_g_k_s, HRR_INT__i_g_k_p);
1352 
1353                 // form INT__i_g_h_d
1354                 ostei_general_hrr_L(6, 4, 5, 2, hCD, HRR_INT__i_g_i_p, HRR_INT__i_g_h_p, HRR_INT__i_g_h_d);
1355 
1356                 // form INT__i_g_i_d
1357                 ostei_general_hrr_L(6, 4, 6, 2, hCD, HRR_INT__i_g_k_p, HRR_INT__i_g_i_p, HRR_INT__i_g_i_d);
1358 
1359                 // form INT__i_g_h_f
1360                 ostei_general_hrr_L(6, 4, 5, 3, hCD, HRR_INT__i_g_i_d, HRR_INT__i_g_h_d, HRR_INT__i_g_h_f);
1361 
1362 
1363             }  // close HRR loop
1364 
1365 
1366         }   // close loop cdbatch
1367 
1368         istart = iend;
1369     }  // close loop over ab
1370 
1371     return P.nshell12_clip * Q.nshell12_clip;
1372 }
1373 
ostei_g_i_h_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_i_h_f)1374 int ostei_g_i_h_f(struct simint_multi_shellpair const P,
1375                   struct simint_multi_shellpair const Q,
1376                   double screen_tol,
1377                   double * const restrict work,
1378                   double * const restrict INT__g_i_h_f)
1379 {
1380     double P_AB[3*P.nshell12];
1381     struct simint_multi_shellpair P_tmp = P;
1382     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
1383     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
1384     P_tmp.AB_x = P_AB;
1385     P_tmp.AB_y = P_AB + P.nshell12;
1386     P_tmp.AB_z = P_AB + 2*P.nshell12;
1387 
1388     for(int i = 0; i < P.nshell12; i++)
1389     {
1390         P_tmp.AB_x[i] = -P.AB_x[i];
1391         P_tmp.AB_y[i] = -P.AB_y[i];
1392         P_tmp.AB_z[i] = -P.AB_z[i];
1393     }
1394 
1395     int ret = ostei_i_g_h_f(P_tmp, Q, screen_tol, work, INT__g_i_h_f);
1396     double buffer[88200] SIMINT_ALIGN_ARRAY_DBL;
1397 
1398     for(int q = 0; q < ret; q++)
1399     {
1400         int idx = 0;
1401         for(int a = 0; a < 15; ++a)
1402         for(int b = 0; b < 28; ++b)
1403         for(int c = 0; c < 21; ++c)
1404         for(int d = 0; d < 10; ++d)
1405             buffer[idx++] = INT__g_i_h_f[q*88200+b*3150+a*210+c*10+d];
1406 
1407         memcpy(INT__g_i_h_f+q*88200, buffer, 88200*sizeof(double));
1408     }
1409 
1410     return ret;
1411 }
1412 
ostei_i_g_f_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_g_f_h)1413 int ostei_i_g_f_h(struct simint_multi_shellpair const P,
1414                   struct simint_multi_shellpair const Q,
1415                   double screen_tol,
1416                   double * const restrict work,
1417                   double * const restrict INT__i_g_f_h)
1418 {
1419     double Q_AB[3*Q.nshell12];
1420     struct simint_multi_shellpair Q_tmp = Q;
1421     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1422     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1423     Q_tmp.AB_x = Q_AB;
1424     Q_tmp.AB_y = Q_AB + Q.nshell12;
1425     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1426 
1427     for(int i = 0; i < Q.nshell12; i++)
1428     {
1429         Q_tmp.AB_x[i] = -Q.AB_x[i];
1430         Q_tmp.AB_y[i] = -Q.AB_y[i];
1431         Q_tmp.AB_z[i] = -Q.AB_z[i];
1432     }
1433 
1434     int ret = ostei_i_g_h_f(P, Q_tmp, screen_tol, work, INT__i_g_f_h);
1435     double buffer[88200] SIMINT_ALIGN_ARRAY_DBL;
1436 
1437     for(int q = 0; q < ret; q++)
1438     {
1439         int idx = 0;
1440         for(int a = 0; a < 28; ++a)
1441         for(int b = 0; b < 15; ++b)
1442         for(int c = 0; c < 10; ++c)
1443         for(int d = 0; d < 21; ++d)
1444             buffer[idx++] = INT__i_g_f_h[q*88200+a*3150+b*210+d*10+c];
1445 
1446         memcpy(INT__i_g_f_h+q*88200, buffer, 88200*sizeof(double));
1447     }
1448 
1449     return ret;
1450 }
1451 
ostei_g_i_f_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_i_f_h)1452 int ostei_g_i_f_h(struct simint_multi_shellpair const P,
1453                   struct simint_multi_shellpair const Q,
1454                   double screen_tol,
1455                   double * const restrict work,
1456                   double * const restrict INT__g_i_f_h)
1457 {
1458     double P_AB[3*P.nshell12];
1459     struct simint_multi_shellpair P_tmp = P;
1460     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
1461     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
1462     P_tmp.AB_x = P_AB;
1463     P_tmp.AB_y = P_AB + P.nshell12;
1464     P_tmp.AB_z = P_AB + 2*P.nshell12;
1465 
1466     for(int i = 0; i < P.nshell12; i++)
1467     {
1468         P_tmp.AB_x[i] = -P.AB_x[i];
1469         P_tmp.AB_y[i] = -P.AB_y[i];
1470         P_tmp.AB_z[i] = -P.AB_z[i];
1471     }
1472 
1473     double Q_AB[3*Q.nshell12];
1474     struct simint_multi_shellpair Q_tmp = Q;
1475     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1476     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1477     Q_tmp.AB_x = Q_AB;
1478     Q_tmp.AB_y = Q_AB + Q.nshell12;
1479     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1480 
1481     for(int i = 0; i < Q.nshell12; i++)
1482     {
1483         Q_tmp.AB_x[i] = -Q.AB_x[i];
1484         Q_tmp.AB_y[i] = -Q.AB_y[i];
1485         Q_tmp.AB_z[i] = -Q.AB_z[i];
1486     }
1487 
1488     int ret = ostei_i_g_h_f(P_tmp, Q_tmp, screen_tol, work, INT__g_i_f_h);
1489     double buffer[88200] SIMINT_ALIGN_ARRAY_DBL;
1490 
1491     for(int q = 0; q < ret; q++)
1492     {
1493         int idx = 0;
1494         for(int a = 0; a < 15; ++a)
1495         for(int b = 0; b < 28; ++b)
1496         for(int c = 0; c < 10; ++c)
1497         for(int d = 0; d < 21; ++d)
1498             buffer[idx++] = INT__g_i_f_h[q*88200+b*3150+a*210+d*10+c];
1499 
1500         memcpy(INT__g_i_f_h+q*88200, buffer, 88200*sizeof(double));
1501     }
1502 
1503     return ret;
1504 }
1505 
1506