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