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