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_s_d_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__s_d_d_s)8 int ostei_s_d_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__s_d_d_s)
13 {
14
15 SIMINT_ASSUME_ALIGN_DBL(work);
16 SIMINT_ASSUME_ALIGN_DBL(INT__s_d_d_s);
17 memset(INT__s_d_d_s, 0, P.nshell12_clip * Q.nshell12_clip * 36 * sizeof(double));
18
19 int ab, cd, abcd;
20 int istart, jstart;
21 int iprimcd, nprim_icd, icd;
22 const int check_screen = (screen_tol > 0.0);
23 int i, j;
24 int n;
25 int not_screened;
26
27 // partition workspace
28 SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*0);
29 SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
30 SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_s_s = primwork + 5;
31 SIMINT_DBLTYPE * const restrict PRIM_INT__s_p_p_s = primwork + 17;
32 SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_s_s = primwork + 35;
33 SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_p_s = primwork + 53;
34 SIMINT_DBLTYPE * const restrict PRIM_INT__s_d_d_s = primwork + 89;
35 double * const hrrwork = (double *)(primwork + 125);
36
37
38 // Create constants
39 const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
40 const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
41 const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
42
43
44 ////////////////////////////////////////
45 // Loop over shells and primitives
46 ////////////////////////////////////////
47
48 abcd = 0;
49 istart = 0;
50 for(ab = 0; ab < P.nshell12_clip; ++ab)
51 {
52 const int iend = istart + P.nprim12[ab];
53
54 cd = 0;
55 jstart = 0;
56
57 for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
58 {
59 const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
60 int jend = jstart;
61 for(i = 0; i < nshellbatch; i++)
62 jend += Q.nprim12[cd+i];
63
64
65 for(i = istart; i < iend; ++i)
66 {
67 SIMINT_DBLTYPE bra_screen_max; // only used if check_screen
68
69 if(check_screen)
70 {
71 // Skip this whole thing if always insignificant
72 if((P.screen[i] * Q.screen_max) < screen_tol)
73 continue;
74 bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
75 }
76
77 icd = 0;
78 iprimcd = 0;
79 nprim_icd = Q.nprim12[cd];
80 double * restrict PRIM_PTR_INT__s_d_d_s = INT__s_d_d_s + abcd * 36;
81
82
83
84 // Load these one per loop over i
85 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
86 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
87 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
88
89 const SIMINT_DBLTYPE P_PB[3] = { SIMINT_DBLSET1(P.PB_x[i]), SIMINT_DBLSET1(P.PB_y[i]), SIMINT_DBLSET1(P.PB_z[i]) };
90
91 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
92 {
93 // calculate the shell offsets
94 // these are the offset from the shell pointed to by cd
95 // for each element
96 int shelloffsets[SIMINT_SIMD_LEN] = {0};
97 int lastoffset = 0;
98 const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
99
100 if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
101 {
102 // Handle if the first element of the vector is a new shell
103 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
104 {
105 nprim_icd += Q.nprim12[cd + (++icd)];
106 PRIM_PTR_INT__s_d_d_s += 36;
107 }
108 iprimcd++;
109 for(n = 1; n < SIMINT_SIMD_LEN; ++n)
110 {
111 if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
112 {
113 shelloffsets[n] = shelloffsets[n-1] + 1;
114 lastoffset++;
115 nprim_icd += Q.nprim12[cd + (++icd)];
116 }
117 else
118 shelloffsets[n] = shelloffsets[n-1];
119 iprimcd++;
120 }
121 }
122 else
123 iprimcd += SIMINT_SIMD_LEN;
124
125 // Do we have to compute this vector (or has it been screened out)?
126 // (not_screened != 0 means we have to do this vector)
127 if(check_screen)
128 {
129 const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
130 if(vmax < screen_tol)
131 {
132 PRIM_PTR_INT__s_d_d_s += lastoffset*36;
133 continue;
134 }
135 }
136
137 const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
138 const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
139 const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
140 const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
141
142
143 /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
144 SIMINT_DBLTYPE PQ[3];
145 PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
146 PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
147 PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
148 SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
149 R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
150 R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
151
152 const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
153 const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
154 const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
155 const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
156 const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
157 const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
158 const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
159
160 // NOTE: Minus sign!
161 const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
162 SIMINT_DBLTYPE aop_PQ[3];
163 aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
164 aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
165 aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
166
167 SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
168 SIMINT_DBLTYPE aoq_PQ[3];
169 aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
170 aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
171 aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
172 // Put a minus sign here so we don't have to in RR routines
173 a_over_q = SIMINT_NEG(a_over_q);
174
175
176 //////////////////////////////////////////////
177 // Fjt function section
178 // Maximum v value: 4
179 //////////////////////////////////////////////
180 // The parameter to the Fjt function
181 const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
182
183
184 const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
185
186
187 boys_F_split(PRIM_INT__s_s_s_s, F_x, 4);
188 SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
189 prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
190 for(n = 0; n <= 4; n++)
191 PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
192
193 //////////////////////////////////////////////
194 // Primitive integrals: Vertical recurrance
195 //////////////////////////////////////////////
196
197 const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
198 const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
199 const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
200 const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
201
202
203
204 // Forming PRIM_INT__s_p_s_s[4 * 3];
205 for(n = 0; n < 4; ++n) // loop over orders of auxiliary function
206 {
207
208 PRIM_INT__s_p_s_s[n * 3 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
209 PRIM_INT__s_p_s_s[n * 3 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 0]);
210
211 PRIM_INT__s_p_s_s[n * 3 + 1] = SIMINT_MUL(P_PB[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
212 PRIM_INT__s_p_s_s[n * 3 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 1]);
213
214 PRIM_INT__s_p_s_s[n * 3 + 2] = SIMINT_MUL(P_PB[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
215 PRIM_INT__s_p_s_s[n * 3 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_s_s[n * 3 + 2]);
216
217 }
218
219
220
221 // Forming PRIM_INT__s_d_s_s[3 * 6];
222 for(n = 0; n < 3; ++n) // loop over orders of auxiliary function
223 {
224
225 PRIM_INT__s_d_s_s[n * 6 + 0] = SIMINT_MUL(P_PB[0], PRIM_INT__s_p_s_s[n * 3 + 0]);
226 PRIM_INT__s_d_s_s[n * 6 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_s_s[n * 6 + 0]);
227 PRIM_INT__s_d_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__s_d_s_s[n * 6 + 0]);
228
229 PRIM_INT__s_d_s_s[n * 6 + 1] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_s_s[n * 3 + 0]);
230 PRIM_INT__s_d_s_s[n * 6 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_s_s[n * 6 + 1]);
231
232 PRIM_INT__s_d_s_s[n * 6 + 2] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_s_s[n * 3 + 0]);
233 PRIM_INT__s_d_s_s[n * 6 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_s_s[n * 6 + 2]);
234
235 PRIM_INT__s_d_s_s[n * 6 + 3] = SIMINT_MUL(P_PB[1], PRIM_INT__s_p_s_s[n * 3 + 1]);
236 PRIM_INT__s_d_s_s[n * 6 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_s_s[n * 6 + 3]);
237 PRIM_INT__s_d_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__s_d_s_s[n * 6 + 3]);
238
239 PRIM_INT__s_d_s_s[n * 6 + 4] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_s_s[n * 3 + 1]);
240 PRIM_INT__s_d_s_s[n * 6 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_s_s[n * 6 + 4]);
241
242 PRIM_INT__s_d_s_s[n * 6 + 5] = SIMINT_MUL(P_PB[2], PRIM_INT__s_p_s_s[n * 3 + 2]);
243 PRIM_INT__s_d_s_s[n * 6 + 5] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_d_s_s[n * 6 + 5]);
244 PRIM_INT__s_d_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__s_d_s_s[n * 6 + 5]);
245
246 }
247
248
249
250 // Forming PRIM_INT__s_d_p_s[2 * 18];
251 for(n = 0; n < 2; ++n) // loop over orders of auxiliary function
252 {
253
254 PRIM_INT__s_d_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_d_s_s[n * 6 + 0]);
255 PRIM_INT__s_d_p_s[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 0], PRIM_INT__s_d_p_s[n * 18 + 0]);
256 PRIM_INT__s_d_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_p_s[n * 18 + 0]);
257
258 PRIM_INT__s_d_p_s[n * 18 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_d_s_s[n * 6 + 0]);
259 PRIM_INT__s_d_p_s[n * 18 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 0], PRIM_INT__s_d_p_s[n * 18 + 1]);
260
261 PRIM_INT__s_d_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_d_s_s[n * 6 + 0]);
262 PRIM_INT__s_d_p_s[n * 18 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 0], PRIM_INT__s_d_p_s[n * 18 + 2]);
263
264 PRIM_INT__s_d_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_d_s_s[n * 6 + 1]);
265 PRIM_INT__s_d_p_s[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 1], PRIM_INT__s_d_p_s[n * 18 + 3]);
266 PRIM_INT__s_d_p_s[n * 18 + 3] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_p_s[n * 18 + 3]);
267
268 PRIM_INT__s_d_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_d_s_s[n * 6 + 1]);
269 PRIM_INT__s_d_p_s[n * 18 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 1], PRIM_INT__s_d_p_s[n * 18 + 4]);
270 PRIM_INT__s_d_p_s[n * 18 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_p_s[n * 18 + 4]);
271
272 PRIM_INT__s_d_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_d_s_s[n * 6 + 1]);
273 PRIM_INT__s_d_p_s[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 1], PRIM_INT__s_d_p_s[n * 18 + 5]);
274
275 PRIM_INT__s_d_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_d_s_s[n * 6 + 2]);
276 PRIM_INT__s_d_p_s[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 2], PRIM_INT__s_d_p_s[n * 18 + 6]);
277 PRIM_INT__s_d_p_s[n * 18 + 6] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_d_p_s[n * 18 + 6]);
278
279 PRIM_INT__s_d_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_d_s_s[n * 6 + 2]);
280 PRIM_INT__s_d_p_s[n * 18 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 2], PRIM_INT__s_d_p_s[n * 18 + 7]);
281
282 PRIM_INT__s_d_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_d_s_s[n * 6 + 2]);
283 PRIM_INT__s_d_p_s[n * 18 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 2], PRIM_INT__s_d_p_s[n * 18 + 8]);
284 PRIM_INT__s_d_p_s[n * 18 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_d_p_s[n * 18 + 8]);
285
286 PRIM_INT__s_d_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_d_s_s[n * 6 + 3]);
287 PRIM_INT__s_d_p_s[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 3], PRIM_INT__s_d_p_s[n * 18 + 9]);
288
289 PRIM_INT__s_d_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_d_s_s[n * 6 + 3]);
290 PRIM_INT__s_d_p_s[n * 18 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 3], PRIM_INT__s_d_p_s[n * 18 + 10]);
291 PRIM_INT__s_d_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_p_s[n * 18 + 10]);
292
293 PRIM_INT__s_d_p_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_d_s_s[n * 6 + 3]);
294 PRIM_INT__s_d_p_s[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 3], PRIM_INT__s_d_p_s[n * 18 + 11]);
295
296 PRIM_INT__s_d_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_d_s_s[n * 6 + 4]);
297 PRIM_INT__s_d_p_s[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 4], PRIM_INT__s_d_p_s[n * 18 + 12]);
298
299 PRIM_INT__s_d_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_d_s_s[n * 6 + 4]);
300 PRIM_INT__s_d_p_s[n * 18 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 4], PRIM_INT__s_d_p_s[n * 18 + 13]);
301 PRIM_INT__s_d_p_s[n * 18 + 13] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_d_p_s[n * 18 + 13]);
302
303 PRIM_INT__s_d_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_d_s_s[n * 6 + 4]);
304 PRIM_INT__s_d_p_s[n * 18 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 4], PRIM_INT__s_d_p_s[n * 18 + 14]);
305 PRIM_INT__s_d_p_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_d_p_s[n * 18 + 14]);
306
307 PRIM_INT__s_d_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_d_s_s[n * 6 + 5]);
308 PRIM_INT__s_d_p_s[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_d_s_s[(n+1) * 6 + 5], PRIM_INT__s_d_p_s[n * 18 + 15]);
309
310 PRIM_INT__s_d_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_d_s_s[n * 6 + 5]);
311 PRIM_INT__s_d_p_s[n * 18 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_d_s_s[(n+1) * 6 + 5], PRIM_INT__s_d_p_s[n * 18 + 16]);
312
313 PRIM_INT__s_d_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_d_s_s[n * 6 + 5]);
314 PRIM_INT__s_d_p_s[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_d_s_s[(n+1) * 6 + 5], PRIM_INT__s_d_p_s[n * 18 + 17]);
315 PRIM_INT__s_d_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_d_p_s[n * 18 + 17]);
316
317 }
318
319
320
321 // Forming PRIM_INT__s_p_p_s[2 * 9];
322 for(n = 0; n < 2; ++n) // loop over orders of auxiliary function
323 {
324
325 PRIM_INT__s_p_p_s[n * 9 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_p_s_s[n * 3 + 0]);
326 PRIM_INT__s_p_p_s[n * 9 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_p_p_s[n * 9 + 0]);
327 PRIM_INT__s_p_p_s[n * 9 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_p_s[n * 9 + 0]);
328
329 PRIM_INT__s_p_p_s[n * 9 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_p_s_s[n * 3 + 0]);
330 PRIM_INT__s_p_p_s[n * 9 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_p_p_s[n * 9 + 1]);
331
332 PRIM_INT__s_p_p_s[n * 9 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_p_s_s[n * 3 + 0]);
333 PRIM_INT__s_p_p_s[n * 9 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 0], PRIM_INT__s_p_p_s[n * 9 + 2]);
334
335 PRIM_INT__s_p_p_s[n * 9 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_p_s_s[n * 3 + 1]);
336 PRIM_INT__s_p_p_s[n * 9 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_p_p_s[n * 9 + 3]);
337
338 PRIM_INT__s_p_p_s[n * 9 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_p_s_s[n * 3 + 1]);
339 PRIM_INT__s_p_p_s[n * 9 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_p_p_s[n * 9 + 4]);
340 PRIM_INT__s_p_p_s[n * 9 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_p_s[n * 9 + 4]);
341
342 PRIM_INT__s_p_p_s[n * 9 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_p_s_s[n * 3 + 1]);
343 PRIM_INT__s_p_p_s[n * 9 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 1], PRIM_INT__s_p_p_s[n * 9 + 5]);
344
345 PRIM_INT__s_p_p_s[n * 9 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_p_s_s[n * 3 + 2]);
346 PRIM_INT__s_p_p_s[n * 9 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_p_p_s[n * 9 + 6]);
347
348 PRIM_INT__s_p_p_s[n * 9 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_p_s_s[n * 3 + 2]);
349 PRIM_INT__s_p_p_s[n * 9 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_p_p_s[n * 9 + 7]);
350
351 PRIM_INT__s_p_p_s[n * 9 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_p_s_s[n * 3 + 2]);
352 PRIM_INT__s_p_p_s[n * 9 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_p_s_s[(n+1) * 3 + 2], PRIM_INT__s_p_p_s[n * 9 + 8]);
353 PRIM_INT__s_p_p_s[n * 9 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_p_p_s[n * 9 + 8]);
354
355 }
356
357
358 VRR_K_s_d_d_s(
359 PRIM_INT__s_d_d_s,
360 PRIM_INT__s_d_p_s,
361 PRIM_INT__s_d_s_s,
362 PRIM_INT__s_p_p_s,
363 Q_PA,
364 a_over_q,
365 aoq_PQ,
366 one_over_2pq,
367 one_over_2q,
368 1);
369
370
371
372
373 ////////////////////////////////////
374 // Accumulate contracted integrals
375 ////////////////////////////////////
376 if(lastoffset == 0)
377 {
378 contract_all(36, PRIM_INT__s_d_d_s, PRIM_PTR_INT__s_d_d_s);
379 }
380 else
381 {
382 contract(36, shelloffsets, PRIM_INT__s_d_d_s, PRIM_PTR_INT__s_d_d_s);
383 PRIM_PTR_INT__s_d_d_s += lastoffset*36;
384 }
385
386 } // close loop over j
387 } // close loop over i
388
389 //Advance to the next batch
390 jstart = SIMINT_SIMD_ROUND(jend);
391 abcd += nshellbatch;
392
393 } // close loop cdbatch
394
395 istart = iend;
396 } // close loop over ab
397
398 return P.nshell12_clip * Q.nshell12_clip;
399 }
400
401