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_g_f_d_s(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_f_d_s)8 int ostei_g_f_d_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__g_f_d_s)
13 {
14
15 SIMINT_ASSUME_ALIGN_DBL(work);
16 SIMINT_ASSUME_ALIGN_DBL(INT__g_f_d_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__g_s_d_s = work + (SIMINT_NSHELL_SIMD * 0);
29 double * const INT__h_s_d_s = work + (SIMINT_NSHELL_SIMD * 90);
30 double * const INT__i_s_d_s = work + (SIMINT_NSHELL_SIMD * 216);
31 double * const INT__k_s_d_s = work + (SIMINT_NSHELL_SIMD * 384);
32 SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*600);
33 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
34 SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 10;
35 SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 37;
36 SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 85;
37 SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 155;
38 SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 215;
39 SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 305;
40 SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 395;
41 SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 485;
42 SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 590;
43 SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 716;
44 SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 842;
45 SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 954;
46 SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 1122;
47 SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_s_s = primwork + 1290;
48 SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_p_s = primwork + 1398;
49 SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_d_s = primwork + 1614;
50 double * const hrrwork = (double *)(primwork + 1830);
51 double * const HRR_INT__g_p_d_s = hrrwork + 0;
52 double * const HRR_INT__g_d_d_s = hrrwork + 270;
53 double * const HRR_INT__h_p_d_s = hrrwork + 810;
54 double * const HRR_INT__h_d_d_s = hrrwork + 1188;
55 double * const HRR_INT__i_p_d_s = hrrwork + 1944;
56
57
58 // Create constants
59 const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
60 const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
61 const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
62 const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
63 const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
64 const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
65 const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
66 const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
67
68
69 ////////////////////////////////////////
70 // Loop over shells and primitives
71 ////////////////////////////////////////
72
73 real_abcd = 0;
74 istart = 0;
75 for(ab = 0; ab < P.nshell12_clip; ++ab)
76 {
77 const int iend = istart + P.nprim12[ab];
78
79 cd = 0;
80 jstart = 0;
81
82 for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
83 {
84 const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
85 int jend = jstart;
86 for(i = 0; i < nshellbatch; i++)
87 jend += Q.nprim12[cd+i];
88
89 // Clear the beginning of the workspace (where we are accumulating integrals)
90 memset(work, 0, SIMINT_NSHELL_SIMD * 600 * sizeof(double));
91 abcd = 0;
92
93
94 for(i = istart; i < iend; ++i)
95 {
96 SIMINT_DBLTYPE bra_screen_max; // only used if check_screen
97
98 if(check_screen)
99 {
100 // Skip this whole thing if always insignificant
101 if((P.screen[i] * Q.screen_max) < screen_tol)
102 continue;
103 bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
104 }
105
106 icd = 0;
107 iprimcd = 0;
108 nprim_icd = Q.nprim12[cd];
109 double * restrict PRIM_PTR_INT__g_s_d_s = INT__g_s_d_s + abcd * 90;
110 double * restrict PRIM_PTR_INT__h_s_d_s = INT__h_s_d_s + abcd * 126;
111 double * restrict PRIM_PTR_INT__i_s_d_s = INT__i_s_d_s + abcd * 168;
112 double * restrict PRIM_PTR_INT__k_s_d_s = INT__k_s_d_s + abcd * 216;
113
114
115
116 // Load these one per loop over i
117 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
118 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
119 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
120
121 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
122
123 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
124 {
125 // calculate the shell offsets
126 // these are the offset from the shell pointed to by cd
127 // for each element
128 int shelloffsets[SIMINT_SIMD_LEN] = {0};
129 int lastoffset = 0;
130 const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
131
132 if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
133 {
134 // Handle if the first element of the vector is a new shell
135 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
136 {
137 nprim_icd += Q.nprim12[cd + (++icd)];
138 PRIM_PTR_INT__g_s_d_s += 90;
139 PRIM_PTR_INT__h_s_d_s += 126;
140 PRIM_PTR_INT__i_s_d_s += 168;
141 PRIM_PTR_INT__k_s_d_s += 216;
142 }
143 iprimcd++;
144 for(n = 1; n < SIMINT_SIMD_LEN; ++n)
145 {
146 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
147 {
148 shelloffsets[n] = shelloffsets[n-1] + 1;
149 lastoffset++;
150 nprim_icd += Q.nprim12[cd + (++icd)];
151 }
152 else
153 shelloffsets[n] = shelloffsets[n-1];
154 iprimcd++;
155 }
156 }
157 else
158 iprimcd += SIMINT_SIMD_LEN;
159
160 // Do we have to compute this vector (or has it been screened out)?
161 // (not_screened != 0 means we have to do this vector)
162 if(check_screen)
163 {
164 const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
165 if(vmax < screen_tol)
166 {
167 PRIM_PTR_INT__g_s_d_s += lastoffset*90;
168 PRIM_PTR_INT__h_s_d_s += lastoffset*126;
169 PRIM_PTR_INT__i_s_d_s += lastoffset*168;
170 PRIM_PTR_INT__k_s_d_s += lastoffset*216;
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: 9
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, 9);
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 <= 9; 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_1_over_2q = one_over_2q;
242 const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
243 const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
244 const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
245 const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
246 const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
247 const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
248 const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
249
250
251
252 // Forming PRIM_INT__p_s_s_s[9 * 3];
253 for(n = 0; n < 9; ++n) // loop over orders of auxiliary function
254 {
255
256 PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
257 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]);
258
259 PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
260 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]);
261
262 PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
263 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]);
264
265 }
266
267
268
269 // Forming PRIM_INT__d_s_s_s[8 * 6];
270 for(n = 0; n < 8; ++n) // loop over orders of auxiliary function
271 {
272
273 PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
274 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]);
275 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]);
276
277 PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
278 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]);
279
280 PRIM_INT__d_s_s_s[n * 6 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
281 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]);
282
283 PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
284 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]);
285 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]);
286
287 PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
288 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]);
289
290 PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
291 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]);
292 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]);
293
294 }
295
296
297
298 // Forming PRIM_INT__f_s_s_s[7 * 10];
299 for(n = 0; n < 7; ++n) // loop over orders of auxiliary function
300 {
301
302 PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
303 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]);
304 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]);
305
306 PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
307 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]);
308
309 PRIM_INT__f_s_s_s[n * 10 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
310 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]);
311
312 PRIM_INT__f_s_s_s[n * 10 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
313 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]);
314
315 PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
316 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]);
317
318 PRIM_INT__f_s_s_s[n * 10 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
319 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]);
320
321 PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
322 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]);
323 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]);
324
325 PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
326 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]);
327
328 PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
329 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]);
330
331 PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
332 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]);
333 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]);
334
335 }
336
337
338 VRR_I_g_s_s_s(
339 PRIM_INT__g_s_s_s,
340 PRIM_INT__f_s_s_s,
341 PRIM_INT__d_s_s_s,
342 P_PA,
343 a_over_p,
344 aop_PQ,
345 one_over_2p,
346 6);
347
348
349 VRR_K_g_s_p_s(
350 PRIM_INT__g_s_p_s,
351 PRIM_INT__g_s_s_s,
352 PRIM_INT__f_s_s_s,
353 Q_PA,
354 aoq_PQ,
355 one_over_2pq,
356 2);
357
358
359 VRR_K_f_s_p_s(
360 PRIM_INT__f_s_p_s,
361 PRIM_INT__f_s_s_s,
362 PRIM_INT__d_s_s_s,
363 Q_PA,
364 aoq_PQ,
365 one_over_2pq,
366 2);
367
368
369 ostei_general_vrr_K(4, 0, 2, 0, 1,
370 one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
371 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);
372
373
374 VRR_I_h_s_s_s(
375 PRIM_INT__h_s_s_s,
376 PRIM_INT__g_s_s_s,
377 PRIM_INT__f_s_s_s,
378 P_PA,
379 a_over_p,
380 aop_PQ,
381 one_over_2p,
382 5);
383
384
385 ostei_general_vrr_K(5, 0, 1, 0, 2,
386 one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
387 PRIM_INT__h_s_s_s, NULL, NULL, PRIM_INT__g_s_s_s, NULL, PRIM_INT__h_s_p_s);
388
389
390 ostei_general_vrr_K(5, 0, 2, 0, 1,
391 one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
392 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);
393
394
395 ostei_general_vrr1_I(6, 4,
396 one_over_2p, a_over_p, aop_PQ, P_PA,
397 PRIM_INT__h_s_s_s, PRIM_INT__g_s_s_s, PRIM_INT__i_s_s_s);
398
399
400 ostei_general_vrr_K(6, 0, 1, 0, 2,
401 one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
402 PRIM_INT__i_s_s_s, NULL, NULL, PRIM_INT__h_s_s_s, NULL, PRIM_INT__i_s_p_s);
403
404
405 ostei_general_vrr_K(6, 0, 2, 0, 1,
406 one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
407 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);
408
409
410 ostei_general_vrr1_I(7, 3,
411 one_over_2p, a_over_p, aop_PQ, P_PA,
412 PRIM_INT__i_s_s_s, PRIM_INT__h_s_s_s, PRIM_INT__k_s_s_s);
413
414
415 ostei_general_vrr_K(7, 0, 1, 0, 2,
416 one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
417 PRIM_INT__k_s_s_s, NULL, NULL, PRIM_INT__i_s_s_s, NULL, PRIM_INT__k_s_p_s);
418
419
420 ostei_general_vrr_K(7, 0, 2, 0, 1,
421 one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
422 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);
423
424
425
426
427 ////////////////////////////////////
428 // Accumulate contracted integrals
429 ////////////////////////////////////
430 if(lastoffset == 0)
431 {
432 contract_all(90, PRIM_INT__g_s_d_s, PRIM_PTR_INT__g_s_d_s);
433 contract_all(126, PRIM_INT__h_s_d_s, PRIM_PTR_INT__h_s_d_s);
434 contract_all(168, PRIM_INT__i_s_d_s, PRIM_PTR_INT__i_s_d_s);
435 contract_all(216, PRIM_INT__k_s_d_s, PRIM_PTR_INT__k_s_d_s);
436 }
437 else
438 {
439 contract(90, shelloffsets, PRIM_INT__g_s_d_s, PRIM_PTR_INT__g_s_d_s);
440 contract(126, shelloffsets, PRIM_INT__h_s_d_s, PRIM_PTR_INT__h_s_d_s);
441 contract(168, shelloffsets, PRIM_INT__i_s_d_s, PRIM_PTR_INT__i_s_d_s);
442 contract(216, shelloffsets, PRIM_INT__k_s_d_s, PRIM_PTR_INT__k_s_d_s);
443 PRIM_PTR_INT__g_s_d_s += lastoffset*90;
444 PRIM_PTR_INT__h_s_d_s += lastoffset*126;
445 PRIM_PTR_INT__i_s_d_s += lastoffset*168;
446 PRIM_PTR_INT__k_s_d_s += lastoffset*216;
447 }
448
449 } // close loop over j
450 } // close loop over i
451
452 //Advance to the next batch
453 jstart = SIMINT_SIMD_ROUND(jend);
454
455 //////////////////////////////////////////////
456 // Contracted integrals: Horizontal recurrance
457 //////////////////////////////////////////////
458
459
460 const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
461
462
463 for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
464 {
465
466 // set up HRR pointers
467 double const * restrict HRR_INT__g_s_d_s = INT__g_s_d_s + abcd * 90;
468 double const * restrict HRR_INT__h_s_d_s = INT__h_s_d_s + abcd * 126;
469 double const * restrict HRR_INT__i_s_d_s = INT__i_s_d_s + abcd * 168;
470 double const * restrict HRR_INT__k_s_d_s = INT__k_s_d_s + abcd * 216;
471 double * restrict HRR_INT__g_f_d_s = INT__g_f_d_s + real_abcd * 900;
472
473 // form INT__g_p_d_s
474 HRR_J_g_p(
475 HRR_INT__g_p_d_s,
476 HRR_INT__g_s_d_s,
477 HRR_INT__h_s_d_s,
478 hAB, 6);
479
480 // form INT__h_p_d_s
481 ostei_general_hrr_J(5, 1, 2, 0, hAB, HRR_INT__i_s_d_s, HRR_INT__h_s_d_s, HRR_INT__h_p_d_s);
482
483 // form INT__i_p_d_s
484 ostei_general_hrr_J(6, 1, 2, 0, hAB, HRR_INT__k_s_d_s, HRR_INT__i_s_d_s, HRR_INT__i_p_d_s);
485
486 // form INT__g_d_d_s
487 ostei_general_hrr_J(4, 2, 2, 0, hAB, HRR_INT__h_p_d_s, HRR_INT__g_p_d_s, HRR_INT__g_d_d_s);
488
489 // form INT__h_d_d_s
490 ostei_general_hrr_J(5, 2, 2, 0, hAB, HRR_INT__i_p_d_s, HRR_INT__h_p_d_s, HRR_INT__h_d_d_s);
491
492 // form INT__g_f_d_s
493 ostei_general_hrr_J(4, 3, 2, 0, hAB, HRR_INT__h_d_d_s, HRR_INT__g_d_d_s, HRR_INT__g_f_d_s);
494
495
496 } // close HRR loop
497
498
499 } // close loop cdbatch
500
501 istart = iend;
502 } // close loop over ab
503
504 return P.nshell12_clip * Q.nshell12_clip;
505 }
506
ostei_f_g_d_s(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_g_d_s)507 int ostei_f_g_d_s(struct simint_multi_shellpair const P,
508 struct simint_multi_shellpair const Q,
509 double screen_tol,
510 double * const restrict work,
511 double * const restrict INT__f_g_d_s)
512 {
513 double P_AB[3*P.nshell12];
514 struct simint_multi_shellpair P_tmp = P;
515 P_tmp.PA_x = P.PB_x; P_tmp.PA_y = P.PB_y; P_tmp.PA_z = P.PB_z;
516 P_tmp.PB_x = P.PA_x; P_tmp.PB_y = P.PA_y; P_tmp.PB_z = P.PA_z;
517 P_tmp.AB_x = P_AB;
518 P_tmp.AB_y = P_AB + P.nshell12;
519 P_tmp.AB_z = P_AB + 2*P.nshell12;
520
521 for(int i = 0; i < P.nshell12; i++)
522 {
523 P_tmp.AB_x[i] = -P.AB_x[i];
524 P_tmp.AB_y[i] = -P.AB_y[i];
525 P_tmp.AB_z[i] = -P.AB_z[i];
526 }
527
528 int ret = ostei_g_f_d_s(P_tmp, Q, screen_tol, work, INT__f_g_d_s);
529 double buffer[900] SIMINT_ALIGN_ARRAY_DBL;
530
531 for(int q = 0; q < ret; q++)
532 {
533 int idx = 0;
534 for(int a = 0; a < 10; ++a)
535 for(int b = 0; b < 15; ++b)
536 for(int c = 0; c < 6; ++c)
537 for(int d = 0; d < 1; ++d)
538 buffer[idx++] = INT__f_g_d_s[q*900+b*60+a*6+c*1+d];
539
540 memcpy(INT__f_g_d_s+q*900, buffer, 900*sizeof(double));
541 }
542
543 return ret;
544 }
545
ostei_g_f_s_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_f_s_d)546 int ostei_g_f_s_d(struct simint_multi_shellpair const P,
547 struct simint_multi_shellpair const Q,
548 double screen_tol,
549 double * const restrict work,
550 double * const restrict INT__g_f_s_d)
551 {
552 double Q_AB[3*Q.nshell12];
553 struct simint_multi_shellpair Q_tmp = Q;
554 Q_tmp.PA_x = Q.PB_x; Q_tmp.PA_y = Q.PB_y; Q_tmp.PA_z = Q.PB_z;
555 Q_tmp.PB_x = Q.PA_x; Q_tmp.PB_y = Q.PA_y; Q_tmp.PB_z = Q.PA_z;
556 Q_tmp.AB_x = Q_AB;
557 Q_tmp.AB_y = Q_AB + Q.nshell12;
558 Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
559
560 for(int i = 0; i < Q.nshell12; i++)
561 {
562 Q_tmp.AB_x[i] = -Q.AB_x[i];
563 Q_tmp.AB_y[i] = -Q.AB_y[i];
564 Q_tmp.AB_z[i] = -Q.AB_z[i];
565 }
566
567 int ret = ostei_g_f_d_s(P, Q_tmp, screen_tol, work, INT__g_f_s_d);
568 double buffer[900] SIMINT_ALIGN_ARRAY_DBL;
569
570 for(int q = 0; q < ret; q++)
571 {
572 int idx = 0;
573 for(int a = 0; a < 15; ++a)
574 for(int b = 0; b < 10; ++b)
575 for(int c = 0; c < 1; ++c)
576 for(int d = 0; d < 6; ++d)
577 buffer[idx++] = INT__g_f_s_d[q*900+a*60+b*6+d*1+c];
578
579 memcpy(INT__g_f_s_d+q*900, buffer, 900*sizeof(double));
580 }
581
582 return ret;
583 }
584
ostei_f_g_s_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__f_g_s_d)585 int ostei_f_g_s_d(struct simint_multi_shellpair const P,
586 struct simint_multi_shellpair const Q,
587 double screen_tol,
588 double * const restrict work,
589 double * const restrict INT__f_g_s_d)
590 {
591 double P_AB[3*P.nshell12];
592 struct simint_multi_shellpair P_tmp = P;
593 P_tmp.PA_x = P.PB_x; P_tmp.PA_y = P.PB_y; P_tmp.PA_z = P.PB_z;
594 P_tmp.PB_x = P.PA_x; P_tmp.PB_y = P.PA_y; P_tmp.PB_z = P.PA_z;
595 P_tmp.AB_x = P_AB;
596 P_tmp.AB_y = P_AB + P.nshell12;
597 P_tmp.AB_z = P_AB + 2*P.nshell12;
598
599 for(int i = 0; i < P.nshell12; i++)
600 {
601 P_tmp.AB_x[i] = -P.AB_x[i];
602 P_tmp.AB_y[i] = -P.AB_y[i];
603 P_tmp.AB_z[i] = -P.AB_z[i];
604 }
605
606 double Q_AB[3*Q.nshell12];
607 struct simint_multi_shellpair Q_tmp = Q;
608 Q_tmp.PA_x = Q.PB_x; Q_tmp.PA_y = Q.PB_y; Q_tmp.PA_z = Q.PB_z;
609 Q_tmp.PB_x = Q.PA_x; Q_tmp.PB_y = Q.PA_y; Q_tmp.PB_z = Q.PA_z;
610 Q_tmp.AB_x = Q_AB;
611 Q_tmp.AB_y = Q_AB + Q.nshell12;
612 Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
613
614 for(int i = 0; i < Q.nshell12; i++)
615 {
616 Q_tmp.AB_x[i] = -Q.AB_x[i];
617 Q_tmp.AB_y[i] = -Q.AB_y[i];
618 Q_tmp.AB_z[i] = -Q.AB_z[i];
619 }
620
621 int ret = ostei_g_f_d_s(P_tmp, Q_tmp, screen_tol, work, INT__f_g_s_d);
622 double buffer[900] SIMINT_ALIGN_ARRAY_DBL;
623
624 for(int q = 0; q < ret; q++)
625 {
626 int idx = 0;
627 for(int a = 0; a < 10; ++a)
628 for(int b = 0; b < 15; ++b)
629 for(int c = 0; c < 1; ++c)
630 for(int d = 0; d < 6; ++d)
631 buffer[idx++] = INT__f_g_s_d[q*900+b*60+a*6+d*1+c];
632
633 memcpy(INT__f_g_s_d+q*900, buffer, 900*sizeof(double));
634 }
635
636 return ret;
637 }
638
639