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_i_g_d_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__i_g_d_p)8 int ostei_i_g_d_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__i_g_d_p)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__i_g_d_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     int ibra;
27 
28     // partition workspace
29     double * const INT__i_s_d_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__i_s_f_s = work + (SIMINT_NSHELL_SIMD * 168);
31     double * const INT__k_s_d_s = work + (SIMINT_NSHELL_SIMD * 448);
32     double * const INT__k_s_f_s = work + (SIMINT_NSHELL_SIMD * 664);
33     double * const INT__l_s_d_s = work + (SIMINT_NSHELL_SIMD * 1024);
34     double * const INT__l_s_f_s = work + (SIMINT_NSHELL_SIMD * 1294);
35     double * const INT__m_s_d_s = work + (SIMINT_NSHELL_SIMD * 1744);
36     double * const INT__m_s_f_s = work + (SIMINT_NSHELL_SIMD * 2074);
37     double * const INT__n_s_d_s = work + (SIMINT_NSHELL_SIMD * 2624);
38     double * const INT__n_s_f_s = work + (SIMINT_NSHELL_SIMD * 3020);
39     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*3680);
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 14;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 53;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 125;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 235;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 385;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 520;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 709;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 898;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 1150;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 1374;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 1626;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 1962;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_s_s = primwork + 2242;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_p_s = primwork + 2494;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_d_s = primwork + 2818;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_f_s = primwork + 3250;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_s_s = primwork + 3610;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_p_s = primwork + 3880;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_d_s = primwork + 4285;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_f_s = primwork + 4825;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_s_s = primwork + 5275;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_p_s = primwork + 5550;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_d_s = primwork + 6045;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_f_s = primwork + 6705;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_s_s = primwork + 7255;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_p_s = primwork + 7519;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_d_s = primwork + 8113;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_f_s = primwork + 8905;
69     double * const hrrwork = (double *)(primwork + 9565);
70     double * const HRR_INT__i_p_d_s = hrrwork + 0;
71     double * const HRR_INT__i_p_f_s = hrrwork + 504;
72     double * const HRR_INT__i_d_d_s = hrrwork + 1344;
73     double * const HRR_INT__i_d_f_s = hrrwork + 2352;
74     double * const HRR_INT__i_f_d_s = hrrwork + 4032;
75     double * const HRR_INT__i_f_f_s = hrrwork + 5712;
76     double * const HRR_INT__i_g_d_s = hrrwork + 8512;
77     double * const HRR_INT__i_g_f_s = hrrwork + 11032;
78     double * const HRR_INT__k_p_d_s = hrrwork + 15232;
79     double * const HRR_INT__k_p_f_s = hrrwork + 15880;
80     double * const HRR_INT__k_d_d_s = hrrwork + 16960;
81     double * const HRR_INT__k_d_f_s = hrrwork + 18256;
82     double * const HRR_INT__k_f_d_s = hrrwork + 20416;
83     double * const HRR_INT__k_f_f_s = hrrwork + 22576;
84     double * const HRR_INT__l_p_d_s = hrrwork + 26176;
85     double * const HRR_INT__l_p_f_s = hrrwork + 26986;
86     double * const HRR_INT__l_d_d_s = hrrwork + 28336;
87     double * const HRR_INT__l_d_f_s = hrrwork + 29956;
88     double * const HRR_INT__m_p_d_s = hrrwork + 32656;
89     double * const HRR_INT__m_p_f_s = hrrwork + 33646;
90 
91 
92     // Create constants
93     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
94     const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
95     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
96     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
97     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
98     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
99     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
100     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
101     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
102     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
103     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
104 
105 
106     ////////////////////////////////////////
107     // Loop over shells and primitives
108     ////////////////////////////////////////
109 
110     real_abcd = 0;
111     istart = 0;
112     for(ab = 0; ab < P.nshell12_clip; ++ab)
113     {
114         const int iend = istart + P.nprim12[ab];
115 
116         cd = 0;
117         jstart = 0;
118 
119         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
120         {
121             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
122             int jend = jstart;
123             for(i = 0; i < nshellbatch; i++)
124                 jend += Q.nprim12[cd+i];
125 
126             // Clear the beginning of the workspace (where we are accumulating integrals)
127             memset(work, 0, SIMINT_NSHELL_SIMD * 3680 * sizeof(double));
128             abcd = 0;
129 
130 
131             for(i = istart; i < iend; ++i)
132             {
133                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
134 
135                 if(check_screen)
136                 {
137                     // Skip this whole thing if always insignificant
138                     if((P.screen[i] * Q.screen_max) < screen_tol)
139                         continue;
140                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
141                 }
142 
143                 icd = 0;
144                 iprimcd = 0;
145                 nprim_icd = Q.nprim12[cd];
146                 double * restrict PRIM_PTR_INT__i_s_d_s = INT__i_s_d_s + abcd * 168;
147                 double * restrict PRIM_PTR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
148                 double * restrict PRIM_PTR_INT__k_s_d_s = INT__k_s_d_s + abcd * 216;
149                 double * restrict PRIM_PTR_INT__k_s_f_s = INT__k_s_f_s + abcd * 360;
150                 double * restrict PRIM_PTR_INT__l_s_d_s = INT__l_s_d_s + abcd * 270;
151                 double * restrict PRIM_PTR_INT__l_s_f_s = INT__l_s_f_s + abcd * 450;
152                 double * restrict PRIM_PTR_INT__m_s_d_s = INT__m_s_d_s + abcd * 330;
153                 double * restrict PRIM_PTR_INT__m_s_f_s = INT__m_s_f_s + abcd * 550;
154                 double * restrict PRIM_PTR_INT__n_s_d_s = INT__n_s_d_s + abcd * 396;
155                 double * restrict PRIM_PTR_INT__n_s_f_s = INT__n_s_f_s + abcd * 660;
156 
157 
158 
159                 // Load these one per loop over i
160                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
161                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
162                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
163 
164                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
165 
166                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
167                 {
168                     // calculate the shell offsets
169                     // these are the offset from the shell pointed to by cd
170                     // for each element
171                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
172                     int lastoffset = 0;
173                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
174 
175                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
176                     {
177                         // Handle if the first element of the vector is a new shell
178                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
179                         {
180                             nprim_icd += Q.nprim12[cd + (++icd)];
181                             PRIM_PTR_INT__i_s_d_s += 168;
182                             PRIM_PTR_INT__i_s_f_s += 280;
183                             PRIM_PTR_INT__k_s_d_s += 216;
184                             PRIM_PTR_INT__k_s_f_s += 360;
185                             PRIM_PTR_INT__l_s_d_s += 270;
186                             PRIM_PTR_INT__l_s_f_s += 450;
187                             PRIM_PTR_INT__m_s_d_s += 330;
188                             PRIM_PTR_INT__m_s_f_s += 550;
189                             PRIM_PTR_INT__n_s_d_s += 396;
190                             PRIM_PTR_INT__n_s_f_s += 660;
191                         }
192                         iprimcd++;
193                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
194                         {
195                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
196                             {
197                                 shelloffsets[n] = shelloffsets[n-1] + 1;
198                                 lastoffset++;
199                                 nprim_icd += Q.nprim12[cd + (++icd)];
200                             }
201                             else
202                                 shelloffsets[n] = shelloffsets[n-1];
203                             iprimcd++;
204                         }
205                     }
206                     else
207                         iprimcd += SIMINT_SIMD_LEN;
208 
209                     // Do we have to compute this vector (or has it been screened out)?
210                     // (not_screened != 0 means we have to do this vector)
211                     if(check_screen)
212                     {
213                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
214                         if(vmax < screen_tol)
215                         {
216                             PRIM_PTR_INT__i_s_d_s += lastoffset*168;
217                             PRIM_PTR_INT__i_s_f_s += lastoffset*280;
218                             PRIM_PTR_INT__k_s_d_s += lastoffset*216;
219                             PRIM_PTR_INT__k_s_f_s += lastoffset*360;
220                             PRIM_PTR_INT__l_s_d_s += lastoffset*270;
221                             PRIM_PTR_INT__l_s_f_s += lastoffset*450;
222                             PRIM_PTR_INT__m_s_d_s += lastoffset*330;
223                             PRIM_PTR_INT__m_s_f_s += lastoffset*550;
224                             PRIM_PTR_INT__n_s_d_s += lastoffset*396;
225                             PRIM_PTR_INT__n_s_f_s += lastoffset*660;
226                             continue;
227                         }
228                     }
229 
230                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
231                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
232                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
233                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
234 
235 
236                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
237                     SIMINT_DBLTYPE PQ[3];
238                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
239                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
240                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
241                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
242                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
243                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
244 
245                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
246                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
247                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
248                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
249                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
250                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
251                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
252 
253                     // NOTE: Minus sign!
254                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
255                     SIMINT_DBLTYPE aop_PQ[3];
256                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
257                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
258                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
259 
260                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
261                     SIMINT_DBLTYPE aoq_PQ[3];
262                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
263                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
264                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
265                     // Put a minus sign here so we don't have to in RR routines
266                     a_over_q = SIMINT_NEG(a_over_q);
267 
268 
269                     //////////////////////////////////////////////
270                     // Fjt function section
271                     // Maximum v value: 13
272                     //////////////////////////////////////////////
273                     // The parameter to the Fjt function
274                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
275 
276 
277                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
278 
279 
280                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 13);
281                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
282                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
283                     for(n = 0; n <= 13; n++)
284                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
285 
286                     //////////////////////////////////////////////
287                     // Primitive integrals: Vertical recurrance
288                     //////////////////////////////////////////////
289 
290                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
291                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
292                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
293                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
294                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
295                     const SIMINT_DBLTYPE vrr_const_6_over_2p = SIMINT_MUL(const_6, one_over_2p);
296                     const SIMINT_DBLTYPE vrr_const_7_over_2p = SIMINT_MUL(const_7, one_over_2p);
297                     const SIMINT_DBLTYPE vrr_const_8_over_2p = SIMINT_MUL(const_8, one_over_2p);
298                     const SIMINT_DBLTYPE vrr_const_9_over_2p = SIMINT_MUL(const_9, one_over_2p);
299                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
300                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
301                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
302                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
303                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
304                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
305                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
306                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
307                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
308                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
309                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
310                     const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
311 
312 
313 
314                     // Forming PRIM_INT__p_s_s_s[13 * 3];
315                     for(n = 0; n < 13; ++n)  // loop over orders of auxiliary function
316                     {
317 
318                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
319                         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]);
320 
321                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
322                         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]);
323 
324                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
325                         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]);
326 
327                     }
328 
329 
330 
331                     // Forming PRIM_INT__d_s_s_s[12 * 6];
332                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
333                     {
334 
335                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
336                         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]);
337                         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]);
338 
339                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
340                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 1]);
341 
342                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
343                         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]);
344                         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]);
345 
346                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
347                         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]);
348                         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]);
349 
350                     }
351 
352 
353 
354                     // Forming PRIM_INT__f_s_s_s[11 * 10];
355                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
356                     {
357 
358                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
359                         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]);
360                         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]);
361 
362                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
363                         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]);
364 
365                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
366                         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]);
367 
368                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
369                         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]);
370 
371                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
372                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__f_s_s_s[n * 10 + 4]);
373 
374                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
375                         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]);
376 
377                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
378                         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]);
379                         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]);
380 
381                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
382                         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]);
383 
384                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
385                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 8]);
386 
387                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
388                         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]);
389                         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]);
390 
391                     }
392 
393 
394                     VRR_I_g_s_s_s(
395                             PRIM_INT__g_s_s_s,
396                             PRIM_INT__f_s_s_s,
397                             PRIM_INT__d_s_s_s,
398                             P_PA,
399                             a_over_p,
400                             aop_PQ,
401                             one_over_2p,
402                             10);
403 
404 
405                     VRR_I_h_s_s_s(
406                             PRIM_INT__h_s_s_s,
407                             PRIM_INT__g_s_s_s,
408                             PRIM_INT__f_s_s_s,
409                             P_PA,
410                             a_over_p,
411                             aop_PQ,
412                             one_over_2p,
413                             9);
414 
415 
416                     ostei_general_vrr1_I(6, 8,
417                             one_over_2p, a_over_p, aop_PQ, P_PA,
418                             PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
419 
420 
421                     ostei_general_vrr_K(6, 0, 1, 0, 3,
422                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
423                             PRIM_INT__i_s_s_s, NULL, NULL, PRIM_INT__h_s_s_s, NULL, PRIM_INT__i_s_p_s);
424 
425 
426                     ostei_general_vrr_K(5, 0, 1, 0, 3,
427                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
428                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
429 
430 
431                     ostei_general_vrr_K(6, 0, 2, 0, 2,
432                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
433                             PRIM_INT__i_s_p_s, PRIM_INT__i_s_s_s, NULL, PRIM_INT__h_s_p_s, NULL, PRIM_INT__i_s_d_s);
434 
435 
436                     VRR_K_g_s_p_s(
437                             PRIM_INT__g_s_p_s,
438                             PRIM_INT__g_s_s_s,
439                             PRIM_INT__f_s_s_s,
440                             Q_PA,
441                             aoq_PQ,
442                             one_over_2pq,
443                             3);
444 
445 
446                     ostei_general_vrr_K(5, 0, 2, 0, 2,
447                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
448                             PRIM_INT__h_s_p_s, PRIM_INT__h_s_s_s, NULL, PRIM_INT__g_s_p_s, NULL, PRIM_INT__h_s_d_s);
449 
450 
451                     ostei_general_vrr_K(6, 0, 3, 0, 1,
452                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
453                             PRIM_INT__i_s_d_s, PRIM_INT__i_s_p_s, NULL, PRIM_INT__h_s_d_s, NULL, PRIM_INT__i_s_f_s);
454 
455 
456                     ostei_general_vrr1_I(7, 7,
457                             one_over_2p, a_over_p, aop_PQ, P_PA,
458                             PRIM_INT__i_s_s_s, PRIM_INT__h_s_s_s, PRIM_INT__k_s_s_s);
459 
460 
461                     ostei_general_vrr_K(7, 0, 1, 0, 3,
462                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
463                             PRIM_INT__k_s_s_s, NULL, NULL, PRIM_INT__i_s_s_s, NULL, PRIM_INT__k_s_p_s);
464 
465 
466                     ostei_general_vrr_K(7, 0, 2, 0, 2,
467                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
468                             PRIM_INT__k_s_p_s, PRIM_INT__k_s_s_s, NULL, PRIM_INT__i_s_p_s, NULL, PRIM_INT__k_s_d_s);
469 
470 
471                     ostei_general_vrr_K(7, 0, 3, 0, 1,
472                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
473                             PRIM_INT__k_s_d_s, PRIM_INT__k_s_p_s, NULL, PRIM_INT__i_s_d_s, NULL, PRIM_INT__k_s_f_s);
474 
475 
476                     ostei_general_vrr1_I(8, 6,
477                             one_over_2p, a_over_p, aop_PQ, P_PA,
478                             PRIM_INT__k_s_s_s, PRIM_INT__i_s_s_s, PRIM_INT__l_s_s_s);
479 
480 
481                     ostei_general_vrr_K(8, 0, 1, 0, 3,
482                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
483                             PRIM_INT__l_s_s_s, NULL, NULL, PRIM_INT__k_s_s_s, NULL, PRIM_INT__l_s_p_s);
484 
485 
486                     ostei_general_vrr_K(8, 0, 2, 0, 2,
487                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
488                             PRIM_INT__l_s_p_s, PRIM_INT__l_s_s_s, NULL, PRIM_INT__k_s_p_s, NULL, PRIM_INT__l_s_d_s);
489 
490 
491                     ostei_general_vrr_K(8, 0, 3, 0, 1,
492                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
493                             PRIM_INT__l_s_d_s, PRIM_INT__l_s_p_s, NULL, PRIM_INT__k_s_d_s, NULL, PRIM_INT__l_s_f_s);
494 
495 
496                     ostei_general_vrr1_I(9, 5,
497                             one_over_2p, a_over_p, aop_PQ, P_PA,
498                             PRIM_INT__l_s_s_s, PRIM_INT__k_s_s_s, PRIM_INT__m_s_s_s);
499 
500 
501                     ostei_general_vrr_K(9, 0, 1, 0, 3,
502                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
503                             PRIM_INT__m_s_s_s, NULL, NULL, PRIM_INT__l_s_s_s, NULL, PRIM_INT__m_s_p_s);
504 
505 
506                     ostei_general_vrr_K(9, 0, 2, 0, 2,
507                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
508                             PRIM_INT__m_s_p_s, PRIM_INT__m_s_s_s, NULL, PRIM_INT__l_s_p_s, NULL, PRIM_INT__m_s_d_s);
509 
510 
511                     ostei_general_vrr_K(9, 0, 3, 0, 1,
512                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
513                             PRIM_INT__m_s_d_s, PRIM_INT__m_s_p_s, NULL, PRIM_INT__l_s_d_s, NULL, PRIM_INT__m_s_f_s);
514 
515 
516                     ostei_general_vrr1_I(10, 4,
517                             one_over_2p, a_over_p, aop_PQ, P_PA,
518                             PRIM_INT__m_s_s_s, PRIM_INT__l_s_s_s, PRIM_INT__n_s_s_s);
519 
520 
521                     ostei_general_vrr_K(10, 0, 1, 0, 3,
522                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
523                             PRIM_INT__n_s_s_s, NULL, NULL, PRIM_INT__m_s_s_s, NULL, PRIM_INT__n_s_p_s);
524 
525 
526                     ostei_general_vrr_K(10, 0, 2, 0, 2,
527                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
528                             PRIM_INT__n_s_p_s, PRIM_INT__n_s_s_s, NULL, PRIM_INT__m_s_p_s, NULL, PRIM_INT__n_s_d_s);
529 
530 
531                     ostei_general_vrr_K(10, 0, 3, 0, 1,
532                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
533                             PRIM_INT__n_s_d_s, PRIM_INT__n_s_p_s, NULL, PRIM_INT__m_s_d_s, NULL, PRIM_INT__n_s_f_s);
534 
535 
536 
537 
538                     ////////////////////////////////////
539                     // Accumulate contracted integrals
540                     ////////////////////////////////////
541                     if(lastoffset == 0)
542                     {
543                         contract_all(168, PRIM_INT__i_s_d_s, PRIM_PTR_INT__i_s_d_s);
544                         contract_all(280, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
545                         contract_all(216, PRIM_INT__k_s_d_s, PRIM_PTR_INT__k_s_d_s);
546                         contract_all(360, PRIM_INT__k_s_f_s, PRIM_PTR_INT__k_s_f_s);
547                         contract_all(270, PRIM_INT__l_s_d_s, PRIM_PTR_INT__l_s_d_s);
548                         contract_all(450, PRIM_INT__l_s_f_s, PRIM_PTR_INT__l_s_f_s);
549                         contract_all(330, PRIM_INT__m_s_d_s, PRIM_PTR_INT__m_s_d_s);
550                         contract_all(550, PRIM_INT__m_s_f_s, PRIM_PTR_INT__m_s_f_s);
551                         contract_all(396, PRIM_INT__n_s_d_s, PRIM_PTR_INT__n_s_d_s);
552                         contract_all(660, PRIM_INT__n_s_f_s, PRIM_PTR_INT__n_s_f_s);
553                     }
554                     else
555                     {
556                         contract(168, shelloffsets, PRIM_INT__i_s_d_s, PRIM_PTR_INT__i_s_d_s);
557                         contract(280, shelloffsets, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
558                         contract(216, shelloffsets, PRIM_INT__k_s_d_s, PRIM_PTR_INT__k_s_d_s);
559                         contract(360, shelloffsets, PRIM_INT__k_s_f_s, PRIM_PTR_INT__k_s_f_s);
560                         contract(270, shelloffsets, PRIM_INT__l_s_d_s, PRIM_PTR_INT__l_s_d_s);
561                         contract(450, shelloffsets, PRIM_INT__l_s_f_s, PRIM_PTR_INT__l_s_f_s);
562                         contract(330, shelloffsets, PRIM_INT__m_s_d_s, PRIM_PTR_INT__m_s_d_s);
563                         contract(550, shelloffsets, PRIM_INT__m_s_f_s, PRIM_PTR_INT__m_s_f_s);
564                         contract(396, shelloffsets, PRIM_INT__n_s_d_s, PRIM_PTR_INT__n_s_d_s);
565                         contract(660, shelloffsets, PRIM_INT__n_s_f_s, PRIM_PTR_INT__n_s_f_s);
566                         PRIM_PTR_INT__i_s_d_s += lastoffset*168;
567                         PRIM_PTR_INT__i_s_f_s += lastoffset*280;
568                         PRIM_PTR_INT__k_s_d_s += lastoffset*216;
569                         PRIM_PTR_INT__k_s_f_s += lastoffset*360;
570                         PRIM_PTR_INT__l_s_d_s += lastoffset*270;
571                         PRIM_PTR_INT__l_s_f_s += lastoffset*450;
572                         PRIM_PTR_INT__m_s_d_s += lastoffset*330;
573                         PRIM_PTR_INT__m_s_f_s += lastoffset*550;
574                         PRIM_PTR_INT__n_s_d_s += lastoffset*396;
575                         PRIM_PTR_INT__n_s_f_s += lastoffset*660;
576                     }
577 
578                 }  // close loop over j
579             }  // close loop over i
580 
581             //Advance to the next batch
582             jstart = SIMINT_SIMD_ROUND(jend);
583 
584             //////////////////////////////////////////////
585             // Contracted integrals: Horizontal recurrance
586             //////////////////////////////////////////////
587 
588 
589             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
590 
591 
592             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
593             {
594                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
595 
596                 // set up HRR pointers
597                 double const * restrict HRR_INT__i_s_d_s = INT__i_s_d_s + abcd * 168;
598                 double const * restrict HRR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
599                 double const * restrict HRR_INT__k_s_d_s = INT__k_s_d_s + abcd * 216;
600                 double const * restrict HRR_INT__k_s_f_s = INT__k_s_f_s + abcd * 360;
601                 double const * restrict HRR_INT__l_s_d_s = INT__l_s_d_s + abcd * 270;
602                 double const * restrict HRR_INT__l_s_f_s = INT__l_s_f_s + abcd * 450;
603                 double const * restrict HRR_INT__m_s_d_s = INT__m_s_d_s + abcd * 330;
604                 double const * restrict HRR_INT__m_s_f_s = INT__m_s_f_s + abcd * 550;
605                 double const * restrict HRR_INT__n_s_d_s = INT__n_s_d_s + abcd * 396;
606                 double const * restrict HRR_INT__n_s_f_s = INT__n_s_f_s + abcd * 660;
607                 double * restrict HRR_INT__i_g_d_p = INT__i_g_d_p + real_abcd * 7560;
608 
609                 // form INT__i_p_d_s
610                 ostei_general_hrr_J(6, 1, 2, 0, hAB, HRR_INT__k_s_d_s, HRR_INT__i_s_d_s, HRR_INT__i_p_d_s);
611 
612                 // form INT__i_p_f_s
613                 ostei_general_hrr_J(6, 1, 3, 0, hAB, HRR_INT__k_s_f_s, HRR_INT__i_s_f_s, HRR_INT__i_p_f_s);
614 
615                 // form INT__k_p_d_s
616                 ostei_general_hrr_J(7, 1, 2, 0, hAB, HRR_INT__l_s_d_s, HRR_INT__k_s_d_s, HRR_INT__k_p_d_s);
617 
618                 // form INT__k_p_f_s
619                 ostei_general_hrr_J(7, 1, 3, 0, hAB, HRR_INT__l_s_f_s, HRR_INT__k_s_f_s, HRR_INT__k_p_f_s);
620 
621                 // form INT__l_p_d_s
622                 ostei_general_hrr_J(8, 1, 2, 0, hAB, HRR_INT__m_s_d_s, HRR_INT__l_s_d_s, HRR_INT__l_p_d_s);
623 
624                 // form INT__l_p_f_s
625                 ostei_general_hrr_J(8, 1, 3, 0, hAB, HRR_INT__m_s_f_s, HRR_INT__l_s_f_s, HRR_INT__l_p_f_s);
626 
627                 // form INT__m_p_d_s
628                 ostei_general_hrr_J(9, 1, 2, 0, hAB, HRR_INT__n_s_d_s, HRR_INT__m_s_d_s, HRR_INT__m_p_d_s);
629 
630                 // form INT__m_p_f_s
631                 ostei_general_hrr_J(9, 1, 3, 0, hAB, HRR_INT__n_s_f_s, HRR_INT__m_s_f_s, HRR_INT__m_p_f_s);
632 
633                 // form INT__i_d_d_s
634                 ostei_general_hrr_J(6, 2, 2, 0, hAB, HRR_INT__k_p_d_s, HRR_INT__i_p_d_s, HRR_INT__i_d_d_s);
635 
636                 // form INT__i_d_f_s
637                 ostei_general_hrr_J(6, 2, 3, 0, hAB, HRR_INT__k_p_f_s, HRR_INT__i_p_f_s, HRR_INT__i_d_f_s);
638 
639                 // form INT__k_d_d_s
640                 ostei_general_hrr_J(7, 2, 2, 0, hAB, HRR_INT__l_p_d_s, HRR_INT__k_p_d_s, HRR_INT__k_d_d_s);
641 
642                 // form INT__k_d_f_s
643                 ostei_general_hrr_J(7, 2, 3, 0, hAB, HRR_INT__l_p_f_s, HRR_INT__k_p_f_s, HRR_INT__k_d_f_s);
644 
645                 // form INT__l_d_d_s
646                 ostei_general_hrr_J(8, 2, 2, 0, hAB, HRR_INT__m_p_d_s, HRR_INT__l_p_d_s, HRR_INT__l_d_d_s);
647 
648                 // form INT__l_d_f_s
649                 ostei_general_hrr_J(8, 2, 3, 0, hAB, HRR_INT__m_p_f_s, HRR_INT__l_p_f_s, HRR_INT__l_d_f_s);
650 
651                 // form INT__i_f_d_s
652                 ostei_general_hrr_J(6, 3, 2, 0, hAB, HRR_INT__k_d_d_s, HRR_INT__i_d_d_s, HRR_INT__i_f_d_s);
653 
654                 // form INT__i_f_f_s
655                 ostei_general_hrr_J(6, 3, 3, 0, hAB, HRR_INT__k_d_f_s, HRR_INT__i_d_f_s, HRR_INT__i_f_f_s);
656 
657                 // form INT__k_f_d_s
658                 ostei_general_hrr_J(7, 3, 2, 0, hAB, HRR_INT__l_d_d_s, HRR_INT__k_d_d_s, HRR_INT__k_f_d_s);
659 
660                 // form INT__k_f_f_s
661                 ostei_general_hrr_J(7, 3, 3, 0, hAB, HRR_INT__l_d_f_s, HRR_INT__k_d_f_s, HRR_INT__k_f_f_s);
662 
663                 // form INT__i_g_d_s
664                 ostei_general_hrr_J(6, 4, 2, 0, hAB, HRR_INT__k_f_d_s, HRR_INT__i_f_d_s, HRR_INT__i_g_d_s);
665 
666                 // form INT__i_g_f_s
667                 ostei_general_hrr_J(6, 4, 3, 0, hAB, HRR_INT__k_f_f_s, HRR_INT__i_f_f_s, HRR_INT__i_g_f_s);
668 
669                 // form INT__i_g_d_p
670                 for(ibra = 0; ibra < 420; ++ibra)
671                 {
672                     HRR_INT__i_g_d_p[ibra * 18 + 0] = HRR_INT__i_g_f_s[ibra * 10 + 0] + ( hCD[0] * HRR_INT__i_g_d_s[ibra * 6 + 0] );
673 
674                     HRR_INT__i_g_d_p[ibra * 18 + 1] = HRR_INT__i_g_f_s[ibra * 10 + 1] + ( hCD[1] * HRR_INT__i_g_d_s[ibra * 6 + 0] );
675 
676                     HRR_INT__i_g_d_p[ibra * 18 + 2] = HRR_INT__i_g_f_s[ibra * 10 + 2] + ( hCD[2] * HRR_INT__i_g_d_s[ibra * 6 + 0] );
677 
678                     HRR_INT__i_g_d_p[ibra * 18 + 3] = HRR_INT__i_g_f_s[ibra * 10 + 1] + ( hCD[0] * HRR_INT__i_g_d_s[ibra * 6 + 1] );
679 
680                     HRR_INT__i_g_d_p[ibra * 18 + 4] = HRR_INT__i_g_f_s[ibra * 10 + 3] + ( hCD[1] * HRR_INT__i_g_d_s[ibra * 6 + 1] );
681 
682                     HRR_INT__i_g_d_p[ibra * 18 + 5] = HRR_INT__i_g_f_s[ibra * 10 + 4] + ( hCD[2] * HRR_INT__i_g_d_s[ibra * 6 + 1] );
683 
684                     HRR_INT__i_g_d_p[ibra * 18 + 6] = HRR_INT__i_g_f_s[ibra * 10 + 2] + ( hCD[0] * HRR_INT__i_g_d_s[ibra * 6 + 2] );
685 
686                     HRR_INT__i_g_d_p[ibra * 18 + 7] = HRR_INT__i_g_f_s[ibra * 10 + 4] + ( hCD[1] * HRR_INT__i_g_d_s[ibra * 6 + 2] );
687 
688                     HRR_INT__i_g_d_p[ibra * 18 + 8] = HRR_INT__i_g_f_s[ibra * 10 + 5] + ( hCD[2] * HRR_INT__i_g_d_s[ibra * 6 + 2] );
689 
690                     HRR_INT__i_g_d_p[ibra * 18 + 9] = HRR_INT__i_g_f_s[ibra * 10 + 3] + ( hCD[0] * HRR_INT__i_g_d_s[ibra * 6 + 3] );
691 
692                     HRR_INT__i_g_d_p[ibra * 18 + 10] = HRR_INT__i_g_f_s[ibra * 10 + 6] + ( hCD[1] * HRR_INT__i_g_d_s[ibra * 6 + 3] );
693 
694                     HRR_INT__i_g_d_p[ibra * 18 + 11] = HRR_INT__i_g_f_s[ibra * 10 + 7] + ( hCD[2] * HRR_INT__i_g_d_s[ibra * 6 + 3] );
695 
696                     HRR_INT__i_g_d_p[ibra * 18 + 12] = HRR_INT__i_g_f_s[ibra * 10 + 4] + ( hCD[0] * HRR_INT__i_g_d_s[ibra * 6 + 4] );
697 
698                     HRR_INT__i_g_d_p[ibra * 18 + 13] = HRR_INT__i_g_f_s[ibra * 10 + 7] + ( hCD[1] * HRR_INT__i_g_d_s[ibra * 6 + 4] );
699 
700                     HRR_INT__i_g_d_p[ibra * 18 + 14] = HRR_INT__i_g_f_s[ibra * 10 + 8] + ( hCD[2] * HRR_INT__i_g_d_s[ibra * 6 + 4] );
701 
702                     HRR_INT__i_g_d_p[ibra * 18 + 15] = HRR_INT__i_g_f_s[ibra * 10 + 5] + ( hCD[0] * HRR_INT__i_g_d_s[ibra * 6 + 5] );
703 
704                     HRR_INT__i_g_d_p[ibra * 18 + 16] = HRR_INT__i_g_f_s[ibra * 10 + 8] + ( hCD[1] * HRR_INT__i_g_d_s[ibra * 6 + 5] );
705 
706                     HRR_INT__i_g_d_p[ibra * 18 + 17] = HRR_INT__i_g_f_s[ibra * 10 + 9] + ( hCD[2] * HRR_INT__i_g_d_s[ibra * 6 + 5] );
707 
708                 }
709 
710 
711             }  // close HRR loop
712 
713 
714         }   // close loop cdbatch
715 
716         istart = iend;
717     }  // close loop over ab
718 
719     return P.nshell12_clip * Q.nshell12_clip;
720 }
721 
ostei_g_i_d_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_i_d_p)722 int ostei_g_i_d_p(struct simint_multi_shellpair const P,
723                   struct simint_multi_shellpair const Q,
724                   double screen_tol,
725                   double * const restrict work,
726                   double * const restrict INT__g_i_d_p)
727 {
728     double P_AB[3*P.nshell12];
729     struct simint_multi_shellpair P_tmp = P;
730     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
731     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
732     P_tmp.AB_x = P_AB;
733     P_tmp.AB_y = P_AB + P.nshell12;
734     P_tmp.AB_z = P_AB + 2*P.nshell12;
735 
736     for(int i = 0; i < P.nshell12; i++)
737     {
738         P_tmp.AB_x[i] = -P.AB_x[i];
739         P_tmp.AB_y[i] = -P.AB_y[i];
740         P_tmp.AB_z[i] = -P.AB_z[i];
741     }
742 
743     int ret = ostei_i_g_d_p(P_tmp, Q, screen_tol, work, INT__g_i_d_p);
744     double buffer[7560] SIMINT_ALIGN_ARRAY_DBL;
745 
746     for(int q = 0; q < ret; q++)
747     {
748         int idx = 0;
749         for(int a = 0; a < 15; ++a)
750         for(int b = 0; b < 28; ++b)
751         for(int c = 0; c < 6; ++c)
752         for(int d = 0; d < 3; ++d)
753             buffer[idx++] = INT__g_i_d_p[q*7560+b*270+a*18+c*3+d];
754 
755         memcpy(INT__g_i_d_p+q*7560, buffer, 7560*sizeof(double));
756     }
757 
758     return ret;
759 }
760 
ostei_i_g_p_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__i_g_p_d)761 int ostei_i_g_p_d(struct simint_multi_shellpair const P,
762                   struct simint_multi_shellpair const Q,
763                   double screen_tol,
764                   double * const restrict work,
765                   double * const restrict INT__i_g_p_d)
766 {
767     double Q_AB[3*Q.nshell12];
768     struct simint_multi_shellpair Q_tmp = Q;
769     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
770     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
771     Q_tmp.AB_x = Q_AB;
772     Q_tmp.AB_y = Q_AB + Q.nshell12;
773     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
774 
775     for(int i = 0; i < Q.nshell12; i++)
776     {
777         Q_tmp.AB_x[i] = -Q.AB_x[i];
778         Q_tmp.AB_y[i] = -Q.AB_y[i];
779         Q_tmp.AB_z[i] = -Q.AB_z[i];
780     }
781 
782     int ret = ostei_i_g_d_p(P, Q_tmp, screen_tol, work, INT__i_g_p_d);
783     double buffer[7560] SIMINT_ALIGN_ARRAY_DBL;
784 
785     for(int q = 0; q < ret; q++)
786     {
787         int idx = 0;
788         for(int a = 0; a < 28; ++a)
789         for(int b = 0; b < 15; ++b)
790         for(int c = 0; c < 3; ++c)
791         for(int d = 0; d < 6; ++d)
792             buffer[idx++] = INT__i_g_p_d[q*7560+a*270+b*18+d*3+c];
793 
794         memcpy(INT__i_g_p_d+q*7560, buffer, 7560*sizeof(double));
795     }
796 
797     return ret;
798 }
799 
ostei_g_i_p_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_i_p_d)800 int ostei_g_i_p_d(struct simint_multi_shellpair const P,
801                   struct simint_multi_shellpair const Q,
802                   double screen_tol,
803                   double * const restrict work,
804                   double * const restrict INT__g_i_p_d)
805 {
806     double P_AB[3*P.nshell12];
807     struct simint_multi_shellpair P_tmp = P;
808     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
809     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
810     P_tmp.AB_x = P_AB;
811     P_tmp.AB_y = P_AB + P.nshell12;
812     P_tmp.AB_z = P_AB + 2*P.nshell12;
813 
814     for(int i = 0; i < P.nshell12; i++)
815     {
816         P_tmp.AB_x[i] = -P.AB_x[i];
817         P_tmp.AB_y[i] = -P.AB_y[i];
818         P_tmp.AB_z[i] = -P.AB_z[i];
819     }
820 
821     double Q_AB[3*Q.nshell12];
822     struct simint_multi_shellpair Q_tmp = Q;
823     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
824     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
825     Q_tmp.AB_x = Q_AB;
826     Q_tmp.AB_y = Q_AB + Q.nshell12;
827     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
828 
829     for(int i = 0; i < Q.nshell12; i++)
830     {
831         Q_tmp.AB_x[i] = -Q.AB_x[i];
832         Q_tmp.AB_y[i] = -Q.AB_y[i];
833         Q_tmp.AB_z[i] = -Q.AB_z[i];
834     }
835 
836     int ret = ostei_i_g_d_p(P_tmp, Q_tmp, screen_tol, work, INT__g_i_p_d);
837     double buffer[7560] SIMINT_ALIGN_ARRAY_DBL;
838 
839     for(int q = 0; q < ret; q++)
840     {
841         int idx = 0;
842         for(int a = 0; a < 15; ++a)
843         for(int b = 0; b < 28; ++b)
844         for(int c = 0; c < 3; ++c)
845         for(int d = 0; d < 6; ++d)
846             buffer[idx++] = INT__g_i_p_d[q*7560+b*270+a*18+d*3+c];
847 
848         memcpy(INT__g_i_p_d+q*7560, buffer, 7560*sizeof(double));
849     }
850 
851     return ret;
852 }
853 
854