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