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