diff --git a/src/cint2c2e.c b/src/cint2c2e.c index 9bcb8aa..8ab71bc 100644 --- a/src/cint2c2e.c +++ b/src/cint2c2e.c @@ -71,7 +71,7 @@ #define PUSH \ if (cum == SIMDD) { \ - CINTg0_2e(g, &bc, envs, cum); \ + (*envs->f_g0_2e)(g, &bc, envs, cum); \ (*envs->f_gout)(gout, g, idx, envs); \ POP_PRIM2CTR; \ } \ @@ -110,7 +110,7 @@ #define RUN_REST \ if (cum == 1) { \ - CINTg0_2e_simd1(g, &bc, envs, 0); \ + (*envs->f_g0_2e_simd1)(g, &bc, envs, 0); \ (*envs->f_gout_simd1)(gout, g, idx, envs); \ } else if (cum > 1) { \ r1 = MM_SET1(1.); \ @@ -118,7 +118,7 @@ MM_STORE(bc.u+i*SIMDD, r1); \ MM_STORE(bc.w+i*SIMDD, r1); \ } \ - CINTg0_2e(g, &bc, envs, cum); \ + (*envs->f_g0_2e)(g, &bc, envs, cum); \ (*envs->f_gout)(gout, g, idx, envs); \ } \ POP_PRIM2CTR @@ -371,90 +371,6 @@ void CINTinit_int2c2e_EnvVars(CINTEnvVars *envs, int *ng, int *shls, envs->g_stride_j = envs->g_stride_k; } -#ifdef WITH_GTG -void CINTg0_2e_gtg(double *g, Rys2eT *bc, CINTEnvVars *envs, int count); -void CINTg0_2e_gtg_simd1(double *g, Rys2eT *bc, CINTEnvVars *envs, int idsimd); - -void CINTinit_int2c2e_gtg_EnvVars(CINTEnvVars *envs, int *ng, int *shls, - int *atm, int natm, int *bas, int nbas, double *env) -{ - envs->natm = natm; - envs->nbas = nbas; - envs->atm = atm; - envs->bas = bas; - envs->env = env; - envs->shls = shls; - - int i_sh = shls[0]; - int k_sh = shls[1]; - envs->i_l = bas(ANG_OF, i_sh); - envs->j_l = 0; - envs->k_l = bas(ANG_OF, k_sh); - envs->l_l = 0; - envs->x_ctr[0] = bas(NCTR_OF, i_sh); - envs->x_ctr[1] = bas(NCTR_OF, k_sh); - envs->x_ctr[2] = 1; - envs->x_ctr[3] = 1; - envs->nfi = (envs->i_l+1)*(envs->i_l+2)/2; - envs->nfj = 1; - envs->nfk = (envs->k_l+1)*(envs->k_l+2)/2; - envs->nfl = 1; - envs->nf = envs->nfi * envs->nfk; - envs->common_factor = 1; - - envs->gbits = ng[GSHIFT]; - envs->ncomp_e1 = ng[POS_E1]; - envs->ncomp_e2 = ng[POS_E2]; - envs->ncomp_tensor = ng[TENSOR]; - - envs->li_ceil = envs->i_l + ng[IINC]; - envs->lj_ceil = 0; - envs->lk_ceil = envs->k_l + ng[KINC]; - envs->ll_ceil = 0; - - envs->ri = env + atm(PTR_COORD, bas(ATOM_OF, i_sh)); - envs->rk = env + atm(PTR_COORD, bas(ATOM_OF, k_sh)); - - envs->nrys_roots = 1; - - int dli = envs->li_ceil + 1; - int dlk = envs->lk_ceil + 1; - envs->g_stride_i = 1; - envs->g_stride_k = dli; - envs->g_stride_l = envs->g_stride_k; - envs->g_size = dli * dlk; - - MM_STORE(envs->aj, MM_SET1(0.)); - MM_STORE(envs->al, MM_SET1(0.)); - MM_STORE(envs->rij+0*SIMDD, MM_SET1(envs->ri[0])); - MM_STORE(envs->rij+1*SIMDD, MM_SET1(envs->ri[1])); - MM_STORE(envs->rij+2*SIMDD, MM_SET1(envs->ri[2])); - MM_STORE(envs->rkl+0*SIMDD, MM_SET1(envs->rk[0])); - MM_STORE(envs->rkl+1*SIMDD, MM_SET1(envs->rk[1])); - MM_STORE(envs->rkl+2*SIMDD, MM_SET1(envs->rk[2])); - envs->g2d_ijmax = envs->g_stride_i; - envs->g2d_klmax = envs->g_stride_k; - envs->rkrl[0] = envs->rk[0]; - envs->rkrl[1] = envs->rk[1]; - envs->rkrl[2] = envs->rk[2]; - envs->rirj[0] = envs->ri[0]; - envs->rirj[1] = envs->ri[1]; - envs->rirj[2] = envs->ri[2]; - envs->rx_in_rklrx = envs->rk; - envs->rx_in_rijrx = envs->ri; - - envs->f_g0_2d4d = &CINTg0_2e_2d; - envs->f_g0_2d4d_simd1 = &CINTg0_2e_2d_simd1; - envs->f_g0_2e = &CINTg0_2e_gtg; - envs->f_g0_2e_simd1 = &CINTg0_2e_gtg_simd1; - - // for CINTg2c_index_xyz and c2s_sph_1e function - envs->j_l = envs->k_l; - envs->nfj = envs->nfk; - envs->g_stride_j = envs->g_stride_k; -} -#endif - int CINT2c2e_cart_drv(double *out, int *dims, CINTEnvVars *envs, CINTOpt *opt, double *cache) diff --git a/src/cint2c2e_gtg.c b/src/cint2c2e_gtg.c index 33c1e6d..058352c 100644 --- a/src/cint2c2e_gtg.c +++ b/src/cint2c2e_gtg.c @@ -8,6 +8,91 @@ #include "optimizer.h" #include "cint2e.h" + +#ifdef WITH_GTG +void CINTg0_2e_gtg(double *g, Rys2eT *bc, CINTEnvVars *envs, int count); +void CINTg0_2e_gtg_simd1(double *g, Rys2eT *bc, CINTEnvVars *envs, int idsimd); + +void CINTinit_int2c2e_gtg_EnvVars(CINTEnvVars *envs, int *ng, int *shls, + int *atm, int natm, int *bas, int nbas, double *env) +{ + envs->natm = natm; + envs->nbas = nbas; + envs->atm = atm; + envs->bas = bas; + envs->env = env; + envs->shls = shls; + + int i_sh = shls[0]; + int k_sh = shls[1]; + envs->i_l = bas(ANG_OF, i_sh); + envs->j_l = 0; + envs->k_l = bas(ANG_OF, k_sh); + envs->l_l = 0; + envs->x_ctr[0] = bas(NCTR_OF, i_sh); + envs->x_ctr[1] = bas(NCTR_OF, k_sh); + envs->x_ctr[2] = 1; + envs->x_ctr[3] = 1; + envs->nfi = (envs->i_l+1)*(envs->i_l+2)/2; + envs->nfj = 1; + envs->nfk = (envs->k_l+1)*(envs->k_l+2)/2; + envs->nfl = 1; + envs->nf = envs->nfi * envs->nfk; + envs->common_factor = SQRTPI * .5; + + envs->gbits = ng[GSHIFT]; + envs->ncomp_e1 = ng[POS_E1]; + envs->ncomp_e2 = ng[POS_E2]; + envs->ncomp_tensor = ng[TENSOR]; + + envs->li_ceil = envs->i_l + ng[IINC]; + envs->lj_ceil = 0; + envs->lk_ceil = envs->k_l + ng[KINC]; + envs->ll_ceil = 0; + + envs->ri = env + atm(PTR_COORD, bas(ATOM_OF, i_sh)); + envs->rk = env + atm(PTR_COORD, bas(ATOM_OF, k_sh)); + + envs->nrys_roots = 1; + + int dli = envs->li_ceil + 1; + int dlk = envs->lk_ceil + 1; + envs->g_stride_i = 1; + envs->g_stride_k = dli; + envs->g_stride_l = envs->g_stride_k; + envs->g_size = dli * dlk; + + MM_STORE(envs->aj, MM_SET1(0.)); + MM_STORE(envs->al, MM_SET1(0.)); + MM_STORE(envs->rij+0*SIMDD, MM_SET1(envs->ri[0])); + MM_STORE(envs->rij+1*SIMDD, MM_SET1(envs->ri[1])); + MM_STORE(envs->rij+2*SIMDD, MM_SET1(envs->ri[2])); + MM_STORE(envs->rkl+0*SIMDD, MM_SET1(envs->rk[0])); + MM_STORE(envs->rkl+1*SIMDD, MM_SET1(envs->rk[1])); + MM_STORE(envs->rkl+2*SIMDD, MM_SET1(envs->rk[2])); + envs->g2d_ijmax = envs->g_stride_i; + envs->g2d_klmax = envs->g_stride_k; + envs->rkrl[0] = envs->rk[0]; + envs->rkrl[1] = envs->rk[1]; + envs->rkrl[2] = envs->rk[2]; + envs->rirj[0] = envs->ri[0]; + envs->rirj[1] = envs->ri[1]; + envs->rirj[2] = envs->ri[2]; + envs->rx_in_rklrx = envs->rk; + envs->rx_in_rijrx = envs->ri; + + envs->f_g0_2d4d = &CINTg0_2e_2d; + envs->f_g0_2d4d_simd1 = &CINTg0_2e_2d_simd1; + envs->f_g0_2e = &CINTg0_2e_gtg; + envs->f_g0_2e_simd1 = &CINTg0_2e_gtg_simd1; + + // for CINTg2c_index_xyz and c2s_sph_1e function + envs->j_l = envs->k_l; + envs->nfj = envs->nfk; + envs->g_stride_j = envs->g_stride_k; +} +#endif + int int2c2e_gtg_sph(double *out, int *dims, int *shls, int *atm, int natm, int *bas, int nbas, double *env, CINTOpt *opt, double *cache) { diff --git a/src/cint3c2e.c b/src/cint3c2e.c index 5430330..e25a306 100644 --- a/src/cint3c2e.c +++ b/src/cint3c2e.c @@ -69,7 +69,7 @@ #define PUSH(RIJ, EXPIJ) \ if (cum == SIMDD) { \ - CINTg0_2e(g, &bc, envs, cum); \ + (*envs->f_g0_2e)(g, &bc, envs, cum); \ (*envs->f_gout)(gout, g, idx, envs); \ POP_PRIM2CTR; \ } \ @@ -114,7 +114,7 @@ #define RUN_REST \ if (cum == 1) { \ - CINTg0_2e_simd1(g, &bc, envs, 0); \ + (*envs->f_g0_2e_simd1)(g, &bc, envs, 0); \ (*envs->f_gout_simd1)(gout, g, idx, envs); \ } else if (cum > 1) { \ r1 = MM_SET1(1.); \ @@ -122,7 +122,7 @@ MM_STORE(bc.u+i*SIMDD, r1); \ MM_STORE(bc.w+i*SIMDD, r1); \ } \ - CINTg0_2e(g, &bc, envs, cum); \ + (*envs->f_g0_2e)(g, &bc, envs, cum); \ (*envs->f_gout)(gout, g, idx, envs); \ } \ POP_PRIM2CTR diff --git a/src/g3c2e.c b/src/g3c2e.c index de5b547..1b2cf36 100644 --- a/src/g3c2e.c +++ b/src/g3c2e.c @@ -163,7 +163,7 @@ void CINTinit_int3c2e_gtg_EnvVars(CINTEnvVars *envs, int *ng, int *shls, envs->nfk = (envs->k_l+1)*(envs->k_l+2)/2; envs->nfl = 1; envs->nf = envs->nfi * envs->nfk * envs->nfj; - envs->common_factor = 1; + envs->common_factor = SQRTPI * .5; envs->gbits = ng[GSHIFT]; envs->ncomp_e1 = ng[POS_E1];