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_s(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_s)8 int ostei_h_s_k_s(struct simint_multi_shellpair const P,
9                   struct simint_multi_shellpair const Q,
10                   double screen_tol,
11                   double * const restrict work,
12                   double * const restrict INT__h_s_k_s)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__h_s_k_s);
17     memset(INT__h_s_k_s, 0, P.nshell12_clip * Q.nshell12_clip * 756 * sizeof(double));
18 
19     int ab, cd, abcd;
20     int istart, jstart;
21     int iprimcd, nprim_icd, icd;
22     const int check_screen = (screen_tol > 0.0);
23     int i, j;
24     int n;
25     int not_screened;
26 
27     // partition workspace
28     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*0);
29     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
30     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 13;
31     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 49;
32     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 115;
33     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 215;
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 350;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 518;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 714;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 930;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1080;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 1305;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 1620;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 2040;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 2580;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 2940;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 3444;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 4116;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 4980;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 5610;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 6450;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 7530;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 8370;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 9450;
52     double * const hrrwork = (double *)(primwork + 10206);
53 
54 
55     // Create constants
56     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
57     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
58     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
59     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
60     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
61     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
62     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
63     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
64 
65 
66     ////////////////////////////////////////
67     // Loop over shells and primitives
68     ////////////////////////////////////////
69 
70     abcd = 0;
71     istart = 0;
72     for(ab = 0; ab < P.nshell12_clip; ++ab)
73     {
74         const int iend = istart + P.nprim12[ab];
75 
76         cd = 0;
77         jstart = 0;
78 
79         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
80         {
81             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
82             int jend = jstart;
83             for(i = 0; i < nshellbatch; i++)
84                 jend += Q.nprim12[cd+i];
85 
86 
87             for(i = istart; i < iend; ++i)
88             {
89                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
90 
91                 if(check_screen)
92                 {
93                     // Skip this whole thing if always insignificant
94                     if((P.screen[i] * Q.screen_max) < screen_tol)
95                         continue;
96                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
97                 }
98 
99                 icd = 0;
100                 iprimcd = 0;
101                 nprim_icd = Q.nprim12[cd];
102                 double * restrict PRIM_PTR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
103 
104 
105 
106                 // Load these one per loop over i
107                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
108                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
109                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
110 
111                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
112 
113                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
114                 {
115                     // calculate the shell offsets
116                     // these are the offset from the shell pointed to by cd
117                     // for each element
118                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
119                     int lastoffset = 0;
120                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
121 
122                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
123                     {
124                         // Handle if the first element of the vector is a new shell
125                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
126                         {
127                             nprim_icd += Q.nprim12[cd + (++icd)];
128                             PRIM_PTR_INT__h_s_k_s += 756;
129                         }
130                         iprimcd++;
131                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
132                         {
133                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
134                             {
135                                 shelloffsets[n] = shelloffsets[n-1] + 1;
136                                 lastoffset++;
137                                 nprim_icd += Q.nprim12[cd + (++icd)];
138                             }
139                             else
140                                 shelloffsets[n] = shelloffsets[n-1];
141                             iprimcd++;
142                         }
143                     }
144                     else
145                         iprimcd += SIMINT_SIMD_LEN;
146 
147                     // Do we have to compute this vector (or has it been screened out)?
148                     // (not_screened != 0 means we have to do this vector)
149                     if(check_screen)
150                     {
151                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
152                         if(vmax < screen_tol)
153                         {
154                             PRIM_PTR_INT__h_s_k_s += lastoffset*756;
155                             continue;
156                         }
157                     }
158 
159                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
160                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
161                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
162                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
163 
164 
165                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
166                     SIMINT_DBLTYPE PQ[3];
167                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
168                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
169                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
170                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
171                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
172                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
173 
174                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
175                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
176                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
177                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
178                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
179                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
180                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
181 
182                     // NOTE: Minus sign!
183                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
184                     SIMINT_DBLTYPE aop_PQ[3];
185                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
186                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
187                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
188 
189                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
190                     SIMINT_DBLTYPE aoq_PQ[3];
191                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
192                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
193                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
194                     // Put a minus sign here so we don't have to in RR routines
195                     a_over_q = SIMINT_NEG(a_over_q);
196 
197 
198                     //////////////////////////////////////////////
199                     // Fjt function section
200                     // Maximum v value: 12
201                     //////////////////////////////////////////////
202                     // The parameter to the Fjt function
203                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
204 
205 
206                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
207 
208 
209                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 12);
210                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
211                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
212                     for(n = 0; n <= 12; n++)
213                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
214 
215                     //////////////////////////////////////////////
216                     // Primitive integrals: Vertical recurrance
217                     //////////////////////////////////////////////
218 
219                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
220                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
221                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
222                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
223                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
224                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
225                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
226                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
227                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
228                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
229                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
230                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
231                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
232                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
233                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
234                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
235                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
236 
237 
238 
239                     // Forming PRIM_INT__s_s_p_s[12 * 3];
240                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
241                     {
242 
243                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
244                         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]);
245 
246                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
247                         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]);
248 
249                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
250                         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]);
251 
252                     }
253 
254 
255 
256                     // Forming PRIM_INT__s_s_d_s[11 * 6];
257                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
258                     {
259 
260                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
261                         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]);
262                         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]);
263 
264                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
265                         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]);
266 
267                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
268                         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]);
269 
270                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
271                         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]);
272                         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]);
273 
274                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
275                         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]);
276 
277                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
278                         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]);
279                         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]);
280 
281                     }
282 
283 
284 
285                     // Forming PRIM_INT__s_s_f_s[10 * 10];
286                     for(n = 0; n < 10; ++n)  // loop over orders of auxiliary function
287                     {
288 
289                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
290                         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]);
291                         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]);
292 
293                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
294                         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]);
295 
296                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
297                         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]);
298 
299                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
300                         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]);
301 
302                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
303                         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]);
304 
305                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
306                         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]);
307 
308                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
309                         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]);
310                         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]);
311 
312                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
313                         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]);
314 
315                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
316                         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]);
317 
318                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
319                         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]);
320                         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]);
321 
322                     }
323 
324 
325                     VRR_K_s_s_g_s(
326                             PRIM_INT__s_s_g_s,
327                             PRIM_INT__s_s_f_s,
328                             PRIM_INT__s_s_d_s,
329                             Q_PA,
330                             a_over_q,
331                             aoq_PQ,
332                             one_over_2q,
333                             9);
334 
335 
336                     VRR_K_s_s_h_s(
337                             PRIM_INT__s_s_h_s,
338                             PRIM_INT__s_s_g_s,
339                             PRIM_INT__s_s_f_s,
340                             Q_PA,
341                             a_over_q,
342                             aoq_PQ,
343                             one_over_2q,
344                             8);
345 
346 
347                     ostei_general_vrr1_K(6, 7,
348                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
349                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
350 
351 
352                     ostei_general_vrr1_K(7, 6,
353                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
354                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
355 
356 
357                     ostei_general_vrr_I(1, 0, 7, 0, 5,
358                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
359                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
360 
361 
362                     ostei_general_vrr_I(1, 0, 6, 0, 5,
363                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
364                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
365 
366 
367                     ostei_general_vrr_I(2, 0, 7, 0, 4,
368                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
369                             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);
370 
371 
372                     ostei_general_vrr_I(1, 0, 5, 0, 5,
373                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
374                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
375 
376 
377                     ostei_general_vrr_I(2, 0, 6, 0, 4,
378                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
379                             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);
380 
381 
382                     ostei_general_vrr_I(3, 0, 7, 0, 3,
383                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
384                             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);
385 
386 
387                     VRR_I_p_s_g_s(
388                             PRIM_INT__p_s_g_s,
389                             PRIM_INT__s_s_g_s,
390                             PRIM_INT__s_s_f_s,
391                             P_PA,
392                             aop_PQ,
393                             one_over_2pq,
394                             5);
395 
396 
397                     ostei_general_vrr_I(2, 0, 5, 0, 4,
398                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
399                             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);
400 
401 
402                     ostei_general_vrr_I(3, 0, 6, 0, 3,
403                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
404                             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);
405 
406 
407                     ostei_general_vrr_I(4, 0, 7, 0, 2,
408                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
409                             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);
410 
411 
412                     VRR_I_p_s_f_s(
413                             PRIM_INT__p_s_f_s,
414                             PRIM_INT__s_s_f_s,
415                             PRIM_INT__s_s_d_s,
416                             P_PA,
417                             aop_PQ,
418                             one_over_2pq,
419                             5);
420 
421 
422                     ostei_general_vrr_I(2, 0, 4, 0, 4,
423                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
424                             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);
425 
426 
427                     ostei_general_vrr_I(3, 0, 5, 0, 3,
428                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
429                             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);
430 
431 
432                     ostei_general_vrr_I(4, 0, 6, 0, 2,
433                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
434                             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);
435 
436 
437                     ostei_general_vrr_I(5, 0, 7, 0, 1,
438                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
439                             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);
440 
441 
442 
443 
444                     ////////////////////////////////////
445                     // Accumulate contracted integrals
446                     ////////////////////////////////////
447                     if(lastoffset == 0)
448                     {
449                         contract_all(756, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
450                     }
451                     else
452                     {
453                         contract(756, shelloffsets, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
454                         PRIM_PTR_INT__h_s_k_s += lastoffset*756;
455                     }
456 
457                 }  // close loop over j
458             }  // close loop over i
459 
460             //Advance to the next batch
461             jstart = SIMINT_SIMD_ROUND(jend);
462             abcd += nshellbatch;
463 
464         }   // close loop cdbatch
465 
466         istart = iend;
467     }  // close loop over ab
468 
469     return P.nshell12_clip * Q.nshell12_clip;
470 }
471 
ostei_s_h_k_s(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_s)472 int ostei_s_h_k_s(struct simint_multi_shellpair const P,
473                   struct simint_multi_shellpair const Q,
474                   double screen_tol,
475                   double * const restrict work,
476                   double * const restrict INT__s_h_k_s)
477 {
478     double P_AB[3*P.nshell12];
479     struct simint_multi_shellpair P_tmp = P;
480     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
481     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
482     P_tmp.AB_x = P_AB;
483     P_tmp.AB_y = P_AB + P.nshell12;
484     P_tmp.AB_z = P_AB + 2*P.nshell12;
485 
486     for(int i = 0; i < P.nshell12; i++)
487     {
488         P_tmp.AB_x[i] = -P.AB_x[i];
489         P_tmp.AB_y[i] = -P.AB_y[i];
490         P_tmp.AB_z[i] = -P.AB_z[i];
491     }
492 
493     int ret = ostei_h_s_k_s(P_tmp, Q, screen_tol, work, INT__s_h_k_s);
494 
495     return ret;
496 }
497 
ostei_h_s_s_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_s_k)498 int ostei_h_s_s_k(struct simint_multi_shellpair const P,
499                   struct simint_multi_shellpair const Q,
500                   double screen_tol,
501                   double * const restrict work,
502                   double * const restrict INT__h_s_s_k)
503 {
504     double Q_AB[3*Q.nshell12];
505     struct simint_multi_shellpair Q_tmp = Q;
506     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
507     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
508     Q_tmp.AB_x = Q_AB;
509     Q_tmp.AB_y = Q_AB + Q.nshell12;
510     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
511 
512     for(int i = 0; i < Q.nshell12; i++)
513     {
514         Q_tmp.AB_x[i] = -Q.AB_x[i];
515         Q_tmp.AB_y[i] = -Q.AB_y[i];
516         Q_tmp.AB_z[i] = -Q.AB_z[i];
517     }
518 
519     int ret = ostei_h_s_k_s(P, Q_tmp, screen_tol, work, INT__h_s_s_k);
520 
521     return ret;
522 }
523 
ostei_s_h_s_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_s_k)524 int ostei_s_h_s_k(struct simint_multi_shellpair const P,
525                   struct simint_multi_shellpair const Q,
526                   double screen_tol,
527                   double * const restrict work,
528                   double * const restrict INT__s_h_s_k)
529 {
530     double P_AB[3*P.nshell12];
531     struct simint_multi_shellpair P_tmp = P;
532     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
533     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
534     P_tmp.AB_x = P_AB;
535     P_tmp.AB_y = P_AB + P.nshell12;
536     P_tmp.AB_z = P_AB + 2*P.nshell12;
537 
538     for(int i = 0; i < P.nshell12; i++)
539     {
540         P_tmp.AB_x[i] = -P.AB_x[i];
541         P_tmp.AB_y[i] = -P.AB_y[i];
542         P_tmp.AB_z[i] = -P.AB_z[i];
543     }
544 
545     double Q_AB[3*Q.nshell12];
546     struct simint_multi_shellpair Q_tmp = Q;
547     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
548     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
549     Q_tmp.AB_x = Q_AB;
550     Q_tmp.AB_y = Q_AB + Q.nshell12;
551     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
552 
553     for(int i = 0; i < Q.nshell12; i++)
554     {
555         Q_tmp.AB_x[i] = -Q.AB_x[i];
556         Q_tmp.AB_y[i] = -Q.AB_y[i];
557         Q_tmp.AB_z[i] = -Q.AB_z[i];
558     }
559 
560     int ret = ostei_h_s_k_s(P_tmp, Q_tmp, screen_tol, work, INT__s_h_s_k);
561 
562     return ret;
563 }
564 
565