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_g_s_i_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_s_i_f)8 int ostei_g_s_i_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__g_s_i_f)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__g_s_i_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 ibra;
26 
27     // partition workspace
28     double * const INT__g_s_i_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__g_s_k_s = work + (SIMINT_NSHELL_SIMD * 420);
30     double * const INT__g_s_l_s = work + (SIMINT_NSHELL_SIMD * 960);
31     double * const INT__g_s_m_s = work + (SIMINT_NSHELL_SIMD * 1635);
32     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*2460);
33     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 14;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 53;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 125;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 235;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 385;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 574;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 798;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1050;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 1320;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 1595;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1715;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 1895;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 2147;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 2483;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 2915;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 3455;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 4115;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 4385;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 4763;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 5267;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 5915;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 6725;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 7715;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 8135;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 8695;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 9415;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 10315;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 11415;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 11835;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 12375;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_m_s = primwork + 13050;
65     double * const hrrwork = (double *)(primwork + 13875);
66     double * const HRR_INT__g_s_i_p = hrrwork + 0;
67     double * const HRR_INT__g_s_i_d = hrrwork + 1260;
68     double * const HRR_INT__g_s_k_p = hrrwork + 3780;
69     double * const HRR_INT__g_s_k_d = hrrwork + 5400;
70     double * const HRR_INT__g_s_l_p = hrrwork + 8640;
71 
72 
73     // Create constants
74     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
75     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
76     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
77     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
78     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
79     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
80     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
81     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
82     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
83     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
84 
85 
86     ////////////////////////////////////////
87     // Loop over shells and primitives
88     ////////////////////////////////////////
89 
90     real_abcd = 0;
91     istart = 0;
92     for(ab = 0; ab < P.nshell12_clip; ++ab)
93     {
94         const int iend = istart + P.nprim12[ab];
95 
96         cd = 0;
97         jstart = 0;
98 
99         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
100         {
101             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
102             int jend = jstart;
103             for(i = 0; i < nshellbatch; i++)
104                 jend += Q.nprim12[cd+i];
105 
106             // Clear the beginning of the workspace (where we are accumulating integrals)
107             memset(work, 0, SIMINT_NSHELL_SIMD * 2460 * sizeof(double));
108             abcd = 0;
109 
110 
111             for(i = istart; i < iend; ++i)
112             {
113                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
114 
115                 if(check_screen)
116                 {
117                     // Skip this whole thing if always insignificant
118                     if((P.screen[i] * Q.screen_max) < screen_tol)
119                         continue;
120                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
121                 }
122 
123                 icd = 0;
124                 iprimcd = 0;
125                 nprim_icd = Q.nprim12[cd];
126                 double * restrict PRIM_PTR_INT__g_s_i_s = INT__g_s_i_s + abcd * 420;
127                 double * restrict PRIM_PTR_INT__g_s_k_s = INT__g_s_k_s + abcd * 540;
128                 double * restrict PRIM_PTR_INT__g_s_l_s = INT__g_s_l_s + abcd * 675;
129                 double * restrict PRIM_PTR_INT__g_s_m_s = INT__g_s_m_s + abcd * 825;
130 
131 
132 
133                 // Load these one per loop over i
134                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
135                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
136                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
137 
138                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
139 
140                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
141                 {
142                     // calculate the shell offsets
143                     // these are the offset from the shell pointed to by cd
144                     // for each element
145                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
146                     int lastoffset = 0;
147                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
148 
149                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
150                     {
151                         // Handle if the first element of the vector is a new shell
152                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
153                         {
154                             nprim_icd += Q.nprim12[cd + (++icd)];
155                             PRIM_PTR_INT__g_s_i_s += 420;
156                             PRIM_PTR_INT__g_s_k_s += 540;
157                             PRIM_PTR_INT__g_s_l_s += 675;
158                             PRIM_PTR_INT__g_s_m_s += 825;
159                         }
160                         iprimcd++;
161                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
162                         {
163                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
164                             {
165                                 shelloffsets[n] = shelloffsets[n-1] + 1;
166                                 lastoffset++;
167                                 nprim_icd += Q.nprim12[cd + (++icd)];
168                             }
169                             else
170                                 shelloffsets[n] = shelloffsets[n-1];
171                             iprimcd++;
172                         }
173                     }
174                     else
175                         iprimcd += SIMINT_SIMD_LEN;
176 
177                     // Do we have to compute this vector (or has it been screened out)?
178                     // (not_screened != 0 means we have to do this vector)
179                     if(check_screen)
180                     {
181                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
182                         if(vmax < screen_tol)
183                         {
184                             PRIM_PTR_INT__g_s_i_s += lastoffset*420;
185                             PRIM_PTR_INT__g_s_k_s += lastoffset*540;
186                             PRIM_PTR_INT__g_s_l_s += lastoffset*675;
187                             PRIM_PTR_INT__g_s_m_s += lastoffset*825;
188                             continue;
189                         }
190                     }
191 
192                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
193                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
194                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
195                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
196 
197 
198                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
199                     SIMINT_DBLTYPE PQ[3];
200                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
201                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
202                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
203                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
204                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
205                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
206 
207                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
208                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
209                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
210                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
211                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
212                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
213                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
214 
215                     // NOTE: Minus sign!
216                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
217                     SIMINT_DBLTYPE aop_PQ[3];
218                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
219                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
220                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
221 
222                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
223                     SIMINT_DBLTYPE aoq_PQ[3];
224                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
225                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
226                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
227                     // Put a minus sign here so we don't have to in RR routines
228                     a_over_q = SIMINT_NEG(a_over_q);
229 
230 
231                     //////////////////////////////////////////////
232                     // Fjt function section
233                     // Maximum v value: 13
234                     //////////////////////////////////////////////
235                     // The parameter to the Fjt function
236                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
237 
238 
239                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
240 
241 
242                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 13);
243                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
244                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
245                     for(n = 0; n <= 13; n++)
246                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
247 
248                     //////////////////////////////////////////////
249                     // Primitive integrals: Vertical recurrance
250                     //////////////////////////////////////////////
251 
252                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
253                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
254                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
255                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
256                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
257                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
258                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
259                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
260                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
261                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
262                     const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
263                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
264                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
265                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
266                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
267                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
268                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
269                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
270                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
271                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
272 
273 
274 
275                     // Forming PRIM_INT__s_s_p_s[13 * 3];
276                     for(n = 0; n < 13; ++n)  // loop over orders of auxiliary function
277                     {
278 
279                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
280                         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]);
281 
282                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
283                         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]);
284 
285                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
286                         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]);
287 
288                     }
289 
290 
291 
292                     // Forming PRIM_INT__s_s_d_s[12 * 6];
293                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
294                     {
295 
296                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
297                         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]);
298                         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]);
299 
300                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
301                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 1]);
302 
303                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
304                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 2]);
305 
306                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
307                         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]);
308                         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]);
309 
310                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
311                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 4]);
312 
313                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
314                         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]);
315                         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]);
316 
317                     }
318 
319 
320 
321                     // Forming PRIM_INT__s_s_f_s[11 * 10];
322                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
323                     {
324 
325                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
326                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 0]);
327                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_s_f_s[n * 10 + 0]);
328 
329                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
330                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 1]);
331 
332                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
333                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 2]);
334 
335                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
336                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 3]);
337 
338                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
339                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_f_s[n * 10 + 4]);
340 
341                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
342                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 5]);
343 
344                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
345                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 6]);
346                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_s_f_s[n * 10 + 6]);
347 
348                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
349                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 7]);
350 
351                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
352                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 8]);
353 
354                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
355                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 9]);
356                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_s_f_s[n * 10 + 9]);
357 
358                     }
359 
360 
361                     VRR_K_s_s_g_s(
362                             PRIM_INT__s_s_g_s,
363                             PRIM_INT__s_s_f_s,
364                             PRIM_INT__s_s_d_s,
365                             Q_PA,
366                             a_over_q,
367                             aoq_PQ,
368                             one_over_2q,
369                             10);
370 
371 
372                     VRR_K_s_s_h_s(
373                             PRIM_INT__s_s_h_s,
374                             PRIM_INT__s_s_g_s,
375                             PRIM_INT__s_s_f_s,
376                             Q_PA,
377                             a_over_q,
378                             aoq_PQ,
379                             one_over_2q,
380                             9);
381 
382 
383                     ostei_general_vrr1_K(6, 8,
384                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
385                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
386 
387 
388                     ostei_general_vrr_I(1, 0, 6, 0, 4,
389                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
390                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
391 
392 
393                     ostei_general_vrr_I(1, 0, 5, 0, 4,
394                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
395                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
396 
397 
398                     ostei_general_vrr_I(2, 0, 6, 0, 3,
399                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
400                             PRIM_INT__p_s_i_s, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);
401 
402 
403                     VRR_I_p_s_g_s(
404                             PRIM_INT__p_s_g_s,
405                             PRIM_INT__s_s_g_s,
406                             PRIM_INT__s_s_f_s,
407                             P_PA,
408                             aop_PQ,
409                             one_over_2pq,
410                             4);
411 
412 
413                     ostei_general_vrr_I(2, 0, 5, 0, 3,
414                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
415                             PRIM_INT__p_s_h_s, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_h_s);
416 
417 
418                     ostei_general_vrr_I(3, 0, 6, 0, 2,
419                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
420                             PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);
421 
422 
423                     VRR_I_p_s_f_s(
424                             PRIM_INT__p_s_f_s,
425                             PRIM_INT__s_s_f_s,
426                             PRIM_INT__s_s_d_s,
427                             P_PA,
428                             aop_PQ,
429                             one_over_2pq,
430                             4);
431 
432 
433                     ostei_general_vrr_I(2, 0, 4, 0, 3,
434                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
435                             PRIM_INT__p_s_g_s, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_g_s);
436 
437 
438                     ostei_general_vrr_I(3, 0, 5, 0, 2,
439                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
440                             PRIM_INT__d_s_h_s, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);
441 
442 
443                     ostei_general_vrr_I(4, 0, 6, 0, 1,
444                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
445                             PRIM_INT__f_s_i_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);
446 
447 
448                     ostei_general_vrr1_K(7, 7,
449                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
450                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
451 
452 
453                     ostei_general_vrr_I(1, 0, 7, 0, 4,
454                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
455                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
456 
457 
458                     ostei_general_vrr_I(2, 0, 7, 0, 3,
459                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
460                             PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);
461 
462 
463                     ostei_general_vrr_I(3, 0, 7, 0, 2,
464                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
465                             PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);
466 
467 
468                     ostei_general_vrr_I(4, 0, 7, 0, 1,
469                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
470                             PRIM_INT__f_s_k_s, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);
471 
472 
473                     ostei_general_vrr1_K(8, 6,
474                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
475                             PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
476 
477 
478                     ostei_general_vrr_I(1, 0, 8, 0, 4,
479                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
480                             PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
481 
482 
483                     ostei_general_vrr_I(2, 0, 8, 0, 3,
484                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
485                             PRIM_INT__p_s_l_s, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_l_s);
486 
487 
488                     ostei_general_vrr_I(3, 0, 8, 0, 2,
489                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
490                             PRIM_INT__d_s_l_s, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_l_s);
491 
492 
493                     ostei_general_vrr_I(4, 0, 8, 0, 1,
494                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
495                             PRIM_INT__f_s_l_s, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_l_s);
496 
497 
498                     ostei_general_vrr1_K(9, 5,
499                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
500                             PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);
501 
502 
503                     ostei_general_vrr_I(1, 0, 9, 0, 4,
504                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
505                             PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);
506 
507 
508                     ostei_general_vrr_I(2, 0, 9, 0, 3,
509                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
510                             PRIM_INT__p_s_m_s, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_m_s);
511 
512 
513                     ostei_general_vrr_I(3, 0, 9, 0, 2,
514                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
515                             PRIM_INT__d_s_m_s, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_m_s);
516 
517 
518                     ostei_general_vrr_I(4, 0, 9, 0, 1,
519                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
520                             PRIM_INT__f_s_m_s, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_m_s);
521 
522 
523 
524 
525                     ////////////////////////////////////
526                     // Accumulate contracted integrals
527                     ////////////////////////////////////
528                     if(lastoffset == 0)
529                     {
530                         contract_all(420, PRIM_INT__g_s_i_s, PRIM_PTR_INT__g_s_i_s);
531                         contract_all(540, PRIM_INT__g_s_k_s, PRIM_PTR_INT__g_s_k_s);
532                         contract_all(675, PRIM_INT__g_s_l_s, PRIM_PTR_INT__g_s_l_s);
533                         contract_all(825, PRIM_INT__g_s_m_s, PRIM_PTR_INT__g_s_m_s);
534                     }
535                     else
536                     {
537                         contract(420, shelloffsets, PRIM_INT__g_s_i_s, PRIM_PTR_INT__g_s_i_s);
538                         contract(540, shelloffsets, PRIM_INT__g_s_k_s, PRIM_PTR_INT__g_s_k_s);
539                         contract(675, shelloffsets, PRIM_INT__g_s_l_s, PRIM_PTR_INT__g_s_l_s);
540                         contract(825, shelloffsets, PRIM_INT__g_s_m_s, PRIM_PTR_INT__g_s_m_s);
541                         PRIM_PTR_INT__g_s_i_s += lastoffset*420;
542                         PRIM_PTR_INT__g_s_k_s += lastoffset*540;
543                         PRIM_PTR_INT__g_s_l_s += lastoffset*675;
544                         PRIM_PTR_INT__g_s_m_s += lastoffset*825;
545                     }
546 
547                 }  // close loop over j
548             }  // close loop over i
549 
550             //Advance to the next batch
551             jstart = SIMINT_SIMD_ROUND(jend);
552 
553             //////////////////////////////////////////////
554             // Contracted integrals: Horizontal recurrance
555             //////////////////////////////////////////////
556 
557 
558 
559 
560             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
561             {
562                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
563 
564                 // set up HRR pointers
565                 double const * restrict HRR_INT__g_s_i_s = INT__g_s_i_s + abcd * 420;
566                 double const * restrict HRR_INT__g_s_k_s = INT__g_s_k_s + abcd * 540;
567                 double const * restrict HRR_INT__g_s_l_s = INT__g_s_l_s + abcd * 675;
568                 double const * restrict HRR_INT__g_s_m_s = INT__g_s_m_s + abcd * 825;
569                 double * restrict HRR_INT__g_s_i_f = INT__g_s_i_f + real_abcd * 4200;
570 
571                 // form INT__g_s_i_p
572                 ostei_general_hrr_L(4, 0, 6, 1, hCD, HRR_INT__g_s_k_s, HRR_INT__g_s_i_s, HRR_INT__g_s_i_p);
573 
574                 // form INT__g_s_k_p
575                 ostei_general_hrr_L(4, 0, 7, 1, hCD, HRR_INT__g_s_l_s, HRR_INT__g_s_k_s, HRR_INT__g_s_k_p);
576 
577                 // form INT__g_s_l_p
578                 ostei_general_hrr_L(4, 0, 8, 1, hCD, HRR_INT__g_s_m_s, HRR_INT__g_s_l_s, HRR_INT__g_s_l_p);
579 
580                 // form INT__g_s_i_d
581                 ostei_general_hrr_L(4, 0, 6, 2, hCD, HRR_INT__g_s_k_p, HRR_INT__g_s_i_p, HRR_INT__g_s_i_d);
582 
583                 // form INT__g_s_k_d
584                 ostei_general_hrr_L(4, 0, 7, 2, hCD, HRR_INT__g_s_l_p, HRR_INT__g_s_k_p, HRR_INT__g_s_k_d);
585 
586                 // form INT__g_s_i_f
587                 ostei_general_hrr_L(4, 0, 6, 3, hCD, HRR_INT__g_s_k_d, HRR_INT__g_s_i_d, HRR_INT__g_s_i_f);
588 
589 
590             }  // close HRR loop
591 
592 
593         }   // close loop cdbatch
594 
595         istart = iend;
596     }  // close loop over ab
597 
598     return P.nshell12_clip * Q.nshell12_clip;
599 }
600 
ostei_s_g_i_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_g_i_f)601 int ostei_s_g_i_f(struct simint_multi_shellpair const P,
602                   struct simint_multi_shellpair const Q,
603                   double screen_tol,
604                   double * const restrict work,
605                   double * const restrict INT__s_g_i_f)
606 {
607     double P_AB[3*P.nshell12];
608     struct simint_multi_shellpair P_tmp = P;
609     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
610     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
611     P_tmp.AB_x = P_AB;
612     P_tmp.AB_y = P_AB + P.nshell12;
613     P_tmp.AB_z = P_AB + 2*P.nshell12;
614 
615     for(int i = 0; i < P.nshell12; i++)
616     {
617         P_tmp.AB_x[i] = -P.AB_x[i];
618         P_tmp.AB_y[i] = -P.AB_y[i];
619         P_tmp.AB_z[i] = -P.AB_z[i];
620     }
621 
622     int ret = ostei_g_s_i_f(P_tmp, Q, screen_tol, work, INT__s_g_i_f);
623     double buffer[4200] SIMINT_ALIGN_ARRAY_DBL;
624 
625     for(int q = 0; q < ret; q++)
626     {
627         int idx = 0;
628         for(int a = 0; a < 1; ++a)
629         for(int b = 0; b < 15; ++b)
630         for(int c = 0; c < 28; ++c)
631         for(int d = 0; d < 10; ++d)
632             buffer[idx++] = INT__s_g_i_f[q*4200+b*280+a*280+c*10+d];
633 
634         memcpy(INT__s_g_i_f+q*4200, buffer, 4200*sizeof(double));
635     }
636 
637     return ret;
638 }
639 
ostei_g_s_f_i(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_s_f_i)640 int ostei_g_s_f_i(struct simint_multi_shellpair const P,
641                   struct simint_multi_shellpair const Q,
642                   double screen_tol,
643                   double * const restrict work,
644                   double * const restrict INT__g_s_f_i)
645 {
646     double Q_AB[3*Q.nshell12];
647     struct simint_multi_shellpair Q_tmp = Q;
648     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
649     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
650     Q_tmp.AB_x = Q_AB;
651     Q_tmp.AB_y = Q_AB + Q.nshell12;
652     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
653 
654     for(int i = 0; i < Q.nshell12; i++)
655     {
656         Q_tmp.AB_x[i] = -Q.AB_x[i];
657         Q_tmp.AB_y[i] = -Q.AB_y[i];
658         Q_tmp.AB_z[i] = -Q.AB_z[i];
659     }
660 
661     int ret = ostei_g_s_i_f(P, Q_tmp, screen_tol, work, INT__g_s_f_i);
662     double buffer[4200] SIMINT_ALIGN_ARRAY_DBL;
663 
664     for(int q = 0; q < ret; q++)
665     {
666         int idx = 0;
667         for(int a = 0; a < 15; ++a)
668         for(int b = 0; b < 1; ++b)
669         for(int c = 0; c < 10; ++c)
670         for(int d = 0; d < 28; ++d)
671             buffer[idx++] = INT__g_s_f_i[q*4200+a*280+b*280+d*10+c];
672 
673         memcpy(INT__g_s_f_i+q*4200, buffer, 4200*sizeof(double));
674     }
675 
676     return ret;
677 }
678 
ostei_s_g_f_i(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_g_f_i)679 int ostei_s_g_f_i(struct simint_multi_shellpair const P,
680                   struct simint_multi_shellpair const Q,
681                   double screen_tol,
682                   double * const restrict work,
683                   double * const restrict INT__s_g_f_i)
684 {
685     double P_AB[3*P.nshell12];
686     struct simint_multi_shellpair P_tmp = P;
687     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
688     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
689     P_tmp.AB_x = P_AB;
690     P_tmp.AB_y = P_AB + P.nshell12;
691     P_tmp.AB_z = P_AB + 2*P.nshell12;
692 
693     for(int i = 0; i < P.nshell12; i++)
694     {
695         P_tmp.AB_x[i] = -P.AB_x[i];
696         P_tmp.AB_y[i] = -P.AB_y[i];
697         P_tmp.AB_z[i] = -P.AB_z[i];
698     }
699 
700     double Q_AB[3*Q.nshell12];
701     struct simint_multi_shellpair Q_tmp = Q;
702     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
703     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
704     Q_tmp.AB_x = Q_AB;
705     Q_tmp.AB_y = Q_AB + Q.nshell12;
706     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
707 
708     for(int i = 0; i < Q.nshell12; i++)
709     {
710         Q_tmp.AB_x[i] = -Q.AB_x[i];
711         Q_tmp.AB_y[i] = -Q.AB_y[i];
712         Q_tmp.AB_z[i] = -Q.AB_z[i];
713     }
714 
715     int ret = ostei_g_s_i_f(P_tmp, Q_tmp, screen_tol, work, INT__s_g_f_i);
716     double buffer[4200] SIMINT_ALIGN_ARRAY_DBL;
717 
718     for(int q = 0; q < ret; q++)
719     {
720         int idx = 0;
721         for(int a = 0; a < 1; ++a)
722         for(int b = 0; b < 15; ++b)
723         for(int c = 0; c < 10; ++c)
724         for(int d = 0; d < 28; ++d)
725             buffer[idx++] = INT__s_g_f_i[q*4200+b*280+a*280+d*10+c];
726 
727         memcpy(INT__s_g_f_i+q*4200, buffer, 4200*sizeof(double));
728     }
729 
730     return ret;
731 }
732 
733