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