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