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_g_d_f_s(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_d_f_s)8 int ostei_g_d_f_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__g_d_f_s)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__g_d_f_s);
17     int ab, cd, abcd;
18     int istart, jstart;
19     int iprimcd, nprim_icd, icd;
20     const int check_screen = (screen_tol > 0.0);
21     int i, j;
22     int n;
23     int not_screened;
24     int real_abcd;
25     int iket;
26 
27     // partition workspace
28     double * const INT__g_s_f_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__h_s_f_s = work + (SIMINT_NSHELL_SIMD * 150);
30     double * const INT__i_s_f_s = work + (SIMINT_NSHELL_SIMD * 360);
31     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*640);
32     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
33     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 10;
34     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 37;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 85;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 139;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 209;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 299;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 419;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 509;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 644;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 824;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 974;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 1079;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 1268;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 1520;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 1730;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 1842;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 2094;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 2430;
51     double * const hrrwork = (double *)(primwork + 2710);
52     double * const HRR_INT__g_p_f_s = hrrwork + 0;
53     double * const HRR_INT__h_p_f_s = hrrwork + 450;
54 
55 
56     // Create constants
57     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
58     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
59     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
60     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
61     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
62     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
63     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
64 
65 
66     ////////////////////////////////////////
67     // Loop over shells and primitives
68     ////////////////////////////////////////
69 
70     real_abcd = 0;
71     istart = 0;
72     for(ab = 0; ab < P.nshell12_clip; ++ab)
73     {
74         const int iend = istart + P.nprim12[ab];
75 
76         cd = 0;
77         jstart = 0;
78 
79         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
80         {
81             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
82             int jend = jstart;
83             for(i = 0; i < nshellbatch; i++)
84                 jend += Q.nprim12[cd+i];
85 
86             // Clear the beginning of the workspace (where we are accumulating integrals)
87             memset(work, 0, SIMINT_NSHELL_SIMD * 640 * sizeof(double));
88             abcd = 0;
89 
90 
91             for(i = istart; i < iend; ++i)
92             {
93                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
94 
95                 if(check_screen)
96                 {
97                     // Skip this whole thing if always insignificant
98                     if((P.screen[i] * Q.screen_max) < screen_tol)
99                         continue;
100                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
101                 }
102 
103                 icd = 0;
104                 iprimcd = 0;
105                 nprim_icd = Q.nprim12[cd];
106                 double * restrict PRIM_PTR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
107                 double * restrict PRIM_PTR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
108                 double * restrict PRIM_PTR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
109 
110 
111 
112                 // Load these one per loop over i
113                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
114                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
115                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
116 
117                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
118 
119                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
120                 {
121                     // calculate the shell offsets
122                     // these are the offset from the shell pointed to by cd
123                     // for each element
124                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
125                     int lastoffset = 0;
126                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
127 
128                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
129                     {
130                         // Handle if the first element of the vector is a new shell
131                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
132                         {
133                             nprim_icd += Q.nprim12[cd + (++icd)];
134                             PRIM_PTR_INT__g_s_f_s += 150;
135                             PRIM_PTR_INT__h_s_f_s += 210;
136                             PRIM_PTR_INT__i_s_f_s += 280;
137                         }
138                         iprimcd++;
139                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
140                         {
141                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
142                             {
143                                 shelloffsets[n] = shelloffsets[n-1] + 1;
144                                 lastoffset++;
145                                 nprim_icd += Q.nprim12[cd + (++icd)];
146                             }
147                             else
148                                 shelloffsets[n] = shelloffsets[n-1];
149                             iprimcd++;
150                         }
151                     }
152                     else
153                         iprimcd += SIMINT_SIMD_LEN;
154 
155                     // Do we have to compute this vector (or has it been screened out)?
156                     // (not_screened != 0 means we have to do this vector)
157                     if(check_screen)
158                     {
159                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
160                         if(vmax < screen_tol)
161                         {
162                             PRIM_PTR_INT__g_s_f_s += lastoffset*150;
163                             PRIM_PTR_INT__h_s_f_s += lastoffset*210;
164                             PRIM_PTR_INT__i_s_f_s += lastoffset*280;
165                             continue;
166                         }
167                     }
168 
169                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
170                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
171                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
172                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
173 
174 
175                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
176                     SIMINT_DBLTYPE PQ[3];
177                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
178                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
179                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
180                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
181                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
182                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
183 
184                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
185                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
186                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
187                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
188                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
189                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
190                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
191 
192                     // NOTE: Minus sign!
193                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
194                     SIMINT_DBLTYPE aop_PQ[3];
195                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
196                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
197                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
198 
199                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
200                     SIMINT_DBLTYPE aoq_PQ[3];
201                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
202                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
203                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
204                     // Put a minus sign here so we don't have to in RR routines
205                     a_over_q = SIMINT_NEG(a_over_q);
206 
207 
208                     //////////////////////////////////////////////
209                     // Fjt function section
210                     // Maximum v value: 9
211                     //////////////////////////////////////////////
212                     // The parameter to the Fjt function
213                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
214 
215 
216                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
217 
218 
219                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 9);
220                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
221                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
222                     for(n = 0; n <= 9; n++)
223                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
224 
225                     //////////////////////////////////////////////
226                     // Primitive integrals: Vertical recurrance
227                     //////////////////////////////////////////////
228 
229                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
230                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
231                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
232                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
233                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
234                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
235                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
236                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
237                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
238                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
239                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
240                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
241                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
242 
243 
244 
245                     // Forming PRIM_INT__p_s_s_s[9 * 3];
246                     for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
247                     {
248 
249                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
250                         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]);
251 
252                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
253                         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]);
254 
255                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
256                         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]);
257 
258                     }
259 
260 
261 
262                     // Forming PRIM_INT__d_s_s_s[8 * 6];
263                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
264                     {
265 
266                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
267                         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]);
268                         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]);
269 
270                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
271                         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]);
272 
273                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
274                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 2]);
275 
276                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
277                         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]);
278                         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]);
279 
280                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
281                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_s[n * 6 + 4]);
282 
283                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
284                         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]);
285                         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]);
286 
287                     }
288 
289 
290 
291                     // Forming PRIM_INT__f_s_s_s[7 * 10];
292                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
293                     {
294 
295                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
296                         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]);
297                         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]);
298 
299                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
300                         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]);
301 
302                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
303                         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]);
304 
305                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
306                         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]);
307 
308                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
309                         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]);
310 
311                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
312                         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]);
313 
314                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
315                         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]);
316                         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]);
317 
318                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
319                         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]);
320 
321                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
322                         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]);
323 
324                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
325                         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]);
326                         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]);
327 
328                     }
329 
330 
331                     VRR_I_g_s_s_s(
332                             PRIM_INT__g_s_s_s,
333                             PRIM_INT__f_s_s_s,
334                             PRIM_INT__d_s_s_s,
335                             P_PA,
336                             a_over_p,
337                             aop_PQ,
338                             one_over_2p,
339                             6);
340 
341 
342                     VRR_K_g_s_p_s(
343                             PRIM_INT__g_s_p_s,
344                             PRIM_INT__g_s_s_s,
345                             PRIM_INT__f_s_s_s,
346                             Q_PA,
347                             aoq_PQ,
348                             one_over_2pq,
349                             3);
350 
351 
352                     VRR_K_f_s_p_s(
353                             PRIM_INT__f_s_p_s,
354                             PRIM_INT__f_s_s_s,
355                             PRIM_INT__d_s_s_s,
356                             Q_PA,
357                             aoq_PQ,
358                             one_over_2pq,
359                             3);
360 
361 
362                     ostei_general_vrr_K(4, 0, 2, 0, 2,
363                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
364                             PRIM_INT__g_s_p_s, PRIM_INT__g_s_s_s, NULL, PRIM_INT__f_s_p_s, NULL, PRIM_INT__g_s_d_s);
365 
366 
367 
368                     // Forming PRIM_INT__d_s_p_s[3 * 18];
369                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
370                     {
371 
372                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
373                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
374                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
375 
376                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
377                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 1]);
378 
379                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
380                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 2]);
381 
382                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
383                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 3]);
384                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 3]);
385 
386                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
387                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 4]);
388                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 4]);
389 
390                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
391                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 5]);
392 
393                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
394                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 6]);
395                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 6]);
396 
397                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
398                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 7]);
399 
400                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
401                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 8]);
402                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 8]);
403 
404                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
405                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);
406 
407                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
408                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 10]);
409                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 10]);
410 
411                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
412                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 11]);
413 
414                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
415                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 12]);
416 
417                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
418                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 13]);
419                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 13]);
420 
421                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
422                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 14]);
423                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 14]);
424 
425                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
426                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 15]);
427 
428                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
429                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 16]);
430 
431                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
432                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 17]);
433                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 17]);
434 
435                     }
436 
437 
438                     VRR_K_f_s_d_s(
439                             PRIM_INT__f_s_d_s,
440                             PRIM_INT__f_s_p_s,
441                             PRIM_INT__f_s_s_s,
442                             PRIM_INT__d_s_p_s,
443                             Q_PA,
444                             a_over_q,
445                             aoq_PQ,
446                             one_over_2pq,
447                             one_over_2q,
448                             2);
449 
450 
451                     ostei_general_vrr_K(4, 0, 3, 0, 1,
452                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
453                             PRIM_INT__g_s_d_s, PRIM_INT__g_s_p_s, NULL, PRIM_INT__f_s_d_s, NULL, PRIM_INT__g_s_f_s);
454 
455 
456                     VRR_I_h_s_s_s(
457                             PRIM_INT__h_s_s_s,
458                             PRIM_INT__g_s_s_s,
459                             PRIM_INT__f_s_s_s,
460                             P_PA,
461                             a_over_p,
462                             aop_PQ,
463                             one_over_2p,
464                             5);
465 
466 
467                     ostei_general_vrr_K(5, 0, 1, 0, 3,
468                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
469                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
470 
471 
472                     ostei_general_vrr_K(5, 0, 2, 0, 2,
473                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
474                             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);
475 
476 
477                     ostei_general_vrr_K(5, 0, 3, 0, 1,
478                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
479                             PRIM_INT__h_s_d_s, PRIM_INT__h_s_p_s, NULL, PRIM_INT__g_s_d_s, NULL, PRIM_INT__h_s_f_s);
480 
481 
482                     ostei_general_vrr1_I(6, 4,
483                             one_over_2p, a_over_p, aop_PQ, P_PA,
484                             PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
485 
486 
487                     ostei_general_vrr_K(6, 0, 1, 0, 3,
488                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
489                             PRIM_INT__i_s_s_s, NULL, NULL, PRIM_INT__h_s_s_s, NULL, PRIM_INT__i_s_p_s);
490 
491 
492                     ostei_general_vrr_K(6, 0, 2, 0, 2,
493                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
494                             PRIM_INT__i_s_p_s, PRIM_INT__i_s_s_s, NULL, PRIM_INT__h_s_p_s, NULL, PRIM_INT__i_s_d_s);
495 
496 
497                     ostei_general_vrr_K(6, 0, 3, 0, 1,
498                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
499                             PRIM_INT__i_s_d_s, PRIM_INT__i_s_p_s, NULL, PRIM_INT__h_s_d_s, NULL, PRIM_INT__i_s_f_s);
500 
501 
502 
503 
504                     ////////////////////////////////////
505                     // Accumulate contracted integrals
506                     ////////////////////////////////////
507                     if(lastoffset == 0)
508                     {
509                         contract_all(150, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
510                         contract_all(210, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
511                         contract_all(280, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
512                     }
513                     else
514                     {
515                         contract(150, shelloffsets, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
516                         contract(210, shelloffsets, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
517                         contract(280, shelloffsets, PRIM_INT__i_s_f_s, PRIM_PTR_INT__i_s_f_s);
518                         PRIM_PTR_INT__g_s_f_s += lastoffset*150;
519                         PRIM_PTR_INT__h_s_f_s += lastoffset*210;
520                         PRIM_PTR_INT__i_s_f_s += lastoffset*280;
521                     }
522 
523                 }  // close loop over j
524             }  // close loop over i
525 
526             //Advance to the next batch
527             jstart = SIMINT_SIMD_ROUND(jend);
528 
529             //////////////////////////////////////////////
530             // Contracted integrals: Horizontal recurrance
531             //////////////////////////////////////////////
532 
533 
534             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
535 
536 
537             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
538             {
539 
540                 // set up HRR pointers
541                 double const * restrict HRR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
542                 double const * restrict HRR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
543                 double const * restrict HRR_INT__i_s_f_s = INT__i_s_f_s + abcd * 280;
544                 double * restrict HRR_INT__g_d_f_s = INT__g_d_f_s + real_abcd * 900;
545 
546                 // form INT__g_p_f_s
547                 HRR_J_g_p(
548                     HRR_INT__g_p_f_s,
549                     HRR_INT__g_s_f_s,
550                     HRR_INT__h_s_f_s,
551                     hAB, 10);
552 
553                 // form INT__h_p_f_s
554                 ostei_general_hrr_J(5, 1, 3, 0, hAB, HRR_INT__i_s_f_s, HRR_INT__h_s_f_s, HRR_INT__h_p_f_s);
555 
556                 // form INT__g_d_f_s
557                 ostei_general_hrr_J(4, 2, 3, 0, hAB, HRR_INT__h_p_f_s, HRR_INT__g_p_f_s, HRR_INT__g_d_f_s);
558 
559 
560             }  // close HRR loop
561 
562 
563         }   // close loop cdbatch
564 
565         istart = iend;
566     }  // close loop over ab
567 
568     return P.nshell12_clip * Q.nshell12_clip;
569 }
570 
ostei_d_g_f_s(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_g_f_s)571 int ostei_d_g_f_s(struct simint_multi_shellpair const P,
572                   struct simint_multi_shellpair const Q,
573                   double screen_tol,
574                   double * const restrict work,
575                   double * const restrict INT__d_g_f_s)
576 {
577     double P_AB[3*P.nshell12];
578     struct simint_multi_shellpair P_tmp = P;
579     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
580     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
581     P_tmp.AB_x = P_AB;
582     P_tmp.AB_y = P_AB + P.nshell12;
583     P_tmp.AB_z = P_AB + 2*P.nshell12;
584 
585     for(int i = 0; i < P.nshell12; i++)
586     {
587         P_tmp.AB_x[i] = -P.AB_x[i];
588         P_tmp.AB_y[i] = -P.AB_y[i];
589         P_tmp.AB_z[i] = -P.AB_z[i];
590     }
591 
592     int ret = ostei_g_d_f_s(P_tmp, Q, screen_tol, work, INT__d_g_f_s);
593     double buffer[900] SIMINT_ALIGN_ARRAY_DBL;
594 
595     for(int q = 0; q < ret; q++)
596     {
597         int idx = 0;
598         for(int a = 0; a < 6; ++a)
599         for(int b = 0; b < 15; ++b)
600         for(int c = 0; c < 10; ++c)
601         for(int d = 0; d < 1; ++d)
602             buffer[idx++] = INT__d_g_f_s[q*900+b*60+a*10+c*1+d];
603 
604         memcpy(INT__d_g_f_s+q*900, buffer, 900*sizeof(double));
605     }
606 
607     return ret;
608 }
609 
ostei_g_d_s_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_d_s_f)610 int ostei_g_d_s_f(struct simint_multi_shellpair const P,
611                   struct simint_multi_shellpair const Q,
612                   double screen_tol,
613                   double * const restrict work,
614                   double * const restrict INT__g_d_s_f)
615 {
616     double Q_AB[3*Q.nshell12];
617     struct simint_multi_shellpair Q_tmp = Q;
618     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
619     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
620     Q_tmp.AB_x = Q_AB;
621     Q_tmp.AB_y = Q_AB + Q.nshell12;
622     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
623 
624     for(int i = 0; i < Q.nshell12; i++)
625     {
626         Q_tmp.AB_x[i] = -Q.AB_x[i];
627         Q_tmp.AB_y[i] = -Q.AB_y[i];
628         Q_tmp.AB_z[i] = -Q.AB_z[i];
629     }
630 
631     int ret = ostei_g_d_f_s(P, Q_tmp, screen_tol, work, INT__g_d_s_f);
632     double buffer[900] SIMINT_ALIGN_ARRAY_DBL;
633 
634     for(int q = 0; q < ret; q++)
635     {
636         int idx = 0;
637         for(int a = 0; a < 15; ++a)
638         for(int b = 0; b < 6; ++b)
639         for(int c = 0; c < 1; ++c)
640         for(int d = 0; d < 10; ++d)
641             buffer[idx++] = INT__g_d_s_f[q*900+a*60+b*10+d*1+c];
642 
643         memcpy(INT__g_d_s_f+q*900, buffer, 900*sizeof(double));
644     }
645 
646     return ret;
647 }
648 
ostei_d_g_s_f(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_g_s_f)649 int ostei_d_g_s_f(struct simint_multi_shellpair const P,
650                   struct simint_multi_shellpair const Q,
651                   double screen_tol,
652                   double * const restrict work,
653                   double * const restrict INT__d_g_s_f)
654 {
655     double P_AB[3*P.nshell12];
656     struct simint_multi_shellpair P_tmp = P;
657     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
658     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
659     P_tmp.AB_x = P_AB;
660     P_tmp.AB_y = P_AB + P.nshell12;
661     P_tmp.AB_z = P_AB + 2*P.nshell12;
662 
663     for(int i = 0; i < P.nshell12; i++)
664     {
665         P_tmp.AB_x[i] = -P.AB_x[i];
666         P_tmp.AB_y[i] = -P.AB_y[i];
667         P_tmp.AB_z[i] = -P.AB_z[i];
668     }
669 
670     double Q_AB[3*Q.nshell12];
671     struct simint_multi_shellpair Q_tmp = Q;
672     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
673     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
674     Q_tmp.AB_x = Q_AB;
675     Q_tmp.AB_y = Q_AB + Q.nshell12;
676     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
677 
678     for(int i = 0; i < Q.nshell12; i++)
679     {
680         Q_tmp.AB_x[i] = -Q.AB_x[i];
681         Q_tmp.AB_y[i] = -Q.AB_y[i];
682         Q_tmp.AB_z[i] = -Q.AB_z[i];
683     }
684 
685     int ret = ostei_g_d_f_s(P_tmp, Q_tmp, screen_tol, work, INT__d_g_s_f);
686     double buffer[900] SIMINT_ALIGN_ARRAY_DBL;
687 
688     for(int q = 0; q < ret; q++)
689     {
690         int idx = 0;
691         for(int a = 0; a < 6; ++a)
692         for(int b = 0; b < 15; ++b)
693         for(int c = 0; c < 1; ++c)
694         for(int d = 0; d < 10; ++d)
695             buffer[idx++] = INT__d_g_s_f[q*900+b*60+a*10+d*1+c];
696 
697         memcpy(INT__d_g_s_f+q*900, buffer, 900*sizeof(double));
698     }
699 
700     return ret;
701 }
702 
703