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