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_d_s_k_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_s_k_i)8 int ostei_d_s_k_i(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__d_s_k_i)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__d_s_k_i);
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__d_s_k_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__d_s_l_s = work + (SIMINT_NSHELL_SIMD * 216);
30     double * const INT__d_s_m_s = work + (SIMINT_NSHELL_SIMD * 486);
31     double * const INT__d_s_n_s = work + (SIMINT_NSHELL_SIMD * 816);
32     double * const INT__d_s_o_s = work + (SIMINT_NSHELL_SIMD * 1212);
33     double * const INT__d_s_q_s = work + (SIMINT_NSHELL_SIMD * 1680);
34     double * const INT__d_s_r_s = work + (SIMINT_NSHELL_SIMD * 2226);
35     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*2856);
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 16;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 61;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 145;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 275;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 455;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 686;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 966;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1290;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 1650;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_n_s = primwork + 2035;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_o_s = primwork + 2431;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_q_s = primwork + 2821;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_r_s = primwork + 3185;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 3500;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 3668;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 3884;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 4154;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_n_s = primwork + 4484;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_o_s = primwork + 4880;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_q_s = primwork + 5348;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_r_s = primwork + 5894;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 6524;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 6740;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 7010;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_n_s = primwork + 7340;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_o_s = primwork + 7736;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_q_s = primwork + 8204;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_r_s = primwork + 8750;
65     double * const hrrwork = (double *)(primwork + 9380);
66     double * const HRR_INT__d_s_k_p = hrrwork + 0;
67     double * const HRR_INT__d_s_k_d = hrrwork + 648;
68     double * const HRR_INT__d_s_k_f = hrrwork + 1944;
69     double * const HRR_INT__d_s_k_g = hrrwork + 4104;
70     double * const HRR_INT__d_s_k_h = hrrwork + 7344;
71     double * const HRR_INT__d_s_l_p = hrrwork + 11880;
72     double * const HRR_INT__d_s_l_d = hrrwork + 12690;
73     double * const HRR_INT__d_s_l_f = hrrwork + 14310;
74     double * const HRR_INT__d_s_l_g = hrrwork + 17010;
75     double * const HRR_INT__d_s_l_h = hrrwork + 21060;
76     double * const HRR_INT__d_s_m_p = hrrwork + 26730;
77     double * const HRR_INT__d_s_m_d = hrrwork + 27720;
78     double * const HRR_INT__d_s_m_f = hrrwork + 29700;
79     double * const HRR_INT__d_s_m_g = hrrwork + 33000;
80     double * const HRR_INT__d_s_n_p = hrrwork + 37950;
81     double * const HRR_INT__d_s_n_d = hrrwork + 39138;
82     double * const HRR_INT__d_s_n_f = hrrwork + 41514;
83     double * const HRR_INT__d_s_o_p = hrrwork + 45474;
84     double * const HRR_INT__d_s_o_d = hrrwork + 46878;
85     double * const HRR_INT__d_s_q_p = hrrwork + 49686;
86 
87 
88     // Create constants
89     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
90     const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
91     const SIMINT_DBLTYPE const_11 = SIMINT_DBLSET1(11);
92     const SIMINT_DBLTYPE const_12 = SIMINT_DBLSET1(12);
93     const SIMINT_DBLTYPE const_13 = SIMINT_DBLSET1(13);
94     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
95     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
96     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
97     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
98     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
99     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
100     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
101     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
102     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
103 
104 
105     ////////////////////////////////////////
106     // Loop over shells and primitives
107     ////////////////////////////////////////
108 
109     real_abcd = 0;
110     istart = 0;
111     for(ab = 0; ab < P.nshell12_clip; ++ab)
112     {
113         const int iend = istart + P.nprim12[ab];
114 
115         cd = 0;
116         jstart = 0;
117 
118         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
119         {
120             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
121             int jend = jstart;
122             for(i = 0; i < nshellbatch; i++)
123                 jend += Q.nprim12[cd+i];
124 
125             // Clear the beginning of the workspace (where we are accumulating integrals)
126             memset(work, 0, SIMINT_NSHELL_SIMD * 2856 * sizeof(double));
127             abcd = 0;
128 
129 
130             for(i = istart; i < iend; ++i)
131             {
132                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
133 
134                 if(check_screen)
135                 {
136                     // Skip this whole thing if always insignificant
137                     if((P.screen[i] * Q.screen_max) < screen_tol)
138                         continue;
139                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
140                 }
141 
142                 icd = 0;
143                 iprimcd = 0;
144                 nprim_icd = Q.nprim12[cd];
145                 double * restrict PRIM_PTR_INT__d_s_k_s = INT__d_s_k_s + abcd * 216;
146                 double * restrict PRIM_PTR_INT__d_s_l_s = INT__d_s_l_s + abcd * 270;
147                 double * restrict PRIM_PTR_INT__d_s_m_s = INT__d_s_m_s + abcd * 330;
148                 double * restrict PRIM_PTR_INT__d_s_n_s = INT__d_s_n_s + abcd * 396;
149                 double * restrict PRIM_PTR_INT__d_s_o_s = INT__d_s_o_s + abcd * 468;
150                 double * restrict PRIM_PTR_INT__d_s_q_s = INT__d_s_q_s + abcd * 546;
151                 double * restrict PRIM_PTR_INT__d_s_r_s = INT__d_s_r_s + abcd * 630;
152 
153 
154 
155                 // Load these one per loop over i
156                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
157                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
158                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
159 
160                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
161 
162                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
163                 {
164                     // calculate the shell offsets
165                     // these are the offset from the shell pointed to by cd
166                     // for each element
167                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
168                     int lastoffset = 0;
169                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
170 
171                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
172                     {
173                         // Handle if the first element of the vector is a new shell
174                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
175                         {
176                             nprim_icd += Q.nprim12[cd + (++icd)];
177                             PRIM_PTR_INT__d_s_k_s += 216;
178                             PRIM_PTR_INT__d_s_l_s += 270;
179                             PRIM_PTR_INT__d_s_m_s += 330;
180                             PRIM_PTR_INT__d_s_n_s += 396;
181                             PRIM_PTR_INT__d_s_o_s += 468;
182                             PRIM_PTR_INT__d_s_q_s += 546;
183                             PRIM_PTR_INT__d_s_r_s += 630;
184                         }
185                         iprimcd++;
186                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
187                         {
188                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
189                             {
190                                 shelloffsets[n] = shelloffsets[n-1] + 1;
191                                 lastoffset++;
192                                 nprim_icd += Q.nprim12[cd + (++icd)];
193                             }
194                             else
195                                 shelloffsets[n] = shelloffsets[n-1];
196                             iprimcd++;
197                         }
198                     }
199                     else
200                         iprimcd += SIMINT_SIMD_LEN;
201 
202                     // Do we have to compute this vector (or has it been screened out)?
203                     // (not_screened != 0 means we have to do this vector)
204                     if(check_screen)
205                     {
206                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
207                         if(vmax < screen_tol)
208                         {
209                             PRIM_PTR_INT__d_s_k_s += lastoffset*216;
210                             PRIM_PTR_INT__d_s_l_s += lastoffset*270;
211                             PRIM_PTR_INT__d_s_m_s += lastoffset*330;
212                             PRIM_PTR_INT__d_s_n_s += lastoffset*396;
213                             PRIM_PTR_INT__d_s_o_s += lastoffset*468;
214                             PRIM_PTR_INT__d_s_q_s += lastoffset*546;
215                             PRIM_PTR_INT__d_s_r_s += lastoffset*630;
216                             continue;
217                         }
218                     }
219 
220                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
221                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
222                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
223                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
224 
225 
226                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
227                     SIMINT_DBLTYPE PQ[3];
228                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
229                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
230                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
231                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
232                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
233                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
234 
235                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
236                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
237                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
238                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
239                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
240                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
241                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
242 
243                     // NOTE: Minus sign!
244                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
245                     SIMINT_DBLTYPE aop_PQ[3];
246                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
247                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
248                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
249 
250                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
251                     SIMINT_DBLTYPE aoq_PQ[3];
252                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
253                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
254                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
255                     // Put a minus sign here so we don't have to in RR routines
256                     a_over_q = SIMINT_NEG(a_over_q);
257 
258 
259                     //////////////////////////////////////////////
260                     // Fjt function section
261                     // Maximum v value: 15
262                     //////////////////////////////////////////////
263                     // The parameter to the Fjt function
264                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
265 
266 
267                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
268 
269 
270                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 15);
271                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
272                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
273                     for(n = 0; n <= 15; n++)
274                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
275 
276                     //////////////////////////////////////////////
277                     // Primitive integrals: Vertical recurrance
278                     //////////////////////////////////////////////
279 
280                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
281                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
282                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
283                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
284                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
285                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
286                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
287                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
288                     const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
289                     const SIMINT_DBLTYPE vrr_const_9_over_2q = SIMINT_MUL(const_9, one_over_2q);
290                     const SIMINT_DBLTYPE vrr_const_10_over_2q = SIMINT_MUL(const_10, one_over_2q);
291                     const SIMINT_DBLTYPE vrr_const_11_over_2q = SIMINT_MUL(const_11, one_over_2q);
292                     const SIMINT_DBLTYPE vrr_const_12_over_2q = SIMINT_MUL(const_12, one_over_2q);
293                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
294                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
295                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
296                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
297                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
298                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
299                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
300                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
301                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
302                     const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
303                     const SIMINT_DBLTYPE vrr_const_11_over_2pq = SIMINT_MUL(const_11, one_over_2pq);
304                     const SIMINT_DBLTYPE vrr_const_12_over_2pq = SIMINT_MUL(const_12, one_over_2pq);
305                     const SIMINT_DBLTYPE vrr_const_13_over_2pq = SIMINT_MUL(const_13, one_over_2pq);
306 
307 
308 
309                     // Forming PRIM_INT__s_s_p_s[15 * 3];
310                     for(n = 0; n < 15; ++n)  // loop over orders of auxiliary function
311                     {
312 
313                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
314                         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]);
315 
316                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
317                         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]);
318 
319                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
320                         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]);
321 
322                     }
323 
324 
325 
326                     // Forming PRIM_INT__s_s_d_s[14 * 6];
327                     for(n = 0; n < 14; ++n)  // loop over orders of auxiliary function
328                     {
329 
330                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
331                         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]);
332                         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]);
333 
334                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
335                         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]);
336                         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]);
337 
338                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
339                         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]);
340                         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]);
341 
342                     }
343 
344 
345 
346                     // Forming PRIM_INT__s_s_f_s[13 * 10];
347                     for(n = 0; n < 13; ++n)  // loop over orders of auxiliary function
348                     {
349 
350                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
351                         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]);
352                         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]);
353 
354                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
355                         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]);
356 
357                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
358                         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]);
359 
360                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
361                         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]);
362                         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]);
363 
364                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
365                         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]);
366 
367                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
368                         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]);
369                         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]);
370 
371                     }
372 
373 
374                     VRR_K_s_s_g_s(
375                             PRIM_INT__s_s_g_s,
376                             PRIM_INT__s_s_f_s,
377                             PRIM_INT__s_s_d_s,
378                             Q_PA,
379                             a_over_q,
380                             aoq_PQ,
381                             one_over_2q,
382                             12);
383 
384 
385                     VRR_K_s_s_h_s(
386                             PRIM_INT__s_s_h_s,
387                             PRIM_INT__s_s_g_s,
388                             PRIM_INT__s_s_f_s,
389                             Q_PA,
390                             a_over_q,
391                             aoq_PQ,
392                             one_over_2q,
393                             11);
394 
395 
396                     ostei_general_vrr1_K(6, 10,
397                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
398                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
399 
400 
401                     ostei_general_vrr1_K(7, 9,
402                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
403                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
404 
405 
406                     ostei_general_vrr_I(1, 0, 7, 0, 2,
407                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
408                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
409 
410 
411                     ostei_general_vrr_I(1, 0, 6, 0, 2,
412                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
413                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
414 
415 
416                     ostei_general_vrr_I(2, 0, 7, 0, 1,
417                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
418                             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);
419 
420 
421                     ostei_general_vrr1_K(8, 8,
422                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
423                             PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
424 
425 
426                     ostei_general_vrr_I(1, 0, 8, 0, 2,
427                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
428                             PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
429 
430 
431                     ostei_general_vrr_I(2, 0, 8, 0, 1,
432                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
433                             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);
434 
435 
436                     ostei_general_vrr1_K(9, 7,
437                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
438                             PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);
439 
440 
441                     ostei_general_vrr_I(1, 0, 9, 0, 2,
442                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
443                             PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);
444 
445 
446                     ostei_general_vrr_I(2, 0, 9, 0, 1,
447                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
448                             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);
449 
450 
451                     ostei_general_vrr1_K(10, 6,
452                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
453                             PRIM_INT__s_s_m_s, PRIM_INT__s_s_l_s, PRIM_INT__s_s_n_s);
454 
455 
456                     ostei_general_vrr_I(1, 0, 10, 0, 2,
457                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
458                             PRIM_INT__s_s_n_s, NULL, NULL, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_n_s);
459 
460 
461                     ostei_general_vrr_I(2, 0, 10, 0, 1,
462                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
463                             PRIM_INT__p_s_n_s, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_n_s);
464 
465 
466                     ostei_general_vrr1_K(11, 5,
467                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
468                             PRIM_INT__s_s_n_s, PRIM_INT__s_s_m_s, PRIM_INT__s_s_o_s);
469 
470 
471                     ostei_general_vrr_I(1, 0, 11, 0, 2,
472                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
473                             PRIM_INT__s_s_o_s, NULL, NULL, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_o_s);
474 
475 
476                     ostei_general_vrr_I(2, 0, 11, 0, 1,
477                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
478                             PRIM_INT__p_s_o_s, PRIM_INT__s_s_o_s, NULL, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_o_s);
479 
480 
481                     ostei_general_vrr1_K(12, 4,
482                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
483                             PRIM_INT__s_s_o_s, PRIM_INT__s_s_n_s, PRIM_INT__s_s_q_s);
484 
485 
486                     ostei_general_vrr_I(1, 0, 12, 0, 2,
487                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
488                             PRIM_INT__s_s_q_s, NULL, NULL, PRIM_INT__s_s_o_s, NULL, PRIM_INT__p_s_q_s);
489 
490 
491                     ostei_general_vrr_I(2, 0, 12, 0, 1,
492                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
493                             PRIM_INT__p_s_q_s, PRIM_INT__s_s_q_s, NULL, PRIM_INT__p_s_o_s, NULL, PRIM_INT__d_s_q_s);
494 
495 
496                     ostei_general_vrr1_K(13, 3,
497                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
498                             PRIM_INT__s_s_q_s, PRIM_INT__s_s_o_s, PRIM_INT__s_s_r_s);
499 
500 
501                     ostei_general_vrr_I(1, 0, 13, 0, 2,
502                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
503                             PRIM_INT__s_s_r_s, NULL, NULL, PRIM_INT__s_s_q_s, NULL, PRIM_INT__p_s_r_s);
504 
505 
506                     ostei_general_vrr_I(2, 0, 13, 0, 1,
507                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
508                             PRIM_INT__p_s_r_s, PRIM_INT__s_s_r_s, NULL, PRIM_INT__p_s_q_s, NULL, PRIM_INT__d_s_r_s);
509 
510 
511 
512 
513                     ////////////////////////////////////
514                     // Accumulate contracted integrals
515                     ////////////////////////////////////
516                     if(lastoffset == 0)
517                     {
518                         contract_all(216, PRIM_INT__d_s_k_s, PRIM_PTR_INT__d_s_k_s);
519                         contract_all(270, PRIM_INT__d_s_l_s, PRIM_PTR_INT__d_s_l_s);
520                         contract_all(330, PRIM_INT__d_s_m_s, PRIM_PTR_INT__d_s_m_s);
521                         contract_all(396, PRIM_INT__d_s_n_s, PRIM_PTR_INT__d_s_n_s);
522                         contract_all(468, PRIM_INT__d_s_o_s, PRIM_PTR_INT__d_s_o_s);
523                         contract_all(546, PRIM_INT__d_s_q_s, PRIM_PTR_INT__d_s_q_s);
524                         contract_all(630, PRIM_INT__d_s_r_s, PRIM_PTR_INT__d_s_r_s);
525                     }
526                     else
527                     {
528                         contract(216, shelloffsets, PRIM_INT__d_s_k_s, PRIM_PTR_INT__d_s_k_s);
529                         contract(270, shelloffsets, PRIM_INT__d_s_l_s, PRIM_PTR_INT__d_s_l_s);
530                         contract(330, shelloffsets, PRIM_INT__d_s_m_s, PRIM_PTR_INT__d_s_m_s);
531                         contract(396, shelloffsets, PRIM_INT__d_s_n_s, PRIM_PTR_INT__d_s_n_s);
532                         contract(468, shelloffsets, PRIM_INT__d_s_o_s, PRIM_PTR_INT__d_s_o_s);
533                         contract(546, shelloffsets, PRIM_INT__d_s_q_s, PRIM_PTR_INT__d_s_q_s);
534                         contract(630, shelloffsets, PRIM_INT__d_s_r_s, PRIM_PTR_INT__d_s_r_s);
535                         PRIM_PTR_INT__d_s_k_s += lastoffset*216;
536                         PRIM_PTR_INT__d_s_l_s += lastoffset*270;
537                         PRIM_PTR_INT__d_s_m_s += lastoffset*330;
538                         PRIM_PTR_INT__d_s_n_s += lastoffset*396;
539                         PRIM_PTR_INT__d_s_o_s += lastoffset*468;
540                         PRIM_PTR_INT__d_s_q_s += lastoffset*546;
541                         PRIM_PTR_INT__d_s_r_s += lastoffset*630;
542                     }
543 
544                 }  // close loop over j
545             }  // close loop over i
546 
547             //Advance to the next batch
548             jstart = SIMINT_SIMD_ROUND(jend);
549 
550             //////////////////////////////////////////////
551             // Contracted integrals: Horizontal recurrance
552             //////////////////////////////////////////////
553 
554 
555 
556 
557             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
558             {
559                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
560 
561                 // set up HRR pointers
562                 double const * restrict HRR_INT__d_s_k_s = INT__d_s_k_s + abcd * 216;
563                 double const * restrict HRR_INT__d_s_l_s = INT__d_s_l_s + abcd * 270;
564                 double const * restrict HRR_INT__d_s_m_s = INT__d_s_m_s + abcd * 330;
565                 double const * restrict HRR_INT__d_s_n_s = INT__d_s_n_s + abcd * 396;
566                 double const * restrict HRR_INT__d_s_o_s = INT__d_s_o_s + abcd * 468;
567                 double const * restrict HRR_INT__d_s_q_s = INT__d_s_q_s + abcd * 546;
568                 double const * restrict HRR_INT__d_s_r_s = INT__d_s_r_s + abcd * 630;
569                 double * restrict HRR_INT__d_s_k_i = INT__d_s_k_i + real_abcd * 6048;
570 
571                 // form INT__d_s_k_p
572                 ostei_general_hrr_L(2, 0, 7, 1, hCD, HRR_INT__d_s_l_s, HRR_INT__d_s_k_s, HRR_INT__d_s_k_p);
573 
574                 // form INT__d_s_l_p
575                 ostei_general_hrr_L(2, 0, 8, 1, hCD, HRR_INT__d_s_m_s, HRR_INT__d_s_l_s, HRR_INT__d_s_l_p);
576 
577                 // form INT__d_s_m_p
578                 ostei_general_hrr_L(2, 0, 9, 1, hCD, HRR_INT__d_s_n_s, HRR_INT__d_s_m_s, HRR_INT__d_s_m_p);
579 
580                 // form INT__d_s_n_p
581                 ostei_general_hrr_L(2, 0, 10, 1, hCD, HRR_INT__d_s_o_s, HRR_INT__d_s_n_s, HRR_INT__d_s_n_p);
582 
583                 // form INT__d_s_o_p
584                 ostei_general_hrr_L(2, 0, 11, 1, hCD, HRR_INT__d_s_q_s, HRR_INT__d_s_o_s, HRR_INT__d_s_o_p);
585 
586                 // form INT__d_s_q_p
587                 ostei_general_hrr_L(2, 0, 12, 1, hCD, HRR_INT__d_s_r_s, HRR_INT__d_s_q_s, HRR_INT__d_s_q_p);
588 
589                 // form INT__d_s_k_d
590                 ostei_general_hrr_L(2, 0, 7, 2, hCD, HRR_INT__d_s_l_p, HRR_INT__d_s_k_p, HRR_INT__d_s_k_d);
591 
592                 // form INT__d_s_l_d
593                 ostei_general_hrr_L(2, 0, 8, 2, hCD, HRR_INT__d_s_m_p, HRR_INT__d_s_l_p, HRR_INT__d_s_l_d);
594 
595                 // form INT__d_s_m_d
596                 ostei_general_hrr_L(2, 0, 9, 2, hCD, HRR_INT__d_s_n_p, HRR_INT__d_s_m_p, HRR_INT__d_s_m_d);
597 
598                 // form INT__d_s_n_d
599                 ostei_general_hrr_L(2, 0, 10, 2, hCD, HRR_INT__d_s_o_p, HRR_INT__d_s_n_p, HRR_INT__d_s_n_d);
600 
601                 // form INT__d_s_o_d
602                 ostei_general_hrr_L(2, 0, 11, 2, hCD, HRR_INT__d_s_q_p, HRR_INT__d_s_o_p, HRR_INT__d_s_o_d);
603 
604                 // form INT__d_s_k_f
605                 ostei_general_hrr_L(2, 0, 7, 3, hCD, HRR_INT__d_s_l_d, HRR_INT__d_s_k_d, HRR_INT__d_s_k_f);
606 
607                 // form INT__d_s_l_f
608                 ostei_general_hrr_L(2, 0, 8, 3, hCD, HRR_INT__d_s_m_d, HRR_INT__d_s_l_d, HRR_INT__d_s_l_f);
609 
610                 // form INT__d_s_m_f
611                 ostei_general_hrr_L(2, 0, 9, 3, hCD, HRR_INT__d_s_n_d, HRR_INT__d_s_m_d, HRR_INT__d_s_m_f);
612 
613                 // form INT__d_s_n_f
614                 ostei_general_hrr_L(2, 0, 10, 3, hCD, HRR_INT__d_s_o_d, HRR_INT__d_s_n_d, HRR_INT__d_s_n_f);
615 
616                 // form INT__d_s_k_g
617                 ostei_general_hrr_L(2, 0, 7, 4, hCD, HRR_INT__d_s_l_f, HRR_INT__d_s_k_f, HRR_INT__d_s_k_g);
618 
619                 // form INT__d_s_l_g
620                 ostei_general_hrr_L(2, 0, 8, 4, hCD, HRR_INT__d_s_m_f, HRR_INT__d_s_l_f, HRR_INT__d_s_l_g);
621 
622                 // form INT__d_s_m_g
623                 ostei_general_hrr_L(2, 0, 9, 4, hCD, HRR_INT__d_s_n_f, HRR_INT__d_s_m_f, HRR_INT__d_s_m_g);
624 
625                 // form INT__d_s_k_h
626                 ostei_general_hrr_L(2, 0, 7, 5, hCD, HRR_INT__d_s_l_g, HRR_INT__d_s_k_g, HRR_INT__d_s_k_h);
627 
628                 // form INT__d_s_l_h
629                 ostei_general_hrr_L(2, 0, 8, 5, hCD, HRR_INT__d_s_m_g, HRR_INT__d_s_l_g, HRR_INT__d_s_l_h);
630 
631                 // form INT__d_s_k_i
632                 ostei_general_hrr_L(2, 0, 7, 6, hCD, HRR_INT__d_s_l_h, HRR_INT__d_s_k_h, HRR_INT__d_s_k_i);
633 
634 
635             }  // close HRR loop
636 
637 
638         }   // close loop cdbatch
639 
640         istart = iend;
641     }  // close loop over ab
642 
643     return P.nshell12_clip * Q.nshell12_clip;
644 }
645 
ostei_s_d_k_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_d_k_i)646 int ostei_s_d_k_i(struct simint_multi_shellpair const P,
647                   struct simint_multi_shellpair const Q,
648                   double screen_tol,
649                   double * const restrict work,
650                   double * const restrict INT__s_d_k_i)
651 {
652     double P_AB[3*P.nshell12];
653     struct simint_multi_shellpair P_tmp = P;
654     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
655     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
656     P_tmp.AB_x = P_AB;
657     P_tmp.AB_y = P_AB + P.nshell12;
658     P_tmp.AB_z = P_AB + 2*P.nshell12;
659 
660     for(int i = 0; i < P.nshell12; i++)
661     {
662         P_tmp.AB_x[i] = -P.AB_x[i];
663         P_tmp.AB_y[i] = -P.AB_y[i];
664         P_tmp.AB_z[i] = -P.AB_z[i];
665     }
666 
667     int ret = ostei_d_s_k_i(P_tmp, Q, screen_tol, work, INT__s_d_k_i);
668     double buffer[6048] SIMINT_ALIGN_ARRAY_DBL;
669 
670     for(int q = 0; q < ret; q++)
671     {
672         int idx = 0;
673         for(int a = 0; a < 1; ++a)
674         for(int b = 0; b < 6; ++b)
675         for(int c = 0; c < 36; ++c)
676         for(int d = 0; d < 28; ++d)
677             buffer[idx++] = INT__s_d_k_i[q*6048+b*1008+a*1008+c*28+d];
678 
679         memcpy(INT__s_d_k_i+q*6048, buffer, 6048*sizeof(double));
680     }
681 
682     return ret;
683 }
684 
ostei_d_s_i_k(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_s_i_k)685 int ostei_d_s_i_k(struct simint_multi_shellpair const P,
686                   struct simint_multi_shellpair const Q,
687                   double screen_tol,
688                   double * const restrict work,
689                   double * const restrict INT__d_s_i_k)
690 {
691     double Q_AB[3*Q.nshell12];
692     struct simint_multi_shellpair Q_tmp = Q;
693     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
694     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
695     Q_tmp.AB_x = Q_AB;
696     Q_tmp.AB_y = Q_AB + Q.nshell12;
697     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
698 
699     for(int i = 0; i < Q.nshell12; i++)
700     {
701         Q_tmp.AB_x[i] = -Q.AB_x[i];
702         Q_tmp.AB_y[i] = -Q.AB_y[i];
703         Q_tmp.AB_z[i] = -Q.AB_z[i];
704     }
705 
706     int ret = ostei_d_s_k_i(P, Q_tmp, screen_tol, work, INT__d_s_i_k);
707     double buffer[6048] SIMINT_ALIGN_ARRAY_DBL;
708 
709     for(int q = 0; q < ret; q++)
710     {
711         int idx = 0;
712         for(int a = 0; a < 6; ++a)
713         for(int b = 0; b < 1; ++b)
714         for(int c = 0; c < 28; ++c)
715         for(int d = 0; d < 36; ++d)
716             buffer[idx++] = INT__d_s_i_k[q*6048+a*1008+b*1008+d*28+c];
717 
718         memcpy(INT__d_s_i_k+q*6048, buffer, 6048*sizeof(double));
719     }
720 
721     return ret;
722 }
723 
ostei_s_d_i_k(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_d_i_k)724 int ostei_s_d_i_k(struct simint_multi_shellpair const P,
725                   struct simint_multi_shellpair const Q,
726                   double screen_tol,
727                   double * const restrict work,
728                   double * const restrict INT__s_d_i_k)
729 {
730     double P_AB[3*P.nshell12];
731     struct simint_multi_shellpair P_tmp = P;
732     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
733     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
734     P_tmp.AB_x = P_AB;
735     P_tmp.AB_y = P_AB + P.nshell12;
736     P_tmp.AB_z = P_AB + 2*P.nshell12;
737 
738     for(int i = 0; i < P.nshell12; i++)
739     {
740         P_tmp.AB_x[i] = -P.AB_x[i];
741         P_tmp.AB_y[i] = -P.AB_y[i];
742         P_tmp.AB_z[i] = -P.AB_z[i];
743     }
744 
745     double Q_AB[3*Q.nshell12];
746     struct simint_multi_shellpair Q_tmp = Q;
747     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
748     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
749     Q_tmp.AB_x = Q_AB;
750     Q_tmp.AB_y = Q_AB + Q.nshell12;
751     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
752 
753     for(int i = 0; i < Q.nshell12; i++)
754     {
755         Q_tmp.AB_x[i] = -Q.AB_x[i];
756         Q_tmp.AB_y[i] = -Q.AB_y[i];
757         Q_tmp.AB_z[i] = -Q.AB_z[i];
758     }
759 
760     int ret = ostei_d_s_k_i(P_tmp, Q_tmp, screen_tol, work, INT__s_d_i_k);
761     double buffer[6048] SIMINT_ALIGN_ARRAY_DBL;
762 
763     for(int q = 0; q < ret; q++)
764     {
765         int idx = 0;
766         for(int a = 0; a < 1; ++a)
767         for(int b = 0; b < 6; ++b)
768         for(int c = 0; c < 28; ++c)
769         for(int d = 0; d < 36; ++d)
770             buffer[idx++] = INT__s_d_i_k[q*6048+b*1008+a*1008+d*28+c];
771 
772         memcpy(INT__s_d_i_k+q*6048, buffer, 6048*sizeof(double));
773     }
774 
775     return ret;
776 }
777 
778