19 #ifndef _libint2_src_lib_libint_itrxsxs_h_ 20 #define _libint2_src_lib_libint_itrxsxs_h_ 24 #include <util_types.h> 25 #include <libint2/cgshell_ordering.h> 29 template <
int part,
int La,
int Lc,
bool InBra,
bool vectorize>
struct ITR_xs_xs {
30 static void compute(
const Libint_t* inteval,
31 LIBINT2_REALTYPE* target,
32 const LIBINT2_REALTYPE* src0,
33 const LIBINT2_REALTYPE* src1,
34 const LIBINT2_REALTYPE* src2,
35 const LIBINT2_REALTYPE* src3);
44 template <
int La,
int Lc,
bool InBra,
bool vectorize>
struct ITR_xs_xs<0,La,Lc,InBra,vectorize> {
46 static void compute(
const Libint_t* inteval,
47 LIBINT2_REALTYPE* target,
48 const LIBINT2_REALTYPE* src0,
49 const LIBINT2_REALTYPE* src1,
50 const LIBINT2_REALTYPE* src2,
51 const LIBINT2_REALTYPE* src3) {
57 const unsigned int veclen = vectorize ? inteval->veclen : 1;
59 const unsigned int Nc = INT_NCART(Lc);
60 const unsigned int NcV = Nc * veclen;
63 FOR_CART(ax, ay, az, La)
65 int a[3]; a[0] = ax; a[1] = ay; a[2] = az;
67 enum XYZ {x=0, y=1, z=2};
75 const LIBINT2_REALTYPE *pfac0;
79 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_0_x) 80 inteval->TwoPRepITR_pfac0_0_0_x
85 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_1_x) 86 inteval->TwoPRepITR_pfac0_0_1_x;
94 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_0_y) 95 inteval->TwoPRepITR_pfac0_0_0_y
100 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_1_y) 101 inteval->TwoPRepITR_pfac0_0_1_y;
109 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_0_z) 110 inteval->TwoPRepITR_pfac0_0_0_z
115 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_1_z) 116 inteval->TwoPRepITR_pfac0_0_1_z;
124 const unsigned int iam1 = INT_CARTINDEX(La-1,a[0],a[1]);
125 const unsigned int am10c0_offset = iam1 * NcV;
126 const LIBINT2_REALTYPE* src0_ptr = src0 + am10c0_offset;
131 const unsigned int iam2 = INT_CARTINDEX(La-2,a[0],a[1]);
132 const unsigned int am20c0_offset = iam2 * NcV;
134 const LIBINT2_REALTYPE* src2_ptr = src2 + am20c0_offset;
135 const LIBINT2_REALTYPE axyz = (LIBINT2_REALTYPE)a[xyz];
138 for(
unsigned int c = 0; c < Nc; ++c) {
139 for(
unsigned int v=0; v<veclen; ++v, ++cv) {
140 target[cv] = pfac0[v] * src0_ptr[cv] + axyz * inteval->oo2z[v] * src2_ptr[cv];
143 #if LIBINT2_FLOP_COUNT 144 inteval->nflops[0] += 4 * NcV;
150 for(
unsigned int c = 0; c < Nc; ++c) {
151 for(
unsigned int v=0; v<veclen; ++v, ++cv) {
152 target[cv] = pfac0[v] * src0_ptr[cv];
155 #if LIBINT2_FLOP_COUNT 156 inteval->nflops[0] += 1 * NcV;
161 const unsigned int Ncp1 = INT_NCART(Lc+1);
162 const unsigned int Ncp1V = Ncp1 * veclen;
163 const unsigned int am10cp10_offset = iam1 * Ncp1V;
164 const LIBINT2_REALTYPE* src1_ptr = src1 + am10cp10_offset;
169 FOR_CART(cx, cy, cz, Lc)
171 int c[3]; c[0] = cx; c[1] = cy; c[2] = cz;
174 const unsigned int cp1 = INT_CARTINDEX(Lc+1,c[0],c[1]);
175 const unsigned int cp1_offset = cp1 * veclen;
176 const LIBINT2_REALTYPE* sptr = src1_ptr + cp1_offset;
177 const LIBINT2_REALTYPE cxyz = (LIBINT2_REALTYPE)c[xyz];
178 for(
unsigned int v=0; v<veclen; ++v, ++cv) {
179 target[cv] -= inteval->eoz[v] * sptr[v];
181 #if LIBINT2_FLOP_COUNT 182 inteval->nflops[0] += 2 * veclen;
190 const unsigned int Ncm1 = INT_NCART(Lc-1);
191 const unsigned int Ncm1V = Ncm1 * veclen;
192 const unsigned int am10cm10_offset = iam1 * Ncm1V;
193 const LIBINT2_REALTYPE* src3_ptr = src3 + am10cm10_offset;
197 FOR_CART(cx, cy, cz, Lc-1)
199 int c[3]; c[0] = cx; c[1] = cy; c[2] = cz;
202 const unsigned int cc = INT_CARTINDEX(Lc,c[0],c[1]);
203 const unsigned int cc_offset = cc * veclen;
204 LIBINT2_REALTYPE* tptr = target + cc_offset;
205 const LIBINT2_REALTYPE cxyz = (LIBINT2_REALTYPE)c[xyz];
206 for(
unsigned int v=0; v<veclen; ++v) {
207 tptr[v] += cxyz * inteval->oo2z[v] * src3_ptr[v];
209 #if LIBINT2_FLOP_COUNT 210 inteval->nflops[0] += 3 * veclen;
232 template <
int La,
int Lc,
bool InBra,
bool vectorize>
struct ITR_xs_xs<1,La,Lc,InBra,vectorize> {
234 static void compute(
const Libint_t* inteval,
235 LIBINT2_REALTYPE* target,
236 const LIBINT2_REALTYPE* src0,
237 const LIBINT2_REALTYPE* src1,
238 const LIBINT2_REALTYPE* src2,
239 const LIBINT2_REALTYPE* src3) {
242 if (La < 1 || Lc < 2)
245 const unsigned int veclen = vectorize ? inteval->veclen : 1;
247 const unsigned int Na = INT_NCART(La);
248 const unsigned int NaV = Na * veclen;
251 FOR_CART(cx, cy, cz, Lc)
253 int c[3]; c[0] = cx; c[1] = cy; c[2] = cz;
255 enum XYZ {x=0, y=1, z=2};
258 if (cy != 0) xyz = y;
259 if (cx != 0) xyz = x;
263 const LIBINT2_REALTYPE *pfac0;
267 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_0_x) 268 inteval->TwoPRepITR_pfac0_1_0_x
273 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_1_x) 274 inteval->TwoPRepITR_pfac0_0_1_x;
282 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_0_y) 283 inteval->TwoPRepITR_pfac0_1_0_y
288 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_1_y) 289 inteval->TwoPRepITR_pfac0_1_1_y;
297 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_0_z) 298 inteval->TwoPRepITR_pfac0_1_0_z
303 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_1_z) 304 inteval->TwoPRepITR_pfac0_1_1_z;
312 const unsigned int icm1 = INT_CARTINDEX(Lc-1,c[0],c[1]);
313 const unsigned int a0cm10_offset = icm1 * NaV;
314 const LIBINT2_REALTYPE* src0_ptr = src0 + a0cm10_offset;
319 const unsigned int icm2 = INT_CARTINDEX(Lc-2,c[0],c[1]);
320 const unsigned int a0cm20_offset = icm2 * NaV;
322 const LIBINT2_REALTYPE* src2_ptr = src2 + am20c0_offset;
323 const LIBINT2_REALTYPE axyz = (LIBINT2_REALTYPE)c[xyz];
326 for(
unsigned int c = 0; c < Nc; ++c) {
327 for(
unsigned int v=0; v<veclen; ++v, ++cv) {
328 target[cv] = pfac0[v] * src0_ptr[cv] + axyz * inteval->oo2z[v] * src2_ptr[cv];
331 #if LIBINT2_FLOP_COUNT 332 inteval->nflops[0] += 4 * NcV;
338 for(
unsigned int c = 0; c < Nc; ++c) {
339 for(
unsigned int v=0; v<veclen; ++v, ++cv) {
340 target[cv] = pfac0[v] * src0_ptr[cv];
343 #if LIBINT2_FLOP_COUNT 344 inteval->nflops[0] += 1 * NcV;
349 const unsigned int Ncp1 = INT_NCART(Lc+1);
350 const unsigned int Ncp1V = Ncp1 * veclen;
351 const unsigned int am10cp10_offset = iam1 * Ncp1V;
352 const LIBINT2_REALTYPE* src1_ptr = src1 + am10cp10_offset;
357 FOR_CART(cx, cy, cz, Lc)
359 int c[3]; c[0] = cx; c[1] = cy; c[2] = cz;
362 const unsigned int cp1 = INT_CARTINDEX(Lc+1,c[0],c[1]);
363 const unsigned int cp1_offset = cp1 * veclen;
364 const LIBINT2_REALTYPE* sptr = src1_ptr + cp1_offset;
365 const LIBINT2_REALTYPE cxyz = (LIBINT2_REALTYPE)c[xyz];
366 for(
unsigned int v=0; v<veclen; ++v, ++cv) {
367 target[cv] -= inteval->eoz[v] * sptr[v];
369 #if LIBINT2_FLOP_COUNT 370 inteval->nflops[0] += 2 * veclen;
378 const unsigned int Ncm1 = INT_NCART(Lc-1);
379 const unsigned int Ncm1V = Ncm1 * veclen;
380 const unsigned int am10cm10_offset = iam1 * Ncm1V;
381 const LIBINT2_REALTYPE* src3_ptr = src3 + am10cm10_offset;
385 FOR_CART(cx, cy, cz, Lc-1)
387 int c[3]; c[0] = cx; c[1] = cy; c[2] = cz;
390 const unsigned int cc = INT_CARTINDEX(Lc,c[0],c[1]);
391 const unsigned int cc_offset = cc * veclen;
392 LIBINT2_REALTYPE* tptr = target + cc_offset;
393 const LIBINT2_REALTYPE cxyz = (LIBINT2_REALTYPE)c[xyz];
394 for(
unsigned int v=0; v<veclen; ++v) {
395 tptr[v] += cxyz * inteval->oo2z[v] * src3_ptr[v];
397 #if LIBINT2_FLOP_COUNT 398 inteval->nflops[0] += 3 * veclen;
416 #endif // header guard Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:23
Definition: test_eri_rys.cc:46
Definition: ITR_xs_xs.h:29