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