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