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_d_s_i_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_s_i_p)8 int ostei_d_s_i_p(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__d_s_i_p)
13 {
14
15 SIMINT_ASSUME_ALIGN_DBL(work);
16 SIMINT_ASSUME_ALIGN_DBL(INT__d_s_i_p);
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__d_s_i_s = work + (SIMINT_NSHELL_SIMD * 0);
29 double * const INT__d_s_k_s = work + (SIMINT_NSHELL_SIMD * 168);
30 SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*384);
31 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
32 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 10;
33 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 37;
34 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 85;
35 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 155;
36 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 245;
37 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 350;
38 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 462;
39 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 570;
40 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 696;
41 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 864;
42 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 1080;
43 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 1248;
44 double * const hrrwork = (double *)(primwork + 1464);
45
46
47 // Create constants
48 const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
49 const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
50 const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
51 const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
52 const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
53 const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
54 const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
55 const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
56
57
58 ////////////////////////////////////////
59 // Loop over shells and primitives
60 ////////////////////////////////////////
61
62 real_abcd = 0;
63 istart = 0;
64 for(ab = 0; ab < P.nshell12_clip; ++ab)
65 {
66 const int iend = istart + P.nprim12[ab];
67
68 cd = 0;
69 jstart = 0;
70
71 for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
72 {
73 const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
74 int jend = jstart;
75 for(i = 0; i < nshellbatch; i++)
76 jend += Q.nprim12[cd+i];
77
78 // Clear the beginning of the workspace (where we are accumulating integrals)
79 memset(work, 0, SIMINT_NSHELL_SIMD * 384 * sizeof(double));
80 abcd = 0;
81
82
83 for(i = istart; i < iend; ++i)
84 {
85 SIMINT_DBLTYPE bra_screen_max; // only used if check_screen
86
87 if(check_screen)
88 {
89 // Skip this whole thing if always insignificant
90 if((P.screen[i] * Q.screen_max) < screen_tol)
91 continue;
92 bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
93 }
94
95 icd = 0;
96 iprimcd = 0;
97 nprim_icd = Q.nprim12[cd];
98 double * restrict PRIM_PTR_INT__d_s_i_s = INT__d_s_i_s + abcd * 168;
99 double * restrict PRIM_PTR_INT__d_s_k_s = INT__d_s_k_s + abcd * 216;
100
101
102
103 // Load these one per loop over i
104 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
105 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
106 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
107
108 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
109
110 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
111 {
112 // calculate the shell offsets
113 // these are the offset from the shell pointed to by cd
114 // for each element
115 int shelloffsets[SIMINT_SIMD_LEN] = {0};
116 int lastoffset = 0;
117 const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
118
119 if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
120 {
121 // Handle if the first element of the vector is a new shell
122 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
123 {
124 nprim_icd += Q.nprim12[cd + (++icd)];
125 PRIM_PTR_INT__d_s_i_s += 168;
126 PRIM_PTR_INT__d_s_k_s += 216;
127 }
128 iprimcd++;
129 for(n = 1; n < SIMINT_SIMD_LEN; ++n)
130 {
131 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
132 {
133 shelloffsets[n] = shelloffsets[n-1] + 1;
134 lastoffset++;
135 nprim_icd += Q.nprim12[cd + (++icd)];
136 }
137 else
138 shelloffsets[n] = shelloffsets[n-1];
139 iprimcd++;
140 }
141 }
142 else
143 iprimcd += SIMINT_SIMD_LEN;
144
145 // Do we have to compute this vector (or has it been screened out)?
146 // (not_screened != 0 means we have to do this vector)
147 if(check_screen)
148 {
149 const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
150 if(vmax < screen_tol)
151 {
152 PRIM_PTR_INT__d_s_i_s += lastoffset*168;
153 PRIM_PTR_INT__d_s_k_s += lastoffset*216;
154 continue;
155 }
156 }
157
158 const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
159 const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
160 const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
161 const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
162
163
164 /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
165 SIMINT_DBLTYPE PQ[3];
166 PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
167 PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
168 PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
169 SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
170 R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
171 R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
172
173 const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
174 const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
175 const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
176 const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
177 const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
178 const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
179 const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
180
181 // NOTE: Minus sign!
182 const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
183 SIMINT_DBLTYPE aop_PQ[3];
184 aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
185 aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
186 aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
187
188 SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
189 SIMINT_DBLTYPE aoq_PQ[3];
190 aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
191 aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
192 aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
193 // Put a minus sign here so we don't have to in RR routines
194 a_over_q = SIMINT_NEG(a_over_q);
195
196
197 //////////////////////////////////////////////
198 // Fjt function section
199 // Maximum v value: 9
200 //////////////////////////////////////////////
201 // The parameter to the Fjt function
202 const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
203
204
205 const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
206
207
208 boys_F_split(PRIM_INT__s_s_s_s, F_x, 9);
209 SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
210 prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
211 for(n = 0; n <= 9; n++)
212 PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
213
214 //////////////////////////////////////////////
215 // Primitive integrals: Vertical recurrance
216 //////////////////////////////////////////////
217
218 const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
219 const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
220 const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
221 const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
222 const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
223 const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
224 const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
225 const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
226 const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
227 const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
228 const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
229 const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
230 const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
231 const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
232
233
234
235 // Forming PRIM_INT__s_s_p_s[9 * 3];
236 for(n = 0; n < 9; ++n) // loop over orders of auxiliary function
237 {
238
239 PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
240 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]);
241
242 PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
243 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]);
244
245 PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
246 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]);
247
248 }
249
250
251
252 // Forming PRIM_INT__s_s_d_s[8 * 6];
253 for(n = 0; n < 8; ++n) // loop over orders of auxiliary function
254 {
255
256 PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
257 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]);
258 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]);
259
260 PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
261 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]);
262 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]);
263
264 PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
265 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]);
266 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]);
267
268 }
269
270
271
272 // Forming PRIM_INT__s_s_f_s[7 * 10];
273 for(n = 0; n < 7; ++n) // loop over orders of auxiliary function
274 {
275
276 PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
277 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]);
278 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]);
279
280 PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
281 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]);
282
283 PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
284 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]);
285
286 PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
287 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]);
288
289 PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
290 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]);
291
292 PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
293 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]);
294 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]);
295
296 PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
297 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]);
298
299 PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
300 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]);
301 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]);
302
303 }
304
305
306 VRR_K_s_s_g_s(
307 PRIM_INT__s_s_g_s,
308 PRIM_INT__s_s_f_s,
309 PRIM_INT__s_s_d_s,
310 Q_PA,
311 a_over_q,
312 aoq_PQ,
313 one_over_2q,
314 6);
315
316
317 VRR_K_s_s_h_s(
318 PRIM_INT__s_s_h_s,
319 PRIM_INT__s_s_g_s,
320 PRIM_INT__s_s_f_s,
321 Q_PA,
322 a_over_q,
323 aoq_PQ,
324 one_over_2q,
325 5);
326
327
328 ostei_general_vrr1_K(6, 4,
329 one_over_2q, a_over_q, aoq_PQ, Q_PA,
330 PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
331
332
333 ostei_general_vrr_I(1, 0, 6, 0, 2,
334 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
335 PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
336
337
338 ostei_general_vrr_I(1, 0, 5, 0, 2,
339 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
340 PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
341
342
343 ostei_general_vrr_I(2, 0, 6, 0, 1,
344 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
345 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);
346
347
348 ostei_general_vrr1_K(7, 3,
349 one_over_2q, a_over_q, aoq_PQ, Q_PA,
350 PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
351
352
353 ostei_general_vrr_I(1, 0, 7, 0, 2,
354 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
355 PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
356
357
358 ostei_general_vrr_I(2, 0, 7, 0, 1,
359 one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
360 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);
361
362
363
364
365 ////////////////////////////////////
366 // Accumulate contracted integrals
367 ////////////////////////////////////
368 if(lastoffset == 0)
369 {
370 contract_all(168, PRIM_INT__d_s_i_s, PRIM_PTR_INT__d_s_i_s);
371 contract_all(216, PRIM_INT__d_s_k_s, PRIM_PTR_INT__d_s_k_s);
372 }
373 else
374 {
375 contract(168, shelloffsets, PRIM_INT__d_s_i_s, PRIM_PTR_INT__d_s_i_s);
376 contract(216, shelloffsets, PRIM_INT__d_s_k_s, PRIM_PTR_INT__d_s_k_s);
377 PRIM_PTR_INT__d_s_i_s += lastoffset*168;
378 PRIM_PTR_INT__d_s_k_s += lastoffset*216;
379 }
380
381 } // close loop over j
382 } // close loop over i
383
384 //Advance to the next batch
385 jstart = SIMINT_SIMD_ROUND(jend);
386
387 //////////////////////////////////////////////
388 // Contracted integrals: Horizontal recurrance
389 //////////////////////////////////////////////
390
391
392
393
394 for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
395 {
396 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
397
398 // set up HRR pointers
399 double const * restrict HRR_INT__d_s_i_s = INT__d_s_i_s + abcd * 168;
400 double const * restrict HRR_INT__d_s_k_s = INT__d_s_k_s + abcd * 216;
401 double * restrict HRR_INT__d_s_i_p = INT__d_s_i_p + real_abcd * 504;
402
403 // form INT__d_s_i_p
404 ostei_general_hrr_L(2, 0, 6, 1, hCD, HRR_INT__d_s_k_s, HRR_INT__d_s_i_s, HRR_INT__d_s_i_p);
405
406
407 } // close HRR loop
408
409
410 } // close loop cdbatch
411
412 istart = iend;
413 } // close loop over ab
414
415 return P.nshell12_clip * Q.nshell12_clip;
416 }
417
ostei_s_d_i_p(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_d_i_p)418 int ostei_s_d_i_p(struct simint_multi_shellpair const P,
419 struct simint_multi_shellpair const Q,
420 double screen_tol,
421 double * const restrict work,
422 double * const restrict INT__s_d_i_p)
423 {
424 double P_AB[3*P.nshell12];
425 struct simint_multi_shellpair P_tmp = P;
426 P_tmp.PA_x = P.PB_x; P_tmp.PA_y = P.PB_y; P_tmp.PA_z = P.PB_z;
427 P_tmp.PB_x = P.PA_x; P_tmp.PB_y = P.PA_y; P_tmp.PB_z = P.PA_z;
428 P_tmp.AB_x = P_AB;
429 P_tmp.AB_y = P_AB + P.nshell12;
430 P_tmp.AB_z = P_AB + 2*P.nshell12;
431
432 for(int i = 0; i < P.nshell12; i++)
433 {
434 P_tmp.AB_x[i] = -P.AB_x[i];
435 P_tmp.AB_y[i] = -P.AB_y[i];
436 P_tmp.AB_z[i] = -P.AB_z[i];
437 }
438
439 int ret = ostei_d_s_i_p(P_tmp, Q, screen_tol, work, INT__s_d_i_p);
440 double buffer[504] SIMINT_ALIGN_ARRAY_DBL;
441
442 for(int q = 0; q < ret; q++)
443 {
444 int idx = 0;
445 for(int a = 0; a < 1; ++a)
446 for(int b = 0; b < 6; ++b)
447 for(int c = 0; c < 28; ++c)
448 for(int d = 0; d < 3; ++d)
449 buffer[idx++] = INT__s_d_i_p[q*504+b*84+a*84+c*3+d];
450
451 memcpy(INT__s_d_i_p+q*504, buffer, 504*sizeof(double));
452 }
453
454 return ret;
455 }
456
ostei_d_s_p_i(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__d_s_p_i)457 int ostei_d_s_p_i(struct simint_multi_shellpair const P,
458 struct simint_multi_shellpair const Q,
459 double screen_tol,
460 double * const restrict work,
461 double * const restrict INT__d_s_p_i)
462 {
463 double Q_AB[3*Q.nshell12];
464 struct simint_multi_shellpair Q_tmp = Q;
465 Q_tmp.PA_x = Q.PB_x; Q_tmp.PA_y = Q.PB_y; Q_tmp.PA_z = Q.PB_z;
466 Q_tmp.PB_x = Q.PA_x; Q_tmp.PB_y = Q.PA_y; Q_tmp.PB_z = Q.PA_z;
467 Q_tmp.AB_x = Q_AB;
468 Q_tmp.AB_y = Q_AB + Q.nshell12;
469 Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
470
471 for(int i = 0; i < Q.nshell12; i++)
472 {
473 Q_tmp.AB_x[i] = -Q.AB_x[i];
474 Q_tmp.AB_y[i] = -Q.AB_y[i];
475 Q_tmp.AB_z[i] = -Q.AB_z[i];
476 }
477
478 int ret = ostei_d_s_i_p(P, Q_tmp, screen_tol, work, INT__d_s_p_i);
479 double buffer[504] SIMINT_ALIGN_ARRAY_DBL;
480
481 for(int q = 0; q < ret; q++)
482 {
483 int idx = 0;
484 for(int a = 0; a < 6; ++a)
485 for(int b = 0; b < 1; ++b)
486 for(int c = 0; c < 3; ++c)
487 for(int d = 0; d < 28; ++d)
488 buffer[idx++] = INT__d_s_p_i[q*504+a*84+b*84+d*3+c];
489
490 memcpy(INT__d_s_p_i+q*504, buffer, 504*sizeof(double));
491 }
492
493 return ret;
494 }
495
ostei_s_d_p_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_d_p_i)496 int ostei_s_d_p_i(struct simint_multi_shellpair const P,
497 struct simint_multi_shellpair const Q,
498 double screen_tol,
499 double * const restrict work,
500 double * const restrict INT__s_d_p_i)
501 {
502 double P_AB[3*P.nshell12];
503 struct simint_multi_shellpair P_tmp = P;
504 P_tmp.PA_x = P.PB_x; P_tmp.PA_y = P.PB_y; P_tmp.PA_z = P.PB_z;
505 P_tmp.PB_x = P.PA_x; P_tmp.PB_y = P.PA_y; P_tmp.PB_z = P.PA_z;
506 P_tmp.AB_x = P_AB;
507 P_tmp.AB_y = P_AB + P.nshell12;
508 P_tmp.AB_z = P_AB + 2*P.nshell12;
509
510 for(int i = 0; i < P.nshell12; i++)
511 {
512 P_tmp.AB_x[i] = -P.AB_x[i];
513 P_tmp.AB_y[i] = -P.AB_y[i];
514 P_tmp.AB_z[i] = -P.AB_z[i];
515 }
516
517 double Q_AB[3*Q.nshell12];
518 struct simint_multi_shellpair Q_tmp = Q;
519 Q_tmp.PA_x = Q.PB_x; Q_tmp.PA_y = Q.PB_y; Q_tmp.PA_z = Q.PB_z;
520 Q_tmp.PB_x = Q.PA_x; Q_tmp.PB_y = Q.PA_y; Q_tmp.PB_z = Q.PA_z;
521 Q_tmp.AB_x = Q_AB;
522 Q_tmp.AB_y = Q_AB + Q.nshell12;
523 Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
524
525 for(int i = 0; i < Q.nshell12; i++)
526 {
527 Q_tmp.AB_x[i] = -Q.AB_x[i];
528 Q_tmp.AB_y[i] = -Q.AB_y[i];
529 Q_tmp.AB_z[i] = -Q.AB_z[i];
530 }
531
532 int ret = ostei_d_s_i_p(P_tmp, Q_tmp, screen_tol, work, INT__s_d_p_i);
533 double buffer[504] SIMINT_ALIGN_ARRAY_DBL;
534
535 for(int q = 0; q < ret; q++)
536 {
537 int idx = 0;
538 for(int a = 0; a < 1; ++a)
539 for(int b = 0; b < 6; ++b)
540 for(int c = 0; c < 3; ++c)
541 for(int d = 0; d < 28; ++d)
542 buffer[idx++] = INT__s_d_p_i[q*504+b*84+a*84+d*3+c];
543
544 memcpy(INT__s_d_p_i+q*504, buffer, 504*sizeof(double));
545 }
546
547 return ret;
548 }
549
550