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