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_s_s_h_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_s_h_d)8 int ostei_s_s_h_d(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__s_s_h_d)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__s_s_h_d);
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__s_s_h_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__s_s_i_s = work + (SIMINT_NSHELL_SIMD * 21);
30     double * const INT__s_s_k_s = work + (SIMINT_NSHELL_SIMD * 49);
31     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*85);
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 + 8;
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 29;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 65;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 115;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 175;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 238;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 294;
40     double * const hrrwork = (double *)(primwork + 330);
41     double * const HRR_INT__s_s_h_p = hrrwork + 0;
42     double * const HRR_INT__s_s_i_p = hrrwork + 63;
43 
44 
45     // Create constants
46     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
47     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
48     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
49     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
50     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
51     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
52     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
53 
54 
55     ////////////////////////////////////////
56     // Loop over shells and primitives
57     ////////////////////////////////////////
58 
59     real_abcd = 0;
60     istart = 0;
61     for(ab = 0; ab < P.nshell12_clip; ++ab)
62     {
63         const int iend = istart + P.nprim12[ab];
64 
65         cd = 0;
66         jstart = 0;
67 
68         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
69         {
70             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
71             int jend = jstart;
72             for(i = 0; i < nshellbatch; i++)
73                 jend += Q.nprim12[cd+i];
74 
75             // Clear the beginning of the workspace (where we are accumulating integrals)
76             memset(work, 0, SIMINT_NSHELL_SIMD * 85 * sizeof(double));
77             abcd = 0;
78 
79 
80             for(i = istart; i < iend; ++i)
81             {
82                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
83 
84                 if(check_screen)
85                 {
86                     // Skip this whole thing if always insignificant
87                     if((P.screen[i] * Q.screen_max) < screen_tol)
88                         continue;
89                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
90                 }
91 
92                 icd = 0;
93                 iprimcd = 0;
94                 nprim_icd = Q.nprim12[cd];
95                 double * restrict PRIM_PTR_INT__s_s_h_s = INT__s_s_h_s + abcd * 21;
96                 double * restrict PRIM_PTR_INT__s_s_i_s = INT__s_s_i_s + abcd * 28;
97                 double * restrict PRIM_PTR_INT__s_s_k_s = INT__s_s_k_s + abcd * 36;
98 
99 
100 
101                 // Load these one per loop over i
102                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
103                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
104                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
105 
106 
107                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
108                 {
109                     // calculate the shell offsets
110                     // these are the offset from the shell pointed to by cd
111                     // for each element
112                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
113                     int lastoffset = 0;
114                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
115 
116                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
117                     {
118                         // Handle if the first element of the vector is a new shell
119                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
120                         {
121                             nprim_icd += Q.nprim12[cd + (++icd)];
122                             PRIM_PTR_INT__s_s_h_s += 21;
123                             PRIM_PTR_INT__s_s_i_s += 28;
124                             PRIM_PTR_INT__s_s_k_s += 36;
125                         }
126                         iprimcd++;
127                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
128                         {
129                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
130                             {
131                                 shelloffsets[n] = shelloffsets[n-1] + 1;
132                                 lastoffset++;
133                                 nprim_icd += Q.nprim12[cd + (++icd)];
134                             }
135                             else
136                                 shelloffsets[n] = shelloffsets[n-1];
137                             iprimcd++;
138                         }
139                     }
140                     else
141                         iprimcd += SIMINT_SIMD_LEN;
142 
143                     // Do we have to compute this vector (or has it been screened out)?
144                     // (not_screened != 0 means we have to do this vector)
145                     if(check_screen)
146                     {
147                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
148                         if(vmax < screen_tol)
149                         {
150                             PRIM_PTR_INT__s_s_h_s += lastoffset*21;
151                             PRIM_PTR_INT__s_s_i_s += lastoffset*28;
152                             PRIM_PTR_INT__s_s_k_s += lastoffset*36;
153                             continue;
154                         }
155                     }
156 
157                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
158                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
159                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
160                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
161 
162 
163                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
164                     SIMINT_DBLTYPE PQ[3];
165                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
166                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
167                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
168                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
169                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
170                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
171 
172                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
173                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
174                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
175                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
176                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
177                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
178                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
179 
180                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
181                     SIMINT_DBLTYPE aoq_PQ[3];
182                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
183                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
184                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
185                     // Put a minus sign here so we don't have to in RR routines
186                     a_over_q = SIMINT_NEG(a_over_q);
187 
188 
189                     //////////////////////////////////////////////
190                     // Fjt function section
191                     // Maximum v value: 7
192                     //////////////////////////////////////////////
193                     // The parameter to the Fjt function
194                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
195 
196 
197                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
198 
199 
200                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 7);
201                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
202                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
203                     for(n = 0; n <= 7; n++)
204                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
205 
206                     //////////////////////////////////////////////
207                     // Primitive integrals: Vertical recurrance
208                     //////////////////////////////////////////////
209 
210                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
211                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
212                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
213                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
214                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
215                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
216 
217 
218 
219                     // Forming PRIM_INT__s_s_p_s[7 * 3];
220                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
221                     {
222 
223                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
224                         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]);
225 
226                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
227                         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]);
228 
229                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
230                         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]);
231 
232                     }
233 
234 
235 
236                     // Forming PRIM_INT__s_s_d_s[6 * 6];
237                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
238                     {
239 
240                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
241                         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]);
242                         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]);
243 
244                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
245                         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]);
246                         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]);
247 
248                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
249                         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]);
250                         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]);
251 
252                     }
253 
254 
255 
256                     // Forming PRIM_INT__s_s_f_s[5 * 10];
257                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
258                     {
259 
260                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
261                         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]);
262                         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]);
263 
264                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
265                         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]);
266 
267                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
268                         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]);
269 
270                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
271                         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]);
272                         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]);
273 
274                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
275                         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]);
276 
277                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
278                         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]);
279                         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]);
280 
281                     }
282 
283 
284                     VRR_K_s_s_g_s(
285                             PRIM_INT__s_s_g_s,
286                             PRIM_INT__s_s_f_s,
287                             PRIM_INT__s_s_d_s,
288                             Q_PA,
289                             a_over_q,
290                             aoq_PQ,
291                             one_over_2q,
292                             4);
293 
294 
295                     VRR_K_s_s_h_s(
296                             PRIM_INT__s_s_h_s,
297                             PRIM_INT__s_s_g_s,
298                             PRIM_INT__s_s_f_s,
299                             Q_PA,
300                             a_over_q,
301                             aoq_PQ,
302                             one_over_2q,
303                             3);
304 
305 
306                     ostei_general_vrr1_K(6, 2,
307                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
308                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
309 
310 
311                     ostei_general_vrr1_K(7, 1,
312                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
313                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
314 
315 
316 
317 
318                     ////////////////////////////////////
319                     // Accumulate contracted integrals
320                     ////////////////////////////////////
321                     if(lastoffset == 0)
322                     {
323                         contract_all(21, PRIM_INT__s_s_h_s, PRIM_PTR_INT__s_s_h_s);
324                         contract_all(28, PRIM_INT__s_s_i_s, PRIM_PTR_INT__s_s_i_s);
325                         contract_all(36, PRIM_INT__s_s_k_s, PRIM_PTR_INT__s_s_k_s);
326                     }
327                     else
328                     {
329                         contract(21, shelloffsets, PRIM_INT__s_s_h_s, PRIM_PTR_INT__s_s_h_s);
330                         contract(28, shelloffsets, PRIM_INT__s_s_i_s, PRIM_PTR_INT__s_s_i_s);
331                         contract(36, shelloffsets, PRIM_INT__s_s_k_s, PRIM_PTR_INT__s_s_k_s);
332                         PRIM_PTR_INT__s_s_h_s += lastoffset*21;
333                         PRIM_PTR_INT__s_s_i_s += lastoffset*28;
334                         PRIM_PTR_INT__s_s_k_s += lastoffset*36;
335                     }
336 
337                 }  // close loop over j
338             }  // close loop over i
339 
340             //Advance to the next batch
341             jstart = SIMINT_SIMD_ROUND(jend);
342 
343             //////////////////////////////////////////////
344             // Contracted integrals: Horizontal recurrance
345             //////////////////////////////////////////////
346 
347 
348 
349 
350             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
351             {
352                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
353 
354                 // set up HRR pointers
355                 double const * restrict HRR_INT__s_s_h_s = INT__s_s_h_s + abcd * 21;
356                 double const * restrict HRR_INT__s_s_i_s = INT__s_s_i_s + abcd * 28;
357                 double const * restrict HRR_INT__s_s_k_s = INT__s_s_k_s + abcd * 36;
358                 double * restrict HRR_INT__s_s_h_d = INT__s_s_h_d + real_abcd * 126;
359 
360                 // form INT__s_s_h_p
361                 ostei_general_hrr_L(0, 0, 5, 1, hCD, HRR_INT__s_s_i_s, HRR_INT__s_s_h_s, HRR_INT__s_s_h_p);
362 
363                 // form INT__s_s_i_p
364                 ostei_general_hrr_L(0, 0, 6, 1, hCD, HRR_INT__s_s_k_s, HRR_INT__s_s_i_s, HRR_INT__s_s_i_p);
365 
366                 // form INT__s_s_h_d
367                 ostei_general_hrr_L(0, 0, 5, 2, hCD, HRR_INT__s_s_i_p, HRR_INT__s_s_h_p, HRR_INT__s_s_h_d);
368 
369 
370             }  // close HRR loop
371 
372 
373         }   // close loop cdbatch
374 
375         istart = iend;
376     }  // close loop over ab
377 
378     return P.nshell12_clip * Q.nshell12_clip;
379 }
380 
ostei_s_s_d_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_s_d_h)381 int ostei_s_s_d_h(struct simint_multi_shellpair const P,
382                   struct simint_multi_shellpair const Q,
383                   double screen_tol,
384                   double * const restrict work,
385                   double * const restrict INT__s_s_d_h)
386 {
387     double Q_AB[3*Q.nshell12];
388     struct simint_multi_shellpair Q_tmp = Q;
389     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
390     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
391     Q_tmp.AB_x = Q_AB;
392     Q_tmp.AB_y = Q_AB + Q.nshell12;
393     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
394 
395     for(int i = 0; i < Q.nshell12; i++)
396     {
397         Q_tmp.AB_x[i] = -Q.AB_x[i];
398         Q_tmp.AB_y[i] = -Q.AB_y[i];
399         Q_tmp.AB_z[i] = -Q.AB_z[i];
400     }
401 
402     int ret = ostei_s_s_h_d(P, Q_tmp, screen_tol, work, INT__s_s_d_h);
403     double buffer[126] SIMINT_ALIGN_ARRAY_DBL;
404 
405     for(int q = 0; q < ret; q++)
406     {
407         int idx = 0;
408         for(int a = 0; a < 1; ++a)
409         for(int b = 0; b < 1; ++b)
410         for(int c = 0; c < 6; ++c)
411         for(int d = 0; d < 21; ++d)
412             buffer[idx++] = INT__s_s_d_h[q*126+a*126+b*126+d*6+c];
413 
414         memcpy(INT__s_s_d_h+q*126, buffer, 126*sizeof(double));
415     }
416 
417     return ret;
418 }
419 
420