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_f_s_i_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_s_i_g)8 int ostei_f_s_i_g(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__f_s_i_g)
13 {
14
15 SIMINT_ASSUME_ALIGN_DBL(work);
16 SIMINT_ASSUME_ALIGN_DBL(INT__f_s_i_g);
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 ibra;
26
27 // partition workspace
28 double * const INT__f_s_i_s = work + (SIMINT_NSHELL_SIMD * 0);
29 double * const INT__f_s_k_s = work + (SIMINT_NSHELL_SIMD * 280);
30 double * const INT__f_s_l_s = work + (SIMINT_NSHELL_SIMD * 640);
31 double * const INT__f_s_m_s = work + (SIMINT_NSHELL_SIMD * 1090);
32 double * const INT__f_s_n_s = work + (SIMINT_NSHELL_SIMD * 1640);
33 SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*2300);
34 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
35 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 14;
36 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 53;
37 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 125;
38 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 235;
39 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 385;
40 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 574;
41 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 798;
42 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1050;
43 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 1320;
44 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_n_s = primwork + 1595;
45 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1859;
46 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 1994;
47 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 2183;
48 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 2435;
49 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 2759;
50 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 3164;
51 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_n_s = primwork + 3659;
52 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 4253;
53 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 4505;
54 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 4841;
55 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 5273;
56 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 5813;
57 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_n_s = primwork + 6473;
58 SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 7265;
59 SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 7545;
60 SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 7905;
61 SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 8355;
62 SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_n_s = primwork + 8905;
63 double * const hrrwork = (double *)(primwork + 9565);
64 double * const HRR_INT__f_s_i_p = hrrwork + 0;
65 double * const HRR_INT__f_s_i_d = hrrwork + 840;
66 double * const HRR_INT__f_s_i_f = hrrwork + 2520;
67 double * const HRR_INT__f_s_k_p = hrrwork + 5320;
68 double * const HRR_INT__f_s_k_d = hrrwork + 6400;
69 double * const HRR_INT__f_s_k_f = hrrwork + 8560;
70 double * const HRR_INT__f_s_l_p = hrrwork + 12160;
71 double * const HRR_INT__f_s_l_d = hrrwork + 13510;
72 double * const HRR_INT__f_s_m_p = hrrwork + 16210;
73
74
75 // Create constants
76 const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
77 const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
78 const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
79 const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
80 const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
81 const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
82 const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
83 const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
84 const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
85 const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
86 const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
87
88
89 ////////////////////////////////////////
90 // Loop over shells and primitives
91 ////////////////////////////////////////
92
93 real_abcd = 0;
94 istart = 0;
95 for(ab = 0; ab < P.nshell12_clip; ++ab)
96 {
97 const int iend = istart + P.nprim12[ab];
98
99 cd = 0;
100 jstart = 0;
101
102 for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
103 {
104 const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
105 int jend = jstart;
106 for(i = 0; i < nshellbatch; i++)
107 jend += Q.nprim12[cd+i];
108
109 // Clear the beginning of the workspace (where we are accumulating integrals)
110 memset(work, 0, SIMINT_NSHELL_SIMD * 2300 * sizeof(double));
111 abcd = 0;
112
113
114 for(i = istart; i < iend; ++i)
115 {
116 SIMINT_DBLTYPE bra_screen_max; // only used if check_screen
117
118 if(check_screen)
119 {
120 // Skip this whole thing if always insignificant
121 if((P.screen[i] * Q.screen_max) < screen_tol)
122 continue;
123 bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
124 }
125
126 icd = 0;
127 iprimcd = 0;
128 nprim_icd = Q.nprim12[cd];
129 double * restrict PRIM_PTR_INT__f_s_i_s = INT__f_s_i_s + abcd * 280;
130 double * restrict PRIM_PTR_INT__f_s_k_s = INT__f_s_k_s + abcd * 360;
131 double * restrict PRIM_PTR_INT__f_s_l_s = INT__f_s_l_s + abcd * 450;
132 double * restrict PRIM_PTR_INT__f_s_m_s = INT__f_s_m_s + abcd * 550;
133 double * restrict PRIM_PTR_INT__f_s_n_s = INT__f_s_n_s + abcd * 660;
134
135
136
137 // Load these one per loop over i
138 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
139 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
140 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
141
142 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
143
144 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
145 {
146 // calculate the shell offsets
147 // these are the offset from the shell pointed to by cd
148 // for each element
149 int shelloffsets[SIMINT_SIMD_LEN] = {0};
150 int lastoffset = 0;
151 const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
152
153 if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
154 {
155 // Handle if the first element of the vector is a new shell
156 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
157 {
158 nprim_icd += Q.nprim12[cd + (++icd)];
159 PRIM_PTR_INT__f_s_i_s += 280;
160 PRIM_PTR_INT__f_s_k_s += 360;
161 PRIM_PTR_INT__f_s_l_s += 450;
162 PRIM_PTR_INT__f_s_m_s += 550;
163 PRIM_PTR_INT__f_s_n_s += 660;
164 }
165 iprimcd++;
166 for(n = 1; n < SIMINT_SIMD_LEN; ++n)
167 {
168 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
169 {
170 shelloffsets[n] = shelloffsets[n-1] + 1;
171 lastoffset++;
172 nprim_icd += Q.nprim12[cd + (++icd)];
173 }
174 else
175 shelloffsets[n] = shelloffsets[n-1];
176 iprimcd++;
177 }
178 }
179 else
180 iprimcd += SIMINT_SIMD_LEN;
181
182 // Do we have to compute this vector (or has it been screened out)?
183 // (not_screened != 0 means we have to do this vector)
184 if(check_screen)
185 {
186 const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
187 if(vmax < screen_tol)
188 {
189 PRIM_PTR_INT__f_s_i_s += lastoffset*280;
190 PRIM_PTR_INT__f_s_k_s += lastoffset*360;
191 PRIM_PTR_INT__f_s_l_s += lastoffset*450;
192 PRIM_PTR_INT__f_s_m_s += lastoffset*550;
193 PRIM_PTR_INT__f_s_n_s += lastoffset*660;
194 continue;
195 }
196 }
197
198 const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
199 const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
200 const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
201 const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
202
203
204 /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
205 SIMINT_DBLTYPE PQ[3];
206 PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
207 PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
208 PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
209 SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
210 R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
211 R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
212
213 const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
214 const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
215 const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
216 const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
217 const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
218 const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
219 const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
220
221 // NOTE: Minus sign!
222 const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
223 SIMINT_DBLTYPE aop_PQ[3];
224 aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
225 aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
226 aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
227
228 SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
229 SIMINT_DBLTYPE aoq_PQ[3];
230 aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
231 aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
232 aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
233 // Put a minus sign here so we don't have to in RR routines
234 a_over_q = SIMINT_NEG(a_over_q);
235
236
237 //////////////////////////////////////////////
238 // Fjt function section
239 // Maximum v value: 13
240 //////////////////////////////////////////////
241 // The parameter to the Fjt function
242 const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
243
244
245 const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
246
247
248 boys_F_split(PRIM_INT__s_s_s_s, F_x, 13);
249 SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
250 prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
251 for(n = 0; n <= 13; n++)
252 PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
253
254 //////////////////////////////////////////////
255 // Primitive integrals: Vertical recurrance
256 //////////////////////////////////////////////
257
258 const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
259 const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
260 const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
261 const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
262 const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
263 const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
264 const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
265 const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
266 const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
267 const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
268 const SIMINT_DBLTYPE vrr_const_9_over_2q = SIMINT_MUL(const_9, one_over_2q);
269 const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
270 const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
271 const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
272 const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
273 const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
274 const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
275 const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
276 const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
277 const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
278 const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
279
280
281
282 // Forming PRIM_INT__s_s_p_s[13 * 3];
283 for(n = 0; n < 13; ++n) // loop over orders of auxiliary function
284 {
285
286 PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
287 PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]);
288
289 PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
290 PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 1]);
291
292 PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
293 PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 2]);
294
295 }
296
297
298
299 // Forming PRIM_INT__s_s_d_s[12 * 6];
300 for(n = 0; n < 12; ++n) // loop over orders of auxiliary function
301 {
302
303 PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
304 PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]);
305 PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 0]);
306
307 PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
308 PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 1]);
309
310 PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
311 PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 3]);
312 PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 3]);
313
314 PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
315 PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_d_s[n * 6 + 5]);
316 PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 5]);
317
318 }
319
320
321
322 // Forming PRIM_INT__s_s_f_s[11 * 10];
323 for(n = 0; n < 11; ++n) // loop over orders of auxiliary function
324 {
325
326 PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
327 PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 0]);
328 PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_s_f_s[n * 10 + 0]);
329
330 PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
331 PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 1]);
332
333 PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
334 PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 2]);
335
336 PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
337 PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 3]);
338
339 PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
340 PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_f_s[n * 10 + 4]);
341
342 PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
343 PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 5]);
344
345 PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
346 PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 6]);
347 PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_s_f_s[n * 10 + 6]);
348
349 PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
350 PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 7]);
351
352 PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
353 PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 8]);
354
355 PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
356 PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 9]);
357 PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_s_f_s[n * 10 + 9]);
358
359 }
360
361
362 VRR_K_s_s_g_s(
363 PRIM_INT__s_s_g_s,
364 PRIM_INT__s_s_f_s,
365 PRIM_INT__s_s_d_s,
366 Q_PA,
367 a_over_q,
368 aoq_PQ,
369 one_over_2q,
370 10);
371
372
373 VRR_K_s_s_h_s(
374 PRIM_INT__s_s_h_s,
375 PRIM_INT__s_s_g_s,
376 PRIM_INT__s_s_f_s,
377 Q_PA,
378 a_over_q,
379 aoq_PQ,
380 one_over_2q,
381 9);
382
383
384 ostei_general_vrr1_K(6, 8,
385 one_over_2q, a_over_q, aoq_PQ, Q_PA,
386 PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
387
388
389 ostei_general_vrr_I(1, 0, 6, 0, 3,
390 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
391 PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
392
393
394 ostei_general_vrr_I(1, 0, 5, 0, 3,
395 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
396 PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
397
398
399 ostei_general_vrr_I(2, 0, 6, 0, 2,
400 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
401 PRIM_INT__p_s_i_s, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);
402
403
404 VRR_I_p_s_g_s(
405 PRIM_INT__p_s_g_s,
406 PRIM_INT__s_s_g_s,
407 PRIM_INT__s_s_f_s,
408 P_PA,
409 aop_PQ,
410 one_over_2pq,
411 3);
412
413
414 ostei_general_vrr_I(2, 0, 5, 0, 2,
415 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
416 PRIM_INT__p_s_h_s, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_h_s);
417
418
419 ostei_general_vrr_I(3, 0, 6, 0, 1,
420 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
421 PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);
422
423
424 ostei_general_vrr1_K(7, 7,
425 one_over_2q, a_over_q, aoq_PQ, Q_PA,
426 PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
427
428
429 ostei_general_vrr_I(1, 0, 7, 0, 3,
430 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
431 PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
432
433
434 ostei_general_vrr_I(2, 0, 7, 0, 2,
435 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
436 PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);
437
438
439 ostei_general_vrr_I(3, 0, 7, 0, 1,
440 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
441 PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);
442
443
444 ostei_general_vrr1_K(8, 6,
445 one_over_2q, a_over_q, aoq_PQ, Q_PA,
446 PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
447
448
449 ostei_general_vrr_I(1, 0, 8, 0, 3,
450 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
451 PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
452
453
454 ostei_general_vrr_I(2, 0, 8, 0, 2,
455 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
456 PRIM_INT__p_s_l_s, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_l_s);
457
458
459 ostei_general_vrr_I(3, 0, 8, 0, 1,
460 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
461 PRIM_INT__d_s_l_s, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_l_s);
462
463
464 ostei_general_vrr1_K(9, 5,
465 one_over_2q, a_over_q, aoq_PQ, Q_PA,
466 PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);
467
468
469 ostei_general_vrr_I(1, 0, 9, 0, 3,
470 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
471 PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);
472
473
474 ostei_general_vrr_I(2, 0, 9, 0, 2,
475 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
476 PRIM_INT__p_s_m_s, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_m_s);
477
478
479 ostei_general_vrr_I(3, 0, 9, 0, 1,
480 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
481 PRIM_INT__d_s_m_s, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_m_s);
482
483
484 ostei_general_vrr1_K(10, 4,
485 one_over_2q, a_over_q, aoq_PQ, Q_PA,
486 PRIM_INT__s_s_m_s, PRIM_INT__s_s_l_s, PRIM_INT__s_s_n_s);
487
488
489 ostei_general_vrr_I(1, 0, 10, 0, 3,
490 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
491 PRIM_INT__s_s_n_s, NULL, NULL, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_n_s);
492
493
494 ostei_general_vrr_I(2, 0, 10, 0, 2,
495 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
496 PRIM_INT__p_s_n_s, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_n_s);
497
498
499 ostei_general_vrr_I(3, 0, 10, 0, 1,
500 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
501 PRIM_INT__d_s_n_s, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_n_s);
502
503
504
505
506 ////////////////////////////////////
507 // Accumulate contracted integrals
508 ////////////////////////////////////
509 if(lastoffset == 0)
510 {
511 contract_all(280, PRIM_INT__f_s_i_s, PRIM_PTR_INT__f_s_i_s);
512 contract_all(360, PRIM_INT__f_s_k_s, PRIM_PTR_INT__f_s_k_s);
513 contract_all(450, PRIM_INT__f_s_l_s, PRIM_PTR_INT__f_s_l_s);
514 contract_all(550, PRIM_INT__f_s_m_s, PRIM_PTR_INT__f_s_m_s);
515 contract_all(660, PRIM_INT__f_s_n_s, PRIM_PTR_INT__f_s_n_s);
516 }
517 else
518 {
519 contract(280, shelloffsets, PRIM_INT__f_s_i_s, PRIM_PTR_INT__f_s_i_s);
520 contract(360, shelloffsets, PRIM_INT__f_s_k_s, PRIM_PTR_INT__f_s_k_s);
521 contract(450, shelloffsets, PRIM_INT__f_s_l_s, PRIM_PTR_INT__f_s_l_s);
522 contract(550, shelloffsets, PRIM_INT__f_s_m_s, PRIM_PTR_INT__f_s_m_s);
523 contract(660, shelloffsets, PRIM_INT__f_s_n_s, PRIM_PTR_INT__f_s_n_s);
524 PRIM_PTR_INT__f_s_i_s += lastoffset*280;
525 PRIM_PTR_INT__f_s_k_s += lastoffset*360;
526 PRIM_PTR_INT__f_s_l_s += lastoffset*450;
527 PRIM_PTR_INT__f_s_m_s += lastoffset*550;
528 PRIM_PTR_INT__f_s_n_s += lastoffset*660;
529 }
530
531 } // close loop over j
532 } // close loop over i
533
534 //Advance to the next batch
535 jstart = SIMINT_SIMD_ROUND(jend);
536
537 //////////////////////////////////////////////
538 // Contracted integrals: Horizontal recurrance
539 //////////////////////////////////////////////
540
541
542
543
544 for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
545 {
546 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
547
548 // set up HRR pointers
549 double const * restrict HRR_INT__f_s_i_s = INT__f_s_i_s + abcd * 280;
550 double const * restrict HRR_INT__f_s_k_s = INT__f_s_k_s + abcd * 360;
551 double const * restrict HRR_INT__f_s_l_s = INT__f_s_l_s + abcd * 450;
552 double const * restrict HRR_INT__f_s_m_s = INT__f_s_m_s + abcd * 550;
553 double const * restrict HRR_INT__f_s_n_s = INT__f_s_n_s + abcd * 660;
554 double * restrict HRR_INT__f_s_i_g = INT__f_s_i_g + real_abcd * 4200;
555
556 // form INT__f_s_i_p
557 ostei_general_hrr_L(3, 0, 6, 1, hCD, HRR_INT__f_s_k_s, HRR_INT__f_s_i_s, HRR_INT__f_s_i_p);
558
559 // form INT__f_s_k_p
560 ostei_general_hrr_L(3, 0, 7, 1, hCD, HRR_INT__f_s_l_s, HRR_INT__f_s_k_s, HRR_INT__f_s_k_p);
561
562 // form INT__f_s_l_p
563 ostei_general_hrr_L(3, 0, 8, 1, hCD, HRR_INT__f_s_m_s, HRR_INT__f_s_l_s, HRR_INT__f_s_l_p);
564
565 // form INT__f_s_m_p
566 ostei_general_hrr_L(3, 0, 9, 1, hCD, HRR_INT__f_s_n_s, HRR_INT__f_s_m_s, HRR_INT__f_s_m_p);
567
568 // form INT__f_s_i_d
569 ostei_general_hrr_L(3, 0, 6, 2, hCD, HRR_INT__f_s_k_p, HRR_INT__f_s_i_p, HRR_INT__f_s_i_d);
570
571 // form INT__f_s_k_d
572 ostei_general_hrr_L(3, 0, 7, 2, hCD, HRR_INT__f_s_l_p, HRR_INT__f_s_k_p, HRR_INT__f_s_k_d);
573
574 // form INT__f_s_l_d
575 ostei_general_hrr_L(3, 0, 8, 2, hCD, HRR_INT__f_s_m_p, HRR_INT__f_s_l_p, HRR_INT__f_s_l_d);
576
577 // form INT__f_s_i_f
578 ostei_general_hrr_L(3, 0, 6, 3, hCD, HRR_INT__f_s_k_d, HRR_INT__f_s_i_d, HRR_INT__f_s_i_f);
579
580 // form INT__f_s_k_f
581 ostei_general_hrr_L(3, 0, 7, 3, hCD, HRR_INT__f_s_l_d, HRR_INT__f_s_k_d, HRR_INT__f_s_k_f);
582
583 // form INT__f_s_i_g
584 ostei_general_hrr_L(3, 0, 6, 4, hCD, HRR_INT__f_s_k_f, HRR_INT__f_s_i_f, HRR_INT__f_s_i_g);
585
586
587 } // close HRR loop
588
589
590 } // close loop cdbatch
591
592 istart = iend;
593 } // close loop over ab
594
595 return P.nshell12_clip * Q.nshell12_clip;
596 }
597
ostei_s_f_i_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_f_i_g)598 int ostei_s_f_i_g(struct simint_multi_shellpair const P,
599 struct simint_multi_shellpair const Q,
600 double screen_tol,
601 double * const restrict work,
602 double * const restrict INT__s_f_i_g)
603 {
604 double P_AB[3*P.nshell12];
605 struct simint_multi_shellpair P_tmp = P;
606 P_tmp.PA_x = P.PB_x; P_tmp.PA_y = P.PB_y; P_tmp.PA_z = P.PB_z;
607 P_tmp.PB_x = P.PA_x; P_tmp.PB_y = P.PA_y; P_tmp.PB_z = P.PA_z;
608 P_tmp.AB_x = P_AB;
609 P_tmp.AB_y = P_AB + P.nshell12;
610 P_tmp.AB_z = P_AB + 2*P.nshell12;
611
612 for(int i = 0; i < P.nshell12; i++)
613 {
614 P_tmp.AB_x[i] = -P.AB_x[i];
615 P_tmp.AB_y[i] = -P.AB_y[i];
616 P_tmp.AB_z[i] = -P.AB_z[i];
617 }
618
619 int ret = ostei_f_s_i_g(P_tmp, Q, screen_tol, work, INT__s_f_i_g);
620 double buffer[4200] SIMINT_ALIGN_ARRAY_DBL;
621
622 for(int q = 0; q < ret; q++)
623 {
624 int idx = 0;
625 for(int a = 0; a < 1; ++a)
626 for(int b = 0; b < 10; ++b)
627 for(int c = 0; c < 28; ++c)
628 for(int d = 0; d < 15; ++d)
629 buffer[idx++] = INT__s_f_i_g[q*4200+b*420+a*420+c*15+d];
630
631 memcpy(INT__s_f_i_g+q*4200, buffer, 4200*sizeof(double));
632 }
633
634 return ret;
635 }
636
ostei_f_s_g_i(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_s_g_i)637 int ostei_f_s_g_i(struct simint_multi_shellpair const P,
638 struct simint_multi_shellpair const Q,
639 double screen_tol,
640 double * const restrict work,
641 double * const restrict INT__f_s_g_i)
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_f_s_i_g(P, Q_tmp, screen_tol, work, INT__f_s_g_i);
659 double buffer[4200] SIMINT_ALIGN_ARRAY_DBL;
660
661 for(int q = 0; q < ret; q++)
662 {
663 int idx = 0;
664 for(int a = 0; a < 10; ++a)
665 for(int b = 0; b < 1; ++b)
666 for(int c = 0; c < 15; ++c)
667 for(int d = 0; d < 28; ++d)
668 buffer[idx++] = INT__f_s_g_i[q*4200+a*420+b*420+d*15+c];
669
670 memcpy(INT__f_s_g_i+q*4200, buffer, 4200*sizeof(double));
671 }
672
673 return ret;
674 }
675
ostei_s_f_g_i(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_f_g_i)676 int ostei_s_f_g_i(struct simint_multi_shellpair const P,
677 struct simint_multi_shellpair const Q,
678 double screen_tol,
679 double * const restrict work,
680 double * const restrict INT__s_f_g_i)
681 {
682 double P_AB[3*P.nshell12];
683 struct simint_multi_shellpair P_tmp = P;
684 P_tmp.PA_x = P.PB_x; P_tmp.PA_y = P.PB_y; P_tmp.PA_z = P.PB_z;
685 P_tmp.PB_x = P.PA_x; P_tmp.PB_y = P.PA_y; P_tmp.PB_z = P.PA_z;
686 P_tmp.AB_x = P_AB;
687 P_tmp.AB_y = P_AB + P.nshell12;
688 P_tmp.AB_z = P_AB + 2*P.nshell12;
689
690 for(int i = 0; i < P.nshell12; i++)
691 {
692 P_tmp.AB_x[i] = -P.AB_x[i];
693 P_tmp.AB_y[i] = -P.AB_y[i];
694 P_tmp.AB_z[i] = -P.AB_z[i];
695 }
696
697 double Q_AB[3*Q.nshell12];
698 struct simint_multi_shellpair Q_tmp = Q;
699 Q_tmp.PA_x = Q.PB_x; Q_tmp.PA_y = Q.PB_y; Q_tmp.PA_z = Q.PB_z;
700 Q_tmp.PB_x = Q.PA_x; Q_tmp.PB_y = Q.PA_y; Q_tmp.PB_z = Q.PA_z;
701 Q_tmp.AB_x = Q_AB;
702 Q_tmp.AB_y = Q_AB + Q.nshell12;
703 Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
704
705 for(int i = 0; i < Q.nshell12; i++)
706 {
707 Q_tmp.AB_x[i] = -Q.AB_x[i];
708 Q_tmp.AB_y[i] = -Q.AB_y[i];
709 Q_tmp.AB_z[i] = -Q.AB_z[i];
710 }
711
712 int ret = ostei_f_s_i_g(P_tmp, Q_tmp, screen_tol, work, INT__s_f_g_i);
713 double buffer[4200] SIMINT_ALIGN_ARRAY_DBL;
714
715 for(int q = 0; q < ret; q++)
716 {
717 int idx = 0;
718 for(int a = 0; a < 1; ++a)
719 for(int b = 0; b < 10; ++b)
720 for(int c = 0; c < 15; ++c)
721 for(int d = 0; d < 28; ++d)
722 buffer[idx++] = INT__s_f_g_i[q*4200+b*420+a*420+d*15+c];
723
724 memcpy(INT__s_f_g_i+q*4200, buffer, 4200*sizeof(double));
725 }
726
727 return ret;
728 }
729
730