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