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_i_s_h_d(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__i_s_h_d)8 int ostei_i_s_h_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__i_s_h_d)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__i_s_h_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__i_s_h_s = work + (SIMINT_NSHELL_SIMD * 0);
29     double * const INT__i_s_i_s = work + (SIMINT_NSHELL_SIMD * 588);
30     double * const INT__i_s_k_s = work + (SIMINT_NSHELL_SIMD * 1372);
31     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*2380);
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 + 14;
34     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 53;
35     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 125;
36     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 235;
37     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 385;
38     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 574;
39     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 798;
40     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 1050;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 1068;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 1122;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 1230;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1410;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 1680;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 2058;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 2562;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 3210;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 3300;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 3480;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 3780;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 4230;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 4860;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 5700;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 6780;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 7020;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 7420;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 8020;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 8860;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 9980;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 11420;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 11870;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 12545;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 13490;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 14750;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 16370;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 17000;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 17882;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 19058;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_h_s = primwork + 20570;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_i_s = primwork + 21158;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_k_s = primwork + 21942;
73     double * const hrrwork = (double *)(primwork + 22950);
74     double * const HRR_INT__i_s_h_p = hrrwork + 0;
75     double * const HRR_INT__i_s_i_p = hrrwork + 1764;
76 
77 
78     // Create constants
79     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
80     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
81     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
82     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
83     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
84     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
85     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
86     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
87 
88 
89     ////////////////////////////////////////
90     // Loop over shells and primitives
91     ////////////////////////////////////////
92 
93     real_abcd = 0;
94     istart = 0;
95     for(ab = 0; ab < P.nshell12_clip; ++ab)
96     {
97         const int iend = istart + P.nprim12[ab];
98 
99         cd = 0;
100         jstart = 0;
101 
102         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
103         {
104             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
105             int jend = jstart;
106             for(i = 0; i < nshellbatch; i++)
107                 jend += Q.nprim12[cd+i];
108 
109             // Clear the beginning of the workspace (where we are accumulating integrals)
110             memset(work, 0, SIMINT_NSHELL_SIMD * 2380 * sizeof(double));
111             abcd = 0;
112 
113 
114             for(i = istart; i < iend; ++i)
115             {
116                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
117 
118                 if(check_screen)
119                 {
120                     // Skip this whole thing if always insignificant
121                     if((P.screen[i] * Q.screen_max) < screen_tol)
122                         continue;
123                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
124                 }
125 
126                 icd = 0;
127                 iprimcd = 0;
128                 nprim_icd = Q.nprim12[cd];
129                 double * restrict PRIM_PTR_INT__i_s_h_s = INT__i_s_h_s + abcd * 588;
130                 double * restrict PRIM_PTR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
131                 double * restrict PRIM_PTR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
132 
133 
134 
135                 // Load these one per loop over i
136                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
137                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
138                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
139 
140                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
141 
142                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
143                 {
144                     // calculate the shell offsets
145                     // these are the offset from the shell pointed to by cd
146                     // for each element
147                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
148                     int lastoffset = 0;
149                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
150 
151                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
152                     {
153                         // Handle if the first element of the vector is a new shell
154                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
155                         {
156                             nprim_icd += Q.nprim12[cd + (++icd)];
157                             PRIM_PTR_INT__i_s_h_s += 588;
158                             PRIM_PTR_INT__i_s_i_s += 784;
159                             PRIM_PTR_INT__i_s_k_s += 1008;
160                         }
161                         iprimcd++;
162                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
163                         {
164                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
165                             {
166                                 shelloffsets[n] = shelloffsets[n-1] + 1;
167                                 lastoffset++;
168                                 nprim_icd += Q.nprim12[cd + (++icd)];
169                             }
170                             else
171                                 shelloffsets[n] = shelloffsets[n-1];
172                             iprimcd++;
173                         }
174                     }
175                     else
176                         iprimcd += SIMINT_SIMD_LEN;
177 
178                     // Do we have to compute this vector (or has it been screened out)?
179                     // (not_screened != 0 means we have to do this vector)
180                     if(check_screen)
181                     {
182                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
183                         if(vmax < screen_tol)
184                         {
185                             PRIM_PTR_INT__i_s_h_s += lastoffset*588;
186                             PRIM_PTR_INT__i_s_i_s += lastoffset*784;
187                             PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
188                             continue;
189                         }
190                     }
191 
192                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
193                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
194                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
195                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
196 
197 
198                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
199                     SIMINT_DBLTYPE PQ[3];
200                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
201                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
202                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
203                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
204                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
205                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
206 
207                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
208                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
209                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
210                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
211                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
212                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
213                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
214 
215                     // NOTE: Minus sign!
216                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
217                     SIMINT_DBLTYPE aop_PQ[3];
218                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
219                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
220                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
221 
222                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
223                     SIMINT_DBLTYPE aoq_PQ[3];
224                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
225                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
226                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
227                     // Put a minus sign here so we don't have to in RR routines
228                     a_over_q = SIMINT_NEG(a_over_q);
229 
230 
231                     //////////////////////////////////////////////
232                     // Fjt function section
233                     // Maximum v value: 13
234                     //////////////////////////////////////////////
235                     // The parameter to the Fjt function
236                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
237 
238 
239                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
240 
241 
242                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 13);
243                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
244                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
245                     for(n = 0; n <= 13; n++)
246                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
247 
248                     //////////////////////////////////////////////
249                     // Primitive integrals: Vertical recurrance
250                     //////////////////////////////////////////////
251 
252                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
253                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
254                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
255                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
256                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
257                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
258                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
259                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
260                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
261                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
262                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
263                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
264                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
265                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
266                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
267                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
268                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
269                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
270 
271 
272 
273                     // Forming PRIM_INT__s_s_p_s[13 * 3];
274                     for(n = 0; n < 13; ++n)  // loop over orders of auxiliary function
275                     {
276 
277                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
278                         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]);
279 
280                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
281                         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]);
282 
283                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
284                         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]);
285 
286                     }
287 
288 
289 
290                     // Forming PRIM_INT__s_s_d_s[12 * 6];
291                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
292                     {
293 
294                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
295                         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]);
296                         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]);
297 
298                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
299                         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]);
300 
301                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
302                         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]);
303 
304                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
305                         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]);
306                         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]);
307 
308                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
309                         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]);
310 
311                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
312                         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]);
313                         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]);
314 
315                     }
316 
317 
318 
319                     // Forming PRIM_INT__s_s_f_s[11 * 10];
320                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
321                     {
322 
323                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
324                         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]);
325                         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]);
326 
327                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
328                         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]);
329 
330                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
331                         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]);
332 
333                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
334                         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]);
335 
336                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
337                         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]);
338 
339                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
340                         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]);
341 
342                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
343                         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]);
344                         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]);
345 
346                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
347                         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]);
348 
349                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
350                         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]);
351 
352                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
353                         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]);
354                         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]);
355 
356                     }
357 
358 
359                     VRR_K_s_s_g_s(
360                             PRIM_INT__s_s_g_s,
361                             PRIM_INT__s_s_f_s,
362                             PRIM_INT__s_s_d_s,
363                             Q_PA,
364                             a_over_q,
365                             aoq_PQ,
366                             one_over_2q,
367                             10);
368 
369 
370                     VRR_K_s_s_h_s(
371                             PRIM_INT__s_s_h_s,
372                             PRIM_INT__s_s_g_s,
373                             PRIM_INT__s_s_f_s,
374                             Q_PA,
375                             a_over_q,
376                             aoq_PQ,
377                             one_over_2q,
378                             9);
379 
380 
381                     ostei_general_vrr_I(1, 0, 5, 0, 6,
382                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
383                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
384 
385 
386                     VRR_I_p_s_g_s(
387                             PRIM_INT__p_s_g_s,
388                             PRIM_INT__s_s_g_s,
389                             PRIM_INT__s_s_f_s,
390                             P_PA,
391                             aop_PQ,
392                             one_over_2pq,
393                             6);
394 
395 
396                     ostei_general_vrr_I(2, 0, 5, 0, 5,
397                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
398                             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);
399 
400 
401                     VRR_I_p_s_f_s(
402                             PRIM_INT__p_s_f_s,
403                             PRIM_INT__s_s_f_s,
404                             PRIM_INT__s_s_d_s,
405                             P_PA,
406                             aop_PQ,
407                             one_over_2pq,
408                             6);
409 
410 
411                     ostei_general_vrr_I(2, 0, 4, 0, 5,
412                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
413                             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);
414 
415 
416                     ostei_general_vrr_I(3, 0, 5, 0, 4,
417                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
418                             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);
419 
420 
421 
422                     // Forming PRIM_INT__p_s_d_s[6 * 18];
423                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
424                     {
425 
426                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
427                         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]);
428                         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]);
429 
430                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
431                         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]);
432                         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]);
433 
434                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
435                         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]);
436                         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]);
437 
438                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
439                         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]);
440 
441                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
442                         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]);
443 
444                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
445                         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]);
446 
447                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
448                         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]);
449 
450                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
451                         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]);
452                         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]);
453 
454                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
455                         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]);
456 
457                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
458                         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]);
459                         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]);
460 
461                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
462                         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]);
463                         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]);
464 
465                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
466                         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]);
467 
468                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
469                         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]);
470 
471                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
472                         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]);
473 
474                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
475                         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]);
476                         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]);
477 
478                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
479                         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]);
480 
481                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
482                         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]);
483                         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]);
484 
485                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
486                         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]);
487                         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]);
488 
489                     }
490 
491 
492                     VRR_I_d_s_f_s(
493                             PRIM_INT__d_s_f_s,
494                             PRIM_INT__p_s_f_s,
495                             PRIM_INT__s_s_f_s,
496                             PRIM_INT__p_s_d_s,
497                             P_PA,
498                             a_over_p,
499                             aop_PQ,
500                             one_over_2p,
501                             one_over_2pq,
502                             5);
503 
504 
505                     ostei_general_vrr_I(3, 0, 4, 0, 4,
506                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
507                             PRIM_INT__d_s_g_s, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_g_s);
508 
509 
510                     ostei_general_vrr_I(4, 0, 5, 0, 3,
511                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
512                             PRIM_INT__f_s_h_s, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);
513 
514 
515 
516                     // Forming PRIM_INT__p_s_p_s[6 * 9];
517                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
518                     {
519 
520                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
521                         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]);
522                         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]);
523 
524                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
525                         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]);
526 
527                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
528                         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]);
529 
530                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
531                         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]);
532 
533                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
534                         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]);
535                         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]);
536 
537                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
538                         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]);
539 
540                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
541                         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]);
542 
543                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
544                         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]);
545 
546                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
547                         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]);
548                         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]);
549 
550                     }
551 
552 
553                     VRR_I_d_s_d_s(
554                             PRIM_INT__d_s_d_s,
555                             PRIM_INT__p_s_d_s,
556                             PRIM_INT__s_s_d_s,
557                             PRIM_INT__p_s_p_s,
558                             P_PA,
559                             a_over_p,
560                             aop_PQ,
561                             one_over_2p,
562                             one_over_2pq,
563                             5);
564 
565 
566                     ostei_general_vrr_I(3, 0, 3, 0, 4,
567                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
568                             PRIM_INT__d_s_f_s, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_d_s, NULL, PRIM_INT__f_s_f_s);
569 
570 
571                     ostei_general_vrr_I(4, 0, 4, 0, 3,
572                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
573                             PRIM_INT__f_s_g_s, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);
574 
575 
576                     ostei_general_vrr_I(5, 0, 5, 0, 2,
577                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
578                             PRIM_INT__g_s_h_s, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_h_s);
579 
580 
581 
582                     // Forming PRIM_INT__p_s_s_s[6 * 3];
583                     for(n = 0; n < 6; ++n)  // loop over orders of auxiliary function
584                     {
585 
586                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
587                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]);
588 
589                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
590                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 1]);
591 
592                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
593                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 2]);
594 
595                     }
596 
597 
598 
599                     // Forming PRIM_INT__d_s_p_s[5 * 18];
600                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
601                     {
602 
603                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 0]);
604                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
605                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 0]);
606                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
607 
608                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 1]);
609                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__d_s_p_s[n * 18 + 1]);
610                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 1]);
611 
612                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 2]);
613                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__d_s_p_s[n * 18 + 2]);
614                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 2]);
615 
616                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 3]);
617                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);
618                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 9]);
619 
620                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 4]);
621                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__d_s_p_s[n * 18 + 10]);
622                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 10]);
623                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 10]);
624 
625                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 5]);
626                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__d_s_p_s[n * 18 + 11]);
627                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 11]);
628 
629                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 6]);
630                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__d_s_p_s[n * 18 + 15]);
631                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 15]);
632 
633                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 7]);
634                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__d_s_p_s[n * 18 + 16]);
635                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 16]);
636 
637                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 8]);
638                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__d_s_p_s[n * 18 + 17]);
639                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 17]);
640                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 17]);
641 
642                     }
643 
644 
645                     VRR_I_f_s_d_s(
646                             PRIM_INT__f_s_d_s,
647                             PRIM_INT__d_s_d_s,
648                             PRIM_INT__p_s_d_s,
649                             PRIM_INT__d_s_p_s,
650                             P_PA,
651                             a_over_p,
652                             aop_PQ,
653                             one_over_2p,
654                             one_over_2pq,
655                             4);
656 
657 
658                     ostei_general_vrr_I(4, 0, 3, 0, 3,
659                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
660                             PRIM_INT__f_s_f_s, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_d_s, NULL, PRIM_INT__g_s_f_s);
661 
662 
663                     ostei_general_vrr_I(5, 0, 4, 0, 2,
664                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
665                             PRIM_INT__g_s_g_s, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_g_s);
666 
667 
668                     ostei_general_vrr_I(6, 0, 5, 0, 1,
669                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
670                             PRIM_INT__h_s_h_s, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_g_s, NULL, PRIM_INT__i_s_h_s);
671 
672 
673                     ostei_general_vrr1_K(6, 8,
674                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
675                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
676 
677 
678                     ostei_general_vrr_I(1, 0, 6, 0, 6,
679                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
680                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
681 
682 
683                     ostei_general_vrr_I(2, 0, 6, 0, 5,
684                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
685                             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);
686 
687 
688                     ostei_general_vrr_I(3, 0, 6, 0, 4,
689                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
690                             PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);
691 
692 
693                     ostei_general_vrr_I(4, 0, 6, 0, 3,
694                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
695                             PRIM_INT__f_s_i_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);
696 
697 
698                     ostei_general_vrr_I(5, 0, 6, 0, 2,
699                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
700                             PRIM_INT__g_s_i_s, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);
701 
702 
703                     ostei_general_vrr_I(6, 0, 6, 0, 1,
704                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
705                             PRIM_INT__h_s_i_s, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_i_s);
706 
707 
708                     ostei_general_vrr1_K(7, 7,
709                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
710                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
711 
712 
713                     ostei_general_vrr_I(1, 0, 7, 0, 6,
714                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
715                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
716 
717 
718                     ostei_general_vrr_I(2, 0, 7, 0, 5,
719                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
720                             PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);
721 
722 
723                     ostei_general_vrr_I(3, 0, 7, 0, 4,
724                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
725                             PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);
726 
727 
728                     ostei_general_vrr_I(4, 0, 7, 0, 3,
729                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
730                             PRIM_INT__f_s_k_s, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);
731 
732 
733                     ostei_general_vrr_I(5, 0, 7, 0, 2,
734                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
735                             PRIM_INT__g_s_k_s, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);
736 
737 
738                     ostei_general_vrr_I(6, 0, 7, 0, 1,
739                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
740                             PRIM_INT__h_s_k_s, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_k_s);
741 
742 
743 
744 
745                     ////////////////////////////////////
746                     // Accumulate contracted integrals
747                     ////////////////////////////////////
748                     if(lastoffset == 0)
749                     {
750                         contract_all(588, PRIM_INT__i_s_h_s, PRIM_PTR_INT__i_s_h_s);
751                         contract_all(784, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
752                         contract_all(1008, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
753                     }
754                     else
755                     {
756                         contract(588, shelloffsets, PRIM_INT__i_s_h_s, PRIM_PTR_INT__i_s_h_s);
757                         contract(784, shelloffsets, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
758                         contract(1008, shelloffsets, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
759                         PRIM_PTR_INT__i_s_h_s += lastoffset*588;
760                         PRIM_PTR_INT__i_s_i_s += lastoffset*784;
761                         PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
762                     }
763 
764                 }  // close loop over j
765             }  // close loop over i
766 
767             //Advance to the next batch
768             jstart = SIMINT_SIMD_ROUND(jend);
769 
770             //////////////////////////////////////////////
771             // Contracted integrals: Horizontal recurrance
772             //////////////////////////////////////////////
773 
774 
775 
776 
777             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
778             {
779                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
780 
781                 // set up HRR pointers
782                 double const * restrict HRR_INT__i_s_h_s = INT__i_s_h_s + abcd * 588;
783                 double const * restrict HRR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
784                 double const * restrict HRR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
785                 double * restrict HRR_INT__i_s_h_d = INT__i_s_h_d + real_abcd * 3528;
786 
787                 // form INT__i_s_h_p
788                 ostei_general_hrr_L(6, 0, 5, 1, hCD, HRR_INT__i_s_i_s, HRR_INT__i_s_h_s, HRR_INT__i_s_h_p);
789 
790                 // form INT__i_s_i_p
791                 ostei_general_hrr_L(6, 0, 6, 1, hCD, HRR_INT__i_s_k_s, HRR_INT__i_s_i_s, HRR_INT__i_s_i_p);
792 
793                 // form INT__i_s_h_d
794                 ostei_general_hrr_L(6, 0, 5, 2, hCD, HRR_INT__i_s_i_p, HRR_INT__i_s_h_p, HRR_INT__i_s_h_d);
795 
796 
797             }  // close HRR loop
798 
799 
800         }   // close loop cdbatch
801 
802         istart = iend;
803     }  // close loop over ab
804 
805     return P.nshell12_clip * Q.nshell12_clip;
806 }
807 
ostei_s_i_h_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_i_h_d)808 int ostei_s_i_h_d(struct simint_multi_shellpair const P,
809                   struct simint_multi_shellpair const Q,
810                   double screen_tol,
811                   double * const restrict work,
812                   double * const restrict INT__s_i_h_d)
813 {
814     double P_AB[3*P.nshell12];
815     struct simint_multi_shellpair P_tmp = P;
816     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
817     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
818     P_tmp.AB_x = P_AB;
819     P_tmp.AB_y = P_AB + P.nshell12;
820     P_tmp.AB_z = P_AB + 2*P.nshell12;
821 
822     for(int i = 0; i < P.nshell12; i++)
823     {
824         P_tmp.AB_x[i] = -P.AB_x[i];
825         P_tmp.AB_y[i] = -P.AB_y[i];
826         P_tmp.AB_z[i] = -P.AB_z[i];
827     }
828 
829     int ret = ostei_i_s_h_d(P_tmp, Q, screen_tol, work, INT__s_i_h_d);
830     double buffer[3528] SIMINT_ALIGN_ARRAY_DBL;
831 
832     for(int q = 0; q < ret; q++)
833     {
834         int idx = 0;
835         for(int a = 0; a < 1; ++a)
836         for(int b = 0; b < 28; ++b)
837         for(int c = 0; c < 21; ++c)
838         for(int d = 0; d < 6; ++d)
839             buffer[idx++] = INT__s_i_h_d[q*3528+b*126+a*126+c*6+d];
840 
841         memcpy(INT__s_i_h_d+q*3528, buffer, 3528*sizeof(double));
842     }
843 
844     return ret;
845 }
846 
ostei_i_s_d_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__i_s_d_h)847 int ostei_i_s_d_h(struct simint_multi_shellpair const P,
848                   struct simint_multi_shellpair const Q,
849                   double screen_tol,
850                   double * const restrict work,
851                   double * const restrict INT__i_s_d_h)
852 {
853     double Q_AB[3*Q.nshell12];
854     struct simint_multi_shellpair Q_tmp = Q;
855     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
856     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
857     Q_tmp.AB_x = Q_AB;
858     Q_tmp.AB_y = Q_AB + Q.nshell12;
859     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
860 
861     for(int i = 0; i < Q.nshell12; i++)
862     {
863         Q_tmp.AB_x[i] = -Q.AB_x[i];
864         Q_tmp.AB_y[i] = -Q.AB_y[i];
865         Q_tmp.AB_z[i] = -Q.AB_z[i];
866     }
867 
868     int ret = ostei_i_s_h_d(P, Q_tmp, screen_tol, work, INT__i_s_d_h);
869     double buffer[3528] SIMINT_ALIGN_ARRAY_DBL;
870 
871     for(int q = 0; q < ret; q++)
872     {
873         int idx = 0;
874         for(int a = 0; a < 28; ++a)
875         for(int b = 0; b < 1; ++b)
876         for(int c = 0; c < 6; ++c)
877         for(int d = 0; d < 21; ++d)
878             buffer[idx++] = INT__i_s_d_h[q*3528+a*126+b*126+d*6+c];
879 
880         memcpy(INT__i_s_d_h+q*3528, buffer, 3528*sizeof(double));
881     }
882 
883     return ret;
884 }
885 
ostei_s_i_d_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__s_i_d_h)886 int ostei_s_i_d_h(struct simint_multi_shellpair const P,
887                   struct simint_multi_shellpair const Q,
888                   double screen_tol,
889                   double * const restrict work,
890                   double * const restrict INT__s_i_d_h)
891 {
892     double P_AB[3*P.nshell12];
893     struct simint_multi_shellpair P_tmp = P;
894     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
895     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
896     P_tmp.AB_x = P_AB;
897     P_tmp.AB_y = P_AB + P.nshell12;
898     P_tmp.AB_z = P_AB + 2*P.nshell12;
899 
900     for(int i = 0; i < P.nshell12; i++)
901     {
902         P_tmp.AB_x[i] = -P.AB_x[i];
903         P_tmp.AB_y[i] = -P.AB_y[i];
904         P_tmp.AB_z[i] = -P.AB_z[i];
905     }
906 
907     double Q_AB[3*Q.nshell12];
908     struct simint_multi_shellpair Q_tmp = Q;
909     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
910     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
911     Q_tmp.AB_x = Q_AB;
912     Q_tmp.AB_y = Q_AB + Q.nshell12;
913     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
914 
915     for(int i = 0; i < Q.nshell12; i++)
916     {
917         Q_tmp.AB_x[i] = -Q.AB_x[i];
918         Q_tmp.AB_y[i] = -Q.AB_y[i];
919         Q_tmp.AB_z[i] = -Q.AB_z[i];
920     }
921 
922     int ret = ostei_i_s_h_d(P_tmp, Q_tmp, screen_tol, work, INT__s_i_d_h);
923     double buffer[3528] SIMINT_ALIGN_ARRAY_DBL;
924 
925     for(int q = 0; q < ret; q++)
926     {
927         int idx = 0;
928         for(int a = 0; a < 1; ++a)
929         for(int b = 0; b < 28; ++b)
930         for(int c = 0; c < 6; ++c)
931         for(int d = 0; d < 21; ++d)
932             buffer[idx++] = INT__s_i_d_h[q*3528+b*126+a*126+d*6+c];
933 
934         memcpy(INT__s_i_d_h+q*3528, buffer, 3528*sizeof(double));
935     }
936 
937     return ret;
938 }
939 
940