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