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