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