1 #include "simint/boys/boys.h"
2 #include "simint/ostei/gen/ostei_generated.h"
3 #include "simint/vectorization/vectorization.h"
4 #include <math.h>
5 #include <string.h>
6 
7 
ostei_h_s_k_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__h_s_k_g)8 int ostei_h_s_k_g(struct simint_multi_shellpair const P,
9                   struct simint_multi_shellpair const Q,
10                   double screen_tol,
11                   double * const restrict work,
12                   double * const restrict INT__h_s_k_g)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__h_s_k_g);
17     int ab, cd, abcd;
18     int istart, jstart;
19     int iprimcd, nprim_icd, icd;
20     const int check_screen = (screen_tol > 0.0);
21     int i, j;
22     int n;
23     int not_screened;
24     int real_abcd;
25     int ibra;
26 
27     // partition workspace
28     double * const INT__h_s_k_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__h_s_l_s = work + (SIMINT_NSHELL_SIMD * 756);
30     double * const INT__h_s_m_s = work + (SIMINT_NSHELL_SIMD * 1701);
31     double * const INT__h_s_n_s = work + (SIMINT_NSHELL_SIMD * 2856);
32     double * const INT__h_s_o_s = work + (SIMINT_NSHELL_SIMD * 4242);
33     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*5880);
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 17;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 65;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 155;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 295;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 490;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 742;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 1050;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1410;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 1815;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_n_s = primwork + 2255;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_o_s = primwork + 2717;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 3185;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 3335;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 3560;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 3875;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 4295;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 4835;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 5510;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_n_s = primwork + 6335;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_o_s = primwork + 7325;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 8495;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 8855;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 9359;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 10031;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 10895;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 11975;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_n_s = primwork + 13295;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_o_s = primwork + 14879;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 16751;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 17381;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 18221;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 19301;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 20651;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_n_s = primwork + 22301;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_o_s = primwork + 24281;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 26621;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 27461;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 28541;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_m_s = primwork + 29891;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_n_s = primwork + 31541;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_o_s = primwork + 33521;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 35861;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_l_s = primwork + 36617;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_m_s = primwork + 37562;
79     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_n_s = primwork + 38717;
80     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_o_s = primwork + 40103;
81     double * const hrrwork = (double *)(primwork + 41741);
82     double * const HRR_INT__h_s_k_p = hrrwork + 0;
83     double * const HRR_INT__h_s_k_d = hrrwork + 2268;
84     double * const HRR_INT__h_s_k_f = hrrwork + 6804;
85     double * const HRR_INT__h_s_l_p = hrrwork + 14364;
86     double * const HRR_INT__h_s_l_d = hrrwork + 17199;
87     double * const HRR_INT__h_s_l_f = hrrwork + 22869;
88     double * const HRR_INT__h_s_m_p = hrrwork + 32319;
89     double * const HRR_INT__h_s_m_d = hrrwork + 35784;
90     double * const HRR_INT__h_s_n_p = hrrwork + 42714;
91 
92 
93     // Create constants
94     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
95     const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
96     const SIMINT_DBLTYPE const_11 = SIMINT_DBLSET1(11);
97     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
98     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
99     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
100     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
101     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
102     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
103     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
104     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
105     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
106 
107 
108     ////////////////////////////////////////
109     // Loop over shells and primitives
110     ////////////////////////////////////////
111 
112     real_abcd = 0;
113     istart = 0;
114     for(ab = 0; ab < P.nshell12_clip; ++ab)
115     {
116         const int iend = istart + P.nprim12[ab];
117 
118         cd = 0;
119         jstart = 0;
120 
121         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
122         {
123             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
124             int jend = jstart;
125             for(i = 0; i < nshellbatch; i++)
126                 jend += Q.nprim12[cd+i];
127 
128             // Clear the beginning of the workspace (where we are accumulating integrals)
129             memset(work, 0, SIMINT_NSHELL_SIMD * 5880 * sizeof(double));
130             abcd = 0;
131 
132 
133             for(i = istart; i < iend; ++i)
134             {
135                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
136 
137                 if(check_screen)
138                 {
139                     // Skip this whole thing if always insignificant
140                     if((P.screen[i] * Q.screen_max) < screen_tol)
141                         continue;
142                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
143                 }
144 
145                 icd = 0;
146                 iprimcd = 0;
147                 nprim_icd = Q.nprim12[cd];
148                 double * restrict PRIM_PTR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
149                 double * restrict PRIM_PTR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
150                 double * restrict PRIM_PTR_INT__h_s_m_s = INT__h_s_m_s + abcd * 1155;
151                 double * restrict PRIM_PTR_INT__h_s_n_s = INT__h_s_n_s + abcd * 1386;
152                 double * restrict PRIM_PTR_INT__h_s_o_s = INT__h_s_o_s + abcd * 1638;
153 
154 
155 
156                 // Load these one per loop over i
157                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
158                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
159                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
160 
161                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
162 
163                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
164                 {
165                     // calculate the shell offsets
166                     // these are the offset from the shell pointed to by cd
167                     // for each element
168                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
169                     int lastoffset = 0;
170                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
171 
172                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
173                     {
174                         // Handle if the first element of the vector is a new shell
175                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
176                         {
177                             nprim_icd += Q.nprim12[cd + (++icd)];
178                             PRIM_PTR_INT__h_s_k_s += 756;
179                             PRIM_PTR_INT__h_s_l_s += 945;
180                             PRIM_PTR_INT__h_s_m_s += 1155;
181                             PRIM_PTR_INT__h_s_n_s += 1386;
182                             PRIM_PTR_INT__h_s_o_s += 1638;
183                         }
184                         iprimcd++;
185                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
186                         {
187                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
188                             {
189                                 shelloffsets[n] = shelloffsets[n-1] + 1;
190                                 lastoffset++;
191                                 nprim_icd += Q.nprim12[cd + (++icd)];
192                             }
193                             else
194                                 shelloffsets[n] = shelloffsets[n-1];
195                             iprimcd++;
196                         }
197                     }
198                     else
199                         iprimcd += SIMINT_SIMD_LEN;
200 
201                     // Do we have to compute this vector (or has it been screened out)?
202                     // (not_screened != 0 means we have to do this vector)
203                     if(check_screen)
204                     {
205                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
206                         if(vmax < screen_tol)
207                         {
208                             PRIM_PTR_INT__h_s_k_s += lastoffset*756;
209                             PRIM_PTR_INT__h_s_l_s += lastoffset*945;
210                             PRIM_PTR_INT__h_s_m_s += lastoffset*1155;
211                             PRIM_PTR_INT__h_s_n_s += lastoffset*1386;
212                             PRIM_PTR_INT__h_s_o_s += lastoffset*1638;
213                             continue;
214                         }
215                     }
216 
217                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
218                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
219                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
220                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
221 
222 
223                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
224                     SIMINT_DBLTYPE PQ[3];
225                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
226                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
227                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
228                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
229                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
230                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
231 
232                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
233                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
234                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
235                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
236                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
237                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
238                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
239 
240                     // NOTE: Minus sign!
241                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
242                     SIMINT_DBLTYPE aop_PQ[3];
243                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
244                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
245                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
246 
247                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
248                     SIMINT_DBLTYPE aoq_PQ[3];
249                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
250                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
251                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
252                     // Put a minus sign here so we don't have to in RR routines
253                     a_over_q = SIMINT_NEG(a_over_q);
254 
255 
256                     //////////////////////////////////////////////
257                     // Fjt function section
258                     // Maximum v value: 16
259                     //////////////////////////////////////////////
260                     // The parameter to the Fjt function
261                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
262 
263 
264                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
265 
266 
267                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 16);
268                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
269                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
270                     for(n = 0; n <= 16; n++)
271                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
272 
273                     //////////////////////////////////////////////
274                     // Primitive integrals: Vertical recurrance
275                     //////////////////////////////////////////////
276 
277                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
278                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
279                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
280                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
281                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
282                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
283                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
284                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
285                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
286                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
287                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
288                     const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
289                     const SIMINT_DBLTYPE vrr_const_9_over_2q = SIMINT_MUL(const_9, one_over_2q);
290                     const SIMINT_DBLTYPE vrr_const_10_over_2q = SIMINT_MUL(const_10, one_over_2q);
291                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
292                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
293                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
294                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
295                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
296                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
297                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
298                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
299                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
300                     const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
301                     const SIMINT_DBLTYPE vrr_const_11_over_2pq = SIMINT_MUL(const_11, one_over_2pq);
302 
303 
304 
305                     // Forming PRIM_INT__s_s_p_s[16 * 3];
306                     for(n = 0; n < 16; ++n)  // loop over orders of auxiliary function
307                     {
308 
309                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
310                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]);
311 
312                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
313                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 1]);
314 
315                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
316                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 2]);
317 
318                     }
319 
320 
321 
322                     // Forming PRIM_INT__s_s_d_s[15 * 6];
323                     for(n = 0; n < 15; ++n)  // loop over orders of auxiliary function
324                     {
325 
326                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
327                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]);
328                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 0]);
329 
330                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
331                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 1]);
332 
333                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
334                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 2]);
335 
336                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
337                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 3]);
338                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 3]);
339 
340                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
341                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 4]);
342 
343                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
344                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_d_s[n * 6 + 5]);
345                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 5]);
346 
347                     }
348 
349 
350 
351                     // Forming PRIM_INT__s_s_f_s[14 * 10];
352                     for(n = 0; n < 14; ++n)  // loop over orders of auxiliary function
353                     {
354 
355                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
356                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 0]);
357                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_s_f_s[n * 10 + 0]);
358 
359                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
360                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 1]);
361 
362                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
363                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 2]);
364 
365                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
366                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 3]);
367 
368                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
369                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_f_s[n * 10 + 4]);
370 
371                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
372                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 5]);
373 
374                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
375                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 6]);
376                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_s_f_s[n * 10 + 6]);
377 
378                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
379                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 7]);
380 
381                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
382                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 8]);
383 
384                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
385                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 9]);
386                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_s_f_s[n * 10 + 9]);
387 
388                     }
389 
390 
391                     VRR_K_s_s_g_s(
392                             PRIM_INT__s_s_g_s,
393                             PRIM_INT__s_s_f_s,
394                             PRIM_INT__s_s_d_s,
395                             Q_PA,
396                             a_over_q,
397                             aoq_PQ,
398                             one_over_2q,
399                             13);
400 
401 
402                     VRR_K_s_s_h_s(
403                             PRIM_INT__s_s_h_s,
404                             PRIM_INT__s_s_g_s,
405                             PRIM_INT__s_s_f_s,
406                             Q_PA,
407                             a_over_q,
408                             aoq_PQ,
409                             one_over_2q,
410                             12);
411 
412 
413                     ostei_general_vrr1_K(6, 11,
414                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
415                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
416 
417 
418                     ostei_general_vrr1_K(7, 10,
419                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
420                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
421 
422 
423                     ostei_general_vrr_I(1, 0, 7, 0, 5,
424                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
425                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
426 
427 
428                     ostei_general_vrr_I(1, 0, 6, 0, 5,
429                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
430                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
431 
432 
433                     ostei_general_vrr_I(2, 0, 7, 0, 4,
434                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
435                             PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);
436 
437 
438                     ostei_general_vrr_I(1, 0, 5, 0, 5,
439                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
440                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
441 
442 
443                     ostei_general_vrr_I(2, 0, 6, 0, 4,
444                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
445                             PRIM_INT__p_s_i_s, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);
446 
447 
448                     ostei_general_vrr_I(3, 0, 7, 0, 3,
449                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
450                             PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);
451 
452 
453                     VRR_I_p_s_g_s(
454                             PRIM_INT__p_s_g_s,
455                             PRIM_INT__s_s_g_s,
456                             PRIM_INT__s_s_f_s,
457                             P_PA,
458                             aop_PQ,
459                             one_over_2pq,
460                             5);
461 
462 
463                     ostei_general_vrr_I(2, 0, 5, 0, 4,
464                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
465                             PRIM_INT__p_s_h_s, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_h_s);
466 
467 
468                     ostei_general_vrr_I(3, 0, 6, 0, 3,
469                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
470                             PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);
471 
472 
473                     ostei_general_vrr_I(4, 0, 7, 0, 2,
474                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
475                             PRIM_INT__f_s_k_s, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);
476 
477 
478                     VRR_I_p_s_f_s(
479                             PRIM_INT__p_s_f_s,
480                             PRIM_INT__s_s_f_s,
481                             PRIM_INT__s_s_d_s,
482                             P_PA,
483                             aop_PQ,
484                             one_over_2pq,
485                             5);
486 
487 
488                     ostei_general_vrr_I(2, 0, 4, 0, 4,
489                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
490                             PRIM_INT__p_s_g_s, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_g_s);
491 
492 
493                     ostei_general_vrr_I(3, 0, 5, 0, 3,
494                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
495                             PRIM_INT__d_s_h_s, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);
496 
497 
498                     ostei_general_vrr_I(4, 0, 6, 0, 2,
499                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
500                             PRIM_INT__f_s_i_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);
501 
502 
503                     ostei_general_vrr_I(5, 0, 7, 0, 1,
504                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
505                             PRIM_INT__g_s_k_s, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);
506 
507 
508                     ostei_general_vrr1_K(8, 9,
509                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
510                             PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
511 
512 
513                     ostei_general_vrr_I(1, 0, 8, 0, 5,
514                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
515                             PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
516 
517 
518                     ostei_general_vrr_I(2, 0, 8, 0, 4,
519                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
520                             PRIM_INT__p_s_l_s, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_l_s);
521 
522 
523                     ostei_general_vrr_I(3, 0, 8, 0, 3,
524                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
525                             PRIM_INT__d_s_l_s, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_l_s);
526 
527 
528                     ostei_general_vrr_I(4, 0, 8, 0, 2,
529                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
530                             PRIM_INT__f_s_l_s, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_l_s);
531 
532 
533                     ostei_general_vrr_I(5, 0, 8, 0, 1,
534                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
535                             PRIM_INT__g_s_l_s, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_l_s);
536 
537 
538                     ostei_general_vrr1_K(9, 8,
539                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
540                             PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);
541 
542 
543                     ostei_general_vrr_I(1, 0, 9, 0, 5,
544                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
545                             PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);
546 
547 
548                     ostei_general_vrr_I(2, 0, 9, 0, 4,
549                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
550                             PRIM_INT__p_s_m_s, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_m_s);
551 
552 
553                     ostei_general_vrr_I(3, 0, 9, 0, 3,
554                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
555                             PRIM_INT__d_s_m_s, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_m_s);
556 
557 
558                     ostei_general_vrr_I(4, 0, 9, 0, 2,
559                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
560                             PRIM_INT__f_s_m_s, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_m_s);
561 
562 
563                     ostei_general_vrr_I(5, 0, 9, 0, 1,
564                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
565                             PRIM_INT__g_s_m_s, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_m_s);
566 
567 
568                     ostei_general_vrr1_K(10, 7,
569                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
570                             PRIM_INT__s_s_m_s, PRIM_INT__s_s_l_s, PRIM_INT__s_s_n_s);
571 
572 
573                     ostei_general_vrr_I(1, 0, 10, 0, 5,
574                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
575                             PRIM_INT__s_s_n_s, NULL, NULL, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_n_s);
576 
577 
578                     ostei_general_vrr_I(2, 0, 10, 0, 4,
579                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
580                             PRIM_INT__p_s_n_s, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_n_s);
581 
582 
583                     ostei_general_vrr_I(3, 0, 10, 0, 3,
584                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
585                             PRIM_INT__d_s_n_s, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_n_s);
586 
587 
588                     ostei_general_vrr_I(4, 0, 10, 0, 2,
589                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
590                             PRIM_INT__f_s_n_s, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_n_s);
591 
592 
593                     ostei_general_vrr_I(5, 0, 10, 0, 1,
594                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
595                             PRIM_INT__g_s_n_s, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_n_s);
596 
597 
598                     ostei_general_vrr1_K(11, 6,
599                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
600                             PRIM_INT__s_s_n_s, PRIM_INT__s_s_m_s, PRIM_INT__s_s_o_s);
601 
602 
603                     ostei_general_vrr_I(1, 0, 11, 0, 5,
604                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
605                             PRIM_INT__s_s_o_s, NULL, NULL, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_o_s);
606 
607 
608                     ostei_general_vrr_I(2, 0, 11, 0, 4,
609                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
610                             PRIM_INT__p_s_o_s, PRIM_INT__s_s_o_s, NULL, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_o_s);
611 
612 
613                     ostei_general_vrr_I(3, 0, 11, 0, 3,
614                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
615                             PRIM_INT__d_s_o_s, PRIM_INT__p_s_o_s, NULL, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_o_s);
616 
617 
618                     ostei_general_vrr_I(4, 0, 11, 0, 2,
619                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
620                             PRIM_INT__f_s_o_s, PRIM_INT__d_s_o_s, NULL, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_o_s);
621 
622 
623                     ostei_general_vrr_I(5, 0, 11, 0, 1,
624                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
625                             PRIM_INT__g_s_o_s, PRIM_INT__f_s_o_s, NULL, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_o_s);
626 
627 
628 
629 
630                     ////////////////////////////////////
631                     // Accumulate contracted integrals
632                     ////////////////////////////////////
633                     if(lastoffset == 0)
634                     {
635                         contract_all(756, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
636                         contract_all(945, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
637                         contract_all(1155, PRIM_INT__h_s_m_s, PRIM_PTR_INT__h_s_m_s);
638                         contract_all(1386, PRIM_INT__h_s_n_s, PRIM_PTR_INT__h_s_n_s);
639                         contract_all(1638, PRIM_INT__h_s_o_s, PRIM_PTR_INT__h_s_o_s);
640                     }
641                     else
642                     {
643                         contract(756, shelloffsets, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
644                         contract(945, shelloffsets, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
645                         contract(1155, shelloffsets, PRIM_INT__h_s_m_s, PRIM_PTR_INT__h_s_m_s);
646                         contract(1386, shelloffsets, PRIM_INT__h_s_n_s, PRIM_PTR_INT__h_s_n_s);
647                         contract(1638, shelloffsets, PRIM_INT__h_s_o_s, PRIM_PTR_INT__h_s_o_s);
648                         PRIM_PTR_INT__h_s_k_s += lastoffset*756;
649                         PRIM_PTR_INT__h_s_l_s += lastoffset*945;
650                         PRIM_PTR_INT__h_s_m_s += lastoffset*1155;
651                         PRIM_PTR_INT__h_s_n_s += lastoffset*1386;
652                         PRIM_PTR_INT__h_s_o_s += lastoffset*1638;
653                     }
654 
655                 }  // close loop over j
656             }  // close loop over i
657 
658             //Advance to the next batch
659             jstart = SIMINT_SIMD_ROUND(jend);
660 
661             //////////////////////////////////////////////
662             // Contracted integrals: Horizontal recurrance
663             //////////////////////////////////////////////
664 
665 
666 
667 
668             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
669             {
670                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
671 
672                 // set up HRR pointers
673                 double const * restrict HRR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
674                 double const * restrict HRR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
675                 double const * restrict HRR_INT__h_s_m_s = INT__h_s_m_s + abcd * 1155;
676                 double const * restrict HRR_INT__h_s_n_s = INT__h_s_n_s + abcd * 1386;
677                 double const * restrict HRR_INT__h_s_o_s = INT__h_s_o_s + abcd * 1638;
678                 double * restrict HRR_INT__h_s_k_g = INT__h_s_k_g + real_abcd * 11340;
679 
680                 // form INT__h_s_k_p
681                 ostei_general_hrr_L(5, 0, 7, 1, hCD, HRR_INT__h_s_l_s, HRR_INT__h_s_k_s, HRR_INT__h_s_k_p);
682 
683                 // form INT__h_s_l_p
684                 ostei_general_hrr_L(5, 0, 8, 1, hCD, HRR_INT__h_s_m_s, HRR_INT__h_s_l_s, HRR_INT__h_s_l_p);
685 
686                 // form INT__h_s_m_p
687                 ostei_general_hrr_L(5, 0, 9, 1, hCD, HRR_INT__h_s_n_s, HRR_INT__h_s_m_s, HRR_INT__h_s_m_p);
688 
689                 // form INT__h_s_n_p
690                 ostei_general_hrr_L(5, 0, 10, 1, hCD, HRR_INT__h_s_o_s, HRR_INT__h_s_n_s, HRR_INT__h_s_n_p);
691 
692                 // form INT__h_s_k_d
693                 ostei_general_hrr_L(5, 0, 7, 2, hCD, HRR_INT__h_s_l_p, HRR_INT__h_s_k_p, HRR_INT__h_s_k_d);
694 
695                 // form INT__h_s_l_d
696                 ostei_general_hrr_L(5, 0, 8, 2, hCD, HRR_INT__h_s_m_p, HRR_INT__h_s_l_p, HRR_INT__h_s_l_d);
697 
698                 // form INT__h_s_m_d
699                 ostei_general_hrr_L(5, 0, 9, 2, hCD, HRR_INT__h_s_n_p, HRR_INT__h_s_m_p, HRR_INT__h_s_m_d);
700 
701                 // form INT__h_s_k_f
702                 ostei_general_hrr_L(5, 0, 7, 3, hCD, HRR_INT__h_s_l_d, HRR_INT__h_s_k_d, HRR_INT__h_s_k_f);
703 
704                 // form INT__h_s_l_f
705                 ostei_general_hrr_L(5, 0, 8, 3, hCD, HRR_INT__h_s_m_d, HRR_INT__h_s_l_d, HRR_INT__h_s_l_f);
706 
707                 // form INT__h_s_k_g
708                 ostei_general_hrr_L(5, 0, 7, 4, hCD, HRR_INT__h_s_l_f, HRR_INT__h_s_k_f, HRR_INT__h_s_k_g);
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_s_h_k_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_h_k_g)722 int ostei_s_h_k_g(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__s_h_k_g)
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_h_s_k_g(P_tmp, Q, screen_tol, work, INT__s_h_k_g);
744     double buffer[11340] SIMINT_ALIGN_ARRAY_DBL;
745 
746     for(int q = 0; q < ret; q++)
747     {
748         int idx = 0;
749         for(int a = 0; a < 1; ++a)
750         for(int b = 0; b < 21; ++b)
751         for(int c = 0; c < 36; ++c)
752         for(int d = 0; d < 15; ++d)
753             buffer[idx++] = INT__s_h_k_g[q*11340+b*540+a*540+c*15+d];
754 
755         memcpy(INT__s_h_k_g+q*11340, buffer, 11340*sizeof(double));
756     }
757 
758     return ret;
759 }
760 
ostei_h_s_g_k(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__h_s_g_k)761 int ostei_h_s_g_k(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__h_s_g_k)
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_h_s_k_g(P, Q_tmp, screen_tol, work, INT__h_s_g_k);
783     double buffer[11340] SIMINT_ALIGN_ARRAY_DBL;
784 
785     for(int q = 0; q < ret; q++)
786     {
787         int idx = 0;
788         for(int a = 0; a < 21; ++a)
789         for(int b = 0; b < 1; ++b)
790         for(int c = 0; c < 15; ++c)
791         for(int d = 0; d < 36; ++d)
792             buffer[idx++] = INT__h_s_g_k[q*11340+a*540+b*540+d*15+c];
793 
794         memcpy(INT__h_s_g_k+q*11340, buffer, 11340*sizeof(double));
795     }
796 
797     return ret;
798 }
799 
ostei_s_h_g_k(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_h_g_k)800 int ostei_s_h_g_k(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__s_h_g_k)
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_h_s_k_g(P_tmp, Q_tmp, screen_tol, work, INT__s_h_g_k);
837     double buffer[11340] SIMINT_ALIGN_ARRAY_DBL;
838 
839     for(int q = 0; q < ret; q++)
840     {
841         int idx = 0;
842         for(int a = 0; a < 1; ++a)
843         for(int b = 0; b < 21; ++b)
844         for(int c = 0; c < 15; ++c)
845         for(int d = 0; d < 36; ++d)
846             buffer[idx++] = INT__s_h_g_k[q*11340+b*540+a*540+d*15+c];
847 
848         memcpy(INT__s_h_g_k+q*11340, buffer, 11340*sizeof(double));
849     }
850 
851     return ret;
852 }
853 
854