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_f_s_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_f_s_p)8 int ostei_d_f_s_p(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_f_s_p)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__d_f_s_p);
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__s_f_s_p = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__s_g_s_p = work + (SIMINT_NSHELL_SIMD * 30);
30     double * const INT__s_h_s_p = work + (SIMINT_NSHELL_SIMD * 75);
31     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*138);
32     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
33     SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_s_s = primwork + 7;
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_s_s = primwork + 25;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_f_s_s = primwork + 55;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_f_s_p = primwork + 95;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_g_s_s = primwork + 125;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_g_s_p = primwork + 170;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_h_s_s = primwork + 215;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_h_s_p = primwork + 257;
41     double * const hrrwork = (double *)(primwork + 320);
42     double * const HRR_INT__p_f_s_p = hrrwork + 0;
43     double * const HRR_INT__p_g_s_p = hrrwork + 90;
44 
45 
46     // Create constants
47     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
48     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
49     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
50     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
51     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
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 * 138 * 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_f_s_p = INT__s_f_s_p + abcd * 30;
96                 double * restrict PRIM_PTR_INT__s_g_s_p = INT__s_g_s_p + abcd * 45;
97                 double * restrict PRIM_PTR_INT__s_h_s_p = INT__s_h_s_p + abcd * 63;
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                 const SIMINT_DBLTYPE P_PB[3] = { SIMINT_DBLSET1(P.PB_x[i]), SIMINT_DBLSET1(P.PB_y[i]), SIMINT_DBLSET1(P.PB_z[i]) };
107 
108                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
109                 {
110                     // calculate the shell offsets
111                     // these are the offset from the shell pointed to by cd
112                     // for each element
113                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
114                     int lastoffset = 0;
115                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
116 
117                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
118                     {
119                         // Handle if the first element of the vector is a new shell
120                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
121                         {
122                             nprim_icd += Q.nprim12[cd + (++icd)];
123                             PRIM_PTR_INT__s_f_s_p += 30;
124                             PRIM_PTR_INT__s_g_s_p += 45;
125                             PRIM_PTR_INT__s_h_s_p += 63;
126                         }
127                         iprimcd++;
128                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
129                         {
130                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
131                             {
132                                 shelloffsets[n] = shelloffsets[n-1] + 1;
133                                 lastoffset++;
134                                 nprim_icd += Q.nprim12[cd + (++icd)];
135                             }
136                             else
137                                 shelloffsets[n] = shelloffsets[n-1];
138                             iprimcd++;
139                         }
140                     }
141                     else
142                         iprimcd += SIMINT_SIMD_LEN;
143 
144                     // Do we have to compute this vector (or has it been screened out)?
145                     // (not_screened != 0 means we have to do this vector)
146                     if(check_screen)
147                     {
148                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
149                         if(vmax < screen_tol)
150                         {
151                             PRIM_PTR_INT__s_f_s_p += lastoffset*30;
152                             PRIM_PTR_INT__s_g_s_p += lastoffset*45;
153                             PRIM_PTR_INT__s_h_s_p += lastoffset*63;
154                             continue;
155                         }
156                     }
157 
158                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
159                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
160                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
161                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
162 
163 
164                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
165                     SIMINT_DBLTYPE PQ[3];
166                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
167                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
168                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
169                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
170                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
171                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
172 
173                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
174                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
175                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
176                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
177                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
178                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
179                     const SIMINT_DBLTYPE Q_PB[3] = { SIMINT_DBLLOAD(Q.PB_x, j), SIMINT_DBLLOAD(Q.PB_y, j), SIMINT_DBLLOAD(Q.PB_z, j) };
180 
181                     // NOTE: Minus sign!
182                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
183                     SIMINT_DBLTYPE aop_PQ[3];
184                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
185                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
186                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
187 
188                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
189                     SIMINT_DBLTYPE aoq_PQ[3];
190                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
191                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
192                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
193                     // Put a minus sign here so we don't have to in RR routines
194                     a_over_q = SIMINT_NEG(a_over_q);
195 
196 
197                     //////////////////////////////////////////////
198                     // Fjt function section
199                     // Maximum v value: 6
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, 6);
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 <= 6; 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_1_over_2pq = one_over_2pq;
223                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
224                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
225                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
226                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
227 
228 
229 
230                     // Forming PRIM_INT__s_p_s_s[6 * 3];
231                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
232                     {
233 
234                         PRIM_INT__s_p_s_s[n * 3 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
235                         PRIM_INT__s_p_s_s[n * 3 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 0]);
236 
237                         PRIM_INT__s_p_s_s[n * 3 + 1] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
238                         PRIM_INT__s_p_s_s[n * 3 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 1]);
239 
240                         PRIM_INT__s_p_s_s[n * 3 + 2] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
241                         PRIM_INT__s_p_s_s[n * 3 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 2]);
242 
243                     }
244 
245 
246 
247                     // Forming PRIM_INT__s_d_s_s[5 * 6];
248                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
249                     {
250 
251                         PRIM_INT__s_d_s_s[n * 6 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_p_s_s[n * 3 + 0]);
252                         PRIM_INT__s_d_s_s[n * 6 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_s_s[n * 6 + 0]);
253                         PRIM_INT__s_d_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__s_d_s_s[n * 6 + 0]);
254 
255                         PRIM_INT__s_d_s_s[n * 6 + 1] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_s_s[n * 3 + 0]);
256                         PRIM_INT__s_d_s_s[n * 6 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_s_s[n * 6 + 1]);
257 
258                         PRIM_INT__s_d_s_s[n * 6 + 2] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_s_s[n * 3 + 0]);
259                         PRIM_INT__s_d_s_s[n * 6 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_s_s[n * 6 + 2]);
260 
261                         PRIM_INT__s_d_s_s[n * 6 + 3] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_s_s[n * 3 + 1]);
262                         PRIM_INT__s_d_s_s[n * 6 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_s_s[n * 6 + 3]);
263                         PRIM_INT__s_d_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__s_d_s_s[n * 6 + 3]);
264 
265                         PRIM_INT__s_d_s_s[n * 6 + 4] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_s_s[n * 3 + 1]);
266                         PRIM_INT__s_d_s_s[n * 6 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_s_s[n * 6 + 4]);
267 
268                         PRIM_INT__s_d_s_s[n * 6 + 5] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_s_s[n * 3 + 2]);
269                         PRIM_INT__s_d_s_s[n * 6 + 5] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_d_s_s[n * 6 + 5]);
270                         PRIM_INT__s_d_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__s_d_s_s[n * 6 + 5]);
271 
272                     }
273 
274 
275 
276                     // Forming PRIM_INT__s_f_s_s[4 * 10];
277                     for(n = 0; n < 4; ++n)  // loop over orders of auxiliary function
278                     {
279 
280                         PRIM_INT__s_f_s_s[n * 10 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_d_s_s[n * 6 + 0]);
281                         PRIM_INT__s_f_s_s[n * 10 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 0], PRIM_INT__s_f_s_s[n * 10 + 0]);
282                         PRIM_INT__s_f_s_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_p_s_s[n * 3 + 0]), PRIM_INT__s_f_s_s[n * 10 + 0]);
283 
284                         PRIM_INT__s_f_s_s[n * 10 + 1] = SIMINT_MUL(P_PB[1], PRIM_INT__s_d_s_s[n * 6 + 0]);
285                         PRIM_INT__s_f_s_s[n * 10 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 0], PRIM_INT__s_f_s_s[n * 10 + 1]);
286 
287                         PRIM_INT__s_f_s_s[n * 10 + 2] = SIMINT_MUL(P_PB[2], PRIM_INT__s_d_s_s[n * 6 + 0]);
288                         PRIM_INT__s_f_s_s[n * 10 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 0], PRIM_INT__s_f_s_s[n * 10 + 2]);
289 
290                         PRIM_INT__s_f_s_s[n * 10 + 3] = SIMINT_MUL(P_PB[0], PRIM_INT__s_d_s_s[n * 6 + 3]);
291                         PRIM_INT__s_f_s_s[n * 10 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 3], PRIM_INT__s_f_s_s[n * 10 + 3]);
292 
293                         PRIM_INT__s_f_s_s[n * 10 + 4] = SIMINT_MUL(P_PB[2], PRIM_INT__s_d_s_s[n * 6 + 1]);
294                         PRIM_INT__s_f_s_s[n * 10 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 1], PRIM_INT__s_f_s_s[n * 10 + 4]);
295 
296                         PRIM_INT__s_f_s_s[n * 10 + 5] = SIMINT_MUL(P_PB[0], PRIM_INT__s_d_s_s[n * 6 + 5]);
297                         PRIM_INT__s_f_s_s[n * 10 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 5], PRIM_INT__s_f_s_s[n * 10 + 5]);
298 
299                         PRIM_INT__s_f_s_s[n * 10 + 6] = SIMINT_MUL(P_PB[1], PRIM_INT__s_d_s_s[n * 6 + 3]);
300                         PRIM_INT__s_f_s_s[n * 10 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 3], PRIM_INT__s_f_s_s[n * 10 + 6]);
301                         PRIM_INT__s_f_s_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_p_s_s[n * 3 + 1]), PRIM_INT__s_f_s_s[n * 10 + 6]);
302 
303                         PRIM_INT__s_f_s_s[n * 10 + 7] = SIMINT_MUL(P_PB[2], PRIM_INT__s_d_s_s[n * 6 + 3]);
304                         PRIM_INT__s_f_s_s[n * 10 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 3], PRIM_INT__s_f_s_s[n * 10 + 7]);
305 
306                         PRIM_INT__s_f_s_s[n * 10 + 8] = SIMINT_MUL(P_PB[1], PRIM_INT__s_d_s_s[n * 6 + 5]);
307                         PRIM_INT__s_f_s_s[n * 10 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 5], PRIM_INT__s_f_s_s[n * 10 + 8]);
308 
309                         PRIM_INT__s_f_s_s[n * 10 + 9] = SIMINT_MUL(P_PB[2], PRIM_INT__s_d_s_s[n * 6 + 5]);
310                         PRIM_INT__s_f_s_s[n * 10 + 9] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 5], PRIM_INT__s_f_s_s[n * 10 + 9]);
311                         PRIM_INT__s_f_s_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_p_s_s[n * 3 + 2]), PRIM_INT__s_f_s_s[n * 10 + 9]);
312 
313                     }
314 
315 
316                     VRR_L_s_f_s_p(
317                             PRIM_INT__s_f_s_p,
318                             PRIM_INT__s_f_s_s,
319                             PRIM_INT__s_d_s_s,
320                             Q_PB,
321                             aoq_PQ,
322                             one_over_2pq,
323                             1);
324 
325 
326                     VRR_J_s_g_s_s(
327                             PRIM_INT__s_g_s_s,
328                             PRIM_INT__s_f_s_s,
329                             PRIM_INT__s_d_s_s,
330                             P_PB,
331                             a_over_p,
332                             aop_PQ,
333                             one_over_2p,
334                             3);
335 
336 
337                     VRR_L_s_g_s_p(
338                             PRIM_INT__s_g_s_p,
339                             PRIM_INT__s_g_s_s,
340                             PRIM_INT__s_f_s_s,
341                             Q_PB,
342                             aoq_PQ,
343                             one_over_2pq,
344                             1);
345 
346 
347                     VRR_J_s_h_s_s(
348                             PRIM_INT__s_h_s_s,
349                             PRIM_INT__s_g_s_s,
350                             PRIM_INT__s_f_s_s,
351                             P_PB,
352                             a_over_p,
353                             aop_PQ,
354                             one_over_2p,
355                             2);
356 
357 
358                     ostei_general_vrr_L(0, 5, 0, 1, 1,
359                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PB,
360                             PRIM_INT__s_h_s_s, NULL, NULL, NULL, PRIM_INT__s_g_s_s, PRIM_INT__s_h_s_p);
361 
362 
363 
364 
365                     ////////////////////////////////////
366                     // Accumulate contracted integrals
367                     ////////////////////////////////////
368                     if(lastoffset == 0)
369                     {
370                         contract_all(30, PRIM_INT__s_f_s_p, PRIM_PTR_INT__s_f_s_p);
371                         contract_all(45, PRIM_INT__s_g_s_p, PRIM_PTR_INT__s_g_s_p);
372                         contract_all(63, PRIM_INT__s_h_s_p, PRIM_PTR_INT__s_h_s_p);
373                     }
374                     else
375                     {
376                         contract(30, shelloffsets, PRIM_INT__s_f_s_p, PRIM_PTR_INT__s_f_s_p);
377                         contract(45, shelloffsets, PRIM_INT__s_g_s_p, PRIM_PTR_INT__s_g_s_p);
378                         contract(63, shelloffsets, PRIM_INT__s_h_s_p, PRIM_PTR_INT__s_h_s_p);
379                         PRIM_PTR_INT__s_f_s_p += lastoffset*30;
380                         PRIM_PTR_INT__s_g_s_p += lastoffset*45;
381                         PRIM_PTR_INT__s_h_s_p += lastoffset*63;
382                     }
383 
384                 }  // close loop over j
385             }  // close loop over i
386 
387             //Advance to the next batch
388             jstart = SIMINT_SIMD_ROUND(jend);
389 
390             //////////////////////////////////////////////
391             // Contracted integrals: Horizontal recurrance
392             //////////////////////////////////////////////
393 
394 
395             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
396 
397 
398             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
399             {
400 
401                 // set up HRR pointers
402                 double const * restrict HRR_INT__s_f_s_p = INT__s_f_s_p + abcd * 30;
403                 double const * restrict HRR_INT__s_g_s_p = INT__s_g_s_p + abcd * 45;
404                 double const * restrict HRR_INT__s_h_s_p = INT__s_h_s_p + abcd * 63;
405                 double * restrict HRR_INT__d_f_s_p = INT__d_f_s_p + real_abcd * 180;
406 
407                 // form INT__p_f_s_p
408                 HRR_I_p_f(
409                     HRR_INT__p_f_s_p,
410                     HRR_INT__s_f_s_p,
411                     HRR_INT__s_g_s_p,
412                     hAB, 3);
413 
414                 // form INT__p_g_s_p
415                 HRR_I_p_g(
416                     HRR_INT__p_g_s_p,
417                     HRR_INT__s_g_s_p,
418                     HRR_INT__s_h_s_p,
419                     hAB, 3);
420 
421                 // form INT__d_f_s_p
422                 HRR_I_d_f(
423                     HRR_INT__d_f_s_p,
424                     HRR_INT__p_f_s_p,
425                     HRR_INT__p_g_s_p,
426                     hAB, 3);
427 
428 
429             }  // close HRR loop
430 
431 
432         }   // close loop cdbatch
433 
434         istart = iend;
435     }  // close loop over ab
436 
437     return P.nshell12_clip * Q.nshell12_clip;
438 }
439 
440