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_i_p(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_i_p)8 int ostei_h_s_i_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__h_s_i_p)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__h_s_i_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 ibra;
26 
27     // partition workspace
28     double * const INT__h_s_i_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__h_s_k_s = work + (SIMINT_NSHELL_SIMD * 588);
30     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*1344);
31     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
32     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 13;
33     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 49;
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 115;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 215;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 350;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 518;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 714;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 930;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 1020;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1170;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 1395;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 1710;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 2130;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 2670;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 2910;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 3270;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 3774;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 4446;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 5310;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 5760;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 6390;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 7230;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 8310;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 8940;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 9780;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 10860;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 11448;
59     double * const hrrwork = (double *)(primwork + 12204);
60 
61 
62     // Create constants
63     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
64     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
65     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
66     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
67     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
68     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
69     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
70     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
71 
72 
73     ////////////////////////////////////////
74     // Loop over shells and primitives
75     ////////////////////////////////////////
76 
77     real_abcd = 0;
78     istart = 0;
79     for(ab = 0; ab < P.nshell12_clip; ++ab)
80     {
81         const int iend = istart + P.nprim12[ab];
82 
83         cd = 0;
84         jstart = 0;
85 
86         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
87         {
88             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
89             int jend = jstart;
90             for(i = 0; i < nshellbatch; i++)
91                 jend += Q.nprim12[cd+i];
92 
93             // Clear the beginning of the workspace (where we are accumulating integrals)
94             memset(work, 0, SIMINT_NSHELL_SIMD * 1344 * sizeof(double));
95             abcd = 0;
96 
97 
98             for(i = istart; i < iend; ++i)
99             {
100                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
101 
102                 if(check_screen)
103                 {
104                     // Skip this whole thing if always insignificant
105                     if((P.screen[i] * Q.screen_max) < screen_tol)
106                         continue;
107                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
108                 }
109 
110                 icd = 0;
111                 iprimcd = 0;
112                 nprim_icd = Q.nprim12[cd];
113                 double * restrict PRIM_PTR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
114                 double * restrict PRIM_PTR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
115 
116 
117 
118                 // Load these one per loop over i
119                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
120                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
121                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
122 
123                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
124 
125                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
126                 {
127                     // calculate the shell offsets
128                     // these are the offset from the shell pointed to by cd
129                     // for each element
130                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
131                     int lastoffset = 0;
132                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
133 
134                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
135                     {
136                         // Handle if the first element of the vector is a new shell
137                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
138                         {
139                             nprim_icd += Q.nprim12[cd + (++icd)];
140                             PRIM_PTR_INT__h_s_i_s += 588;
141                             PRIM_PTR_INT__h_s_k_s += 756;
142                         }
143                         iprimcd++;
144                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
145                         {
146                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
147                             {
148                                 shelloffsets[n] = shelloffsets[n-1] + 1;
149                                 lastoffset++;
150                                 nprim_icd += Q.nprim12[cd + (++icd)];
151                             }
152                             else
153                                 shelloffsets[n] = shelloffsets[n-1];
154                             iprimcd++;
155                         }
156                     }
157                     else
158                         iprimcd += SIMINT_SIMD_LEN;
159 
160                     // Do we have to compute this vector (or has it been screened out)?
161                     // (not_screened != 0 means we have to do this vector)
162                     if(check_screen)
163                     {
164                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
165                         if(vmax < screen_tol)
166                         {
167                             PRIM_PTR_INT__h_s_i_s += lastoffset*588;
168                             PRIM_PTR_INT__h_s_k_s += lastoffset*756;
169                             continue;
170                         }
171                     }
172 
173                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
174                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
175                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
176                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
177 
178 
179                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
180                     SIMINT_DBLTYPE PQ[3];
181                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
182                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
183                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
184                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
185                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
186                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
187 
188                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
189                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
190                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
191                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
192                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
193                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
194                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
195 
196                     // NOTE: Minus sign!
197                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
198                     SIMINT_DBLTYPE aop_PQ[3];
199                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
200                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
201                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
202 
203                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
204                     SIMINT_DBLTYPE aoq_PQ[3];
205                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
206                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
207                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
208                     // Put a minus sign here so we don't have to in RR routines
209                     a_over_q = SIMINT_NEG(a_over_q);
210 
211 
212                     //////////////////////////////////////////////
213                     // Fjt function section
214                     // Maximum v value: 12
215                     //////////////////////////////////////////////
216                     // The parameter to the Fjt function
217                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
218 
219 
220                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
221 
222 
223                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 12);
224                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
225                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
226                     for(n = 0; n <= 12; n++)
227                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
228 
229                     //////////////////////////////////////////////
230                     // Primitive integrals: Vertical recurrance
231                     //////////////////////////////////////////////
232 
233                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
234                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
235                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
236                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
237                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
238                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
239                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
240                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
241                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
242                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
243                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
244                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
245                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
246                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
247                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
248                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
249                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
250 
251 
252 
253                     // Forming PRIM_INT__s_s_p_s[12 * 3];
254                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
255                     {
256 
257                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
258                         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]);
259 
260                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
261                         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]);
262 
263                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
264                         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]);
265 
266                     }
267 
268 
269 
270                     // Forming PRIM_INT__s_s_d_s[11 * 6];
271                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
272                     {
273 
274                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
275                         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]);
276                         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]);
277 
278                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
279                         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]);
280 
281                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
282                         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]);
283 
284                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
285                         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]);
286                         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]);
287 
288                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
289                         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]);
290 
291                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
292                         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]);
293                         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]);
294 
295                     }
296 
297 
298 
299                     // Forming PRIM_INT__s_s_f_s[10 * 10];
300                     for(n = 0; n < 10; ++n)  // loop over orders of auxiliary function
301                     {
302 
303                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
304                         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]);
305                         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]);
306 
307                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
308                         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]);
309 
310                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
311                         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]);
312 
313                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
314                         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]);
315 
316                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
317                         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]);
318 
319                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
320                         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]);
321 
322                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
323                         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]);
324                         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]);
325 
326                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
327                         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]);
328 
329                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
330                         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]);
331 
332                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
333                         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]);
334                         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]);
335 
336                     }
337 
338 
339                     VRR_K_s_s_g_s(
340                             PRIM_INT__s_s_g_s,
341                             PRIM_INT__s_s_f_s,
342                             PRIM_INT__s_s_d_s,
343                             Q_PA,
344                             a_over_q,
345                             aoq_PQ,
346                             one_over_2q,
347                             9);
348 
349 
350                     VRR_K_s_s_h_s(
351                             PRIM_INT__s_s_h_s,
352                             PRIM_INT__s_s_g_s,
353                             PRIM_INT__s_s_f_s,
354                             Q_PA,
355                             a_over_q,
356                             aoq_PQ,
357                             one_over_2q,
358                             8);
359 
360 
361                     ostei_general_vrr1_K(6, 7,
362                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
363                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
364 
365 
366                     ostei_general_vrr_I(1, 0, 6, 0, 5,
367                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
368                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
369 
370 
371                     ostei_general_vrr_I(1, 0, 5, 0, 5,
372                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
373                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
374 
375 
376                     ostei_general_vrr_I(2, 0, 6, 0, 4,
377                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
378                             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);
379 
380 
381                     VRR_I_p_s_g_s(
382                             PRIM_INT__p_s_g_s,
383                             PRIM_INT__s_s_g_s,
384                             PRIM_INT__s_s_f_s,
385                             P_PA,
386                             aop_PQ,
387                             one_over_2pq,
388                             5);
389 
390 
391                     ostei_general_vrr_I(2, 0, 5, 0, 4,
392                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
393                             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);
394 
395 
396                     ostei_general_vrr_I(3, 0, 6, 0, 3,
397                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
398                             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);
399 
400 
401                     VRR_I_p_s_f_s(
402                             PRIM_INT__p_s_f_s,
403                             PRIM_INT__s_s_f_s,
404                             PRIM_INT__s_s_d_s,
405                             P_PA,
406                             aop_PQ,
407                             one_over_2pq,
408                             5);
409 
410 
411                     ostei_general_vrr_I(2, 0, 4, 0, 4,
412                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
413                             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);
414 
415 
416                     ostei_general_vrr_I(3, 0, 5, 0, 3,
417                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
418                             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);
419 
420 
421                     ostei_general_vrr_I(4, 0, 6, 0, 2,
422                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
423                             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);
424 
425 
426 
427                     // Forming PRIM_INT__p_s_d_s[5 * 18];
428                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
429                     {
430 
431                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
432                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
433                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
434 
435                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
436                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
437                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
438 
439                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
440                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
441                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
442 
443                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
444                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 3]);
445 
446                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
447                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 4]);
448 
449                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
450                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 5]);
451 
452                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
453                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 6]);
454 
455                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
456                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 7]);
457                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 7]);
458 
459                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
460                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 8]);
461 
462                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
463                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 9]);
464                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 9]);
465 
466                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
467                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 10]);
468                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 10]);
469 
470                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
471                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 11]);
472 
473                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
474                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 12]);
475 
476                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
477                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 13]);
478 
479                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
480                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 14]);
481                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 14]);
482 
483                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
484                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 15]);
485 
486                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
487                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 16]);
488                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 16]);
489 
490                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
491                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 17]);
492                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 17]);
493 
494                     }
495 
496 
497                     VRR_I_d_s_f_s(
498                             PRIM_INT__d_s_f_s,
499                             PRIM_INT__p_s_f_s,
500                             PRIM_INT__s_s_f_s,
501                             PRIM_INT__p_s_d_s,
502                             P_PA,
503                             a_over_p,
504                             aop_PQ,
505                             one_over_2p,
506                             one_over_2pq,
507                             4);
508 
509 
510                     ostei_general_vrr_I(3, 0, 4, 0, 3,
511                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
512                             PRIM_INT__d_s_g_s, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_g_s);
513 
514 
515                     ostei_general_vrr_I(4, 0, 5, 0, 2,
516                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
517                             PRIM_INT__f_s_h_s, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);
518 
519 
520                     ostei_general_vrr_I(5, 0, 6, 0, 1,
521                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
522                             PRIM_INT__g_s_i_s, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);
523 
524 
525                     ostei_general_vrr1_K(7, 6,
526                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
527                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
528 
529 
530                     ostei_general_vrr_I(1, 0, 7, 0, 5,
531                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
532                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
533 
534 
535                     ostei_general_vrr_I(2, 0, 7, 0, 4,
536                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
537                             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);
538 
539 
540                     ostei_general_vrr_I(3, 0, 7, 0, 3,
541                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
542                             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);
543 
544 
545                     ostei_general_vrr_I(4, 0, 7, 0, 2,
546                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
547                             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);
548 
549 
550                     ostei_general_vrr_I(5, 0, 7, 0, 1,
551                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
552                             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);
553 
554 
555 
556 
557                     ////////////////////////////////////
558                     // Accumulate contracted integrals
559                     ////////////////////////////////////
560                     if(lastoffset == 0)
561                     {
562                         contract_all(588, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
563                         contract_all(756, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
564                     }
565                     else
566                     {
567                         contract(588, shelloffsets, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
568                         contract(756, shelloffsets, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
569                         PRIM_PTR_INT__h_s_i_s += lastoffset*588;
570                         PRIM_PTR_INT__h_s_k_s += lastoffset*756;
571                     }
572 
573                 }  // close loop over j
574             }  // close loop over i
575 
576             //Advance to the next batch
577             jstart = SIMINT_SIMD_ROUND(jend);
578 
579             //////////////////////////////////////////////
580             // Contracted integrals: Horizontal recurrance
581             //////////////////////////////////////////////
582 
583 
584 
585 
586             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
587             {
588                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
589 
590                 // set up HRR pointers
591                 double const * restrict HRR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
592                 double const * restrict HRR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
593                 double * restrict HRR_INT__h_s_i_p = INT__h_s_i_p + real_abcd * 1764;
594 
595                 // form INT__h_s_i_p
596                 ostei_general_hrr_L(5, 0, 6, 1, hCD, HRR_INT__h_s_k_s, HRR_INT__h_s_i_s, HRR_INT__h_s_i_p);
597 
598 
599             }  // close HRR loop
600 
601 
602         }   // close loop cdbatch
603 
604         istart = iend;
605     }  // close loop over ab
606 
607     return P.nshell12_clip * Q.nshell12_clip;
608 }
609 
ostei_s_h_i_p(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_i_p)610 int ostei_s_h_i_p(struct simint_multi_shellpair const P,
611                   struct simint_multi_shellpair const Q,
612                   double screen_tol,
613                   double * const restrict work,
614                   double * const restrict INT__s_h_i_p)
615 {
616     double P_AB[3*P.nshell12];
617     struct simint_multi_shellpair P_tmp = P;
618     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
619     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
620     P_tmp.AB_x = P_AB;
621     P_tmp.AB_y = P_AB + P.nshell12;
622     P_tmp.AB_z = P_AB + 2*P.nshell12;
623 
624     for(int i = 0; i < P.nshell12; i++)
625     {
626         P_tmp.AB_x[i] = -P.AB_x[i];
627         P_tmp.AB_y[i] = -P.AB_y[i];
628         P_tmp.AB_z[i] = -P.AB_z[i];
629     }
630 
631     int ret = ostei_h_s_i_p(P_tmp, Q, screen_tol, work, INT__s_h_i_p);
632     double buffer[1764] SIMINT_ALIGN_ARRAY_DBL;
633 
634     for(int q = 0; q < ret; q++)
635     {
636         int idx = 0;
637         for(int a = 0; a < 1; ++a)
638         for(int b = 0; b < 21; ++b)
639         for(int c = 0; c < 28; ++c)
640         for(int d = 0; d < 3; ++d)
641             buffer[idx++] = INT__s_h_i_p[q*1764+b*84+a*84+c*3+d];
642 
643         memcpy(INT__s_h_i_p+q*1764, buffer, 1764*sizeof(double));
644     }
645 
646     return ret;
647 }
648 
ostei_h_s_p_i(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_p_i)649 int ostei_h_s_p_i(struct simint_multi_shellpair const P,
650                   struct simint_multi_shellpair const Q,
651                   double screen_tol,
652                   double * const restrict work,
653                   double * const restrict INT__h_s_p_i)
654 {
655     double Q_AB[3*Q.nshell12];
656     struct simint_multi_shellpair Q_tmp = Q;
657     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
658     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
659     Q_tmp.AB_x = Q_AB;
660     Q_tmp.AB_y = Q_AB + Q.nshell12;
661     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
662 
663     for(int i = 0; i < Q.nshell12; i++)
664     {
665         Q_tmp.AB_x[i] = -Q.AB_x[i];
666         Q_tmp.AB_y[i] = -Q.AB_y[i];
667         Q_tmp.AB_z[i] = -Q.AB_z[i];
668     }
669 
670     int ret = ostei_h_s_i_p(P, Q_tmp, screen_tol, work, INT__h_s_p_i);
671     double buffer[1764] SIMINT_ALIGN_ARRAY_DBL;
672 
673     for(int q = 0; q < ret; q++)
674     {
675         int idx = 0;
676         for(int a = 0; a < 21; ++a)
677         for(int b = 0; b < 1; ++b)
678         for(int c = 0; c < 3; ++c)
679         for(int d = 0; d < 28; ++d)
680             buffer[idx++] = INT__h_s_p_i[q*1764+a*84+b*84+d*3+c];
681 
682         memcpy(INT__h_s_p_i+q*1764, buffer, 1764*sizeof(double));
683     }
684 
685     return ret;
686 }
687 
ostei_s_h_p_i(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_p_i)688 int ostei_s_h_p_i(struct simint_multi_shellpair const P,
689                   struct simint_multi_shellpair const Q,
690                   double screen_tol,
691                   double * const restrict work,
692                   double * const restrict INT__s_h_p_i)
693 {
694     double P_AB[3*P.nshell12];
695     struct simint_multi_shellpair P_tmp = P;
696     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
697     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
698     P_tmp.AB_x = P_AB;
699     P_tmp.AB_y = P_AB + P.nshell12;
700     P_tmp.AB_z = P_AB + 2*P.nshell12;
701 
702     for(int i = 0; i < P.nshell12; i++)
703     {
704         P_tmp.AB_x[i] = -P.AB_x[i];
705         P_tmp.AB_y[i] = -P.AB_y[i];
706         P_tmp.AB_z[i] = -P.AB_z[i];
707     }
708 
709     double Q_AB[3*Q.nshell12];
710     struct simint_multi_shellpair Q_tmp = Q;
711     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
712     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
713     Q_tmp.AB_x = Q_AB;
714     Q_tmp.AB_y = Q_AB + Q.nshell12;
715     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
716 
717     for(int i = 0; i < Q.nshell12; i++)
718     {
719         Q_tmp.AB_x[i] = -Q.AB_x[i];
720         Q_tmp.AB_y[i] = -Q.AB_y[i];
721         Q_tmp.AB_z[i] = -Q.AB_z[i];
722     }
723 
724     int ret = ostei_h_s_i_p(P_tmp, Q_tmp, screen_tol, work, INT__s_h_p_i);
725     double buffer[1764] SIMINT_ALIGN_ARRAY_DBL;
726 
727     for(int q = 0; q < ret; q++)
728     {
729         int idx = 0;
730         for(int a = 0; a < 1; ++a)
731         for(int b = 0; b < 21; ++b)
732         for(int c = 0; c < 3; ++c)
733         for(int d = 0; d < 28; ++d)
734             buffer[idx++] = INT__s_h_p_i[q*1764+b*84+a*84+d*3+c];
735 
736         memcpy(INT__s_h_p_i+q*1764, buffer, 1764*sizeof(double));
737     }
738 
739     return ret;
740 }
741 
742