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