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