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_p_d_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_p_d_p)8 int ostei_g_p_d_p(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_p_d_p)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__g_p_d_p);
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     int ibra;
27 
28     // partition workspace
29     double * const INT__g_s_d_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__g_s_f_s = work + (SIMINT_NSHELL_SIMD * 90);
31     double * const INT__h_s_d_s = work + (SIMINT_NSHELL_SIMD * 240);
32     double * const INT__h_s_f_s = work + (SIMINT_NSHELL_SIMD * 366);
33     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*576);
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 9;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 33;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 75;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 129;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 189;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 279;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 399;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 474;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 609;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 789;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 939;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 1023;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 1212;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 1464;
49     double * const hrrwork = (double *)(primwork + 1674);
50     double * const HRR_INT__g_p_d_s = hrrwork + 0;
51     double * const HRR_INT__g_p_f_s = hrrwork + 270;
52 
53 
54     // Create constants
55     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
56     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
57     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
58     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
59     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
60     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
61 
62 
63     ////////////////////////////////////////
64     // Loop over shells and primitives
65     ////////////////////////////////////////
66 
67     real_abcd = 0;
68     istart = 0;
69     for(ab = 0; ab < P.nshell12_clip; ++ab)
70     {
71         const int iend = istart + P.nprim12[ab];
72 
73         cd = 0;
74         jstart = 0;
75 
76         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
77         {
78             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
79             int jend = jstart;
80             for(i = 0; i < nshellbatch; i++)
81                 jend += Q.nprim12[cd+i];
82 
83             // Clear the beginning of the workspace (where we are accumulating integrals)
84             memset(work, 0, SIMINT_NSHELL_SIMD * 576 * sizeof(double));
85             abcd = 0;
86 
87 
88             for(i = istart; i < iend; ++i)
89             {
90                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
91 
92                 if(check_screen)
93                 {
94                     // Skip this whole thing if always insignificant
95                     if((P.screen[i] * Q.screen_max) < screen_tol)
96                         continue;
97                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
98                 }
99 
100                 icd = 0;
101                 iprimcd = 0;
102                 nprim_icd = Q.nprim12[cd];
103                 double * restrict PRIM_PTR_INT__g_s_d_s = INT__g_s_d_s + abcd * 90;
104                 double * restrict PRIM_PTR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
105                 double * restrict PRIM_PTR_INT__h_s_d_s = INT__h_s_d_s + abcd * 126;
106                 double * restrict PRIM_PTR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
107 
108 
109 
110                 // Load these one per loop over i
111                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
112                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
113                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
114 
115                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
116 
117                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
118                 {
119                     // calculate the shell offsets
120                     // these are the offset from the shell pointed to by cd
121                     // for each element
122                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
123                     int lastoffset = 0;
124                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
125 
126                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
127                     {
128                         // Handle if the first element of the vector is a new shell
129                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
130                         {
131                             nprim_icd += Q.nprim12[cd + (++icd)];
132                             PRIM_PTR_INT__g_s_d_s += 90;
133                             PRIM_PTR_INT__g_s_f_s += 150;
134                             PRIM_PTR_INT__h_s_d_s += 126;
135                             PRIM_PTR_INT__h_s_f_s += 210;
136                         }
137                         iprimcd++;
138                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
139                         {
140                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
141                             {
142                                 shelloffsets[n] = shelloffsets[n-1] + 1;
143                                 lastoffset++;
144                                 nprim_icd += Q.nprim12[cd + (++icd)];
145                             }
146                             else
147                                 shelloffsets[n] = shelloffsets[n-1];
148                             iprimcd++;
149                         }
150                     }
151                     else
152                         iprimcd += SIMINT_SIMD_LEN;
153 
154                     // Do we have to compute this vector (or has it been screened out)?
155                     // (not_screened != 0 means we have to do this vector)
156                     if(check_screen)
157                     {
158                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
159                         if(vmax < screen_tol)
160                         {
161                             PRIM_PTR_INT__g_s_d_s += lastoffset*90;
162                             PRIM_PTR_INT__g_s_f_s += lastoffset*150;
163                             PRIM_PTR_INT__h_s_d_s += lastoffset*126;
164                             PRIM_PTR_INT__h_s_f_s += lastoffset*210;
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: 8
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, 8);
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 <= 8; 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_1_over_2q = one_over_2q;
234                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
235                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
236                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
237                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
238                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
239                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
240 
241 
242 
243                     // Forming PRIM_INT__p_s_s_s[8 * 3];
244                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
245                     {
246 
247                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
248                         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]);
249 
250                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
251                         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]);
252 
253                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
254                         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]);
255 
256                     }
257 
258 
259 
260                     // Forming PRIM_INT__d_s_s_s[7 * 6];
261                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
262                     {
263 
264                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
265                         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]);
266                         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]);
267 
268                         PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
269                         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]);
270 
271                         PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
272                         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]);
273 
274                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
275                         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]);
276                         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]);
277 
278                         PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
279                         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]);
280 
281                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
282                         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]);
283                         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]);
284 
285                     }
286 
287 
288 
289                     // Forming PRIM_INT__f_s_s_s[6 * 10];
290                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
291                     {
292 
293                         PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
294                         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]);
295                         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]);
296 
297                         PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
298                         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]);
299 
300                         PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
301                         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]);
302 
303                         PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
304                         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]);
305 
306                         PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
307                         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]);
308 
309                         PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
310                         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]);
311 
312                         PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
313                         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]);
314                         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]);
315 
316                         PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
317                         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]);
318 
319                         PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
320                         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]);
321 
322                         PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
323                         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]);
324                         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]);
325 
326                     }
327 
328 
329                     VRR_I_g_s_s_s(
330                             PRIM_INT__g_s_s_s,
331                             PRIM_INT__f_s_s_s,
332                             PRIM_INT__d_s_s_s,
333                             P_PA,
334                             a_over_p,
335                             aop_PQ,
336                             one_over_2p,
337                             5);
338 
339 
340                     VRR_K_g_s_p_s(
341                             PRIM_INT__g_s_p_s,
342                             PRIM_INT__g_s_s_s,
343                             PRIM_INT__f_s_s_s,
344                             Q_PA,
345                             aoq_PQ,
346                             one_over_2pq,
347                             3);
348 
349 
350                     VRR_K_f_s_p_s(
351                             PRIM_INT__f_s_p_s,
352                             PRIM_INT__f_s_s_s,
353                             PRIM_INT__d_s_s_s,
354                             Q_PA,
355                             aoq_PQ,
356                             one_over_2pq,
357                             3);
358 
359 
360                     ostei_general_vrr_K(4, 0, 2, 0, 2,
361                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
362                             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);
363 
364 
365 
366                     // Forming PRIM_INT__d_s_p_s[3 * 18];
367                     for(n = 0; n < 3; ++n)  // loop over orders of auxiliary function
368                     {
369 
370                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
371                         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]);
372                         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]);
373 
374                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
375                         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]);
376 
377                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
378                         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]);
379 
380                         PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
381                         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]);
382                         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]);
383 
384                         PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
385                         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]);
386                         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]);
387 
388                         PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
389                         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]);
390 
391                         PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
392                         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]);
393                         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]);
394 
395                         PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
396                         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]);
397 
398                         PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
399                         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]);
400                         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]);
401 
402                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
403                         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]);
404 
405                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
406                         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]);
407                         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]);
408 
409                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
410                         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]);
411 
412                         PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
413                         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]);
414 
415                         PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
416                         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]);
417                         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]);
418 
419                         PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
420                         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]);
421                         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]);
422 
423                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
424                         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]);
425 
426                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
427                         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]);
428 
429                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
430                         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]);
431                         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]);
432 
433                     }
434 
435 
436                     VRR_K_f_s_d_s(
437                             PRIM_INT__f_s_d_s,
438                             PRIM_INT__f_s_p_s,
439                             PRIM_INT__f_s_s_s,
440                             PRIM_INT__d_s_p_s,
441                             Q_PA,
442                             a_over_q,
443                             aoq_PQ,
444                             one_over_2pq,
445                             one_over_2q,
446                             2);
447 
448 
449                     ostei_general_vrr_K(4, 0, 3, 0, 1,
450                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
451                             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);
452 
453 
454                     VRR_I_h_s_s_s(
455                             PRIM_INT__h_s_s_s,
456                             PRIM_INT__g_s_s_s,
457                             PRIM_INT__f_s_s_s,
458                             P_PA,
459                             a_over_p,
460                             aop_PQ,
461                             one_over_2p,
462                             4);
463 
464 
465                     ostei_general_vrr_K(5, 0, 1, 0, 3,
466                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
467                             PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
468 
469 
470                     ostei_general_vrr_K(5, 0, 2, 0, 2,
471                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
472                             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);
473 
474 
475                     ostei_general_vrr_K(5, 0, 3, 0, 1,
476                             one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
477                             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);
478 
479 
480 
481 
482                     ////////////////////////////////////
483                     // Accumulate contracted integrals
484                     ////////////////////////////////////
485                     if(lastoffset == 0)
486                     {
487                         contract_all(90, PRIM_INT__g_s_d_s, PRIM_PTR_INT__g_s_d_s);
488                         contract_all(150, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
489                         contract_all(126, PRIM_INT__h_s_d_s, PRIM_PTR_INT__h_s_d_s);
490                         contract_all(210, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
491                     }
492                     else
493                     {
494                         contract(90, shelloffsets, PRIM_INT__g_s_d_s, PRIM_PTR_INT__g_s_d_s);
495                         contract(150, shelloffsets, PRIM_INT__g_s_f_s, PRIM_PTR_INT__g_s_f_s);
496                         contract(126, shelloffsets, PRIM_INT__h_s_d_s, PRIM_PTR_INT__h_s_d_s);
497                         contract(210, shelloffsets, PRIM_INT__h_s_f_s, PRIM_PTR_INT__h_s_f_s);
498                         PRIM_PTR_INT__g_s_d_s += lastoffset*90;
499                         PRIM_PTR_INT__g_s_f_s += lastoffset*150;
500                         PRIM_PTR_INT__h_s_d_s += lastoffset*126;
501                         PRIM_PTR_INT__h_s_f_s += lastoffset*210;
502                     }
503 
504                 }  // close loop over j
505             }  // close loop over i
506 
507             //Advance to the next batch
508             jstart = SIMINT_SIMD_ROUND(jend);
509 
510             //////////////////////////////////////////////
511             // Contracted integrals: Horizontal recurrance
512             //////////////////////////////////////////////
513 
514 
515             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
516 
517 
518             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
519             {
520                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
521 
522                 // set up HRR pointers
523                 double const * restrict HRR_INT__g_s_d_s = INT__g_s_d_s + abcd * 90;
524                 double const * restrict HRR_INT__g_s_f_s = INT__g_s_f_s + abcd * 150;
525                 double const * restrict HRR_INT__h_s_d_s = INT__h_s_d_s + abcd * 126;
526                 double const * restrict HRR_INT__h_s_f_s = INT__h_s_f_s + abcd * 210;
527                 double * restrict HRR_INT__g_p_d_p = INT__g_p_d_p + real_abcd * 810;
528 
529                 // form INT__g_p_d_s
530                 HRR_J_g_p(
531                     HRR_INT__g_p_d_s,
532                     HRR_INT__g_s_d_s,
533                     HRR_INT__h_s_d_s,
534                     hAB, 6);
535 
536                 // form INT__g_p_f_s
537                 HRR_J_g_p(
538                     HRR_INT__g_p_f_s,
539                     HRR_INT__g_s_f_s,
540                     HRR_INT__h_s_f_s,
541                     hAB, 10);
542 
543                 // form INT__g_p_d_p
544                 for(ibra = 0; ibra < 45; ++ibra)
545                 {
546                     HRR_INT__g_p_d_p[ibra * 18 + 0] = HRR_INT__g_p_f_s[ibra * 10 + 0] + ( hCD[0] * HRR_INT__g_p_d_s[ibra * 6 + 0] );
547 
548                     HRR_INT__g_p_d_p[ibra * 18 + 1] = HRR_INT__g_p_f_s[ibra * 10 + 1] + ( hCD[1] * HRR_INT__g_p_d_s[ibra * 6 + 0] );
549 
550                     HRR_INT__g_p_d_p[ibra * 18 + 2] = HRR_INT__g_p_f_s[ibra * 10 + 2] + ( hCD[2] * HRR_INT__g_p_d_s[ibra * 6 + 0] );
551 
552                     HRR_INT__g_p_d_p[ibra * 18 + 3] = HRR_INT__g_p_f_s[ibra * 10 + 1] + ( hCD[0] * HRR_INT__g_p_d_s[ibra * 6 + 1] );
553 
554                     HRR_INT__g_p_d_p[ibra * 18 + 4] = HRR_INT__g_p_f_s[ibra * 10 + 3] + ( hCD[1] * HRR_INT__g_p_d_s[ibra * 6 + 1] );
555 
556                     HRR_INT__g_p_d_p[ibra * 18 + 5] = HRR_INT__g_p_f_s[ibra * 10 + 4] + ( hCD[2] * HRR_INT__g_p_d_s[ibra * 6 + 1] );
557 
558                     HRR_INT__g_p_d_p[ibra * 18 + 6] = HRR_INT__g_p_f_s[ibra * 10 + 2] + ( hCD[0] * HRR_INT__g_p_d_s[ibra * 6 + 2] );
559 
560                     HRR_INT__g_p_d_p[ibra * 18 + 7] = HRR_INT__g_p_f_s[ibra * 10 + 4] + ( hCD[1] * HRR_INT__g_p_d_s[ibra * 6 + 2] );
561 
562                     HRR_INT__g_p_d_p[ibra * 18 + 8] = HRR_INT__g_p_f_s[ibra * 10 + 5] + ( hCD[2] * HRR_INT__g_p_d_s[ibra * 6 + 2] );
563 
564                     HRR_INT__g_p_d_p[ibra * 18 + 9] = HRR_INT__g_p_f_s[ibra * 10 + 3] + ( hCD[0] * HRR_INT__g_p_d_s[ibra * 6 + 3] );
565 
566                     HRR_INT__g_p_d_p[ibra * 18 + 10] = HRR_INT__g_p_f_s[ibra * 10 + 6] + ( hCD[1] * HRR_INT__g_p_d_s[ibra * 6 + 3] );
567 
568                     HRR_INT__g_p_d_p[ibra * 18 + 11] = HRR_INT__g_p_f_s[ibra * 10 + 7] + ( hCD[2] * HRR_INT__g_p_d_s[ibra * 6 + 3] );
569 
570                     HRR_INT__g_p_d_p[ibra * 18 + 12] = HRR_INT__g_p_f_s[ibra * 10 + 4] + ( hCD[0] * HRR_INT__g_p_d_s[ibra * 6 + 4] );
571 
572                     HRR_INT__g_p_d_p[ibra * 18 + 13] = HRR_INT__g_p_f_s[ibra * 10 + 7] + ( hCD[1] * HRR_INT__g_p_d_s[ibra * 6 + 4] );
573 
574                     HRR_INT__g_p_d_p[ibra * 18 + 14] = HRR_INT__g_p_f_s[ibra * 10 + 8] + ( hCD[2] * HRR_INT__g_p_d_s[ibra * 6 + 4] );
575 
576                     HRR_INT__g_p_d_p[ibra * 18 + 15] = HRR_INT__g_p_f_s[ibra * 10 + 5] + ( hCD[0] * HRR_INT__g_p_d_s[ibra * 6 + 5] );
577 
578                     HRR_INT__g_p_d_p[ibra * 18 + 16] = HRR_INT__g_p_f_s[ibra * 10 + 8] + ( hCD[1] * HRR_INT__g_p_d_s[ibra * 6 + 5] );
579 
580                     HRR_INT__g_p_d_p[ibra * 18 + 17] = HRR_INT__g_p_f_s[ibra * 10 + 9] + ( hCD[2] * HRR_INT__g_p_d_s[ibra * 6 + 5] );
581 
582                 }
583 
584 
585             }  // close HRR loop
586 
587 
588         }   // close loop cdbatch
589 
590         istart = iend;
591     }  // close loop over ab
592 
593     return P.nshell12_clip * Q.nshell12_clip;
594 }
595 
ostei_p_g_d_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__p_g_d_p)596 int ostei_p_g_d_p(struct simint_multi_shellpair const P,
597                   struct simint_multi_shellpair const Q,
598                   double screen_tol,
599                   double * const restrict work,
600                   double * const restrict INT__p_g_d_p)
601 {
602     double P_AB[3*P.nshell12];
603     struct simint_multi_shellpair P_tmp = P;
604     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
605     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
606     P_tmp.AB_x = P_AB;
607     P_tmp.AB_y = P_AB + P.nshell12;
608     P_tmp.AB_z = P_AB + 2*P.nshell12;
609 
610     for(int i = 0; i < P.nshell12; i++)
611     {
612         P_tmp.AB_x[i] = -P.AB_x[i];
613         P_tmp.AB_y[i] = -P.AB_y[i];
614         P_tmp.AB_z[i] = -P.AB_z[i];
615     }
616 
617     int ret = ostei_g_p_d_p(P_tmp, Q, screen_tol, work, INT__p_g_d_p);
618     double buffer[810] SIMINT_ALIGN_ARRAY_DBL;
619 
620     for(int q = 0; q < ret; q++)
621     {
622         int idx = 0;
623         for(int a = 0; a < 3; ++a)
624         for(int b = 0; b < 15; ++b)
625         for(int c = 0; c < 6; ++c)
626         for(int d = 0; d < 3; ++d)
627             buffer[idx++] = INT__p_g_d_p[q*810+b*54+a*18+c*3+d];
628 
629         memcpy(INT__p_g_d_p+q*810, buffer, 810*sizeof(double));
630     }
631 
632     return ret;
633 }
634 
ostei_g_p_p_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_p_p_d)635 int ostei_g_p_p_d(struct simint_multi_shellpair const P,
636                   struct simint_multi_shellpair const Q,
637                   double screen_tol,
638                   double * const restrict work,
639                   double * const restrict INT__g_p_p_d)
640 {
641     double Q_AB[3*Q.nshell12];
642     struct simint_multi_shellpair Q_tmp = Q;
643     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
644     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
645     Q_tmp.AB_x = Q_AB;
646     Q_tmp.AB_y = Q_AB + Q.nshell12;
647     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
648 
649     for(int i = 0; i < Q.nshell12; i++)
650     {
651         Q_tmp.AB_x[i] = -Q.AB_x[i];
652         Q_tmp.AB_y[i] = -Q.AB_y[i];
653         Q_tmp.AB_z[i] = -Q.AB_z[i];
654     }
655 
656     int ret = ostei_g_p_d_p(P, Q_tmp, screen_tol, work, INT__g_p_p_d);
657     double buffer[810] SIMINT_ALIGN_ARRAY_DBL;
658 
659     for(int q = 0; q < ret; q++)
660     {
661         int idx = 0;
662         for(int a = 0; a < 15; ++a)
663         for(int b = 0; b < 3; ++b)
664         for(int c = 0; c < 3; ++c)
665         for(int d = 0; d < 6; ++d)
666             buffer[idx++] = INT__g_p_p_d[q*810+a*54+b*18+d*3+c];
667 
668         memcpy(INT__g_p_p_d+q*810, buffer, 810*sizeof(double));
669     }
670 
671     return ret;
672 }
673 
ostei_p_g_p_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__p_g_p_d)674 int ostei_p_g_p_d(struct simint_multi_shellpair const P,
675                   struct simint_multi_shellpair const Q,
676                   double screen_tol,
677                   double * const restrict work,
678                   double * const restrict INT__p_g_p_d)
679 {
680     double P_AB[3*P.nshell12];
681     struct simint_multi_shellpair P_tmp = P;
682     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
683     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
684     P_tmp.AB_x = P_AB;
685     P_tmp.AB_y = P_AB + P.nshell12;
686     P_tmp.AB_z = P_AB + 2*P.nshell12;
687 
688     for(int i = 0; i < P.nshell12; i++)
689     {
690         P_tmp.AB_x[i] = -P.AB_x[i];
691         P_tmp.AB_y[i] = -P.AB_y[i];
692         P_tmp.AB_z[i] = -P.AB_z[i];
693     }
694 
695     double Q_AB[3*Q.nshell12];
696     struct simint_multi_shellpair Q_tmp = Q;
697     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
698     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
699     Q_tmp.AB_x = Q_AB;
700     Q_tmp.AB_y = Q_AB + Q.nshell12;
701     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
702 
703     for(int i = 0; i < Q.nshell12; i++)
704     {
705         Q_tmp.AB_x[i] = -Q.AB_x[i];
706         Q_tmp.AB_y[i] = -Q.AB_y[i];
707         Q_tmp.AB_z[i] = -Q.AB_z[i];
708     }
709 
710     int ret = ostei_g_p_d_p(P_tmp, Q_tmp, screen_tol, work, INT__p_g_p_d);
711     double buffer[810] SIMINT_ALIGN_ARRAY_DBL;
712 
713     for(int q = 0; q < ret; q++)
714     {
715         int idx = 0;
716         for(int a = 0; a < 3; ++a)
717         for(int b = 0; b < 15; ++b)
718         for(int c = 0; c < 3; ++c)
719         for(int d = 0; d < 6; ++d)
720             buffer[idx++] = INT__p_g_p_d[q*810+b*54+a*18+d*3+c];
721 
722         memcpy(INT__p_g_p_d+q*810, buffer, 810*sizeof(double));
723     }
724 
725     return ret;
726 }
727 
728