diff --git a/CMakeLists.txt b/CMakeLists.txt index 933c5eea..12137c8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.5) project (cint C) set(cint_VERSION_MAJOR "4") -set(cint_VERSION_MINOR "3") +set(cint_VERSION_MINOR "4") set(cint_VERSION_PATCH "0") set(cint_VERSION_TWEAK "0") set(cint_VERSION "${cint_VERSION_MAJOR}.${cint_VERSION_MINOR}.${cint_VERSION_PATCH}") diff --git a/ChangeLog b/ChangeLog index 57fbacb2..28d972a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +Version 4.4.0 (2021-05-04): + * Fix bugs in c2s transfomration for int1e_grids + * Fix bugs int1e_grids code generator + * Refactor cart2sph + * Refactor int1e drivers Version 4.3.0 (2021-04-24): - * Add int1e_grids + * Add new integral type int1e_grids * Fix cache size type Version 4.1.3 (2021-04-13): * Fix memory address int32 overflow for heavily contracted basis diff --git a/README b/README index 4742c453..bae261fc 100644 --- a/README +++ b/README @@ -1,8 +1,8 @@ libcint ======= -version 4.3.0 -2021-04-24 +version 4.4.0 +2021-05-04 What is libcint diff --git a/include/cint.h.in b/include/cint.h.in index 0dbe237b..6143a1e7 100644 --- a/include/cint.h.in +++ b/include/cint.h.in @@ -22,21 +22,27 @@ #define CACHE_SIZE_T FINT #endif -#define PTR_EXPCUTOFF 0 -#define PTR_COMMON_ORIG 1 -#define PTR_RINV_ORIG 4 -#define PTR_RINV_ZETA 7 +// global parameters in env +// Overall cutoff for integral prescreening, value needs to be ~ln(threshold) +#define PTR_EXPCUTOFF 0 +// R_C of (r-R_C) in dipole, GIAO operators +#define PTR_COMMON_ORIG 1 +// R_O in 1/|r-R_O| +#define PTR_RINV_ORIG 4 +// ZETA parameter for Gaussian charge distribution (Gaussian nuclear model) +#define PTR_RINV_ZETA 7 // omega parameter in range-separated coulomb operator // LR interaction: erf(omega*r12)/r12 if omega > 0 // SR interaction: erfc(omega*r12)/r12 if omega < 0 -#define PTR_RANGE_OMEGA 8 -// Yukawa potential and slater-type geminal e^{-zeta r} -#define PTR_F12_ZETA 9 +#define PTR_RANGE_OMEGA 8 +// Yukawa potential and Slater-type geminal e^{-zeta r} +#define PTR_F12_ZETA 9 // Gaussian type geminal e^{-zeta r^2} -#define PTR_GTG_ZETA 10 -#define NGRIDS 11 -#define PTR_GRIDS 12 -#define PTR_ENV_START 20 +#define PTR_GTG_ZETA 10 +#define NGRIDS 11 +#define PTR_GRIDS 12 +#define PTR_ENV_START 20 + // slots of atm #define CHARGE_OF 0 @@ -113,8 +119,15 @@ #define TSRZY 7 #define TSRZZ 8 -// some other boundaries -#define ANG_MAX 12 // l = 0..11 +// other boundaries +#define MXRYSROOTS 32 // > ANG_MAX*2+1 for 4c2e +#define ANG_MAX 15 // l = 0..15 +#define LMAX1 16 // > ANG_MAX +#define CART_MAX 136 // > (ANG_MAX*(ANG_MAX+1)/2) +#define SHLS_MAX 1048576 +#define NPRIM_MAX 64 +#define NCTR_MAX 64 + #define POINT_NUC 1 #define GAUSSIAN_NUC 2 #define FRAC_CHARGE_NUC 3 @@ -168,32 +181,29 @@ double *CINTc2s_ket_sph1(double *sph, double *cart, FINT lds, FINT ldc, FINT l); double CINTgto_norm(FINT n, double a); -void CINTinit_2e_optimizer(CINTOpt **opt, const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env); -void CINTinit_optimizer(CINTOpt **opt, const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env); +void CINTinit_2e_optimizer(CINTOpt **opt, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env); +void CINTinit_optimizer(CINTOpt **opt, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env); void CINTdel_2e_optimizer(CINTOpt **opt); void CINTdel_optimizer(CINTOpt **opt); -CACHE_SIZE_T cint2e_cart(double *opijkl, const FINT *shls, - const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env, - const CINTOpt *opt); -void cint2e_cart_optimizer(CINTOpt **opt, const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env); -CACHE_SIZE_T cint2e_sph(double *opijkl, const FINT *shls, - const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env, - const CINTOpt *opt); -void cint2e_sph_optimizer(CINTOpt **opt, const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env); -CACHE_SIZE_T cint2e(double *opijkl, const FINT *shls, - const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env, - const CINTOpt *opt); -void cint2e_optimizer(CINTOpt **opt, const FINT *atm, const FINT natm, - const FINT *bas, const FINT nbas, const double *env); +FINT cint2e_cart(double *opijkl, FINT *shls, + FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, + CINTOpt *opt); +void cint2e_cart_optimizer(CINTOpt **opt, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env); +FINT cint2e_sph(double *opijkl, FINT *shls, + FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, + CINTOpt *opt); +void cint2e_sph_optimizer(CINTOpt **opt, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env); +FINT cint2e(double *opijkl, FINT *shls, + FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, + CINTOpt *opt); +void cint2e_optimizer(CINTOpt **opt, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env); #ifndef __cplusplus #include diff --git a/include/cint_funcs.h b/include/cint_funcs.h index c5f87043..2b04a3aa 100644 --- a/include/cint_funcs.h +++ b/include/cint_funcs.h @@ -1072,3 +1072,15 @@ extern CINTIntegralFunction int1e_grids_ip_cart; extern CINTIntegralFunction int1e_grids_ip_sph; extern CINTIntegralFunction int1e_grids_ip_spinor; +/* */ +extern CINTOptimizerFunction int1e_grids_ipvip_optimizer; +extern CINTIntegralFunction int1e_grids_ipvip_cart; +extern CINTIntegralFunction int1e_grids_ipvip_sph; +extern CINTIntegralFunction int1e_grids_ipvip_spinor; + +/* */ +extern CINTOptimizerFunction int1e_grids_spvsp_optimizer; +extern CINTIntegralFunction int1e_grids_spvsp_cart; +extern CINTIntegralFunction int1e_grids_spvsp_sph; +extern CINTIntegralFunction int1e_grids_spvsp_spinor; + diff --git a/scripts/auto_intor.cl b/scripts/auto_intor.cl index 93f55299..5e9369d2 100644 --- a/scripts/auto_intor.cl +++ b/scripts/auto_intor.cl @@ -4,8 +4,8 @@ (load "gen-code.cl") (gen-cint "intor1.c" - '("int1e_ovlp" ( \| )) - '("int1e_nuc" ( \| nuc \| )) + ;'("int1e_ovlp" ( \| )) + ;'("int1e_nuc" ( \| nuc \| )) '("int1e_kin" (.5 \| p dot p)) '("int1e_ia01p" (#C(0 1) \| nabla-rinv \| cross p)) '("int1e_giao_irjxp" (#C(0 1) \| r cross p)) @@ -222,5 +222,7 @@ ) (gen-cint "int1e_grids1.c" - '("int1e_grids_ip" ( nabla \| grids \| )) + '("int1e_grids_ip" ( nabla \| grids \| )) + '("int1e_grids_ipvip" ( nabla \| grids \| nabla )) + '("int1e_grids_spvsp" ( sigma dot p \| grids \| sigma dot p )) ) diff --git a/scripts/cart2sph.py b/scripts/cart2sph.py index 51f6f99a..b72b8c91 100644 --- a/scripts/cart2sph.py +++ b/scripts/cart2sph.py @@ -265,13 +265,29 @@ def sph2spinor(l): ua, ub = sph2spinor(l) for k in range(l * 2): print(f'// j = {l*2-1}/2, mj = {k*2+1-l*2}/2') - ca = [f'{mpmath.nstr(c.real, 18)} + {mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ua[:,k]] - cb = [f'{mpmath.nstr(c.real, 18)} + {mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ub[:,k]] + ca = [f'{mpmath.nstr(c.real, 18)}' for c in ua[:,k]] + cb = [f'{mpmath.nstr(c.real, 18)}' for c in ub[:,k]] print(f'{", ".join(ca)},') print(f'{", ".join(cb)},') for k in range(l * 2, l * 4 + 2): print(f'// j = {l*2+1}/2, mj = {k*2-1-l*6}/2') - ca = [f'{mpmath.nstr(c.real, 18)} + {mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ua[:,k]] - cb = [f'{mpmath.nstr(c.real, 18)} + {mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ub[:,k]] + ca = [f'{mpmath.nstr(c.real, 18)}' for c in ua[:,k]] + cb = [f'{mpmath.nstr(c.real, 18)}' for c in ub[:,k]] + print(f'{", ".join(ca)},') + print(f'{", ".join(cb)},') + + l = 4 + ncart = (l + 1) * (l + 2) // 2 + ua, ub = sph2spinor(l) + for k in range(l * 2): + print(f'// j = {l*2-1}/2, mj = {k*2+1-l*2}/2') + ca = [f'{mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ua[:,k]] + cb = [f'{mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ub[:,k]] + print(f'{", ".join(ca)},') + print(f'{", ".join(cb)},') + for k in range(l * 2, l * 4 + 2): + print(f'// j = {l*2+1}/2, mj = {k*2-1-l*6}/2') + ca = [f'{mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ua[:,k]] + cb = [f'{mpmath.nstr(c.imag, 18)}*_Complex_I' for c in ub[:,k]] print(f'{", ".join(ca)},') print(f'{", ".join(cb)},') diff --git a/scripts/gen-code.cl b/scripts/gen-code.cl index 32eaca16..d37602c6 100644 --- a/scripts/gen-code.cl +++ b/scripts/gen-code.cl @@ -386,7 +386,44 @@ ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3];~%") (dump-s-for-nroots fout tot-bits 1) - (gen-c-block+ fout flat-script) + (gen-c-block-with-empty fout flat-script) + (format fout "}}~%") + goutinc))) + +(defun gen-code-gout1e-rinv (fout intname raw-infix flat-script) + (destructuring-bind (op bra-i ket-j bra-k ket-l) + (split-int-expression raw-infix) + (let* ((i-rev (effect-keys bra-i)) ;nf; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; +double *g0 = g;~%") + (loop + for i in (range (num-g-intermediates tot-bits op i-len j-len)) do + (format fout "double *g~a = g~a + envs->g_size * 3;~%" (1+ i) i)) + (dump-declare-dri-for-rc fout bra-i "i") + (dump-declare-dri-for-rc fout (append op ket-j) "j") + (dump-declare-giao-ij fout bra-i (append op ket-j)) +;;; generate g_(bin) +;;; for the operators act on the |ket>, the reversed scan order and r_combinator +;;; is required; for the operators acto on the i_l+~a, envs->j_l, 0, 0);~%") + (fmt-op (mkstr "G2E_~aJ(g~a, g~a, envs->i_l+~d, envs->j_l+~a, 0, 0); +G2E_~aI(g~a, g~a, envs->i_l+~d, envs->j_l+~a, 0, 0); +for (ix = 0; ix < envs->g_size * 3; ix++) {g~a[ix] += g~a[ix];}~%")) + (fmt-j (mkstr "G2E_~aJ(g~a, g~a, envs->i_l+~d, envs->j_l+~a, 0, 0);~%"))) + (dump-combo-braket fout fmt-i fmt-op fmt-j i-rev op-rev j-rev 0)) + (dump-s-2e fout tot-bits 0) + (gen-c-block-with-empty fout flat-script) (format fout "}}~%") goutinc))) @@ -415,8 +452,11 @@ iz = idx[2+n*3];~%") (if (or (member 'nuc raw-infix) (member 'rinv raw-infix) (member 'nabla-rinv raw-infix)) - (format tmpout "FINT ng[] = {~d, ~d, 0, 0, ~d, ~d, 0, ~d};~%" - i-len (+ op-len j-len) tot-bits e1comps tensors) + (if (intersection *act-left-right* op) + (format tmpout "FINT ng[] = {~d, ~d, 0, 0, ~d, ~d, 0, ~d};~%" + (1+ i-len) (+ op-len j-len) tot-bits e1comps tensors) + (format tmpout "FINT ng[] = {~d, ~d, 0, 0, ~d, ~d, 0, ~d};~%" + i-len (+ op-len j-len) tot-bits e1comps tensors)) (format tmpout "FINT ng[] = {~d, ~d, 0, 0, ~d, ~d, 1, ~d};~%" i-len (+ op-len j-len) tot-bits e1comps tensors)))) (envs-common (with-output-to-string (tmpout) @@ -429,7 +469,11 @@ iz = idx[2+n*3];~%") (write-functype-header t intname (format nil "/* <~{~a ~}i|~{~a ~}|~{~a ~}j> */" bra-i op ket-j)) (format fout "/* <~{~a ~}i|~{~a ~}|~{~a ~}j> */~%" bra-i op ket-j) - (gen-code-gout1e fout intname raw-infix flat-script) + (cond ((or (member 'nuc raw-infix) + (member 'rinv raw-infix) + (member 'nabla-rinv raw-infix)) + (gen-code-gout1e-rinv fout intname raw-infix flat-script)) + (t (gen-code-gout1e fout intname raw-infix flat-script))) (format fout "void ~a_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) {~%" intname) (format fout ngdef) (format fout "CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env);~%}~%") @@ -1290,8 +1334,11 @@ for (ig = 0; ig < bgrids; ig++) {~%") (e1comps (if (eql sf 'sf) 1 4)) (tensors (if (eql sf 'sf) goutinc (/ goutinc 4))) (ngdef (with-output-to-string (tmpout) - (format tmpout "FINT ng[] = {~d, ~d, 0, 0, ~d, ~d, 0, ~d};~%" - i-len (+ op-len j-len) tot-bits e1comps tensors))) + (if (intersection *act-left-right* op) + (format tmpout "FINT ng[] = {~d, ~d, 0, 0, ~d, ~d, 0, ~d};~%" + (1+ i-len) (+ op-len j-len) tot-bits e1comps tensors) + (format tmpout "FINT ng[] = {~d, ~d, 0, 0, ~d, ~d, 0, ~d};~%" + i-len (+ op-len j-len) tot-bits e1comps tensors)))) (envs-common (with-output-to-string (tmpout) (format tmpout ngdef) (format tmpout "CINTEnvVars envs;~%") diff --git a/src/autocode/deriv3.c b/src/autocode/deriv3.c index 64a88cfb..64810950 100644 --- a/src/autocode/deriv3.c +++ b/src/autocode/deriv3.c @@ -17,7 +17,8 @@ /* */ void CINTgout1e_int1e_ipipipnuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -26,45 +27,77 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_I(g1, g0, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_I(g1, g0, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*27+0] = + s[0]; +gout[n*27+1] = + s[9]; +gout[n*27+2] = + s[18]; +gout[n*27+3] = + s[3]; +gout[n*27+4] = + s[12]; +gout[n*27+5] = + s[21]; +gout[n*27+6] = + s[6]; +gout[n*27+7] = + s[15]; +gout[n*27+8] = + s[24]; +gout[n*27+9] = + s[1]; +gout[n*27+10] = + s[10]; +gout[n*27+11] = + s[19]; +gout[n*27+12] = + s[4]; +gout[n*27+13] = + s[13]; +gout[n*27+14] = + s[22]; +gout[n*27+15] = + s[7]; +gout[n*27+16] = + s[16]; +gout[n*27+17] = + s[25]; +gout[n*27+18] = + s[2]; +gout[n*27+19] = + s[11]; +gout[n*27+20] = + s[20]; +gout[n*27+21] = + s[5]; +gout[n*27+22] = + s[14]; +gout[n*27+23] = + s[23]; +gout[n*27+24] = + s[8]; +gout[n*27+25] = + s[17]; +gout[n*27+26] = + s[26]; +} else { gout[n*27+0] += + s[0]; gout[n*27+1] += + s[9]; gout[n*27+2] += + s[18]; @@ -92,7 +125,7 @@ gout[n*27+23] += + s[23]; gout[n*27+24] += + s[8]; gout[n*27+25] += + s[17]; gout[n*27+26] += + s[26]; -}} +}}} void int1e_ipipipnuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {3, 0, 0, 0, 3, 1, 0, 27}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -126,7 +159,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipipipnuc) /* */ void CINTgout1e_int1e_ipipiprinv(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -135,45 +169,77 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_I(g1, g0, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_I(g1, g0, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*27+0] = + s[0]; +gout[n*27+1] = + s[9]; +gout[n*27+2] = + s[18]; +gout[n*27+3] = + s[3]; +gout[n*27+4] = + s[12]; +gout[n*27+5] = + s[21]; +gout[n*27+6] = + s[6]; +gout[n*27+7] = + s[15]; +gout[n*27+8] = + s[24]; +gout[n*27+9] = + s[1]; +gout[n*27+10] = + s[10]; +gout[n*27+11] = + s[19]; +gout[n*27+12] = + s[4]; +gout[n*27+13] = + s[13]; +gout[n*27+14] = + s[22]; +gout[n*27+15] = + s[7]; +gout[n*27+16] = + s[16]; +gout[n*27+17] = + s[25]; +gout[n*27+18] = + s[2]; +gout[n*27+19] = + s[11]; +gout[n*27+20] = + s[20]; +gout[n*27+21] = + s[5]; +gout[n*27+22] = + s[14]; +gout[n*27+23] = + s[23]; +gout[n*27+24] = + s[8]; +gout[n*27+25] = + s[17]; +gout[n*27+26] = + s[26]; +} else { gout[n*27+0] += + s[0]; gout[n*27+1] += + s[9]; gout[n*27+2] += + s[18]; @@ -201,7 +267,7 @@ gout[n*27+23] += + s[23]; gout[n*27+24] += + s[8]; gout[n*27+25] += + s[17]; gout[n*27+26] += + s[26]; -}} +}}} void int1e_ipipiprinv_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {3, 0, 0, 0, 3, 1, 0, 27}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -235,7 +301,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipipiprinv) /* */ void CINTgout1e_int1e_ipipnucip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -244,45 +311,77 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*27+0] = + s[0]; +gout[n*27+1] = + s[1]; +gout[n*27+2] = + s[2]; +gout[n*27+3] = + s[9]; +gout[n*27+4] = + s[10]; +gout[n*27+5] = + s[11]; +gout[n*27+6] = + s[18]; +gout[n*27+7] = + s[19]; +gout[n*27+8] = + s[20]; +gout[n*27+9] = + s[3]; +gout[n*27+10] = + s[4]; +gout[n*27+11] = + s[5]; +gout[n*27+12] = + s[12]; +gout[n*27+13] = + s[13]; +gout[n*27+14] = + s[14]; +gout[n*27+15] = + s[21]; +gout[n*27+16] = + s[22]; +gout[n*27+17] = + s[23]; +gout[n*27+18] = + s[6]; +gout[n*27+19] = + s[7]; +gout[n*27+20] = + s[8]; +gout[n*27+21] = + s[15]; +gout[n*27+22] = + s[16]; +gout[n*27+23] = + s[17]; +gout[n*27+24] = + s[24]; +gout[n*27+25] = + s[25]; +gout[n*27+26] = + s[26]; +} else { gout[n*27+0] += + s[0]; gout[n*27+1] += + s[1]; gout[n*27+2] += + s[2]; @@ -310,7 +409,7 @@ gout[n*27+23] += + s[17]; gout[n*27+24] += + s[24]; gout[n*27+25] += + s[25]; gout[n*27+26] += + s[26]; -}} +}}} void int1e_ipipnucip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 1, 0, 27}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -344,7 +443,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipipnucip) /* */ void CINTgout1e_int1e_ipiprinvip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -353,45 +453,77 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*27+0] = + s[0]; +gout[n*27+1] = + s[1]; +gout[n*27+2] = + s[2]; +gout[n*27+3] = + s[9]; +gout[n*27+4] = + s[10]; +gout[n*27+5] = + s[11]; +gout[n*27+6] = + s[18]; +gout[n*27+7] = + s[19]; +gout[n*27+8] = + s[20]; +gout[n*27+9] = + s[3]; +gout[n*27+10] = + s[4]; +gout[n*27+11] = + s[5]; +gout[n*27+12] = + s[12]; +gout[n*27+13] = + s[13]; +gout[n*27+14] = + s[14]; +gout[n*27+15] = + s[21]; +gout[n*27+16] = + s[22]; +gout[n*27+17] = + s[23]; +gout[n*27+18] = + s[6]; +gout[n*27+19] = + s[7]; +gout[n*27+20] = + s[8]; +gout[n*27+21] = + s[15]; +gout[n*27+22] = + s[16]; +gout[n*27+23] = + s[17]; +gout[n*27+24] = + s[24]; +gout[n*27+25] = + s[25]; +gout[n*27+26] = + s[26]; +} else { gout[n*27+0] += + s[0]; gout[n*27+1] += + s[1]; gout[n*27+2] += + s[2]; @@ -419,7 +551,7 @@ gout[n*27+23] += + s[17]; gout[n*27+24] += + s[24]; gout[n*27+25] += + s[25]; gout[n*27+26] += + s[26]; -}} +}}} void int1e_ipiprinvip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 1, 0, 27}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); diff --git a/src/autocode/dkb.c b/src/autocode/dkb.c index 101e1ea4..939ecef5 100644 --- a/src/autocode/dkb.c +++ b/src/autocode/dkb.c @@ -65,11 +65,17 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*4+0] = - s[0] - s[12] - s[24]; +gout[n*4+1] = - s[1] - s[13] - s[25]; +gout[n*4+2] = - s[2] - s[14] - s[26]; +gout[n*4+3] = 0; +} else { gout[n*4+0] += - s[0] - s[12] - s[24]; gout[n*4+1] += - s[1] - s[13] - s[25]; gout[n*4+2] += - s[2] - s[14] - s[26]; gout[n*4+3] += 0; -}} +}}} void int1e_spspsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 2, 0, 0, 3, 4, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -103,23 +109,33 @@ ALL_CINT1E_FORTRAN_(int1e_spspsp) /* */ void CINTgout1e_int1e_spnuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; +G2E_D_I(g1, g0, envs->i_l+0, envs->j_l, 0, 0); double s[3]; -G1E_D_I(g1, g0, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +for (i = 0; i < 3; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g1[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g0[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g0[ix+i] * g0[iy+i] * g1[iz+i]; +} +if (gout_empty) { +gout[n*4+0] = + s[0]; +gout[n*4+1] = + s[1]; +gout[n*4+2] = + s[2]; +gout[n*4+3] = 0; +} else { gout[n*4+0] += + s[0]; gout[n*4+1] += + s[1]; gout[n*4+2] += + s[2]; gout[n*4+3] += 0; -}} +}}} void int1e_spnuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 4, 0, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); diff --git a/src/autocode/grad1.c b/src/autocode/grad1.c index 3d73aceb..51439595 100644 --- a/src/autocode/grad1.c +++ b/src/autocode/grad1.c @@ -29,10 +29,15 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*3+0] = + s[0]; +gout[n*3+1] = + s[1]; +gout[n*3+2] = + s[2]; +} else { gout[n*3+0] += + s[0]; gout[n*3+1] += + s[1]; gout[n*3+2] += + s[2]; -}} +}}} void int1e_ipovlp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -78,10 +83,15 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*3+0] = + s[0]; +gout[n*3+1] = + s[1]; +gout[n*3+2] = + s[2]; +} else { gout[n*3+0] += + s[0]; gout[n*3+1] += + s[1]; gout[n*3+2] += + s[2]; -}} +}}} void int1e_ovlpip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 1, 0, 0, 1, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -163,10 +173,15 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*3+0] = - s[0] - s[4] - s[8]; +gout[n*3+1] = - s[9] - s[13] - s[17]; +gout[n*3+2] = - s[18] - s[22] - s[26]; +} else { gout[n*3+0] += - s[0] - s[4] - s[8]; gout[n*3+1] += - s[9] - s[13] - s[17]; gout[n*3+2] += - s[18] - s[22] - s[26]; -}} +}}} void int1e_ipkin_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 2, 0, 0, 3, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -251,10 +266,15 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*3+0] = - s[0] - s[12] - s[24]; +gout[n*3+1] = - s[1] - s[13] - s[25]; +gout[n*3+2] = - s[2] - s[14] - s[26]; +} else { gout[n*3+0] += - s[0] - s[12] - s[24]; gout[n*3+1] += - s[1] - s[13] - s[25]; gout[n*3+2] += - s[2] - s[14] - s[26]; -}} +}}} void int1e_kinip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 3, 0, 0, 3, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -291,22 +311,31 @@ ALL_CINT1E_FORTRAN_(int1e_kinip) /* */ void CINTgout1e_int1e_ipnuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; +G2E_D_I(g1, g0, envs->i_l+0, envs->j_l, 0, 0); double s[3]; -G1E_D_I(g1, g0, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +for (i = 0; i < 3; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g1[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g0[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g0[ix+i] * g0[iy+i] * g1[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[0]; +gout[n*3+1] = + s[1]; +gout[n*3+2] = + s[2]; +} else { gout[n*3+0] += + s[0]; gout[n*3+1] += + s[1]; gout[n*3+2] += + s[2]; -}} +}}} void int1e_ipnuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -340,22 +369,31 @@ ALL_CINT1E_FORTRAN_(int1e_ipnuc) /* */ void CINTgout1e_int1e_iprinv(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; +G2E_D_I(g1, g0, envs->i_l+0, envs->j_l, 0, 0); double s[3]; -G1E_D_I(g1, g0, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +for (i = 0; i < 3; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g1[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g0[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g0[ix+i] * g0[iy+i] * g1[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[0]; +gout[n*3+1] = + s[1]; +gout[n*3+2] = + s[2]; +} else { gout[n*3+0] += + s[0]; gout[n*3+1] += + s[1]; gout[n*3+2] += + s[2]; -}} +}}} void int1e_iprinv_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -389,7 +427,8 @@ ALL_CINT1E_FORTRAN_(int1e_iprinv) /* */ void CINTgout1e_int1e_ipspnucsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -398,45 +437,62 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*12+0] = + s[11] - s[19]; +gout[n*12+1] = + s[18] - s[2]; +gout[n*12+2] = + s[1] - s[9]; +gout[n*12+3] = + s[0] + s[10] + s[20]; +gout[n*12+4] = + s[14] - s[22]; +gout[n*12+5] = + s[21] - s[5]; +gout[n*12+6] = + s[4] - s[12]; +gout[n*12+7] = + s[3] + s[13] + s[23]; +gout[n*12+8] = + s[17] - s[25]; +gout[n*12+9] = + s[24] - s[8]; +gout[n*12+10] = + s[7] - s[15]; +gout[n*12+11] = + s[6] + s[16] + s[26]; +} else { gout[n*12+0] += + s[11] - s[19]; gout[n*12+1] += + s[18] - s[2]; gout[n*12+2] += + s[1] - s[9]; @@ -449,7 +505,7 @@ gout[n*12+8] += + s[17] - s[25]; gout[n*12+9] += + s[24] - s[8]; gout[n*12+10] += + s[7] - s[15]; gout[n*12+11] += + s[6] + s[16] + s[26]; -}} +}}} void int1e_ipspnucsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 4, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -483,7 +539,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipspnucsp) /* */ void CINTgout1e_int1e_ipsprinvsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -492,45 +549,62 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*12+0] = + s[11] - s[19]; +gout[n*12+1] = + s[18] - s[2]; +gout[n*12+2] = + s[1] - s[9]; +gout[n*12+3] = + s[0] + s[10] + s[20]; +gout[n*12+4] = + s[14] - s[22]; +gout[n*12+5] = + s[21] - s[5]; +gout[n*12+6] = + s[4] - s[12]; +gout[n*12+7] = + s[3] + s[13] + s[23]; +gout[n*12+8] = + s[17] - s[25]; +gout[n*12+9] = + s[24] - s[8]; +gout[n*12+10] = + s[7] - s[15]; +gout[n*12+11] = + s[6] + s[16] + s[26]; +} else { gout[n*12+0] += + s[11] - s[19]; gout[n*12+1] += + s[18] - s[2]; gout[n*12+2] += + s[1] - s[9]; @@ -543,7 +617,7 @@ gout[n*12+8] += + s[17] - s[25]; gout[n*12+9] += + s[24] - s[8]; gout[n*12+10] += + s[7] - s[15]; gout[n*12+11] += + s[6] + s[16] + s[26]; -}} +}}} void int1e_ipsprinvsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 4, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -577,7 +651,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipsprinvsp) /* */ void CINTgout1e_int1e_ippnucp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -586,49 +661,57 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[0] + s[4] + s[8]; +gout[n*3+1] = + s[9] + s[13] + s[17]; +gout[n*3+2] = + s[18] + s[22] + s[26]; +} else { gout[n*3+0] += + s[0] + s[4] + s[8]; gout[n*3+1] += + s[9] + s[13] + s[17]; gout[n*3+2] += + s[18] + s[22] + s[26]; -}} +}}} void int1e_ippnucp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -662,7 +745,8 @@ ALL_CINT1E_FORTRAN_(int1e_ippnucp) /* */ void CINTgout1e_int1e_ipprinvp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -671,49 +755,57 @@ double *g4 = g3 + envs->g_size * 3; double *g5 = g4 + envs->g_size * 3; double *g6 = g5 + envs->g_size * 3; double *g7 = g6 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[0] + s[4] + s[8]; +gout[n*3+1] = + s[9] + s[13] + s[17]; +gout[n*3+2] = + s[18] + s[22] + s[26]; +} else { gout[n*3+0] += + s[0] + s[4] + s[8]; gout[n*3+1] += + s[9] + s[13] + s[17]; gout[n*3+2] += + s[18] + s[22] + s[26]; -}} +}}} void int1e_ipprinvp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); diff --git a/src/autocode/hess.c b/src/autocode/hess.c index 7d77b1ac..46941e5e 100644 --- a/src/autocode/hess.c +++ b/src/autocode/hess.c @@ -39,6 +39,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[3]; +gout[n*9+2] = + s[6]; +gout[n*9+3] = + s[1]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[7]; +gout[n*9+6] = + s[2]; +gout[n*9+7] = + s[5]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[3]; gout[n*9+2] += + s[6]; @@ -48,7 +59,7 @@ gout[n*9+5] += + s[7]; gout[n*9+6] += + s[2]; gout[n*9+7] += + s[5]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_ipipovlp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 0, 0, 0, 2, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -104,6 +115,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -113,7 +135,7 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_ipovlpip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -265,6 +287,17 @@ s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +if (gout_empty) { +gout[n*9+0] = - s[0] - s[4] - s[8]; +gout[n*9+1] = - s[27] - s[31] - s[35]; +gout[n*9+2] = - s[54] - s[58] - s[62]; +gout[n*9+3] = - s[9] - s[13] - s[17]; +gout[n*9+4] = - s[36] - s[40] - s[44]; +gout[n*9+5] = - s[63] - s[67] - s[71]; +gout[n*9+6] = - s[18] - s[22] - s[26]; +gout[n*9+7] = - s[45] - s[49] - s[53]; +gout[n*9+8] = - s[72] - s[76] - s[80]; +} else { gout[n*9+0] += - s[0] - s[4] - s[8]; gout[n*9+1] += - s[27] - s[31] - s[35]; gout[n*9+2] += - s[54] - s[58] - s[62]; @@ -274,7 +307,7 @@ gout[n*9+5] += - s[63] - s[67] - s[71]; gout[n*9+6] += - s[18] - s[22] - s[26]; gout[n*9+7] += - s[45] - s[49] - s[53]; gout[n*9+8] += - s[72] - s[76] - s[80]; -}} +}}} void int1e_ipipkin_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 2, 0, 0, 4, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -429,6 +462,17 @@ s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +if (gout_empty) { +gout[n*9+0] = - s[0] - s[12] - s[24]; +gout[n*9+1] = - s[1] - s[13] - s[25]; +gout[n*9+2] = - s[2] - s[14] - s[26]; +gout[n*9+3] = - s[27] - s[39] - s[51]; +gout[n*9+4] = - s[28] - s[40] - s[52]; +gout[n*9+5] = - s[29] - s[41] - s[53]; +gout[n*9+6] = - s[54] - s[66] - s[78]; +gout[n*9+7] = - s[55] - s[67] - s[79]; +gout[n*9+8] = - s[56] - s[68] - s[80]; +} else { gout[n*9+0] += - s[0] - s[12] - s[24]; gout[n*9+1] += - s[1] - s[13] - s[25]; gout[n*9+2] += - s[2] - s[14] - s[26]; @@ -438,7 +482,7 @@ gout[n*9+5] += - s[29] - s[41] - s[53]; gout[n*9+6] += - s[54] - s[66] - s[78]; gout[n*9+7] += - s[55] - s[67] - s[79]; gout[n*9+8] += - s[56] - s[68] - s[80]; -}} +}}} void int1e_ipkinip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 3, 0, 0, 4, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -475,28 +519,43 @@ ALL_CINT1E_FORTRAN_(int1e_ipkinip) /* */ void CINTgout1e_int1e_ipipnuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_I(g1, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_I(g1, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[3]; +gout[n*9+2] = + s[6]; +gout[n*9+3] = + s[1]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[7]; +gout[n*9+6] = + s[2]; +gout[n*9+7] = + s[5]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[3]; gout[n*9+2] += + s[6]; @@ -506,7 +565,7 @@ gout[n*9+5] += + s[7]; gout[n*9+6] += + s[2]; gout[n*9+7] += + s[5]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_ipipnuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 0, 0, 0, 2, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -540,28 +599,43 @@ ALL_CINT1E_FORTRAN_(int1e_ipipnuc) /* */ void CINTgout1e_int1e_ipnucip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -571,7 +645,7 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_ipnucip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -605,28 +679,43 @@ ALL_CINT1E_FORTRAN_(int1e_ipnucip) /* */ void CINTgout1e_int1e_ipiprinv(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_I(g1, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_I(g1, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[3]; +gout[n*9+2] = + s[6]; +gout[n*9+3] = + s[1]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[7]; +gout[n*9+6] = + s[2]; +gout[n*9+7] = + s[5]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[3]; gout[n*9+2] += + s[6]; @@ -636,7 +725,7 @@ gout[n*9+5] += + s[7]; gout[n*9+6] += + s[2]; gout[n*9+7] += + s[5]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_ipiprinv_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 0, 0, 0, 2, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -670,28 +759,43 @@ ALL_CINT1E_FORTRAN_(int1e_ipiprinv) /* */ void CINTgout1e_int1e_iprinvip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -701,7 +805,7 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_iprinvip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -981,7 +1085,8 @@ ALL_CINT_FORTRAN_(int2e_ip1ip2) /* */ void CINTgout1e_int1e_ipippnucp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -998,107 +1103,121 @@ double *g12 = g11 + envs->g_size * 3; double *g13 = g12 + envs->g_size * 3; double *g14 = g13 + envs->g_size * 3; double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); double s[81]; -G1E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0] + s[4] + s[8]; +gout[n*9+1] = + s[27] + s[31] + s[35]; +gout[n*9+2] = + s[54] + s[58] + s[62]; +gout[n*9+3] = + s[9] + s[13] + s[17]; +gout[n*9+4] = + s[36] + s[40] + s[44]; +gout[n*9+5] = + s[63] + s[67] + s[71]; +gout[n*9+6] = + s[18] + s[22] + s[26]; +gout[n*9+7] = + s[45] + s[49] + s[53]; +gout[n*9+8] = + s[72] + s[76] + s[80]; +} else { gout[n*9+0] += + s[0] + s[4] + s[8]; gout[n*9+1] += + s[27] + s[31] + s[35]; gout[n*9+2] += + s[54] + s[58] + s[62]; @@ -1108,7 +1227,7 @@ gout[n*9+5] += + s[63] + s[67] + s[71]; gout[n*9+6] += + s[18] + s[22] + s[26]; gout[n*9+7] += + s[45] + s[49] + s[53]; gout[n*9+8] += + s[72] + s[76] + s[80]; -}} +}}} void int1e_ipippnucp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1142,7 +1261,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipippnucp) /* */ void CINTgout1e_int1e_ippnucpip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -1159,312 +1279,166 @@ double *g12 = g11 + envs->g_size * 3; double *g13 = g12 + envs->g_size * 3; double *g14 = g13 + envs->g_size * 3; double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0, 0); +G2E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); double s[81]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0); -G1E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; -gout[n*9+0] += + s[0] + s[12] + s[24]; -gout[n*9+1] += + s[27] + s[39] + s[51]; -gout[n*9+2] += + s[54] + s[66] + s[78]; -gout[n*9+3] += + s[1] + s[13] + s[25]; -gout[n*9+4] += + s[28] + s[40] + s[52]; -gout[n*9+5] += + s[55] + s[67] + s[79]; -gout[n*9+6] += + s[2] + s[14] + s[26]; -gout[n*9+7] += + s[29] + s[41] + s[53]; -gout[n*9+8] += + s[56] + s[68] + s[80]; -}} -void int1e_ippnucpip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; -CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); -} -CACHE_SIZE_T int1e_ippnucpip_cart(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ippnucpip; -return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 2); -} // int1e_ippnucpip_cart -CACHE_SIZE_T int1e_ippnucpip_sph(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ippnucpip; -return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 2); -} // int1e_ippnucpip_sph -CACHE_SIZE_T int1e_ippnucpip_spinor(double complex *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ippnucpip; -return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 2); -} // int1e_ippnucpip_spinor -ALL_CINT1E(int1e_ippnucpip) -ALL_CINT1E_FORTRAN_(int1e_ippnucpip) -/* */ -void CINTgout1e_int1e_ipipprinvp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { -FINT nf = envs->nf; -FINT ix, iy, iz, n; -double *g0 = g; -double *g1 = g0 + envs->g_size * 3; -double *g2 = g1 + envs->g_size * 3; -double *g3 = g2 + envs->g_size * 3; -double *g4 = g3 + envs->g_size * 3; -double *g5 = g4 + envs->g_size * 3; -double *g6 = g5 + envs->g_size * 3; -double *g7 = g6 + envs->g_size * 3; -double *g8 = g7 + envs->g_size * 3; -double *g9 = g8 + envs->g_size * 3; -double *g10 = g9 + envs->g_size * 3; -double *g11 = g10 + envs->g_size * 3; -double *g12 = g11 + envs->g_size * 3; -double *g13 = g12 + envs->g_size * 3; -double *g14 = g13 + envs->g_size * 3; -double *g15 = g14 + envs->g_size * 3; -double s[81]; -G1E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); -for (n = 0; n < nf; n++) { -ix = idx[0+n*3]; -iy = idx[1+n*3]; -iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; -gout[n*9+0] += + s[0] + s[4] + s[8]; -gout[n*9+1] += + s[27] + s[31] + s[35]; -gout[n*9+2] += + s[54] + s[58] + s[62]; -gout[n*9+3] += + s[9] + s[13] + s[17]; -gout[n*9+4] += + s[36] + s[40] + s[44]; -gout[n*9+5] += + s[63] + s[67] + s[71]; -gout[n*9+6] += + s[18] + s[22] + s[26]; -gout[n*9+7] += + s[45] + s[49] + s[53]; -gout[n*9+8] += + s[72] + s[76] + s[80]; -}} -void int1e_ipipprinvp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0] + s[12] + s[24]; +gout[n*9+1] = + s[27] + s[39] + s[51]; +gout[n*9+2] = + s[54] + s[66] + s[78]; +gout[n*9+3] = + s[1] + s[13] + s[25]; +gout[n*9+4] = + s[28] + s[40] + s[52]; +gout[n*9+5] = + s[55] + s[67] + s[79]; +gout[n*9+6] = + s[2] + s[14] + s[26]; +gout[n*9+7] = + s[29] + s[41] + s[53]; +gout[n*9+8] = + s[56] + s[68] + s[80]; +} else { +gout[n*9+0] += + s[0] + s[12] + s[24]; +gout[n*9+1] += + s[27] + s[39] + s[51]; +gout[n*9+2] += + s[54] + s[66] + s[78]; +gout[n*9+3] += + s[1] + s[13] + s[25]; +gout[n*9+4] += + s[28] + s[40] + s[52]; +gout[n*9+5] += + s[55] + s[67] + s[79]; +gout[n*9+6] += + s[2] + s[14] + s[26]; +gout[n*9+7] += + s[29] + s[41] + s[53]; +gout[n*9+8] += + s[56] + s[68] + s[80]; +}}} +void int1e_ippnucpip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { +FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } -CACHE_SIZE_T int1e_ipipprinvp_cart(double *out, FINT *dims, FINT *shls, +CACHE_SIZE_T int1e_ippnucpip_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ipipprinvp; -return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); -} // int1e_ipipprinvp_cart -CACHE_SIZE_T int1e_ipipprinvp_sph(double *out, FINT *dims, FINT *shls, +envs.f_gout = &CINTgout1e_int1e_ippnucpip; +return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 2); +} // int1e_ippnucpip_cart +CACHE_SIZE_T int1e_ippnucpip_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ipipprinvp; -return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); -} // int1e_ipipprinvp_sph -CACHE_SIZE_T int1e_ipipprinvp_spinor(double complex *out, FINT *dims, FINT *shls, +envs.f_gout = &CINTgout1e_int1e_ippnucpip; +return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 2); +} // int1e_ippnucpip_sph +CACHE_SIZE_T int1e_ippnucpip_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ipipprinvp; -return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 1); -} // int1e_ipipprinvp_spinor -ALL_CINT1E(int1e_ipipprinvp) -ALL_CINT1E_FORTRAN_(int1e_ipipprinvp) -/* */ -void CINTgout1e_int1e_ipprinvpip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { +envs.f_gout = &CINTgout1e_int1e_ippnucpip; +return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 2); +} // int1e_ippnucpip_spinor +ALL_CINT1E(int1e_ippnucpip) +ALL_CINT1E_FORTRAN_(int1e_ippnucpip) +/* */ +void CINTgout1e_int1e_ipipprinvp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -1481,107 +1455,297 @@ double *g12 = g11 + envs->g_size * 3; double *g13 = g12 + envs->g_size * 3; double *g14 = g13 + envs->g_size * 3; double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); double s[81]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0); -G1E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0] + s[4] + s[8]; +gout[n*9+1] = + s[27] + s[31] + s[35]; +gout[n*9+2] = + s[54] + s[58] + s[62]; +gout[n*9+3] = + s[9] + s[13] + s[17]; +gout[n*9+4] = + s[36] + s[40] + s[44]; +gout[n*9+5] = + s[63] + s[67] + s[71]; +gout[n*9+6] = + s[18] + s[22] + s[26]; +gout[n*9+7] = + s[45] + s[49] + s[53]; +gout[n*9+8] = + s[72] + s[76] + s[80]; +} else { +gout[n*9+0] += + s[0] + s[4] + s[8]; +gout[n*9+1] += + s[27] + s[31] + s[35]; +gout[n*9+2] += + s[54] + s[58] + s[62]; +gout[n*9+3] += + s[9] + s[13] + s[17]; +gout[n*9+4] += + s[36] + s[40] + s[44]; +gout[n*9+5] += + s[63] + s[67] + s[71]; +gout[n*9+6] += + s[18] + s[22] + s[26]; +gout[n*9+7] += + s[45] + s[49] + s[53]; +gout[n*9+8] += + s[72] + s[76] + s[80]; +}}} +void int1e_ipipprinvp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { +FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); +} +CACHE_SIZE_T int1e_ipipprinvp_cart(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_ipipprinvp; +return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); +} // int1e_ipipprinvp_cart +CACHE_SIZE_T int1e_ipipprinvp_sph(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_ipipprinvp; +return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); +} // int1e_ipipprinvp_sph +CACHE_SIZE_T int1e_ipipprinvp_spinor(double complex *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {3, 1, 0, 0, 4, 1, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_ipipprinvp; +return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 1); +} // int1e_ipipprinvp_spinor +ALL_CINT1E(int1e_ipipprinvp) +ALL_CINT1E_FORTRAN_(int1e_ipipprinvp) +/* */ +void CINTgout1e_int1e_ipprinvpip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { +FINT nf = envs->nf; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; +double *g0 = g; +double *g1 = g0 + envs->g_size * 3; +double *g2 = g1 + envs->g_size * 3; +double *g3 = g2 + envs->g_size * 3; +double *g4 = g3 + envs->g_size * 3; +double *g5 = g4 + envs->g_size * 3; +double *g6 = g5 + envs->g_size * 3; +double *g7 = g6 + envs->g_size * 3; +double *g8 = g7 + envs->g_size * 3; +double *g9 = g8 + envs->g_size * 3; +double *g10 = g9 + envs->g_size * 3; +double *g11 = g10 + envs->g_size * 3; +double *g12 = g11 + envs->g_size * 3; +double *g13 = g12 + envs->g_size * 3; +double *g14 = g13 + envs->g_size * 3; +double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0, 0); +G2E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); +double s[81]; +for (n = 0; n < nf; n++) { +ix = idx[0+n*3]; +iy = idx[1+n*3]; +iz = idx[2+n*3]; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0] + s[12] + s[24]; +gout[n*9+1] = + s[27] + s[39] + s[51]; +gout[n*9+2] = + s[54] + s[66] + s[78]; +gout[n*9+3] = + s[1] + s[13] + s[25]; +gout[n*9+4] = + s[28] + s[40] + s[52]; +gout[n*9+5] = + s[55] + s[67] + s[79]; +gout[n*9+6] = + s[2] + s[14] + s[26]; +gout[n*9+7] = + s[29] + s[41] + s[53]; +gout[n*9+8] = + s[56] + s[68] + s[80]; +} else { gout[n*9+0] += + s[0] + s[12] + s[24]; gout[n*9+1] += + s[27] + s[39] + s[51]; gout[n*9+2] += + s[54] + s[66] + s[78]; @@ -1591,7 +1755,7 @@ gout[n*9+5] += + s[55] + s[67] + s[79]; gout[n*9+6] += + s[2] + s[14] + s[26]; gout[n*9+7] += + s[29] + s[41] + s[53]; gout[n*9+8] += + s[56] + s[68] + s[80]; -}} +}}} void int1e_ipprinvpip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 2, 0, 0, 4, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1625,124 +1789,166 @@ ALL_CINT1E_FORTRAN_(int1e_ipprinvpip) /* */ void CINTgout1e_int1e_ipipspnucsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; -double *g4 = g3 + envs->g_size * 3; -double *g5 = g4 + envs->g_size * 3; -double *g6 = g5 + envs->g_size * 3; -double *g7 = g6 + envs->g_size * 3; -double *g8 = g7 + envs->g_size * 3; -double *g9 = g8 + envs->g_size * 3; -double *g10 = g9 + envs->g_size * 3; -double *g11 = g10 + envs->g_size * 3; -double *g12 = g11 + envs->g_size * 3; -double *g13 = g12 + envs->g_size * 3; -double *g14 = g13 + envs->g_size * 3; -double *g15 = g14 + envs->g_size * 3; -double s[81]; -G1E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); -for (n = 0; n < nf; n++) { -ix = idx[0+n*3]; -iy = idx[1+n*3]; -iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +double *g4 = g3 + envs->g_size * 3; +double *g5 = g4 + envs->g_size * 3; +double *g6 = g5 + envs->g_size * 3; +double *g7 = g6 + envs->g_size * 3; +double *g8 = g7 + envs->g_size * 3; +double *g9 = g8 + envs->g_size * 3; +double *g10 = g9 + envs->g_size * 3; +double *g11 = g10 + envs->g_size * 3; +double *g12 = g11 + envs->g_size * 3; +double *g13 = g12 + envs->g_size * 3; +double *g14 = g13 + envs->g_size * 3; +double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); +double s[81]; +for (n = 0; n < nf; n++) { +ix = idx[0+n*3]; +iy = idx[1+n*3]; +iz = idx[2+n*3]; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*36+0] = + s[29] - s[55]; +gout[n*36+1] = + s[54] - s[2]; +gout[n*36+2] = + s[1] - s[27]; +gout[n*36+3] = + s[0] + s[28] + s[56]; +gout[n*36+4] = + s[32] - s[58]; +gout[n*36+5] = + s[57] - s[5]; +gout[n*36+6] = + s[4] - s[30]; +gout[n*36+7] = + s[3] + s[31] + s[59]; +gout[n*36+8] = + s[35] - s[61]; +gout[n*36+9] = + s[60] - s[8]; +gout[n*36+10] = + s[7] - s[33]; +gout[n*36+11] = + s[6] + s[34] + s[62]; +gout[n*36+12] = + s[38] - s[64]; +gout[n*36+13] = + s[63] - s[11]; +gout[n*36+14] = + s[10] - s[36]; +gout[n*36+15] = + s[9] + s[37] + s[65]; +gout[n*36+16] = + s[41] - s[67]; +gout[n*36+17] = + s[66] - s[14]; +gout[n*36+18] = + s[13] - s[39]; +gout[n*36+19] = + s[12] + s[40] + s[68]; +gout[n*36+20] = + s[44] - s[70]; +gout[n*36+21] = + s[69] - s[17]; +gout[n*36+22] = + s[16] - s[42]; +gout[n*36+23] = + s[15] + s[43] + s[71]; +gout[n*36+24] = + s[47] - s[73]; +gout[n*36+25] = + s[72] - s[20]; +gout[n*36+26] = + s[19] - s[45]; +gout[n*36+27] = + s[18] + s[46] + s[74]; +gout[n*36+28] = + s[50] - s[76]; +gout[n*36+29] = + s[75] - s[23]; +gout[n*36+30] = + s[22] - s[48]; +gout[n*36+31] = + s[21] + s[49] + s[77]; +gout[n*36+32] = + s[53] - s[79]; +gout[n*36+33] = + s[78] - s[26]; +gout[n*36+34] = + s[25] - s[51]; +gout[n*36+35] = + s[24] + s[52] + s[80]; +} else { gout[n*36+0] += + s[29] - s[55]; gout[n*36+1] += + s[54] - s[2]; gout[n*36+2] += + s[1] - s[27]; @@ -1777,160 +1983,202 @@ gout[n*36+30] += + s[22] - s[48]; gout[n*36+31] += + s[21] + s[49] + s[77]; gout[n*36+32] += + s[53] - s[79]; gout[n*36+33] += + s[78] - s[26]; -gout[n*36+34] += + s[25] - s[51]; -gout[n*36+35] += + s[24] + s[52] + s[80]; -}} -void int1e_ipipspnucsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; -CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); -} -CACHE_SIZE_T int1e_ipipspnucsp_cart(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ipipspnucsp; -return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 2); -} // int1e_ipipspnucsp_cart -CACHE_SIZE_T int1e_ipipspnucsp_sph(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ipipspnucsp; -return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 2); -} // int1e_ipipspnucsp_sph -CACHE_SIZE_T int1e_ipipspnucsp_spinor(double complex *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ipipspnucsp; -return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_si_1e, 2); -} // int1e_ipipspnucsp_spinor -ALL_CINT1E(int1e_ipipspnucsp) -ALL_CINT1E_FORTRAN_(int1e_ipipspnucsp) -/* */ -void CINTgout1e_int1e_ipspnucspip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { -FINT nf = envs->nf; -FINT ix, iy, iz, n; -double *g0 = g; -double *g1 = g0 + envs->g_size * 3; -double *g2 = g1 + envs->g_size * 3; -double *g3 = g2 + envs->g_size * 3; -double *g4 = g3 + envs->g_size * 3; -double *g5 = g4 + envs->g_size * 3; -double *g6 = g5 + envs->g_size * 3; -double *g7 = g6 + envs->g_size * 3; -double *g8 = g7 + envs->g_size * 3; -double *g9 = g8 + envs->g_size * 3; -double *g10 = g9 + envs->g_size * 3; -double *g11 = g10 + envs->g_size * 3; -double *g12 = g11 + envs->g_size * 3; -double *g13 = g12 + envs->g_size * 3; -double *g14 = g13 + envs->g_size * 3; -double *g15 = g14 + envs->g_size * 3; -double s[81]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0); -G1E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); -for (n = 0; n < nf; n++) { -ix = idx[0+n*3]; -iy = idx[1+n*3]; -iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +gout[n*36+34] += + s[25] - s[51]; +gout[n*36+35] += + s[24] + s[52] + s[80]; +}}} +void int1e_ipipspnucsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { +FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; +CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); +} +CACHE_SIZE_T int1e_ipipspnucsp_cart(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_ipipspnucsp; +return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 2); +} // int1e_ipipspnucsp_cart +CACHE_SIZE_T int1e_ipipspnucsp_sph(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_ipipspnucsp; +return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 2); +} // int1e_ipipspnucsp_sph +CACHE_SIZE_T int1e_ipipspnucsp_spinor(double complex *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_ipipspnucsp; +return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_si_1e, 2); +} // int1e_ipipspnucsp_spinor +ALL_CINT1E(int1e_ipipspnucsp) +ALL_CINT1E_FORTRAN_(int1e_ipipspnucsp) +/* */ +void CINTgout1e_int1e_ipspnucspip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { +FINT nf = envs->nf; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; +double *g0 = g; +double *g1 = g0 + envs->g_size * 3; +double *g2 = g1 + envs->g_size * 3; +double *g3 = g2 + envs->g_size * 3; +double *g4 = g3 + envs->g_size * 3; +double *g5 = g4 + envs->g_size * 3; +double *g6 = g5 + envs->g_size * 3; +double *g7 = g6 + envs->g_size * 3; +double *g8 = g7 + envs->g_size * 3; +double *g9 = g8 + envs->g_size * 3; +double *g10 = g9 + envs->g_size * 3; +double *g11 = g10 + envs->g_size * 3; +double *g12 = g11 + envs->g_size * 3; +double *g13 = g12 + envs->g_size * 3; +double *g14 = g13 + envs->g_size * 3; +double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0, 0); +G2E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); +double s[81]; +for (n = 0; n < nf; n++) { +ix = idx[0+n*3]; +iy = idx[1+n*3]; +iz = idx[2+n*3]; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*36+0] = + s[33] - s[57]; +gout[n*36+1] = + s[54] - s[6]; +gout[n*36+2] = + s[3] - s[27]; +gout[n*36+3] = + s[0] + s[30] + s[60]; +gout[n*36+4] = + s[34] - s[58]; +gout[n*36+5] = + s[55] - s[7]; +gout[n*36+6] = + s[4] - s[28]; +gout[n*36+7] = + s[1] + s[31] + s[61]; +gout[n*36+8] = + s[35] - s[59]; +gout[n*36+9] = + s[56] - s[8]; +gout[n*36+10] = + s[5] - s[29]; +gout[n*36+11] = + s[2] + s[32] + s[62]; +gout[n*36+12] = + s[42] - s[66]; +gout[n*36+13] = + s[63] - s[15]; +gout[n*36+14] = + s[12] - s[36]; +gout[n*36+15] = + s[9] + s[39] + s[69]; +gout[n*36+16] = + s[43] - s[67]; +gout[n*36+17] = + s[64] - s[16]; +gout[n*36+18] = + s[13] - s[37]; +gout[n*36+19] = + s[10] + s[40] + s[70]; +gout[n*36+20] = + s[44] - s[68]; +gout[n*36+21] = + s[65] - s[17]; +gout[n*36+22] = + s[14] - s[38]; +gout[n*36+23] = + s[11] + s[41] + s[71]; +gout[n*36+24] = + s[51] - s[75]; +gout[n*36+25] = + s[72] - s[24]; +gout[n*36+26] = + s[21] - s[45]; +gout[n*36+27] = + s[18] + s[48] + s[78]; +gout[n*36+28] = + s[52] - s[76]; +gout[n*36+29] = + s[73] - s[25]; +gout[n*36+30] = + s[22] - s[46]; +gout[n*36+31] = + s[19] + s[49] + s[79]; +gout[n*36+32] = + s[53] - s[77]; +gout[n*36+33] = + s[74] - s[26]; +gout[n*36+34] = + s[23] - s[47]; +gout[n*36+35] = + s[20] + s[50] + s[80]; +} else { gout[n*36+0] += + s[33] - s[57]; gout[n*36+1] += + s[54] - s[6]; gout[n*36+2] += + s[3] - s[27]; @@ -1967,7 +2215,7 @@ gout[n*36+32] += + s[53] - s[77]; gout[n*36+33] += + s[74] - s[26]; gout[n*36+34] += + s[23] - s[47]; gout[n*36+35] += + s[20] + s[50] + s[80]; -}} +}}} void int1e_ipspnucspip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 2, 0, 0, 4, 4, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2001,7 +2249,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipspnucspip) /* */ void CINTgout1e_int1e_ipipsprinvsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -2018,107 +2267,148 @@ double *g12 = g11 + envs->g_size * 3; double *g13 = g12 + envs->g_size * 3; double *g14 = g13 + envs->g_size * 3; double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); double s[81]; -G1E_D_J(g1, g0, envs->i_l+3, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+2, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*36+0] = + s[29] - s[55]; +gout[n*36+1] = + s[54] - s[2]; +gout[n*36+2] = + s[1] - s[27]; +gout[n*36+3] = + s[0] + s[28] + s[56]; +gout[n*36+4] = + s[32] - s[58]; +gout[n*36+5] = + s[57] - s[5]; +gout[n*36+6] = + s[4] - s[30]; +gout[n*36+7] = + s[3] + s[31] + s[59]; +gout[n*36+8] = + s[35] - s[61]; +gout[n*36+9] = + s[60] - s[8]; +gout[n*36+10] = + s[7] - s[33]; +gout[n*36+11] = + s[6] + s[34] + s[62]; +gout[n*36+12] = + s[38] - s[64]; +gout[n*36+13] = + s[63] - s[11]; +gout[n*36+14] = + s[10] - s[36]; +gout[n*36+15] = + s[9] + s[37] + s[65]; +gout[n*36+16] = + s[41] - s[67]; +gout[n*36+17] = + s[66] - s[14]; +gout[n*36+18] = + s[13] - s[39]; +gout[n*36+19] = + s[12] + s[40] + s[68]; +gout[n*36+20] = + s[44] - s[70]; +gout[n*36+21] = + s[69] - s[17]; +gout[n*36+22] = + s[16] - s[42]; +gout[n*36+23] = + s[15] + s[43] + s[71]; +gout[n*36+24] = + s[47] - s[73]; +gout[n*36+25] = + s[72] - s[20]; +gout[n*36+26] = + s[19] - s[45]; +gout[n*36+27] = + s[18] + s[46] + s[74]; +gout[n*36+28] = + s[50] - s[76]; +gout[n*36+29] = + s[75] - s[23]; +gout[n*36+30] = + s[22] - s[48]; +gout[n*36+31] = + s[21] + s[49] + s[77]; +gout[n*36+32] = + s[53] - s[79]; +gout[n*36+33] = + s[78] - s[26]; +gout[n*36+34] = + s[25] - s[51]; +gout[n*36+35] = + s[24] + s[52] + s[80]; +} else { gout[n*36+0] += + s[29] - s[55]; gout[n*36+1] += + s[54] - s[2]; gout[n*36+2] += + s[1] - s[27]; @@ -2155,7 +2445,7 @@ gout[n*36+32] += + s[53] - s[79]; gout[n*36+33] += + s[78] - s[26]; gout[n*36+34] += + s[25] - s[51]; gout[n*36+35] += + s[24] + s[52] + s[80]; -}} +}}} void int1e_ipipsprinvsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {3, 1, 0, 0, 4, 4, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2189,7 +2479,8 @@ ALL_CINT1E_FORTRAN_(int1e_ipipsprinvsp) /* */ void CINTgout1e_int1e_ipsprinvspip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -2206,107 +2497,148 @@ double *g12 = g11 + envs->g_size * 3; double *g13 = g12 + envs->g_size * 3; double *g14 = g13 + envs->g_size * 3; double *g15 = g14 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0, 0); +G2E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0, 0); double s[81]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+2, envs->j_l+1, 0); -G1E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g4, g0, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g8, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g9, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g10, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g11, g3, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g12, g4, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g13, g5, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g14, g6, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g15, g7, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g15[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g14[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g14[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g13[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g12[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g12[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g13[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g12[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g12[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g11[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g10[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g10[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g9[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g8[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g8[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g9[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g8[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g8[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g11[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g10[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g10[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g9[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g8[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g8[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g9[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g8[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g8[ix+0]*g0[iy+0]*g7[iz+0]; -s[27] = + g7[ix+0]*g8[iy+0]*g0[iz+0]; -s[28] = + g6[ix+0]*g9[iy+0]*g0[iz+0]; -s[29] = + g6[ix+0]*g8[iy+0]*g1[iz+0]; -s[30] = + g5[ix+0]*g10[iy+0]*g0[iz+0]; -s[31] = + g4[ix+0]*g11[iy+0]*g0[iz+0]; -s[32] = + g4[ix+0]*g10[iy+0]*g1[iz+0]; -s[33] = + g5[ix+0]*g8[iy+0]*g2[iz+0]; -s[34] = + g4[ix+0]*g9[iy+0]*g2[iz+0]; -s[35] = + g4[ix+0]*g8[iy+0]*g3[iz+0]; -s[36] = + g3[ix+0]*g12[iy+0]*g0[iz+0]; -s[37] = + g2[ix+0]*g13[iy+0]*g0[iz+0]; -s[38] = + g2[ix+0]*g12[iy+0]*g1[iz+0]; -s[39] = + g1[ix+0]*g14[iy+0]*g0[iz+0]; -s[40] = + g0[ix+0]*g15[iy+0]*g0[iz+0]; -s[41] = + g0[ix+0]*g14[iy+0]*g1[iz+0]; -s[42] = + g1[ix+0]*g12[iy+0]*g2[iz+0]; -s[43] = + g0[ix+0]*g13[iy+0]*g2[iz+0]; -s[44] = + g0[ix+0]*g12[iy+0]*g3[iz+0]; -s[45] = + g3[ix+0]*g8[iy+0]*g4[iz+0]; -s[46] = + g2[ix+0]*g9[iy+0]*g4[iz+0]; -s[47] = + g2[ix+0]*g8[iy+0]*g5[iz+0]; -s[48] = + g1[ix+0]*g10[iy+0]*g4[iz+0]; -s[49] = + g0[ix+0]*g11[iy+0]*g4[iz+0]; -s[50] = + g0[ix+0]*g10[iy+0]*g5[iz+0]; -s[51] = + g1[ix+0]*g8[iy+0]*g6[iz+0]; -s[52] = + g0[ix+0]*g9[iy+0]*g6[iz+0]; -s[53] = + g0[ix+0]*g8[iy+0]*g7[iz+0]; -s[54] = + g7[ix+0]*g0[iy+0]*g8[iz+0]; -s[55] = + g6[ix+0]*g1[iy+0]*g8[iz+0]; -s[56] = + g6[ix+0]*g0[iy+0]*g9[iz+0]; -s[57] = + g5[ix+0]*g2[iy+0]*g8[iz+0]; -s[58] = + g4[ix+0]*g3[iy+0]*g8[iz+0]; -s[59] = + g4[ix+0]*g2[iy+0]*g9[iz+0]; -s[60] = + g5[ix+0]*g0[iy+0]*g10[iz+0]; -s[61] = + g4[ix+0]*g1[iy+0]*g10[iz+0]; -s[62] = + g4[ix+0]*g0[iy+0]*g11[iz+0]; -s[63] = + g3[ix+0]*g4[iy+0]*g8[iz+0]; -s[64] = + g2[ix+0]*g5[iy+0]*g8[iz+0]; -s[65] = + g2[ix+0]*g4[iy+0]*g9[iz+0]; -s[66] = + g1[ix+0]*g6[iy+0]*g8[iz+0]; -s[67] = + g0[ix+0]*g7[iy+0]*g8[iz+0]; -s[68] = + g0[ix+0]*g6[iy+0]*g9[iz+0]; -s[69] = + g1[ix+0]*g4[iy+0]*g10[iz+0]; -s[70] = + g0[ix+0]*g5[iy+0]*g10[iz+0]; -s[71] = + g0[ix+0]*g4[iy+0]*g11[iz+0]; -s[72] = + g3[ix+0]*g0[iy+0]*g12[iz+0]; -s[73] = + g2[ix+0]*g1[iy+0]*g12[iz+0]; -s[74] = + g2[ix+0]*g0[iy+0]*g13[iz+0]; -s[75] = + g1[ix+0]*g2[iy+0]*g12[iz+0]; -s[76] = + g0[ix+0]*g3[iy+0]*g12[iz+0]; -s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; -s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; -s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; -s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +for (i = 0; i < 81; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g15[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g14[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g14[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g13[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g12[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g12[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g13[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g12[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g12[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g11[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g10[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g10[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g9[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g8[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g8[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g9[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g8[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g8[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g11[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g10[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g10[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g9[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g8[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g8[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g9[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g8[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g8[ix+i] * g0[iy+i] * g7[iz+i]; +s[27] += g7[ix+i] * g8[iy+i] * g0[iz+i]; +s[28] += g6[ix+i] * g9[iy+i] * g0[iz+i]; +s[29] += g6[ix+i] * g8[iy+i] * g1[iz+i]; +s[30] += g5[ix+i] * g10[iy+i] * g0[iz+i]; +s[31] += g4[ix+i] * g11[iy+i] * g0[iz+i]; +s[32] += g4[ix+i] * g10[iy+i] * g1[iz+i]; +s[33] += g5[ix+i] * g8[iy+i] * g2[iz+i]; +s[34] += g4[ix+i] * g9[iy+i] * g2[iz+i]; +s[35] += g4[ix+i] * g8[iy+i] * g3[iz+i]; +s[36] += g3[ix+i] * g12[iy+i] * g0[iz+i]; +s[37] += g2[ix+i] * g13[iy+i] * g0[iz+i]; +s[38] += g2[ix+i] * g12[iy+i] * g1[iz+i]; +s[39] += g1[ix+i] * g14[iy+i] * g0[iz+i]; +s[40] += g0[ix+i] * g15[iy+i] * g0[iz+i]; +s[41] += g0[ix+i] * g14[iy+i] * g1[iz+i]; +s[42] += g1[ix+i] * g12[iy+i] * g2[iz+i]; +s[43] += g0[ix+i] * g13[iy+i] * g2[iz+i]; +s[44] += g0[ix+i] * g12[iy+i] * g3[iz+i]; +s[45] += g3[ix+i] * g8[iy+i] * g4[iz+i]; +s[46] += g2[ix+i] * g9[iy+i] * g4[iz+i]; +s[47] += g2[ix+i] * g8[iy+i] * g5[iz+i]; +s[48] += g1[ix+i] * g10[iy+i] * g4[iz+i]; +s[49] += g0[ix+i] * g11[iy+i] * g4[iz+i]; +s[50] += g0[ix+i] * g10[iy+i] * g5[iz+i]; +s[51] += g1[ix+i] * g8[iy+i] * g6[iz+i]; +s[52] += g0[ix+i] * g9[iy+i] * g6[iz+i]; +s[53] += g0[ix+i] * g8[iy+i] * g7[iz+i]; +s[54] += g7[ix+i] * g0[iy+i] * g8[iz+i]; +s[55] += g6[ix+i] * g1[iy+i] * g8[iz+i]; +s[56] += g6[ix+i] * g0[iy+i] * g9[iz+i]; +s[57] += g5[ix+i] * g2[iy+i] * g8[iz+i]; +s[58] += g4[ix+i] * g3[iy+i] * g8[iz+i]; +s[59] += g4[ix+i] * g2[iy+i] * g9[iz+i]; +s[60] += g5[ix+i] * g0[iy+i] * g10[iz+i]; +s[61] += g4[ix+i] * g1[iy+i] * g10[iz+i]; +s[62] += g4[ix+i] * g0[iy+i] * g11[iz+i]; +s[63] += g3[ix+i] * g4[iy+i] * g8[iz+i]; +s[64] += g2[ix+i] * g5[iy+i] * g8[iz+i]; +s[65] += g2[ix+i] * g4[iy+i] * g9[iz+i]; +s[66] += g1[ix+i] * g6[iy+i] * g8[iz+i]; +s[67] += g0[ix+i] * g7[iy+i] * g8[iz+i]; +s[68] += g0[ix+i] * g6[iy+i] * g9[iz+i]; +s[69] += g1[ix+i] * g4[iy+i] * g10[iz+i]; +s[70] += g0[ix+i] * g5[iy+i] * g10[iz+i]; +s[71] += g0[ix+i] * g4[iy+i] * g11[iz+i]; +s[72] += g3[ix+i] * g0[iy+i] * g12[iz+i]; +s[73] += g2[ix+i] * g1[iy+i] * g12[iz+i]; +s[74] += g2[ix+i] * g0[iy+i] * g13[iz+i]; +s[75] += g1[ix+i] * g2[iy+i] * g12[iz+i]; +s[76] += g0[ix+i] * g3[iy+i] * g12[iz+i]; +s[77] += g0[ix+i] * g2[iy+i] * g13[iz+i]; +s[78] += g1[ix+i] * g0[iy+i] * g14[iz+i]; +s[79] += g0[ix+i] * g1[iy+i] * g14[iz+i]; +s[80] += g0[ix+i] * g0[iy+i] * g15[iz+i]; +} +if (gout_empty) { +gout[n*36+0] = + s[33] - s[57]; +gout[n*36+1] = + s[54] - s[6]; +gout[n*36+2] = + s[3] - s[27]; +gout[n*36+3] = + s[0] + s[30] + s[60]; +gout[n*36+4] = + s[34] - s[58]; +gout[n*36+5] = + s[55] - s[7]; +gout[n*36+6] = + s[4] - s[28]; +gout[n*36+7] = + s[1] + s[31] + s[61]; +gout[n*36+8] = + s[35] - s[59]; +gout[n*36+9] = + s[56] - s[8]; +gout[n*36+10] = + s[5] - s[29]; +gout[n*36+11] = + s[2] + s[32] + s[62]; +gout[n*36+12] = + s[42] - s[66]; +gout[n*36+13] = + s[63] - s[15]; +gout[n*36+14] = + s[12] - s[36]; +gout[n*36+15] = + s[9] + s[39] + s[69]; +gout[n*36+16] = + s[43] - s[67]; +gout[n*36+17] = + s[64] - s[16]; +gout[n*36+18] = + s[13] - s[37]; +gout[n*36+19] = + s[10] + s[40] + s[70]; +gout[n*36+20] = + s[44] - s[68]; +gout[n*36+21] = + s[65] - s[17]; +gout[n*36+22] = + s[14] - s[38]; +gout[n*36+23] = + s[11] + s[41] + s[71]; +gout[n*36+24] = + s[51] - s[75]; +gout[n*36+25] = + s[72] - s[24]; +gout[n*36+26] = + s[21] - s[45]; +gout[n*36+27] = + s[18] + s[48] + s[78]; +gout[n*36+28] = + s[52] - s[76]; +gout[n*36+29] = + s[73] - s[25]; +gout[n*36+30] = + s[22] - s[46]; +gout[n*36+31] = + s[19] + s[49] + s[79]; +gout[n*36+32] = + s[53] - s[77]; +gout[n*36+33] = + s[74] - s[26]; +gout[n*36+34] = + s[23] - s[47]; +gout[n*36+35] = + s[20] + s[50] + s[80]; +} else { gout[n*36+0] += + s[33] - s[57]; gout[n*36+1] += + s[54] - s[6]; gout[n*36+2] += + s[3] - s[27]; @@ -2343,7 +2675,7 @@ gout[n*36+32] += + s[53] - s[77]; gout[n*36+33] += + s[74] - s[26]; gout[n*36+34] += + s[23] - s[47]; gout[n*36+35] += + s[20] + s[50] + s[80]; -}} +}}} void int1e_ipsprinvspip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 2, 0, 0, 4, 4, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); diff --git a/src/autocode/int1e_grids1.c b/src/autocode/int1e_grids1.c index 7996c30d..b1c14558 100644 --- a/src/autocode/int1e_grids1.c +++ b/src/autocode/int1e_grids1.c @@ -78,3 +78,165 @@ return CINT1e_grids_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e_grids); } // int1e_grids_ip_spinor ALL_CINT1E(int1e_grids_ip) ALL_CINT1E_FORTRAN_(int1e_grids_ip) +/* */ +void CINTgout1e_int1e_grids_ipvip(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { +FINT ngrids = envs->ngrids; +FINT bgrids = MIN(ngrids - envs->grids_offset, GRID_BLKSIZE); +FINT nrys_roots = envs->nrys_roots; +FINT nf = envs->nf; +FINT ix, iy, iz, n, i, ig; +double *g0 = g; +double *g1 = g0 + envs->g_size * 3; +double *g2 = g1 + envs->g_size * 3; +double *g3 = g2 + envs->g_size * 3; +double s[GRID_BLKSIZE * 9]; +G1E_GRIDS_D_J(g1, g0, envs->i_l+1, envs->j_l+0); +G1E_GRIDS_D_I(g2, g0, envs->i_l+0, envs->j_l); +G1E_GRIDS_D_I(g3, g1, envs->i_l+0, envs->j_l); +for (n = 0; n < nf; n++) { +ix = idx[0+n*3]; +iy = idx[1+n*3]; +iz = idx[2+n*3]; +for (i = 0; i < 9; i++) { +for (ig = 0; ig < bgrids; ig++) { s[ig+i*GRID_BLKSIZE] = 0; }} +for (i = 0; i < nrys_roots; i++) { +for (ig = 0; ig < bgrids; ig++) { +s[ig+GRID_BLKSIZE*0] += g3[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*1] += g2[ix+ig+i*GRID_BLKSIZE] * g1[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*2] += g2[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g1[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*3] += g1[ix+ig+i*GRID_BLKSIZE] * g2[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*4] += g0[ix+ig+i*GRID_BLKSIZE] * g3[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*5] += g0[ix+ig+i*GRID_BLKSIZE] * g2[iy+ig+i*GRID_BLKSIZE] * g1[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*6] += g1[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g2[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*7] += g0[ix+ig+i*GRID_BLKSIZE] * g1[iy+ig+i*GRID_BLKSIZE] * g2[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*8] += g0[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g3[iz+ig+i*GRID_BLKSIZE]; +}}; +if (gout_empty) { +for (ig = 0; ig < bgrids; ig++) { +gout[ig+bgrids*(n*9+0)] = + s[ig+GRID_BLKSIZE*0]; +gout[ig+bgrids*(n*9+1)] = + s[ig+GRID_BLKSIZE*1]; +gout[ig+bgrids*(n*9+2)] = + s[ig+GRID_BLKSIZE*2]; +gout[ig+bgrids*(n*9+3)] = + s[ig+GRID_BLKSIZE*3]; +gout[ig+bgrids*(n*9+4)] = + s[ig+GRID_BLKSIZE*4]; +gout[ig+bgrids*(n*9+5)] = + s[ig+GRID_BLKSIZE*5]; +gout[ig+bgrids*(n*9+6)] = + s[ig+GRID_BLKSIZE*6]; +gout[ig+bgrids*(n*9+7)] = + s[ig+GRID_BLKSIZE*7]; +gout[ig+bgrids*(n*9+8)] = + s[ig+GRID_BLKSIZE*8]; +}} else { +for (ig = 0; ig < bgrids; ig++) { +gout[ig+bgrids*(n*9+0)] += + s[ig+GRID_BLKSIZE*0]; +gout[ig+bgrids*(n*9+1)] += + s[ig+GRID_BLKSIZE*1]; +gout[ig+bgrids*(n*9+2)] += + s[ig+GRID_BLKSIZE*2]; +gout[ig+bgrids*(n*9+3)] += + s[ig+GRID_BLKSIZE*3]; +gout[ig+bgrids*(n*9+4)] += + s[ig+GRID_BLKSIZE*4]; +gout[ig+bgrids*(n*9+5)] += + s[ig+GRID_BLKSIZE*5]; +gout[ig+bgrids*(n*9+6)] += + s[ig+GRID_BLKSIZE*6]; +gout[ig+bgrids*(n*9+7)] += + s[ig+GRID_BLKSIZE*7]; +gout[ig+bgrids*(n*9+8)] += + s[ig+GRID_BLKSIZE*8]; +}}}} +void int1e_grids_ipvip_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { +FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 9}; +CINTall_1e_grids_optimizer(opt, ng, atm, natm, bas, nbas, env); +} +CACHE_SIZE_T int1e_grids_ipvip_cart(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_grids_ipvip; +return CINT1e_grids_drv(out, dims, &envs, cache, &c2s_cart_1e_grids); +} // int1e_grids_ipvip_cart +CACHE_SIZE_T int1e_grids_ipvip_sph(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_grids_ipvip; +return CINT1e_grids_drv(out, dims, &envs, cache, &c2s_sph_1e_grids); +} // int1e_grids_ipvip_sph +CACHE_SIZE_T int1e_grids_ipvip_spinor(double complex *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 9}; +CINTEnvVars envs; +CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_grids_ipvip; +return CINT1e_grids_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e_grids); +} // int1e_grids_ipvip_spinor +ALL_CINT1E(int1e_grids_ipvip) +ALL_CINT1E_FORTRAN_(int1e_grids_ipvip) +/* */ +void CINTgout1e_int1e_grids_spvsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { +FINT ngrids = envs->ngrids; +FINT bgrids = MIN(ngrids - envs->grids_offset, GRID_BLKSIZE); +FINT nrys_roots = envs->nrys_roots; +FINT nf = envs->nf; +FINT ix, iy, iz, n, i, ig; +double *g0 = g; +double *g1 = g0 + envs->g_size * 3; +double *g2 = g1 + envs->g_size * 3; +double *g3 = g2 + envs->g_size * 3; +double s[GRID_BLKSIZE * 9]; +G1E_GRIDS_D_J(g1, g0, envs->i_l+1, envs->j_l+0); +G1E_GRIDS_D_I(g2, g0, envs->i_l+0, envs->j_l); +G1E_GRIDS_D_I(g3, g1, envs->i_l+0, envs->j_l); +for (n = 0; n < nf; n++) { +ix = idx[0+n*3]; +iy = idx[1+n*3]; +iz = idx[2+n*3]; +for (i = 0; i < 9; i++) { +for (ig = 0; ig < bgrids; ig++) { s[ig+i*GRID_BLKSIZE] = 0; }} +for (i = 0; i < nrys_roots; i++) { +for (ig = 0; ig < bgrids; ig++) { +s[ig+GRID_BLKSIZE*0] += g3[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*1] += g2[ix+ig+i*GRID_BLKSIZE] * g1[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*2] += g2[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g1[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*3] += g1[ix+ig+i*GRID_BLKSIZE] * g2[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*4] += g0[ix+ig+i*GRID_BLKSIZE] * g3[iy+ig+i*GRID_BLKSIZE] * g0[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*5] += g0[ix+ig+i*GRID_BLKSIZE] * g2[iy+ig+i*GRID_BLKSIZE] * g1[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*6] += g1[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g2[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*7] += g0[ix+ig+i*GRID_BLKSIZE] * g1[iy+ig+i*GRID_BLKSIZE] * g2[iz+ig+i*GRID_BLKSIZE]; +s[ig+GRID_BLKSIZE*8] += g0[ix+ig+i*GRID_BLKSIZE] * g0[iy+ig+i*GRID_BLKSIZE] * g3[iz+ig+i*GRID_BLKSIZE]; +}}; +if (gout_empty) { +for (ig = 0; ig < bgrids; ig++) { +gout[ig+bgrids*(n*4+0)] = + s[ig+GRID_BLKSIZE*5] - s[ig+GRID_BLKSIZE*7]; +gout[ig+bgrids*(n*4+1)] = + s[ig+GRID_BLKSIZE*6] - s[ig+GRID_BLKSIZE*2]; +gout[ig+bgrids*(n*4+2)] = + s[ig+GRID_BLKSIZE*1] - s[ig+GRID_BLKSIZE*3]; +gout[ig+bgrids*(n*4+3)] = + s[ig+GRID_BLKSIZE*0] + s[ig+GRID_BLKSIZE*4] + s[ig+GRID_BLKSIZE*8]; +}} else { +for (ig = 0; ig < bgrids; ig++) { +gout[ig+bgrids*(n*4+0)] += + s[ig+GRID_BLKSIZE*5] - s[ig+GRID_BLKSIZE*7]; +gout[ig+bgrids*(n*4+1)] += + s[ig+GRID_BLKSIZE*6] - s[ig+GRID_BLKSIZE*2]; +gout[ig+bgrids*(n*4+2)] += + s[ig+GRID_BLKSIZE*1] - s[ig+GRID_BLKSIZE*3]; +gout[ig+bgrids*(n*4+3)] += + s[ig+GRID_BLKSIZE*0] + s[ig+GRID_BLKSIZE*4] + s[ig+GRID_BLKSIZE*8]; +}}}} +void int1e_grids_spvsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { +FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 1}; +CINTall_1e_grids_optimizer(opt, ng, atm, natm, bas, nbas, env); +} +CACHE_SIZE_T int1e_grids_spvsp_cart(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 1}; +CINTEnvVars envs; +CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_grids_spvsp; +return CINT1e_grids_drv(out, dims, &envs, cache, &c2s_cart_1e_grids); +} // int1e_grids_spvsp_cart +CACHE_SIZE_T int1e_grids_spvsp_sph(double *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 1}; +CINTEnvVars envs; +CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_grids_spvsp; +return CINT1e_grids_drv(out, dims, &envs, cache, &c2s_sph_1e_grids); +} // int1e_grids_spvsp_sph +CACHE_SIZE_T int1e_grids_spvsp_spinor(double complex *out, FINT *dims, FINT *shls, +FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { +FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 1}; +CINTEnvVars envs; +CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); +envs.f_gout = &CINTgout1e_int1e_grids_spvsp; +return CINT1e_grids_spinor_drv(out, dims, &envs, cache, &c2s_si_1e_grids); +} // int1e_grids_spvsp_spinor +ALL_CINT1E(int1e_grids_spvsp) +ALL_CINT1E_FORTRAN_(int1e_grids_spvsp) diff --git a/src/autocode/intor1.c b/src/autocode/intor1.c index 97c36b7b..9499eb6b 100644 --- a/src/autocode/intor1.c +++ b/src/autocode/intor1.c @@ -14,92 +14,6 @@ #include "cint2e.h" #include "misc.h" #include "c2f.h" -/* */ -void CINTgout1e_int1e_ovlp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { -FINT nf = envs->nf; -FINT ix, iy, iz, n; -double *g0 = g; -double s[1]; -for (n = 0; n < nf; n++) { -ix = idx[0+n*3]; -iy = idx[1+n*3]; -iz = idx[2+n*3]; -s[0] = + g0[ix+0]*g0[iy+0]*g0[iz+0]; -gout[n*1+0] += + s[0]; -}} -void int1e_ovlp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; -CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); -} -CACHE_SIZE_T int1e_ovlp_cart(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ovlp; -return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 0); -} // int1e_ovlp_cart -CACHE_SIZE_T int1e_ovlp_sph(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ovlp; -return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 0); -} // int1e_ovlp_sph -CACHE_SIZE_T int1e_ovlp_spinor(double complex *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_ovlp; -return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 0); -} // int1e_ovlp_spinor -ALL_CINT1E(int1e_ovlp) -ALL_CINT1E_FORTRAN_(int1e_ovlp) -/* */ -void CINTgout1e_int1e_nuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { -FINT nf = envs->nf; -FINT ix, iy, iz, n; -double *g0 = g; -double s[1]; -for (n = 0; n < nf; n++) { -ix = idx[0+n*3]; -iy = idx[1+n*3]; -iz = idx[2+n*3]; -s[0] = + g0[ix+0]*g0[iy+0]*g0[iz+0]; -gout[n*1+0] += + s[0]; -}} -void int1e_nuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; -CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); -} -CACHE_SIZE_T int1e_nuc_cart(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_nuc; -return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 2); -} // int1e_nuc_cart -CACHE_SIZE_T int1e_nuc_sph(double *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_nuc; -return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 2); -} // int1e_nuc_sph -CACHE_SIZE_T int1e_nuc_spinor(double complex *out, FINT *dims, FINT *shls, -FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; -CINTEnvVars envs; -CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); -envs.f_gout = &CINTgout1e_int1e_nuc; -return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 2); -} // int1e_nuc_spinor -ALL_CINT1E(int1e_nuc) -ALL_CINT1E_FORTRAN_(int1e_nuc) /* */ void CINTgout1e_int1e_kin(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; @@ -125,8 +39,11 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*1+0] = - s[0] - s[4] - s[8]; +} else { gout[n*1+0] += - s[0] - s[4] - s[8]; -}} +}}} void int1e_kin_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -163,41 +80,50 @@ ALL_CINT1E_FORTRAN_(int1e_kin) /* */ void CINTgout1e_int1e_ia01p(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; -double s[9]; -G1E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0); -G1E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0); +G2E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0, 0); +G2E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g2[ix] += g3[ix];} -G1E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0); +G2E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0, 0); +double s[9]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[5] - s[7]; +gout[n*3+1] = + s[6] - s[2]; +gout[n*3+2] = + s[1] - s[3]; +} else { gout[n*3+0] += + s[5] - s[7]; gout[n*3+1] += + s[6] - s[2]; gout[n*3+2] += + s[1] - s[3]; -}} +}}} void int1e_ia01p_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_ia01p_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_ia01p; @@ -205,7 +131,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_ia01p_cart CACHE_SIZE_T int1e_ia01p_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_ia01p; @@ -213,7 +139,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_ia01p_sph CACHE_SIZE_T int1e_ia01p_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_ia01p; @@ -246,10 +172,15 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*3+0] = + s[5] - s[7]; +gout[n*3+1] = + s[6] - s[2]; +gout[n*3+2] = + s[1] - s[3]; +} else { gout[n*3+0] += + s[5] - s[7]; gout[n*3+1] += + s[6] - s[2]; gout[n*3+2] += + s[1] - s[3]; -}} +}}} void int1e_giao_irjxp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -309,10 +240,15 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*3+0] = + s[5] - s[7]; +gout[n*3+1] = + s[6] - s[2]; +gout[n*3+2] = + s[1] - s[3]; +} else { gout[n*3+0] += + s[5] - s[7]; gout[n*3+1] += + s[6] - s[2]; gout[n*3+2] += + s[1] - s[3]; -}} +}}} void int1e_cg_irxp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -346,30 +282,45 @@ ALL_CINT1E_FORTRAN_(int1e_cg_irxp) /* */ void CINTgout1e_int1e_giao_a11part(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; -double s[9]; -G1E_R_J(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0); -G1E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0); +G2E_R_J(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0, 0); +G2E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g2[ix] += g3[ix];} -G1E_R_J(g3, g2, envs->i_l+0, envs->j_l+0, 0); +G2E_R_J(g3, g2, envs->i_l+0, envs->j_l+0, 0, 0); +double s[9]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -379,14 +330,14 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_giao_a11part_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_giao_a11part_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_giao_a11part; @@ -395,7 +346,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_giao_a11part_cart CACHE_SIZE_T int1e_giao_a11part_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_giao_a11part; @@ -404,7 +355,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_giao_a11part_sph CACHE_SIZE_T int1e_giao_a11part_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_giao_a11part; @@ -416,7 +367,8 @@ ALL_CINT1E_FORTRAN_(int1e_giao_a11part) /* */ void CINTgout1e_int1e_cg_a11part(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -425,25 +377,39 @@ double drj[3]; drj[0] = envs->rj[0] - envs->env[PTR_COMMON_ORIG+0]; drj[1] = envs->rj[1] - envs->env[PTR_COMMON_ORIG+1]; drj[2] = envs->rj[2] - envs->env[PTR_COMMON_ORIG+2]; -double s[9]; -G1E_RCJ(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0); -G1E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0); +G2E_RCJ(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0, 0); +G2E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g2[ix] += g3[ix];} -G1E_RCJ(g3, g2, envs->i_l+0, envs->j_l+0, 0); +G2E_RCJ(g3, g2, envs->i_l+0, envs->j_l+0, 0, 0); +double s[9]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -453,14 +419,14 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_cg_a11part_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_cg_a11part_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_cg_a11part; @@ -469,7 +435,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_cg_a11part_cart CACHE_SIZE_T int1e_cg_a11part_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_cg_a11part; @@ -478,7 +444,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_cg_a11part_sph CACHE_SIZE_T int1e_cg_a11part_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; +FINT ng[] = {1, 2, 0, 0, 2, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_cg_a11part; @@ -490,7 +456,8 @@ ALL_CINT1E_FORTRAN_(int1e_cg_a11part) /* */ void CINTgout1e_int1e_a01gp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -506,47 +473,61 @@ rirj[2] = envs->ri[2] - envs->rj[2]; c[0] = 1 * rirj[0]; c[1] = 1 * rirj[1]; c[2] = 1 * rirj[2]; -double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+1, envs->j_l+1, 0); -G1E_D_I(g3, g0, envs->i_l+1, envs->j_l+1, 0); +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+1, envs->j_l+1, 0, 0); +G2E_D_I(g3, g0, envs->i_l+1, envs->j_l+1, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g2[ix] += g3[ix];} -G1E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0); -G1E_R0I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_R0I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_R0I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_R0I(g7, g3, envs->i_l+0, envs->j_l, 0); +G2E_D_J(g3, g2, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_R0I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_R0I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_R0I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_R0I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); +double s[27]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = + c[1]*s[23] - c[2]*s[14] - c[1]*s[25] + c[2]*s[16]; +gout[n*9+1] = + c[1]*s[24] - c[2]*s[15] - c[1]*s[20] + c[2]*s[11]; +gout[n*9+2] = + c[1]*s[19] - c[2]*s[10] - c[1]*s[21] + c[2]*s[12]; +gout[n*9+3] = + c[2]*s[5] - c[0]*s[23] - c[2]*s[7] + c[0]*s[25]; +gout[n*9+4] = + c[2]*s[6] - c[0]*s[24] - c[2]*s[2] + c[0]*s[20]; +gout[n*9+5] = + c[2]*s[1] - c[0]*s[19] - c[2]*s[3] + c[0]*s[21]; +gout[n*9+6] = + c[0]*s[14] - c[1]*s[5] - c[0]*s[16] + c[1]*s[7]; +gout[n*9+7] = + c[0]*s[15] - c[1]*s[6] - c[0]*s[11] + c[1]*s[2]; +gout[n*9+8] = + c[0]*s[10] - c[1]*s[1] - c[0]*s[12] + c[1]*s[3]; +} else { gout[n*9+0] += + c[1]*s[23] - c[2]*s[14] - c[1]*s[25] + c[2]*s[16]; gout[n*9+1] += + c[1]*s[24] - c[2]*s[15] - c[1]*s[20] + c[2]*s[11]; gout[n*9+2] += + c[1]*s[19] - c[2]*s[10] - c[1]*s[21] + c[2]*s[12]; @@ -556,14 +537,14 @@ gout[n*9+5] += + c[2]*s[1] - c[0]*s[19] - c[2]*s[3] + c[0]*s[21]; gout[n*9+6] += + c[0]*s[14] - c[1]*s[5] - c[0]*s[16] + c[1]*s[7]; gout[n*9+7] += + c[0]*s[15] - c[1]*s[6] - c[0]*s[11] + c[1]*s[2]; gout[n*9+8] += + c[0]*s[10] - c[1]*s[1] - c[0]*s[12] + c[1]*s[3]; -}} +}}} void int1e_a01gp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {1, 2, 0, 0, 3, 1, 0, 9}; +FINT ng[] = {2, 2, 0, 0, 3, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_a01gp_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 2, 0, 0, 3, 1, 0, 9}; +FINT ng[] = {2, 2, 0, 0, 3, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_a01gp; @@ -584,7 +565,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_a01gp_cart CACHE_SIZE_T int1e_a01gp_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 2, 0, 0, 3, 1, 0, 9}; +FINT ng[] = {2, 2, 0, 0, 3, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_a01gp; @@ -605,7 +586,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_a01gp_sph CACHE_SIZE_T int1e_a01gp_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 2, 0, 0, 3, 1, 0, 9}; +FINT ng[] = {2, 2, 0, 0, 3, 1, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_a01gp; @@ -684,10 +665,15 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*3+0] = + c[1]*s[18] - c[2]*s[9] + c[1]*s[22] - c[2]*s[13] + c[1]*s[26] - c[2]*s[17]; +gout[n*3+1] = + c[2]*s[0] - c[0]*s[18] + c[2]*s[4] - c[0]*s[22] + c[2]*s[8] - c[0]*s[26]; +gout[n*3+2] = + c[0]*s[9] - c[1]*s[0] + c[0]*s[13] - c[1]*s[4] + c[0]*s[17] - c[1]*s[8]; +} else { gout[n*3+0] += + c[1]*s[18] - c[2]*s[9] + c[1]*s[22] - c[2]*s[13] + c[1]*s[26] - c[2]*s[17]; gout[n*3+1] += + c[2]*s[0] - c[0]*s[18] + c[2]*s[4] - c[0]*s[22] + c[2]*s[8] - c[0]*s[26]; gout[n*3+2] += + c[0]*s[9] - c[1]*s[0] + c[0]*s[13] - c[1]*s[4] + c[0]*s[17] - c[1]*s[8]; -}} +}}} void int1e_igkin_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 2, 0, 0, 3, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -779,10 +765,15 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*3+0] = - c[1]*s[2] + c[2]*s[1]; +gout[n*3+1] = - c[2]*s[0] + c[0]*s[2]; +gout[n*3+2] = - c[0]*s[1] + c[1]*s[0]; +} else { gout[n*3+0] += - c[1]*s[2] + c[2]*s[1]; gout[n*3+1] += - c[2]*s[0] + c[0]*s[2]; gout[n*3+2] += - c[0]*s[1] + c[1]*s[0]; -}} +}}} void int1e_igovlp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -855,7 +846,8 @@ ALL_CINT1E_FORTRAN_(int1e_igovlp) /* */ void CINTgout1e_int1e_ignuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double rirj[3], c[3]; @@ -865,19 +857,27 @@ rirj[2] = envs->ri[2] - envs->rj[2]; c[0] = 1 * rirj[0]; c[1] = 1 * rirj[1]; c[2] = 1 * rirj[2]; +G2E_R0I(g1, g0, envs->i_l+0, envs->j_l, 0, 0); double s[3]; -G1E_R0I(g1, g0, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +for (i = 0; i < 3; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g1[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g0[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g0[ix+i] * g0[iy+i] * g1[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = - c[1]*s[2] + c[2]*s[1]; +gout[n*3+1] = - c[2]*s[0] + c[0]*s[2]; +gout[n*3+2] = - c[0]*s[1] + c[1]*s[0]; +} else { gout[n*3+0] += - c[1]*s[2] + c[2]*s[1]; gout[n*3+1] += - c[2]*s[0] + c[0]*s[2]; gout[n*3+2] += - c[0]*s[1] + c[1]*s[0]; -}} +}}} void int1e_ignuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -950,30 +950,37 @@ ALL_CINT1E_FORTRAN_(int1e_ignuc) /* */ void CINTgout1e_int1e_pnucp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*1+0] = + s[0] + s[4] + s[8]; +} else { gout[n*1+0] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_pnucp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1023,8 +1030,11 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[2]; +} else { gout[n*1+0] += + s[2]; -}} +}}} void int1e_z_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 1, 0, 0, 1, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1084,8 +1094,11 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[8]; +} else { gout[n*1+0] += + s[8]; -}} +}}} void int1e_zz_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1135,10 +1148,15 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*3+0] = + s[0]; +gout[n*3+1] = + s[1]; +gout[n*3+2] = + s[2]; +} else { gout[n*3+0] += + s[0]; gout[n*3+1] += + s[1]; gout[n*3+2] += + s[2]; -}} +}}} void int1e_r_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 1, 0, 0, 1, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1198,8 +1216,11 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[0] + s[4] + s[8]; +} else { gout[n*1+0] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_r2_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1259,6 +1280,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -1268,7 +1300,7 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_rr_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1354,6 +1386,35 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*27+0] = + s[0]; +gout[n*27+1] = + s[1]; +gout[n*27+2] = + s[2]; +gout[n*27+3] = + s[3]; +gout[n*27+4] = + s[4]; +gout[n*27+5] = + s[5]; +gout[n*27+6] = + s[6]; +gout[n*27+7] = + s[7]; +gout[n*27+8] = + s[8]; +gout[n*27+9] = + s[9]; +gout[n*27+10] = + s[10]; +gout[n*27+11] = + s[11]; +gout[n*27+12] = + s[12]; +gout[n*27+13] = + s[13]; +gout[n*27+14] = + s[14]; +gout[n*27+15] = + s[15]; +gout[n*27+16] = + s[16]; +gout[n*27+17] = + s[17]; +gout[n*27+18] = + s[18]; +gout[n*27+19] = + s[19]; +gout[n*27+20] = + s[20]; +gout[n*27+21] = + s[21]; +gout[n*27+22] = + s[22]; +gout[n*27+23] = + s[23]; +gout[n*27+24] = + s[24]; +gout[n*27+25] = + s[25]; +gout[n*27+26] = + s[26]; +} else { gout[n*27+0] += + s[0]; gout[n*27+1] += + s[1]; gout[n*27+2] += + s[2]; @@ -1381,7 +1442,7 @@ gout[n*27+23] += + s[23]; gout[n*27+24] += + s[24]; gout[n*27+25] += + s[25]; gout[n*27+26] += + s[26]; -}} +}}} void int1e_rrr_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 3, 0, 0, 3, 1, 1, 27}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1537,6 +1598,89 @@ s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +if (gout_empty) { +gout[n*81+0] = + s[0]; +gout[n*81+1] = + s[1]; +gout[n*81+2] = + s[2]; +gout[n*81+3] = + s[3]; +gout[n*81+4] = + s[4]; +gout[n*81+5] = + s[5]; +gout[n*81+6] = + s[6]; +gout[n*81+7] = + s[7]; +gout[n*81+8] = + s[8]; +gout[n*81+9] = + s[9]; +gout[n*81+10] = + s[10]; +gout[n*81+11] = + s[11]; +gout[n*81+12] = + s[12]; +gout[n*81+13] = + s[13]; +gout[n*81+14] = + s[14]; +gout[n*81+15] = + s[15]; +gout[n*81+16] = + s[16]; +gout[n*81+17] = + s[17]; +gout[n*81+18] = + s[18]; +gout[n*81+19] = + s[19]; +gout[n*81+20] = + s[20]; +gout[n*81+21] = + s[21]; +gout[n*81+22] = + s[22]; +gout[n*81+23] = + s[23]; +gout[n*81+24] = + s[24]; +gout[n*81+25] = + s[25]; +gout[n*81+26] = + s[26]; +gout[n*81+27] = + s[27]; +gout[n*81+28] = + s[28]; +gout[n*81+29] = + s[29]; +gout[n*81+30] = + s[30]; +gout[n*81+31] = + s[31]; +gout[n*81+32] = + s[32]; +gout[n*81+33] = + s[33]; +gout[n*81+34] = + s[34]; +gout[n*81+35] = + s[35]; +gout[n*81+36] = + s[36]; +gout[n*81+37] = + s[37]; +gout[n*81+38] = + s[38]; +gout[n*81+39] = + s[39]; +gout[n*81+40] = + s[40]; +gout[n*81+41] = + s[41]; +gout[n*81+42] = + s[42]; +gout[n*81+43] = + s[43]; +gout[n*81+44] = + s[44]; +gout[n*81+45] = + s[45]; +gout[n*81+46] = + s[46]; +gout[n*81+47] = + s[47]; +gout[n*81+48] = + s[48]; +gout[n*81+49] = + s[49]; +gout[n*81+50] = + s[50]; +gout[n*81+51] = + s[51]; +gout[n*81+52] = + s[52]; +gout[n*81+53] = + s[53]; +gout[n*81+54] = + s[54]; +gout[n*81+55] = + s[55]; +gout[n*81+56] = + s[56]; +gout[n*81+57] = + s[57]; +gout[n*81+58] = + s[58]; +gout[n*81+59] = + s[59]; +gout[n*81+60] = + s[60]; +gout[n*81+61] = + s[61]; +gout[n*81+62] = + s[62]; +gout[n*81+63] = + s[63]; +gout[n*81+64] = + s[64]; +gout[n*81+65] = + s[65]; +gout[n*81+66] = + s[66]; +gout[n*81+67] = + s[67]; +gout[n*81+68] = + s[68]; +gout[n*81+69] = + s[69]; +gout[n*81+70] = + s[70]; +gout[n*81+71] = + s[71]; +gout[n*81+72] = + s[72]; +gout[n*81+73] = + s[73]; +gout[n*81+74] = + s[74]; +gout[n*81+75] = + s[75]; +gout[n*81+76] = + s[76]; +gout[n*81+77] = + s[77]; +gout[n*81+78] = + s[78]; +gout[n*81+79] = + s[79]; +gout[n*81+80] = + s[80]; +} else { gout[n*81+0] += + s[0]; gout[n*81+1] += + s[1]; gout[n*81+2] += + s[2]; @@ -1618,7 +1762,7 @@ gout[n*81+77] += + s[77]; gout[n*81+78] += + s[78]; gout[n*81+79] += + s[79]; gout[n*81+80] += + s[80]; -}} +}}} void int1e_rrrr_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 4, 0, 0, 4, 1, 1, 81}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1664,8 +1808,11 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[2]; +} else { gout[n*1+0] += + s[2]; -}} +}}} void int1e_z_origj_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 1, 0, 0, 1, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1721,8 +1868,11 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[8]; +} else { gout[n*1+0] += + s[8]; -}} +}}} void int1e_zz_origj_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1768,10 +1918,15 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*3+0] = + s[0]; +gout[n*3+1] = + s[1]; +gout[n*3+2] = + s[2]; +} else { gout[n*3+0] += + s[0]; gout[n*3+1] += + s[1]; gout[n*3+2] += + s[2]; -}} +}}} void int1e_r_origj_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 1, 0, 0, 1, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1827,6 +1982,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -1836,7 +2002,7 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_rr_origj_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1892,8 +2058,11 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[0] + s[4] + s[8]; +} else { gout[n*1+0] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_r2_origj_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2045,8 +2214,11 @@ s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[0] + 2*s[4] + 2*s[8] + s[40] + 2*s[44] + s[80]; +} else { gout[n*1+0] += + s[0] + 2*s[4] + 2*s[8] + s[40] + 2*s[44] + s[80]; -}} +}}} void int1e_r4_origj_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 4, 0, 0, 4, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2198,8 +2370,11 @@ s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[0] + 2*s[4] + 2*s[8] + s[40] + 2*s[44] + s[80]; +} else { gout[n*1+0] += + s[0] + 2*s[4] + 2*s[8] + s[40] + 2*s[44] + s[80]; -}} +}}} void int1e_p4_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 2, 0, 0, 4, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2233,30 +2408,37 @@ ALL_CINT1E_FORTRAN_(int1e_p4) /* */ void CINTgout1e_int1e_prinvp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*1+0] = + s[0] + s[4] + s[8]; +} else { gout[n*1+0] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_prinvp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2290,32 +2472,41 @@ ALL_CINT1E_FORTRAN_(int1e_prinvp) /* */ void CINTgout1e_int1e_prinvxp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[5] - s[7]; +gout[n*3+1] = + s[6] - s[2]; +gout[n*3+2] = + s[1] - s[3]; +} else { gout[n*3+0] += + s[5] - s[7]; gout[n*3+1] += + s[6] - s[2]; gout[n*3+2] += + s[1] - s[3]; -}} +}}} void int1e_prinvxp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2349,32 +2540,41 @@ ALL_CINT1E_FORTRAN_(int1e_prinvxp) /* */ void CINTgout1e_int1e_pnucxp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[5] - s[7]; +gout[n*3+1] = + s[6] - s[2]; +gout[n*3+2] = + s[1] - s[3]; +} else { gout[n*3+0] += + s[5] - s[7]; gout[n*3+1] += + s[6] - s[2]; gout[n*3+2] += + s[1] - s[3]; -}} +}}} void int1e_pnucxp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2434,6 +2634,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*9+0] = + s[0]; +gout[n*9+1] = + s[1]; +gout[n*9+2] = + s[2]; +gout[n*9+3] = + s[3]; +gout[n*9+4] = + s[4]; +gout[n*9+5] = + s[5]; +gout[n*9+6] = + s[6]; +gout[n*9+7] = + s[7]; +gout[n*9+8] = + s[8]; +} else { gout[n*9+0] += + s[0]; gout[n*9+1] += + s[1]; gout[n*9+2] += + s[2]; @@ -2443,7 +2654,7 @@ gout[n*9+5] += + s[5]; gout[n*9+6] += + s[6]; gout[n*9+7] += + s[7]; gout[n*9+8] += + s[8]; -}} +}}} void int1e_irp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2529,6 +2740,35 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*27+0] = + s[0]; +gout[n*27+1] = + s[1]; +gout[n*27+2] = + s[2]; +gout[n*27+3] = + s[3]; +gout[n*27+4] = + s[4]; +gout[n*27+5] = + s[5]; +gout[n*27+6] = + s[6]; +gout[n*27+7] = + s[7]; +gout[n*27+8] = + s[8]; +gout[n*27+9] = + s[9]; +gout[n*27+10] = + s[10]; +gout[n*27+11] = + s[11]; +gout[n*27+12] = + s[12]; +gout[n*27+13] = + s[13]; +gout[n*27+14] = + s[14]; +gout[n*27+15] = + s[15]; +gout[n*27+16] = + s[16]; +gout[n*27+17] = + s[17]; +gout[n*27+18] = + s[18]; +gout[n*27+19] = + s[19]; +gout[n*27+20] = + s[20]; +gout[n*27+21] = + s[21]; +gout[n*27+22] = + s[22]; +gout[n*27+23] = + s[23]; +gout[n*27+24] = + s[24]; +gout[n*27+25] = + s[25]; +gout[n*27+26] = + s[26]; +} else { gout[n*27+0] += + s[0]; gout[n*27+1] += + s[1]; gout[n*27+2] += + s[2]; @@ -2556,7 +2796,7 @@ gout[n*27+23] += + s[23]; gout[n*27+24] += + s[24]; gout[n*27+25] += + s[25]; gout[n*27+26] += + s[26]; -}} +}}} void int1e_irrp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 3, 0, 0, 3, 1, 1, 27}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2642,6 +2882,35 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*27+0] = + s[0]; +gout[n*27+1] = + s[1]; +gout[n*27+2] = + s[2]; +gout[n*27+3] = + s[3]; +gout[n*27+4] = + s[4]; +gout[n*27+5] = + s[5]; +gout[n*27+6] = + s[6]; +gout[n*27+7] = + s[7]; +gout[n*27+8] = + s[8]; +gout[n*27+9] = + s[9]; +gout[n*27+10] = + s[10]; +gout[n*27+11] = + s[11]; +gout[n*27+12] = + s[12]; +gout[n*27+13] = + s[13]; +gout[n*27+14] = + s[14]; +gout[n*27+15] = + s[15]; +gout[n*27+16] = + s[16]; +gout[n*27+17] = + s[17]; +gout[n*27+18] = + s[18]; +gout[n*27+19] = + s[19]; +gout[n*27+20] = + s[20]; +gout[n*27+21] = + s[21]; +gout[n*27+22] = + s[22]; +gout[n*27+23] = + s[23]; +gout[n*27+24] = + s[24]; +gout[n*27+25] = + s[25]; +gout[n*27+26] = + s[26]; +} else { gout[n*27+0] += + s[0]; gout[n*27+1] += + s[1]; gout[n*27+2] += + s[2]; @@ -2669,7 +2938,7 @@ gout[n*27+23] += + s[23]; gout[n*27+24] += + s[24]; gout[n*27+25] += + s[25]; gout[n*27+26] += + s[26]; -}} +}}} void int1e_irpr_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 3, 0, 0, 3, 1, 1, 27}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2738,6 +3007,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*9+0] = - c[4]*s[8] + 2*c[5]*s[7] - c[8]*s[4]; +gout[n*9+1] = - c[5]*s[6] + c[8]*s[3] + c[3]*s[8] - c[6]*s[5]; +gout[n*9+2] = - c[3]*s[7] + c[6]*s[4] + c[4]*s[6] - c[7]*s[3]; +gout[n*9+3] = - c[7]*s[2] + c[1]*s[8] + c[8]*s[1] - c[2]*s[7]; +gout[n*9+4] = - c[8]*s[0] + 2*c[6]*s[2] - c[0]*s[8]; +gout[n*9+5] = - c[6]*s[1] + c[0]*s[7] + c[7]*s[0] - c[1]*s[6]; +gout[n*9+6] = - c[1]*s[5] + c[4]*s[2] + c[2]*s[4] - c[5]*s[1]; +gout[n*9+7] = - c[2]*s[3] + c[5]*s[0] + c[0]*s[5] - c[3]*s[2]; +gout[n*9+8] = - c[0]*s[4] + 2*c[1]*s[3] - c[4]*s[0]; +} else { gout[n*9+0] += - c[4]*s[8] + 2*c[5]*s[7] - c[8]*s[4]; gout[n*9+1] += - c[5]*s[6] + c[8]*s[3] + c[3]*s[8] - c[6]*s[5]; gout[n*9+2] += - c[3]*s[7] + c[6]*s[4] + c[4]*s[6] - c[7]*s[3]; @@ -2747,7 +3027,7 @@ gout[n*9+5] += - c[6]*s[1] + c[0]*s[7] + c[7]*s[0] - c[1]*s[6]; gout[n*9+6] += - c[1]*s[5] + c[4]*s[2] + c[2]*s[4] - c[5]*s[1]; gout[n*9+7] += - c[2]*s[3] + c[5]*s[0] + c[0]*s[5] - c[3]*s[2]; gout[n*9+8] += - c[0]*s[4] + 2*c[1]*s[3] - c[4]*s[0]; -}} +}}} void int1e_ggovlp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2915,6 +3195,17 @@ s[77] = + g0[ix+0]*g2[iy+0]*g13[iz+0]; s[78] = + g1[ix+0]*g0[iy+0]*g14[iz+0]; s[79] = + g0[ix+0]*g1[iy+0]*g14[iz+0]; s[80] = + g0[ix+0]*g0[iy+0]*g15[iz+0]; +if (gout_empty) { +gout[n*9+0] = + c[4]*s[72] -2*c[5]*s[63] + c[8]*s[36] + c[4]*s[76] -2*c[5]*s[67] + c[8]*s[40] + c[4]*s[80] -2*c[5]*s[71] + c[8]*s[44]; +gout[n*9+1] = + c[5]*s[54] - c[8]*s[27] - c[3]*s[72] + c[6]*s[45] + c[5]*s[58] - c[8]*s[31] - c[3]*s[76] + c[6]*s[49] + c[5]*s[62] - c[8]*s[35] - c[3]*s[80] + c[6]*s[53]; +gout[n*9+2] = + c[3]*s[63] - c[6]*s[36] - c[4]*s[54] + c[7]*s[27] + c[3]*s[67] - c[6]*s[40] - c[4]*s[58] + c[7]*s[31] + c[3]*s[71] - c[6]*s[44] - c[4]*s[62] + c[7]*s[35]; +gout[n*9+3] = + c[7]*s[18] - c[1]*s[72] - c[8]*s[9] + c[2]*s[63] + c[7]*s[22] - c[1]*s[76] - c[8]*s[13] + c[2]*s[67] + c[7]*s[26] - c[1]*s[80] - c[8]*s[17] + c[2]*s[71]; +gout[n*9+4] = + c[8]*s[0] -2*c[6]*s[18] + c[0]*s[72] + c[8]*s[4] -2*c[6]*s[22] + c[0]*s[76] + c[8]*s[8] -2*c[6]*s[26] + c[0]*s[80]; +gout[n*9+5] = + c[6]*s[9] - c[0]*s[63] - c[7]*s[0] + c[1]*s[54] + c[6]*s[13] - c[0]*s[67] - c[7]*s[4] + c[1]*s[58] + c[6]*s[17] - c[0]*s[71] - c[7]*s[8] + c[1]*s[62]; +gout[n*9+6] = + c[1]*s[45] - c[4]*s[18] - c[2]*s[36] + c[5]*s[9] + c[1]*s[49] - c[4]*s[22] - c[2]*s[40] + c[5]*s[13] + c[1]*s[53] - c[4]*s[26] - c[2]*s[44] + c[5]*s[17]; +gout[n*9+7] = + c[2]*s[27] - c[5]*s[0] - c[0]*s[45] + c[3]*s[18] + c[2]*s[31] - c[5]*s[4] - c[0]*s[49] + c[3]*s[22] + c[2]*s[35] - c[5]*s[8] - c[0]*s[53] + c[3]*s[26]; +gout[n*9+8] = + c[0]*s[36] -2*c[1]*s[27] + c[4]*s[0] + c[0]*s[40] -2*c[1]*s[31] + c[4]*s[4] + c[0]*s[44] -2*c[1]*s[35] + c[4]*s[8]; +} else { gout[n*9+0] += + c[4]*s[72] -2*c[5]*s[63] + c[8]*s[36] + c[4]*s[76] -2*c[5]*s[67] + c[8]*s[40] + c[4]*s[80] -2*c[5]*s[71] + c[8]*s[44]; gout[n*9+1] += + c[5]*s[54] - c[8]*s[27] - c[3]*s[72] + c[6]*s[45] + c[5]*s[58] - c[8]*s[31] - c[3]*s[76] + c[6]*s[49] + c[5]*s[62] - c[8]*s[35] - c[3]*s[80] + c[6]*s[53]; gout[n*9+2] += + c[3]*s[63] - c[6]*s[36] - c[4]*s[54] + c[7]*s[27] + c[3]*s[67] - c[6]*s[40] - c[4]*s[58] + c[7]*s[31] + c[3]*s[71] - c[6]*s[44] - c[4]*s[62] + c[7]*s[35]; @@ -2924,7 +3215,7 @@ gout[n*9+5] += + c[6]*s[9] - c[0]*s[63] - c[7]*s[0] + c[1]*s[54] + c[6]*s[13] - gout[n*9+6] += + c[1]*s[45] - c[4]*s[18] - c[2]*s[36] + c[5]*s[9] + c[1]*s[49] - c[4]*s[22] - c[2]*s[40] + c[5]*s[13] + c[1]*s[53] - c[4]*s[26] - c[2]*s[44] + c[5]*s[17]; gout[n*9+7] += + c[2]*s[27] - c[5]*s[0] - c[0]*s[45] + c[3]*s[18] + c[2]*s[31] - c[5]*s[4] - c[0]*s[49] + c[3]*s[22] + c[2]*s[35] - c[5]*s[8] - c[0]*s[53] + c[3]*s[26]; gout[n*9+8] += + c[0]*s[36] -2*c[1]*s[27] + c[4]*s[0] + c[0]*s[40] -2*c[1]*s[31] + c[4]*s[4] + c[0]*s[44] -2*c[1]*s[35] + c[4]*s[8]; -}} +}}} void int1e_ggkin_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 4, 0, 0, 4, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -2961,7 +3252,8 @@ ALL_CINT1E_FORTRAN_(int1e_ggkin) /* */ void CINTgout1e_int1e_ggnuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -2979,23 +3271,37 @@ c[5] = 1 * rirj[1] * rirj[2]; c[6] = 1 * rirj[2] * rirj[0]; c[7] = 1 * rirj[2] * rirj[1]; c[8] = 1 * rirj[2] * rirj[2]; +G2E_R0J(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_R0J(g2, g0, envs->i_l+0, envs->j_l+1, 0, 0); +G2E_R0J(g3, g2, envs->i_l+0, envs->j_l+0, 0, 0); double s[9]; -G1E_R0J(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_R0J(g2, g0, envs->i_l+0, envs->j_l+1, 0); -G1E_R0J(g3, g2, envs->i_l+0, envs->j_l+0, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*9+0] = - c[4]*s[8] + 2*c[5]*s[7] - c[8]*s[4]; +gout[n*9+1] = - c[5]*s[6] + c[8]*s[3] + c[3]*s[8] - c[6]*s[5]; +gout[n*9+2] = - c[3]*s[7] + c[6]*s[4] + c[4]*s[6] - c[7]*s[3]; +gout[n*9+3] = - c[7]*s[2] + c[1]*s[8] + c[8]*s[1] - c[2]*s[7]; +gout[n*9+4] = - c[8]*s[0] + 2*c[6]*s[2] - c[0]*s[8]; +gout[n*9+5] = - c[6]*s[1] + c[0]*s[7] + c[7]*s[0] - c[1]*s[6]; +gout[n*9+6] = - c[1]*s[5] + c[4]*s[2] + c[2]*s[4] - c[5]*s[1]; +gout[n*9+7] = - c[2]*s[3] + c[5]*s[0] + c[0]*s[5] - c[3]*s[2]; +gout[n*9+8] = - c[0]*s[4] + 2*c[1]*s[3] - c[4]*s[0]; +} else { gout[n*9+0] += - c[4]*s[8] + 2*c[5]*s[7] - c[8]*s[4]; gout[n*9+1] += - c[5]*s[6] + c[8]*s[3] + c[3]*s[8] - c[6]*s[5]; gout[n*9+2] += - c[3]*s[7] + c[6]*s[4] + c[4]*s[6] - c[7]*s[3]; @@ -3005,7 +3311,7 @@ gout[n*9+5] += - c[6]*s[1] + c[0]*s[7] + c[7]*s[0] - c[1]*s[6]; gout[n*9+6] += - c[1]*s[5] + c[4]*s[2] + c[2]*s[4] - c[5]*s[1]; gout[n*9+7] += - c[2]*s[3] + c[5]*s[0] + c[0]*s[5] - c[3]*s[2]; gout[n*9+8] += - c[0]*s[4] + 2*c[1]*s[3] - c[4]*s[0]; -}} +}}} void int1e_ggnuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -3097,6 +3403,17 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*9+0] = + c[1]*s[23] - c[2]*s[14] - c[1]*s[25] + c[2]*s[16]; +gout[n*9+1] = + c[1]*s[24] - c[2]*s[15] - c[1]*s[20] + c[2]*s[11]; +gout[n*9+2] = + c[1]*s[19] - c[2]*s[10] - c[1]*s[21] + c[2]*s[12]; +gout[n*9+3] = + c[2]*s[5] - c[0]*s[23] - c[2]*s[7] + c[0]*s[25]; +gout[n*9+4] = + c[2]*s[6] - c[0]*s[24] - c[2]*s[2] + c[0]*s[20]; +gout[n*9+5] = + c[2]*s[1] - c[0]*s[19] - c[2]*s[3] + c[0]*s[21]; +gout[n*9+6] = + c[0]*s[14] - c[1]*s[5] - c[0]*s[16] + c[1]*s[7]; +gout[n*9+7] = + c[0]*s[15] - c[1]*s[6] - c[0]*s[11] + c[1]*s[2]; +gout[n*9+8] = + c[0]*s[10] - c[1]*s[1] - c[0]*s[12] + c[1]*s[3]; +} else { gout[n*9+0] += + c[1]*s[23] - c[2]*s[14] - c[1]*s[25] + c[2]*s[16]; gout[n*9+1] += + c[1]*s[24] - c[2]*s[15] - c[1]*s[20] + c[2]*s[11]; gout[n*9+2] += + c[1]*s[19] - c[2]*s[10] - c[1]*s[21] + c[2]*s[12]; @@ -3106,7 +3423,7 @@ gout[n*9+5] += + c[2]*s[1] - c[0]*s[19] - c[2]*s[3] + c[0]*s[21]; gout[n*9+6] += + c[0]*s[14] - c[1]*s[5] - c[0]*s[16] + c[1]*s[7]; gout[n*9+7] += + c[0]*s[15] - c[1]*s[6] - c[0]*s[11] + c[1]*s[2]; gout[n*9+8] += + c[0]*s[10] - c[1]*s[1] - c[0]*s[12] + c[1]*s[3]; -}} +}}} void int1e_grjxp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 3, 0, 0, 3, 1, 1, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -3143,16 +3460,23 @@ ALL_CINT1E_FORTRAN_(int1e_grjxp) /* */ void CINTgout1e_int1e_rinv(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double s[1]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g0[ix+0]*g0[iy+0]*g0[iz+0]; +for (i = 0; i < 1; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g0[ix+i] * g0[iy+i] * g0[iz+i]; +} +if (gout_empty) { +gout[n*1+0] = + s[0]; +} else { gout[n*1+0] += + s[0]; -}} +}}} void int1e_rinv_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -3186,32 +3510,41 @@ ALL_CINT1E_FORTRAN_(int1e_rinv) /* */ void CINTgout1e_int1e_drinv(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; -double s[3]; -G1E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l+0, 0); +G2E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l+0, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g1[ix] += g2[ix];} +double s[3]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +for (i = 0; i < 3; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g1[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g0[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g0[ix+i] * g0[iy+i] * g1[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[0]; +gout[n*3+1] = + s[1]; +gout[n*3+2] = + s[2]; +} else { gout[n*3+0] += + s[0]; gout[n*3+1] += + s[1]; gout[n*3+2] += + s[2]; -}} +}}} void int1e_drinv_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {0, 1, 0, 0, 1, 1, 0, 3}; +FINT ng[] = {1, 1, 0, 0, 1, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_drinv_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 1, 0, 0, 1, 1, 0, 3}; +FINT ng[] = {1, 1, 0, 0, 1, 1, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_drinv; @@ -3219,7 +3552,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_drinv_cart CACHE_SIZE_T int1e_drinv_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 1, 0, 0, 1, 1, 0, 3}; +FINT ng[] = {1, 1, 0, 0, 1, 1, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_drinv; @@ -3227,7 +3560,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_drinv_sph CACHE_SIZE_T int1e_drinv_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 1, 0, 0, 1, 1, 0, 3}; +FINT ng[] = {1, 1, 0, 0, 1, 1, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_drinv; diff --git a/src/autocode/intor2.c b/src/autocode/intor2.c index c6afdd51..5e054784 100644 --- a/src/autocode/intor2.c +++ b/src/autocode/intor2.c @@ -1008,7 +1008,8 @@ ALL_CINT_FORTRAN_(int2e_ipvg2_xp1) /* */ void CINTgout1e_int1e_inuc_rcxp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -1017,27 +1018,35 @@ double drj[3]; drj[0] = envs->rj[0] - envs->env[PTR_COMMON_ORIG+0]; drj[1] = envs->rj[1] - envs->env[PTR_COMMON_ORIG+1]; drj[2] = envs->rj[2] - envs->env[PTR_COMMON_ORIG+2]; +G2E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_RCJ(g2, g0, envs->i_l+0, envs->j_l+1, 0, 0); +G2E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_RCJ(g2, g0, envs->i_l+0, envs->j_l+1, 0); -G1E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[5] - s[7]; +gout[n*3+1] = + s[6] - s[2]; +gout[n*3+2] = + s[1] - s[3]; +} else { gout[n*3+0] += + s[5] - s[7]; gout[n*3+1] += + s[6] - s[2]; gout[n*3+2] += + s[1] - s[3]; -}} +}}} void int1e_inuc_rcxp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1071,32 +1080,41 @@ ALL_CINT1E_FORTRAN_(int1e_inuc_rcxp) /* */ void CINTgout1e_int1e_inuc_rxp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_R_J(g2, g0, envs->i_l+0, envs->j_l+1, 0, 0); +G2E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_R_J(g2, g0, envs->i_l+0, envs->j_l+1, 0); -G1E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + s[5] - s[7]; +gout[n*3+1] = + s[6] - s[2]; +gout[n*3+2] = + s[1] - s[3]; +} else { gout[n*3+0] += + s[5] - s[7]; gout[n*3+1] += + s[6] - s[2]; gout[n*3+2] += + s[1] - s[3]; -}} +}}} void int1e_inuc_rxp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 2, 0, 0, 2, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); diff --git a/src/autocode/intor3.c b/src/autocode/intor3.c index c055499b..54f9292f 100644 --- a/src/autocode/intor3.c +++ b/src/autocode/intor3.c @@ -25,6 +25,20 @@ ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; s[0] = + g0[ix+0]*g0[iy+0]*g0[iz+0]; +if (gout_empty) { +gout[n*12+0] = - s[0]; +gout[n*12+1] = 0; +gout[n*12+2] = 0; +gout[n*12+3] = 0; +gout[n*12+4] = 0; +gout[n*12+5] = - s[0]; +gout[n*12+6] = 0; +gout[n*12+7] = 0; +gout[n*12+8] = 0; +gout[n*12+9] = 0; +gout[n*12+10] = - s[0]; +gout[n*12+11] = 0; +} else { gout[n*12+0] += - s[0]; gout[n*12+1] += 0; gout[n*12+2] += 0; @@ -37,7 +51,7 @@ gout[n*12+8] += 0; gout[n*12+9] += 0; gout[n*12+10] += - s[0]; gout[n*12+11] += 0; -}} +}}} void int1e_sigma_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {0, 0, 0, 0, 0, 4, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -93,6 +107,20 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*12+0] = - s[0] + s[8] + s[4]; +gout[n*12+1] = -2*s[3]; +gout[n*12+2] = -2*s[6]; +gout[n*12+3] = 0; +gout[n*12+4] = -2*s[1]; +gout[n*12+5] = - s[4] + s[0] + s[8]; +gout[n*12+6] = -2*s[7]; +gout[n*12+7] = 0; +gout[n*12+8] = -2*s[2]; +gout[n*12+9] = -2*s[5]; +gout[n*12+10] = - s[8] + s[4] + s[0]; +gout[n*12+11] = 0; +} else { gout[n*12+0] += - s[0] + s[8] + s[4]; gout[n*12+1] += -2*s[3]; gout[n*12+2] += -2*s[6]; @@ -105,7 +133,7 @@ gout[n*12+8] += -2*s[2]; gout[n*12+9] += -2*s[5]; gout[n*12+10] += - s[8] + s[4] + s[0]; gout[n*12+11] += 0; -}} +}}} void int1e_spsigmasp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -161,11 +189,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*4+0] = + s[5] - s[7]; +gout[n*4+1] = + s[6] - s[2]; +gout[n*4+2] = + s[1] - s[3]; +gout[n*4+3] = + s[0] + s[4] + s[8]; +} else { gout[n*4+0] += + s[5] - s[7]; gout[n*4+1] += + s[6] - s[2]; gout[n*4+2] += + s[1] - s[3]; gout[n*4+3] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_srsr_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -211,11 +245,17 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*4+0] = - s[0]; +gout[n*4+1] = - s[1]; +gout[n*4+2] = - s[2]; +gout[n*4+3] = 0; +} else { gout[n*4+0] += - s[0]; gout[n*4+1] += - s[1]; gout[n*4+2] += - s[2]; gout[n*4+3] += 0; -}} +}}} void int1e_sr_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 4, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -271,11 +311,17 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*4+0] = - s[5] + s[7]; +gout[n*4+1] = - s[6] + s[2]; +gout[n*4+2] = - s[1] + s[3]; +gout[n*4+3] = - s[0] - s[4] - s[8]; +} else { gout[n*4+0] += - s[5] + s[7]; gout[n*4+1] += - s[6] + s[2]; gout[n*4+2] += - s[1] + s[3]; gout[n*4+3] += - s[0] - s[4] - s[8]; -}} +}}} void int1e_srsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -331,8 +377,11 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*1+0] = + s[0] + s[4] + s[8]; +} else { gout[n*1+0] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_spsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 1, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -378,11 +427,17 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*4+0] = + s[0]; +gout[n*4+1] = + s[1]; +gout[n*4+2] = + s[2]; +gout[n*4+3] = 0; +} else { gout[n*4+0] += + s[0]; gout[n*4+1] += + s[1]; gout[n*4+2] += + s[2]; gout[n*4+3] += 0; -}} +}}} void int1e_sp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 4, 1, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -416,33 +471,43 @@ ALL_CINT1E_FORTRAN_(int1e_sp) /* */ void CINTgout1e_int1e_spnucsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*4+0] = + s[5] - s[7]; +gout[n*4+1] = + s[6] - s[2]; +gout[n*4+2] = + s[1] - s[3]; +gout[n*4+3] = + s[0] + s[4] + s[8]; +} else { gout[n*4+0] += + s[5] - s[7]; gout[n*4+1] += + s[6] - s[2]; gout[n*4+2] += + s[1] - s[3]; gout[n*4+3] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_spnucsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -476,33 +541,43 @@ ALL_CINT1E_FORTRAN_(int1e_spnucsp) /* */ void CINTgout1e_int1e_sprinvsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*4+0] = + s[5] - s[7]; +gout[n*4+1] = + s[6] - s[2]; +gout[n*4+2] = + s[1] - s[3]; +gout[n*4+3] = + s[0] + s[4] + s[8]; +} else { gout[n*4+0] += + s[5] - s[7]; gout[n*4+1] += + s[6] - s[2]; gout[n*4+2] += + s[1] - s[3]; gout[n*4+3] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_sprinvsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -536,33 +611,43 @@ ALL_CINT1E_FORTRAN_(int1e_sprinvsp) /* */ void CINTgout1e_int1e_srnucsr(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_R_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_R_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_R_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_R_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_R_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_R_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*4+0] = + s[5] - s[7]; +gout[n*4+1] = + s[6] - s[2]; +gout[n*4+2] = + s[1] - s[3]; +gout[n*4+3] = + s[0] + s[4] + s[8]; +} else { gout[n*4+0] += + s[5] - s[7]; gout[n*4+1] += + s[6] - s[2]; gout[n*4+2] += + s[1] - s[3]; gout[n*4+3] += + s[0] + s[4] + s[8]; -}} +}}} void int1e_srnucsr_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 1}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -648,6 +733,20 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*12+0] = 0; +gout[n*12+1] = + s[18] - s[2]; +gout[n*12+2] = + s[1] - s[9]; +gout[n*12+3] = + s[0] + s[10] + s[20]; +gout[n*12+4] = + s[14] - s[22]; +gout[n*12+5] = 0; +gout[n*12+6] = + s[4] - s[12]; +gout[n*12+7] = + s[3] + s[13] + s[23]; +gout[n*12+8] = + s[17] - s[25]; +gout[n*12+9] = + s[24] - s[8]; +gout[n*12+10] = 0; +gout[n*12+11] = + s[6] + s[16] + s[26]; +} else { gout[n*12+0] += 0; gout[n*12+1] += + s[18] - s[2]; gout[n*12+2] += + s[1] - s[9]; @@ -660,7 +759,7 @@ gout[n*12+8] += + s[17] - s[25]; gout[n*12+9] += + s[24] - s[8]; gout[n*12+10] += 0; gout[n*12+11] += + s[6] + s[16] + s[26]; -}} +}}} void int1e_sprsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 2, 0, 0, 3, 4, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -713,10 +812,15 @@ iz = idx[2+n*3]; s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +if (gout_empty) { +gout[n*3+0] = + c[1]*s[2] - c[2]*s[1]; +gout[n*3+1] = + c[2]*s[0] - c[0]*s[2]; +gout[n*3+2] = + c[0]*s[1] - c[1]*s[0]; +} else { gout[n*3+0] += + c[1]*s[2] - c[2]*s[1]; gout[n*3+1] += + c[2]*s[0] - c[0]*s[2]; gout[n*3+2] += + c[0]*s[1] - c[1]*s[0]; -}} +}}} void int1e_govlp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 1, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -789,7 +893,8 @@ ALL_CINT1E_FORTRAN_(int1e_govlp) /* */ void CINTgout1e_int1e_gnuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double rirj[3], c[3]; @@ -799,19 +904,27 @@ rirj[2] = envs->ri[2] - envs->rj[2]; c[0] = 1 * rirj[0]; c[1] = 1 * rirj[1]; c[2] = 1 * rirj[2]; +G2E_R0I(g1, g0, envs->i_l+0, envs->j_l, 0, 0); double s[3]; -G1E_R0I(g1, g0, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g1[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g0[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g0[ix+0]*g0[iy+0]*g1[iz+0]; +for (i = 0; i < 3; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g1[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g0[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g0[ix+i] * g0[iy+i] * g1[iz+i]; +} +if (gout_empty) { +gout[n*3+0] = + c[1]*s[2] - c[2]*s[1]; +gout[n*3+1] = + c[2]*s[0] - c[0]*s[2]; +gout[n*3+2] = + c[0]*s[1] - c[1]*s[0]; +} else { gout[n*3+0] += + c[1]*s[2] - c[2]*s[1]; gout[n*3+1] += + c[2]*s[0] - c[0]*s[2]; gout[n*3+2] += + c[0]*s[1] - c[1]*s[0]; -}} +}}} void int1e_gnuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 0, 0, 0, 1, 1, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -884,7 +997,8 @@ ALL_CINT1E_FORTRAN_(int1e_gnuc) /* */ void CINTgout1e_int1e_cg_sa10sa01(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -893,25 +1007,66 @@ double dri[3]; dri[0] = envs->ri[0] - envs->env[PTR_COMMON_ORIG+0]; dri[1] = envs->ri[1] - envs->env[PTR_COMMON_ORIG+1]; dri[2] = envs->ri[2] - envs->env[PTR_COMMON_ORIG+2]; -double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l+0, 0); +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l+0, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g1[ix] += g2[ix];} -G1E_RCI(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_RCI(g3, g1, envs->i_l+0, envs->j_l, 0); +G2E_RCI(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_RCI(g3, g1, envs->i_l+0, envs->j_l, 0, 0); +double s[9]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*36+0] = - s[7] + s[5]; +gout[n*36+1] = 0; +gout[n*36+2] = 0; +gout[n*36+3] = + s[8] + s[4]; +gout[n*36+4] = + s[6]; +gout[n*36+5] = + s[5]; +gout[n*36+6] = + s[8]; +gout[n*36+7] = - s[3]; +gout[n*36+8] = - s[3]; +gout[n*36+9] = - s[4]; +gout[n*36+10] = - s[7]; +gout[n*36+11] = - s[6]; +gout[n*36+12] = - s[2]; +gout[n*36+13] = - s[7]; +gout[n*36+14] = - s[8]; +gout[n*36+15] = - s[1]; +gout[n*36+16] = 0; +gout[n*36+17] = - s[2] + s[6]; +gout[n*36+18] = 0; +gout[n*36+19] = + s[8] + s[0]; +gout[n*36+20] = + s[0]; +gout[n*36+21] = + s[1]; +gout[n*36+22] = + s[6]; +gout[n*36+23] = - s[7]; +gout[n*36+24] = + s[1]; +gout[n*36+25] = + s[4]; +gout[n*36+26] = + s[5]; +gout[n*36+27] = - s[2]; +gout[n*36+28] = - s[0]; +gout[n*36+29] = - s[3]; +gout[n*36+30] = - s[2]; +gout[n*36+31] = - s[5]; +gout[n*36+32] = 0; +gout[n*36+33] = 0; +gout[n*36+34] = - s[3] + s[1]; +gout[n*36+35] = + s[4] + s[0]; +} else { gout[n*36+0] += - s[7] + s[5]; gout[n*36+1] += 0; gout[n*36+2] += 0; @@ -948,14 +1103,14 @@ gout[n*36+32] += 0; gout[n*36+33] += 0; gout[n*36+34] += - s[3] + s[1]; gout[n*36+35] += + s[4] + s[0]; -}} +}}} void int1e_cg_sa10sa01_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_cg_sa10sa01_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_cg_sa10sa01; @@ -964,7 +1119,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_cg_sa10sa01_cart CACHE_SIZE_T int1e_cg_sa10sa01_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_cg_sa10sa01; @@ -973,7 +1128,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_cg_sa10sa01_sph CACHE_SIZE_T int1e_cg_sa10sa01_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_cg_sa10sa01; @@ -1011,6 +1166,20 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*12+0] = + s[8] + s[4]; +gout[n*12+1] = - s[3]; +gout[n*12+2] = - s[6]; +gout[n*12+3] = + s[7] - s[5]; +gout[n*12+4] = - s[1]; +gout[n*12+5] = + s[0] + s[8]; +gout[n*12+6] = - s[7]; +gout[n*12+7] = - s[6] + s[2]; +gout[n*12+8] = - s[2]; +gout[n*12+9] = - s[5]; +gout[n*12+10] = + s[4] + s[0]; +gout[n*12+11] = + s[3] - s[1]; +} else { gout[n*12+0] += + s[8] + s[4]; gout[n*12+1] += - s[3]; gout[n*12+2] += - s[6]; @@ -1023,7 +1192,7 @@ gout[n*12+8] += - s[2]; gout[n*12+9] += - s[5]; gout[n*12+10] += + s[4] + s[0]; gout[n*12+11] += + s[3] - s[1]; -}} +}}} void int1e_cg_sa10sp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1060,7 +1229,8 @@ ALL_CINT1E_FORTRAN_(int1e_cg_sa10sp) /* */ void CINTgout1e_int1e_cg_sa10nucsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -1069,23 +1239,40 @@ double dri[3]; dri[0] = envs->ri[0] - envs->env[PTR_COMMON_ORIG+0]; dri[1] = envs->ri[1] - envs->env[PTR_COMMON_ORIG+1]; dri[2] = envs->ri[2] - envs->env[PTR_COMMON_ORIG+2]; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_RCI(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_RCI(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_RCI(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_RCI(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*12+0] = + s[8] + s[4]; +gout[n*12+1] = - s[3]; +gout[n*12+2] = - s[6]; +gout[n*12+3] = + s[7] - s[5]; +gout[n*12+4] = - s[1]; +gout[n*12+5] = + s[0] + s[8]; +gout[n*12+6] = - s[7]; +gout[n*12+7] = - s[6] + s[2]; +gout[n*12+8] = - s[2]; +gout[n*12+9] = - s[5]; +gout[n*12+10] = + s[4] + s[0]; +gout[n*12+11] = + s[3] - s[1]; +} else { gout[n*12+0] += + s[8] + s[4]; gout[n*12+1] += - s[3]; gout[n*12+2] += - s[6]; @@ -1098,7 +1285,7 @@ gout[n*12+8] += - s[2]; gout[n*12+9] += - s[5]; gout[n*12+10] += + s[4] + s[0]; gout[n*12+11] += + s[3] - s[1]; -}} +}}} void int1e_cg_sa10nucsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1135,30 +1322,72 @@ ALL_CINT1E_FORTRAN_(int1e_cg_sa10nucsp) /* */ void CINTgout1e_int1e_giao_sa10sa01(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; -double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+1, envs->j_l+0, 0); +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+1, envs->j_l+0, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g1[ix] += g2[ix];} -G1E_R_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_R_I(g3, g1, envs->i_l+0, envs->j_l, 0); +G2E_R_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_R_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); +double s[9]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*36+0] = - s[7] + s[5]; +gout[n*36+1] = 0; +gout[n*36+2] = 0; +gout[n*36+3] = + s[8] + s[4]; +gout[n*36+4] = + s[6]; +gout[n*36+5] = + s[5]; +gout[n*36+6] = + s[8]; +gout[n*36+7] = - s[3]; +gout[n*36+8] = - s[3]; +gout[n*36+9] = - s[4]; +gout[n*36+10] = - s[7]; +gout[n*36+11] = - s[6]; +gout[n*36+12] = - s[2]; +gout[n*36+13] = - s[7]; +gout[n*36+14] = - s[8]; +gout[n*36+15] = - s[1]; +gout[n*36+16] = 0; +gout[n*36+17] = - s[2] + s[6]; +gout[n*36+18] = 0; +gout[n*36+19] = + s[8] + s[0]; +gout[n*36+20] = + s[0]; +gout[n*36+21] = + s[1]; +gout[n*36+22] = + s[6]; +gout[n*36+23] = - s[7]; +gout[n*36+24] = + s[1]; +gout[n*36+25] = + s[4]; +gout[n*36+26] = + s[5]; +gout[n*36+27] = - s[2]; +gout[n*36+28] = - s[0]; +gout[n*36+29] = - s[3]; +gout[n*36+30] = - s[2]; +gout[n*36+31] = - s[5]; +gout[n*36+32] = 0; +gout[n*36+33] = 0; +gout[n*36+34] = - s[3] + s[1]; +gout[n*36+35] = + s[4] + s[0]; +} else { gout[n*36+0] += - s[7] + s[5]; gout[n*36+1] += 0; gout[n*36+2] += 0; @@ -1195,14 +1424,14 @@ gout[n*36+32] += 0; gout[n*36+33] += 0; gout[n*36+34] += - s[3] + s[1]; gout[n*36+35] += + s[4] + s[0]; -}} +}}} void int1e_giao_sa10sa01_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_giao_sa10sa01_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_giao_sa10sa01; @@ -1211,7 +1440,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_giao_sa10sa01_cart CACHE_SIZE_T int1e_giao_sa10sa01_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_giao_sa10sa01; @@ -1220,7 +1449,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_giao_sa10sa01_sph CACHE_SIZE_T int1e_giao_sa10sa01_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 9}; +FINT ng[] = {2, 1, 0, 0, 2, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_giao_sa10sa01; @@ -1254,6 +1483,20 @@ s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +if (gout_empty) { +gout[n*12+0] = + s[8] + s[4]; +gout[n*12+1] = - s[3]; +gout[n*12+2] = - s[6]; +gout[n*12+3] = + s[7] - s[5]; +gout[n*12+4] = - s[1]; +gout[n*12+5] = + s[0] + s[8]; +gout[n*12+6] = - s[7]; +gout[n*12+7] = - s[6] + s[2]; +gout[n*12+8] = - s[2]; +gout[n*12+9] = - s[5]; +gout[n*12+10] = + s[4] + s[0]; +gout[n*12+11] = + s[3] - s[1]; +} else { gout[n*12+0] += + s[8] + s[4]; gout[n*12+1] += - s[3]; gout[n*12+2] += - s[6]; @@ -1266,7 +1509,7 @@ gout[n*12+8] += - s[2]; gout[n*12+9] += - s[5]; gout[n*12+10] += + s[4] + s[0]; gout[n*12+11] += + s[3] - s[1]; -}} +}}} void int1e_giao_sa10sp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1303,28 +1546,46 @@ ALL_CINT1E_FORTRAN_(int1e_giao_sa10sp) /* */ void CINTgout1e_int1e_giao_sa10nucsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; +G2E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0, 0); +G2E_R_I(g2, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_R_I(g3, g1, envs->i_l+0, envs->j_l, 0, 0); double s[9]; -G1E_D_J(g1, g0, envs->i_l+1, envs->j_l+0, 0); -G1E_R_I(g2, g0, envs->i_l+0, envs->j_l, 0); -G1E_R_I(g3, g1, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*12+0] = + s[8] + s[4]; +gout[n*12+1] = - s[3]; +gout[n*12+2] = - s[6]; +gout[n*12+3] = + s[7] - s[5]; +gout[n*12+4] = - s[1]; +gout[n*12+5] = + s[0] + s[8]; +gout[n*12+6] = - s[7]; +gout[n*12+7] = - s[6] + s[2]; +gout[n*12+8] = - s[2]; +gout[n*12+9] = - s[5]; +gout[n*12+10] = + s[4] + s[0]; +gout[n*12+11] = + s[3] - s[1]; +} else { gout[n*12+0] += + s[8] + s[4]; gout[n*12+1] += - s[3]; gout[n*12+2] += - s[6]; @@ -1337,7 +1598,7 @@ gout[n*12+8] += - s[2]; gout[n*12+9] += - s[5]; gout[n*12+10] += + s[4] + s[0]; gout[n*12+11] += + s[3] - s[1]; -}} +}}} void int1e_giao_sa10nucsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {1, 1, 0, 0, 2, 4, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1374,30 +1635,48 @@ ALL_CINT1E_FORTRAN_(int1e_giao_sa10nucsp) /* */ void CINTgout1e_int1e_sa01sp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; double *g3 = g2 + envs->g_size * 3; -double s[9]; -G1E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0); -G1E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0); -G1E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0); +G2E_D_J(g1, g0, envs->i_l+0, envs->j_l+0, 0, 0); +G2E_D_J(g2, g0, envs->i_l+0, envs->j_l+1, 0, 0); +G2E_D_I(g3, g0, envs->i_l+0, envs->j_l+1, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g2[ix] += g3[ix];} -G1E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0); +G2E_D_J(g3, g2, envs->i_l+0, envs->j_l+0, 0, 0); +double s[9]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g3[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g2[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g2[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g1[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g0[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g0[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g1[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g0[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g0[ix+0]*g0[iy+0]*g3[iz+0]; +for (i = 0; i < 9; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g3[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g2[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g2[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g1[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g0[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g0[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g1[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g0[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g0[ix+i] * g0[iy+i] * g3[iz+i]; +} +if (gout_empty) { +gout[n*12+0] = + s[8] + s[4]; +gout[n*12+1] = - s[3]; +gout[n*12+2] = - s[6]; +gout[n*12+3] = + s[7] - s[5]; +gout[n*12+4] = - s[1]; +gout[n*12+5] = + s[0] + s[8]; +gout[n*12+6] = - s[7]; +gout[n*12+7] = - s[6] + s[2]; +gout[n*12+8] = - s[2]; +gout[n*12+9] = - s[5]; +gout[n*12+10] = + s[4] + s[0]; +gout[n*12+11] = + s[3] - s[1]; +} else { gout[n*12+0] += + s[8] + s[4]; gout[n*12+1] += - s[3]; gout[n*12+2] += - s[6]; @@ -1410,14 +1689,14 @@ gout[n*12+8] += - s[2]; gout[n*12+9] += - s[5]; gout[n*12+10] += + s[4] + s[0]; gout[n*12+11] += + s[3] - s[1]; -}} +}}} void int1e_sa01sp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {0, 2, 0, 0, 2, 4, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 4, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_sa01sp_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 4, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 4, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_sa01sp; @@ -1425,7 +1704,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_sa01sp_cart CACHE_SIZE_T int1e_sa01sp_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 4, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 4, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_sa01sp; @@ -1433,7 +1712,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_sa01sp_sph CACHE_SIZE_T int1e_sa01sp_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {0, 2, 0, 0, 2, 4, 0, 3}; +FINT ng[] = {1, 2, 0, 0, 2, 4, 0, 3}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_sa01sp; @@ -1499,6 +1778,20 @@ s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +if (gout_empty) { +gout[n*12+0] = + c[1]*s[17] - c[2]*s[14] - c[1]*s[25] + c[2]*s[22]; +gout[n*12+1] = + c[1]*s[24] - c[1]*s[8]; +gout[n*12+2] = - c[2]*s[4] + c[2]*s[12]; +gout[n*12+3] = + c[1]*s[6] - c[2]*s[3] + c[1]*s[16] - c[2]*s[13] + c[1]*s[26] - c[2]*s[23]; +gout[n*12+4] = - c[0]*s[17] + c[0]*s[25]; +gout[n*12+5] = + c[2]*s[18] - c[0]*s[24] - c[2]*s[2] + c[0]*s[8]; +gout[n*12+6] = + c[2]*s[1] - c[2]*s[9]; +gout[n*12+7] = + c[2]*s[0] - c[0]*s[6] + c[2]*s[10] - c[0]*s[16] + c[2]*s[20] - c[0]*s[26]; +gout[n*12+8] = + c[0]*s[14] - c[0]*s[22]; +gout[n*12+9] = - c[1]*s[18] + c[1]*s[2]; +gout[n*12+10] = + c[0]*s[4] - c[1]*s[1] - c[0]*s[12] + c[1]*s[9]; +gout[n*12+11] = + c[0]*s[3] - c[1]*s[0] + c[0]*s[13] - c[1]*s[10] + c[0]*s[23] - c[1]*s[20]; +} else { gout[n*12+0] += + c[1]*s[17] - c[2]*s[14] - c[1]*s[25] + c[2]*s[22]; gout[n*12+1] += + c[1]*s[24] - c[1]*s[8]; gout[n*12+2] += - c[2]*s[4] + c[2]*s[12]; @@ -1511,7 +1804,7 @@ gout[n*12+8] += + c[0]*s[14] - c[0]*s[22]; gout[n*12+9] += - c[1]*s[18] + c[1]*s[2]; gout[n*12+10] += + c[0]*s[4] - c[1]*s[1] - c[0]*s[12] + c[1]*s[9]; gout[n*12+11] += + c[0]*s[3] - c[1]*s[0] + c[0]*s[13] - c[1]*s[10] + c[0]*s[23] - c[1]*s[20]; -}} +}}} void int1e_spgsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 4, 1, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1584,7 +1877,8 @@ ALL_CINT1E_FORTRAN_(int1e_spgsp) /* */ void CINTgout1e_int1e_spgnucsp(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -1600,45 +1894,62 @@ rirj[2] = envs->ri[2] - envs->rj[2]; c[0] = 1 * rirj[0]; c[1] = 1 * rirj[1]; c[2] = 1 * rirj[2]; +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_R0I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_R0I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_R0I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_R0I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*12+0] = + c[1]*s[17] - c[2]*s[14] - c[1]*s[25] + c[2]*s[22]; +gout[n*12+1] = + c[1]*s[24] - c[2]*s[21] - c[1]*s[8] + c[2]*s[5]; +gout[n*12+2] = + c[1]*s[7] - c[2]*s[4] - c[1]*s[15] + c[2]*s[12]; +gout[n*12+3] = + c[1]*s[6] - c[2]*s[3] + c[1]*s[16] - c[2]*s[13] + c[1]*s[26] - c[2]*s[23]; +gout[n*12+4] = + c[2]*s[11] - c[0]*s[17] - c[2]*s[19] + c[0]*s[25]; +gout[n*12+5] = + c[2]*s[18] - c[0]*s[24] - c[2]*s[2] + c[0]*s[8]; +gout[n*12+6] = + c[2]*s[1] - c[0]*s[7] - c[2]*s[9] + c[0]*s[15]; +gout[n*12+7] = + c[2]*s[0] - c[0]*s[6] + c[2]*s[10] - c[0]*s[16] + c[2]*s[20] - c[0]*s[26]; +gout[n*12+8] = + c[0]*s[14] - c[1]*s[11] - c[0]*s[22] + c[1]*s[19]; +gout[n*12+9] = + c[0]*s[21] - c[1]*s[18] - c[0]*s[5] + c[1]*s[2]; +gout[n*12+10] = + c[0]*s[4] - c[1]*s[1] - c[0]*s[12] + c[1]*s[9]; +gout[n*12+11] = + c[0]*s[3] - c[1]*s[0] + c[0]*s[13] - c[1]*s[10] + c[0]*s[23] - c[1]*s[20]; +} else { gout[n*12+0] += + c[1]*s[17] - c[2]*s[14] - c[1]*s[25] + c[2]*s[22]; gout[n*12+1] += + c[1]*s[24] - c[2]*s[21] - c[1]*s[8] + c[2]*s[5]; gout[n*12+2] += + c[1]*s[7] - c[2]*s[4] - c[1]*s[15] + c[2]*s[12]; @@ -1651,7 +1962,7 @@ gout[n*12+8] += + c[0]*s[14] - c[1]*s[11] - c[0]*s[22] + c[1]*s[19]; gout[n*12+9] += + c[0]*s[21] - c[1]*s[18] - c[0]*s[5] + c[1]*s[2]; gout[n*12+10] += + c[0]*s[4] - c[1]*s[1] - c[0]*s[12] + c[1]*s[9]; gout[n*12+11] += + c[0]*s[3] - c[1]*s[0] + c[0]*s[13] - c[1]*s[10] + c[0]*s[23] - c[1]*s[20]; -}} +}}} void int1e_spgnucsp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { FINT ng[] = {2, 1, 0, 0, 3, 4, 0, 3}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); @@ -1724,7 +2035,8 @@ ALL_CINT1E_FORTRAN_(int1e_spgnucsp) /* */ void CINTgout1e_int1e_spgsa01(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT gout_empty) { FINT nf = envs->nf; -FINT ix, iy, iz, n; +FINT nrys_roots = envs->nrys_roots; +FINT ix, iy, iz, n, i; double *g0 = g; double *g1 = g0 + envs->g_size * 3; double *g2 = g1 + envs->g_size * 3; @@ -1740,47 +2052,88 @@ rirj[2] = envs->ri[2] - envs->rj[2]; c[0] = 1 * rirj[0]; c[1] = 1 * rirj[1]; c[2] = 1 * rirj[2]; -double s[27]; -G1E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0); -G1E_D_I(g2, g0, envs->i_l+2, envs->j_l+0, 0); +G2E_D_J(g1, g0, envs->i_l+2, envs->j_l+0, 0, 0); +G2E_D_I(g2, g0, envs->i_l+2, envs->j_l+0, 0, 0); for (ix = 0; ix < envs->g_size * 3; ix++) {g1[ix] += g2[ix];} -G1E_R0I(g2, g0, envs->i_l+1, envs->j_l, 0); -G1E_R0I(g3, g1, envs->i_l+1, envs->j_l, 0); -G1E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0); -G1E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0); +G2E_R0I(g2, g0, envs->i_l+1, envs->j_l, 0, 0); +G2E_R0I(g3, g1, envs->i_l+1, envs->j_l, 0, 0); +G2E_D_I(g4, g0, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g5, g1, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g6, g2, envs->i_l+0, envs->j_l, 0, 0); +G2E_D_I(g7, g3, envs->i_l+0, envs->j_l, 0, 0); +double s[27]; for (n = 0; n < nf; n++) { ix = idx[0+n*3]; iy = idx[1+n*3]; iz = idx[2+n*3]; -s[0] = + g7[ix+0]*g0[iy+0]*g0[iz+0]; -s[1] = + g6[ix+0]*g1[iy+0]*g0[iz+0]; -s[2] = + g6[ix+0]*g0[iy+0]*g1[iz+0]; -s[3] = + g5[ix+0]*g2[iy+0]*g0[iz+0]; -s[4] = + g4[ix+0]*g3[iy+0]*g0[iz+0]; -s[5] = + g4[ix+0]*g2[iy+0]*g1[iz+0]; -s[6] = + g5[ix+0]*g0[iy+0]*g2[iz+0]; -s[7] = + g4[ix+0]*g1[iy+0]*g2[iz+0]; -s[8] = + g4[ix+0]*g0[iy+0]*g3[iz+0]; -s[9] = + g3[ix+0]*g4[iy+0]*g0[iz+0]; -s[10] = + g2[ix+0]*g5[iy+0]*g0[iz+0]; -s[11] = + g2[ix+0]*g4[iy+0]*g1[iz+0]; -s[12] = + g1[ix+0]*g6[iy+0]*g0[iz+0]; -s[13] = + g0[ix+0]*g7[iy+0]*g0[iz+0]; -s[14] = + g0[ix+0]*g6[iy+0]*g1[iz+0]; -s[15] = + g1[ix+0]*g4[iy+0]*g2[iz+0]; -s[16] = + g0[ix+0]*g5[iy+0]*g2[iz+0]; -s[17] = + g0[ix+0]*g4[iy+0]*g3[iz+0]; -s[18] = + g3[ix+0]*g0[iy+0]*g4[iz+0]; -s[19] = + g2[ix+0]*g1[iy+0]*g4[iz+0]; -s[20] = + g2[ix+0]*g0[iy+0]*g5[iz+0]; -s[21] = + g1[ix+0]*g2[iy+0]*g4[iz+0]; -s[22] = + g0[ix+0]*g3[iy+0]*g4[iz+0]; -s[23] = + g0[ix+0]*g2[iy+0]*g5[iz+0]; -s[24] = + g1[ix+0]*g0[iy+0]*g6[iz+0]; -s[25] = + g0[ix+0]*g1[iy+0]*g6[iz+0]; -s[26] = + g0[ix+0]*g0[iy+0]*g7[iz+0]; +for (i = 0; i < 27; i++) { s[i] = 0; } +for (i = 0; i < nrys_roots; i++) { +s[0] += g7[ix+i] * g0[iy+i] * g0[iz+i]; +s[1] += g6[ix+i] * g1[iy+i] * g0[iz+i]; +s[2] += g6[ix+i] * g0[iy+i] * g1[iz+i]; +s[3] += g5[ix+i] * g2[iy+i] * g0[iz+i]; +s[4] += g4[ix+i] * g3[iy+i] * g0[iz+i]; +s[5] += g4[ix+i] * g2[iy+i] * g1[iz+i]; +s[6] += g5[ix+i] * g0[iy+i] * g2[iz+i]; +s[7] += g4[ix+i] * g1[iy+i] * g2[iz+i]; +s[8] += g4[ix+i] * g0[iy+i] * g3[iz+i]; +s[9] += g3[ix+i] * g4[iy+i] * g0[iz+i]; +s[10] += g2[ix+i] * g5[iy+i] * g0[iz+i]; +s[11] += g2[ix+i] * g4[iy+i] * g1[iz+i]; +s[12] += g1[ix+i] * g6[iy+i] * g0[iz+i]; +s[13] += g0[ix+i] * g7[iy+i] * g0[iz+i]; +s[14] += g0[ix+i] * g6[iy+i] * g1[iz+i]; +s[15] += g1[ix+i] * g4[iy+i] * g2[iz+i]; +s[16] += g0[ix+i] * g5[iy+i] * g2[iz+i]; +s[17] += g0[ix+i] * g4[iy+i] * g3[iz+i]; +s[18] += g3[ix+i] * g0[iy+i] * g4[iz+i]; +s[19] += g2[ix+i] * g1[iy+i] * g4[iz+i]; +s[20] += g2[ix+i] * g0[iy+i] * g5[iz+i]; +s[21] += g1[ix+i] * g2[iy+i] * g4[iz+i]; +s[22] += g0[ix+i] * g3[iy+i] * g4[iz+i]; +s[23] += g0[ix+i] * g2[iy+i] * g5[iz+i]; +s[24] += g1[ix+i] * g0[iy+i] * g6[iz+i]; +s[25] += g0[ix+i] * g1[iy+i] * g6[iz+i]; +s[26] += g0[ix+i] * g0[iy+i] * g7[iz+i]; +} +if (gout_empty) { +gout[n*36+0] = - c[1]*s[16] + c[2]*s[13] - c[1]*s[26] + c[2]*s[23]; +gout[n*36+1] = + c[1]*s[7] - c[2]*s[4]; +gout[n*36+2] = + c[1]*s[8] - c[2]*s[5]; +gout[n*36+3] = + c[1]*s[17] - c[2]*s[14] - c[1]*s[25] + c[2]*s[22]; +gout[n*36+4] = + c[1]*s[15] - c[2]*s[12]; +gout[n*36+5] = - c[1]*s[26] + c[2]*s[23] - c[1]*s[6] + c[2]*s[3]; +gout[n*36+6] = + c[1]*s[17] - c[2]*s[14]; +gout[n*36+7] = - c[1]*s[8] + c[2]*s[5] + c[1]*s[24] - c[2]*s[21]; +gout[n*36+8] = + c[1]*s[24] - c[2]*s[21]; +gout[n*36+9] = + c[1]*s[25] - c[2]*s[22]; +gout[n*36+10] = - c[1]*s[6] + c[2]*s[3] - c[1]*s[16] + c[2]*s[13]; +gout[n*36+11] = + c[1]*s[7] - c[2]*s[4] - c[1]*s[15] + c[2]*s[12]; +gout[n*36+12] = - c[2]*s[10] + c[0]*s[16] - c[2]*s[20] + c[0]*s[26]; +gout[n*36+13] = + c[2]*s[1] - c[0]*s[7]; +gout[n*36+14] = + c[2]*s[2] - c[0]*s[8]; +gout[n*36+15] = + c[2]*s[11] - c[0]*s[17] - c[2]*s[19] + c[0]*s[25]; +gout[n*36+16] = + c[2]*s[9] - c[0]*s[15]; +gout[n*36+17] = - c[2]*s[20] + c[0]*s[26] - c[2]*s[0] + c[0]*s[6]; +gout[n*36+18] = + c[2]*s[11] - c[0]*s[17]; +gout[n*36+19] = - c[2]*s[2] + c[0]*s[8] + c[2]*s[18] - c[0]*s[24]; +gout[n*36+20] = + c[2]*s[18] - c[0]*s[24]; +gout[n*36+21] = + c[2]*s[19] - c[0]*s[25]; +gout[n*36+22] = - c[2]*s[0] + c[0]*s[6] - c[2]*s[10] + c[0]*s[16]; +gout[n*36+23] = + c[2]*s[1] - c[0]*s[7] - c[2]*s[9] + c[0]*s[15]; +gout[n*36+24] = - c[0]*s[13] + c[1]*s[10] - c[0]*s[23] + c[1]*s[20]; +gout[n*36+25] = + c[0]*s[4] - c[1]*s[1]; +gout[n*36+26] = + c[0]*s[5] - c[1]*s[2]; +gout[n*36+27] = + c[0]*s[14] - c[1]*s[11] - c[0]*s[22] + c[1]*s[19]; +gout[n*36+28] = + c[0]*s[12] - c[1]*s[9]; +gout[n*36+29] = - c[0]*s[23] + c[1]*s[20] - c[0]*s[3] + c[1]*s[0]; +gout[n*36+30] = + c[0]*s[14] - c[1]*s[11]; +gout[n*36+31] = - c[0]*s[5] + c[1]*s[2] + c[0]*s[21] - c[1]*s[18]; +gout[n*36+32] = + c[0]*s[21] - c[1]*s[18]; +gout[n*36+33] = + c[0]*s[22] - c[1]*s[19]; +gout[n*36+34] = - c[0]*s[3] + c[1]*s[0] - c[0]*s[13] + c[1]*s[10]; +gout[n*36+35] = + c[0]*s[4] - c[1]*s[1] - c[0]*s[12] + c[1]*s[9]; +} else { gout[n*36+0] += - c[1]*s[16] + c[2]*s[13] - c[1]*s[26] + c[2]*s[23]; gout[n*36+1] += + c[1]*s[7] - c[2]*s[4]; gout[n*36+2] += + c[1]*s[8] - c[2]*s[5]; @@ -1817,14 +2170,14 @@ gout[n*36+32] += + c[0]*s[21] - c[1]*s[18]; gout[n*36+33] += + c[0]*s[22] - c[1]*s[19]; gout[n*36+34] += - c[0]*s[3] + c[1]*s[0] - c[0]*s[13] + c[1]*s[10]; gout[n*36+35] += + c[0]*s[4] - c[1]*s[1] - c[0]*s[12] + c[1]*s[9]; -}} +}}} void int1e_spgsa01_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { -FINT ng[] = {2, 1, 0, 0, 3, 4, 0, 9}; +FINT ng[] = {3, 1, 0, 0, 3, 4, 0, 9}; CINTall_1e_optimizer(opt, ng, atm, natm, bas, nbas, env); } CACHE_SIZE_T int1e_spgsa01_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {2, 1, 0, 0, 3, 4, 0, 9}; +FINT ng[] = {3, 1, 0, 0, 3, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_spgsa01; @@ -1845,7 +2198,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 1); } // int1e_spgsa01_cart CACHE_SIZE_T int1e_spgsa01_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {2, 1, 0, 0, 3, 4, 0, 9}; +FINT ng[] = {3, 1, 0, 0, 3, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_spgsa01; @@ -1866,7 +2219,7 @@ return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 1); } // int1e_spgsa01_sph CACHE_SIZE_T int1e_spgsa01_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { -FINT ng[] = {2, 1, 0, 0, 3, 4, 0, 9}; +FINT ng[] = {3, 1, 0, 0, 3, 4, 0, 9}; CINTEnvVars envs; CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_int1e_spgsa01; diff --git a/src/breit.c b/src/breit.c index 121d2bef..56670171 100644 --- a/src/breit.c +++ b/src/breit.c @@ -40,7 +40,7 @@ CACHE_SIZE_T int2e_breit_##X##_spinor(double complex *out, FINT *dims, FINT *shl ncomp_tensor, &int2e_##X##_spinor, \ &int2e_gauge_r1_##X##_spinor, &int2e_gauge_r2_##X##_spinor); \ } \ -CACHE_SIZE_T cint2e_breit_##X##_spinor(double complex *out, FINT *shls, \ +FINT cint2e_breit_##X##_spinor(double complex *out, FINT *shls, \ FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, \ CINTOpt *opt) \ { \ diff --git a/src/c2f.h b/src/c2f.h index 793ec413..29536898 100644 --- a/src/c2f.h +++ b/src/c2f.h @@ -7,7 +7,7 @@ #include "config.h" #define ALL_CINT_FORTRAN_(NAME) \ -CACHE_SIZE_T c##NAME##_sph_(double *out, FINT *shls, FINT *atm, FINT *natm, \ +FINT c##NAME##_sph_(double *out, FINT *shls, FINT *atm, FINT *natm, \ FINT *bas, FINT *nbas, double *env, size_t optptr_as_integer8) { \ CINTOpt **opt = (CINTOpt **)optptr_as_integer8; \ return NAME##_sph(out, NULL, shls, \ @@ -18,7 +18,7 @@ void c##NAME##_sph_optimizer_(size_t optptr_as_integer8, FINT *atm, FINT *natm, CINTOpt **opt = (CINTOpt **)optptr_as_integer8; \ NAME##_optimizer(opt, atm, *natm, bas, *nbas, env); \ } \ -CACHE_SIZE_T c##NAME##_cart_(double *out, FINT *shls, FINT *atm, FINT *natm, \ +FINT c##NAME##_cart_(double *out, FINT *shls, FINT *atm, FINT *natm, \ FINT *bas, FINT *nbas, double *env, size_t optptr_as_integer8) { \ CINTOpt **opt = (CINTOpt **)optptr_as_integer8; \ return NAME##_cart(out, NULL, shls, \ @@ -28,7 +28,7 @@ void c##NAME##_cart_optimizer_(CINTOpt **opt, FINT *atm, FINT *natm, \ FINT *bas, FINT *nbas, double *env) { \ NAME##_optimizer(opt, atm, *natm, bas, *nbas, env); \ } \ -CACHE_SIZE_T c##NAME##_(double *out, FINT *shls, FINT *atm, FINT *natm, \ +FINT c##NAME##_(double *out, FINT *shls, FINT *atm, FINT *natm, \ FINT *bas, FINT *nbas, double *env, size_t optptr_as_integer8) { \ CINTOpt **opt = (CINTOpt **)optptr_as_integer8; \ return NAME##_spinor((double complex *)out, NULL, shls, \ @@ -41,16 +41,16 @@ void c##NAME##_optimizer_(size_t optptr_as_integer8, FINT *atm, FINT *natm, \ } #define ALL_CINT1E_FORTRAN_(NAME) \ -CACHE_SIZE_T c##NAME##_sph_(double *out, FINT *shls, FINT *atm, FINT *natm, \ +FINT c##NAME##_sph_(double *out, FINT *shls, FINT *atm, FINT *natm, \ FINT *bas, FINT *nbas, double *env) { \ return NAME##_sph(out, NULL, shls, atm, *natm, bas, *nbas, env, NULL, NULL); \ } \ -CACHE_SIZE_T c##NAME##_cart_(double *out, FINT *shls, FINT *atm, FINT *natm, \ +FINT c##NAME##_cart_(double *out, FINT *shls, FINT *atm, FINT *natm, \ FINT *bas, FINT *nbas, double *env) { \ return NAME##_cart(out, NULL, shls, \ atm, *natm, bas, *nbas, env, NULL, NULL); \ } \ -CACHE_SIZE_T c##NAME##_(double *out, FINT *shls, FINT *atm, FINT *natm, \ +FINT c##NAME##_(double *out, FINT *shls, FINT *atm, FINT *natm, \ FINT *bas, FINT *nbas, double *env) { \ return NAME##_spinor((double complex *)out, NULL, shls, \ atm, *natm, bas, *nbas, env, NULL, NULL); \ diff --git a/src/cart2sph.c b/src/cart2sph.c index 53d8992f..78fe94c4 100644 --- a/src/cart2sph.c +++ b/src/cart2sph.c @@ -13,7 +13,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "cint_bas.h" #include "cart2sph.h" #include "misc.h" @@ -2182,6 +2182,10 @@ static FINT _len_spinor(FINT kappa, FINT l) } } +static int _len_cart[] = { + 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136 +}; + struct cart2sp_t { const double *cart2sph; const double complex *cart2j_lt_l; // j < kappa, l > 0 @@ -2325,7 +2329,7 @@ static void c2s_zgemm(const char transa, const char transb, // transform integrals from cartesian to spheric static double *a_bra_cart2spheric(double *gsph, FINT nket, double *gcart, FINT l) { - const FINT nf = (l+1)*(l+2)/2; + const FINT nf = _len_cart[l]; const FINT nd = l * 2 + 1; c2s_dgemm('T', 'N', nd, nket, nf, 1, g_c2s[l].cart2sph, nf, gcart, nf, 0, gsph, nd); @@ -2335,7 +2339,7 @@ static double *a_bra_cart2spheric(double *gsph, FINT nket, double *gcart, FINT l static double *a_ket_cart2spheric(double *gsph, double *gcart, FINT lds, FINT nbra, FINT l) { - const FINT nf = (l+1)*(l+2)/2; + const FINT nf = _len_cart[l]; const FINT nd = l * 2 + 1; c2s_dgemm('N', 'N', nbra, nd, nf, 1, gcart, nbra, g_c2s[l].cart2sph, nf, 0, gsph, lds); @@ -2700,7 +2704,7 @@ double *(*c2s_ket_sph1[])(double *gsph, double *gcart, static void a_bra_cart2spinor_sf(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) { - FINT nf = (l+1)*(l+2)/2; + FINT nf = _len_cart[l]; FINT nd = _len_spinor(kappa, l); const double complex *coeff_c2s; @@ -2728,7 +2732,7 @@ static void a_bra_cart2spinor_e1sf(double complex *gsp, FINT nket, static void a_bra_cart2spinor_si(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) { - FINT nf = (l+1)*(l+2)/2; + FINT nf = _len_cart[l]; FINT nd = _len_spinor(kappa, l); const double complex *coeff_c2s; @@ -2743,39 +2747,6 @@ static void a_bra_cart2spinor_si(double complex *gsp, FINT nket, 1, coeff_c2s+nf, nf*2, gcart+nf*nket, nf, 1, gsp, nd); } -static void a_ket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - FINT nf = (l+1)*(l+2)/2; - FINT nd = _len_spinor(kappa, l); - const double complex *coeff_c2s; - - if (kappa < 0) { // j = l + 1/2 - coeff_c2s = g_c2s[l].cart2j_gt_l; - } else { - coeff_c2s = g_c2s[l].cart2j_lt_l; - } - c2s_zgemm('N', 'N', nbra, nd, nf*2, - 1, gcart, nbra, coeff_c2s, nf*2, 0, gsp, nbra); -} -// with phase "i" -static void a_iket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex ZI = 0 + 1 * _Complex_I; - FINT nf = (l+1)*(l+2)/2; - FINT nd = _len_spinor(kappa, l); - const double complex *coeff_c2s; - - if (kappa < 0) { // j = l + 1/2 - coeff_c2s = g_c2s[l].cart2j_gt_l; - } else { - coeff_c2s = g_c2s[l].cart2j_lt_l; - } - c2s_zgemm('N', 'N', nbra, nd, nf*2, - ZI, gcart, nbra, coeff_c2s, nf*2, 0, gsp, nbra); -} - static void s_bra_cart2spinor_sf(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) { @@ -2813,28 +2784,7 @@ static void s_bra_cart2spinor_si(double complex *gsp, FINT nket, gsp[i*2+1] = gcart [i]; } } -static void s_ket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - double complex *gsp1 = gsp + nbra; - double complex *gcart1 = gcart + nbra; - FINT i; - for (i = 0; i < nbra; i++) { - gsp [i] = gcart1[i]; - gsp1[i] = gcart [i]; - } -} -static void s_iket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - double complex *gsp1 = gsp + nbra; - double complex *gcart1 = gcart + nbra; - FINT i; - for (i = 0; i < nbra; i++) { - gsp [i] = gcart1[i] * _Complex_I; - gsp1[i] = gcart [i] * _Complex_I; - } -} + static void p_bra_cart2spinor_sf(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) { @@ -2958,74 +2908,6 @@ static void p_bra_cart2spinor_si(double complex *gsp, FINT nket, } } } -static void p_ket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[1].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[ i] = creal(coeff_c2s[0])*gcart[nbra*0+i] - + cimag(coeff_c2s[1])*gcart[nbra*1+i]*_Complex_I - + creal(coeff_c2s[5])*gcart[nbra*5+i]; - gsp[nbra+i] = creal(coeff_c2s[8])*gcart[nbra*2+i] - + creal(coeff_c2s[9])*gcart[nbra*3+i] - + cimag(coeff_c2s[10])*gcart[nbra*4+i]*_Complex_I; - } - gsp += nbra * 2; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[1].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[3])*gcart[nbra*3+i] - + cimag(coeff_c2s[4])*gcart[nbra*4+i]*_Complex_I; - gsp[1*nbra+i] = creal(coeff_c2s[6])*gcart[nbra*0+i] - + cimag(coeff_c2s[7])*gcart[nbra*1+i]*_Complex_I - + creal(coeff_c2s[11])*gcart[nbra*5+i]; - gsp[2*nbra+i] = creal(coeff_c2s[14])*gcart[nbra*2+i] - + creal(coeff_c2s[15])*gcart[nbra*3+i] - + cimag(coeff_c2s[16])*gcart[nbra*4+i]*_Complex_I; - gsp[3*nbra+i] = creal(coeff_c2s[18])*gcart[nbra*0+i] - + cimag(coeff_c2s[19])*gcart[nbra*1+i]*_Complex_I; - } - } -} -static void p_iket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[1].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[ i] = creal(coeff_c2s[0])*gcart[nbra*0+i]*_Complex_I - - cimag(coeff_c2s[1])*gcart[nbra*1+i] - + creal(coeff_c2s[5])*gcart[nbra*5+i]*_Complex_I; - gsp[nbra+i] = creal(coeff_c2s[8])*gcart[nbra*2+i]*_Complex_I - + creal(coeff_c2s[9])*gcart[nbra*3+i]*_Complex_I - - cimag(coeff_c2s[10])*gcart[nbra*4+i]; - } - gsp += nbra * 2; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[1].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[3])*gcart[nbra*3+i]*_Complex_I - - cimag(coeff_c2s[4])*gcart[nbra*4+i]; - gsp[1*nbra+i] = creal(coeff_c2s[6])*gcart[nbra*0+i]*_Complex_I - - cimag(coeff_c2s[7])*gcart[nbra*1+i] - + creal(coeff_c2s[11])*gcart[nbra*5+i]*_Complex_I; - gsp[2*nbra+i] = creal(coeff_c2s[14])*gcart[nbra*2+i]*_Complex_I - + creal(coeff_c2s[15])*gcart[nbra*3+i]*_Complex_I - - cimag(coeff_c2s[16])*gcart[nbra*4+i]; - gsp[3*nbra+i] = creal(coeff_c2s[18])*gcart[nbra*0+i]*_Complex_I - - cimag(coeff_c2s[19])*gcart[nbra*1+i]; - } - } -} static void d_bra_cart2spinor_sf(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) @@ -3242,134 +3124,6 @@ static void d_bra_cart2spinor_si(double complex *gsp, FINT nket, } } } -static void d_ket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[2].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[0])*gcart[nbra* 0+i] - + creal(coeff_c2s[3])*gcart[nbra* 3+i] - + cimag(coeff_c2s[1])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[8])*gcart[nbra* 8+i] - + cimag(coeff_c2s[10])*gcart[nbra*10+i]*_Complex_I; - gsp[1*nbra+i] = creal(coeff_c2s[14])*gcart[nbra* 2+i] - + cimag(coeff_c2s[16])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[18])*gcart[nbra* 6+i] - + creal(coeff_c2s[21])*gcart[nbra* 9+i] - + creal(coeff_c2s[23])*gcart[nbra*11+i]; - gsp[2*nbra+i] = creal(coeff_c2s[24])*gcart[nbra* 0+i] - + creal(coeff_c2s[27])*gcart[nbra* 3+i] - + creal(coeff_c2s[29])*gcart[nbra* 5+i] - + creal(coeff_c2s[32])*gcart[nbra* 8+i] - + cimag(coeff_c2s[34])*gcart[nbra*10+i]*_Complex_I; - gsp[3*nbra+i] = creal(coeff_c2s[38])*gcart[nbra* 2+i] - + cimag(coeff_c2s[40])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[42])*gcart[nbra* 6+i] - + creal(coeff_c2s[45])*gcart[nbra* 9+i] - + cimag(coeff_c2s[43])*gcart[nbra* 7+i]*_Complex_I; - } - gsp += nbra * 4; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[2].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[6])*gcart[nbra* 6+i] - + creal(coeff_c2s[9])*gcart[nbra* 9+i] - + cimag(coeff_c2s[7])*gcart[nbra* 7+i]*_Complex_I; - gsp[1*nbra+i] = creal(coeff_c2s[12])*gcart[nbra* 0+i] - + creal(coeff_c2s[15])*gcart[nbra* 3+i] - + cimag(coeff_c2s[13])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[20])*gcart[nbra* 8+i] - + cimag(coeff_c2s[22])*gcart[nbra*10+i]*_Complex_I; - gsp[2*nbra+i] = creal(coeff_c2s[26])*gcart[nbra* 2+i] - + cimag(coeff_c2s[28])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[30])*gcart[nbra* 6+i] - + creal(coeff_c2s[33])*gcart[nbra* 9+i] - + creal(coeff_c2s[35])*gcart[nbra*11+i]; - gsp[3*nbra+i] = creal(coeff_c2s[36])*gcart[nbra* 0+i] - + creal(coeff_c2s[39])*gcart[nbra* 3+i] - + creal(coeff_c2s[41])*gcart[nbra* 5+i] - + creal(coeff_c2s[44])*gcart[nbra* 8+i] - + cimag(coeff_c2s[46])*gcart[nbra*10+i]*_Complex_I; - gsp[4*nbra+i] = creal(coeff_c2s[50])*gcart[nbra* 2+i] - + cimag(coeff_c2s[52])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[54])*gcart[nbra* 6+i] - + creal(coeff_c2s[57])*gcart[nbra* 9+i] - + cimag(coeff_c2s[55])*gcart[nbra* 7+i]*_Complex_I; - gsp[5*nbra+i] = creal(coeff_c2s[60])*gcart[nbra* 0+i] - + creal(coeff_c2s[63])*gcart[nbra* 3+i] - + cimag(coeff_c2s[61])*gcart[nbra* 1+i]*_Complex_I; - } - } -} -static void d_iket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[2].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[0])*gcart[nbra* 0+i]*_Complex_I - + creal(coeff_c2s[3])*gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[1])*gcart[nbra* 1+i] - + creal(coeff_c2s[8])*gcart[nbra* 8+i]*_Complex_I - - cimag(coeff_c2s[10])*gcart[nbra*10+i]; - gsp[1*nbra+i] = creal(coeff_c2s[14])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[16])*gcart[nbra* 4+i] - + creal(coeff_c2s[18])*gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[21])*gcart[nbra* 9+i]*_Complex_I - + creal(coeff_c2s[23])*gcart[nbra*11+i]*_Complex_I; - gsp[2*nbra+i] = creal(coeff_c2s[24])*gcart[nbra* 0+i]*_Complex_I - + creal(coeff_c2s[27])*gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[29])*gcart[nbra* 5+i]*_Complex_I - + creal(coeff_c2s[32])*gcart[nbra* 8+i]*_Complex_I - - cimag(coeff_c2s[34])*gcart[nbra*10+i]; - gsp[3*nbra+i] = creal(coeff_c2s[38])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[40])*gcart[nbra* 4+i] - + creal(coeff_c2s[42])*gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[45])*gcart[nbra* 9+i]*_Complex_I - - cimag(coeff_c2s[43])*gcart[nbra* 7+i]; - } - gsp += nbra * 4; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[2].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[6])*gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[9])*gcart[nbra* 9+i]*_Complex_I - - cimag(coeff_c2s[7])*gcart[nbra* 7+i]; - gsp[1*nbra+i] = creal(coeff_c2s[12])*gcart[nbra* 0+i]*_Complex_I - + creal(coeff_c2s[15])*gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[13])*gcart[nbra* 1+i] - + creal(coeff_c2s[20])*gcart[nbra* 8+i]*_Complex_I - - cimag(coeff_c2s[22])*gcart[nbra*10+i]; - gsp[2*nbra+i] = creal(coeff_c2s[26])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[28])*gcart[nbra* 4+i] - + creal(coeff_c2s[30])*gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[33])*gcart[nbra* 9+i]*_Complex_I - + creal(coeff_c2s[35])*gcart[nbra*11+i]*_Complex_I; - gsp[3*nbra+i] = creal(coeff_c2s[36])*gcart[nbra* 0+i]*_Complex_I - + creal(coeff_c2s[39])*gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[41])*gcart[nbra* 5+i]*_Complex_I - + creal(coeff_c2s[44])*gcart[nbra* 8+i]*_Complex_I - - cimag(coeff_c2s[46])*gcart[nbra*10+i]; - gsp[4*nbra+i] = creal(coeff_c2s[50])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[52])*gcart[nbra* 4+i] - + creal(coeff_c2s[54])*gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[57])*gcart[nbra* 9+i]*_Complex_I - - cimag(coeff_c2s[55])*gcart[nbra* 7+i]; - gsp[5*nbra+i] = creal(coeff_c2s[60])*gcart[nbra* 0+i]*_Complex_I - + creal(coeff_c2s[63])*gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[61])*gcart[nbra* 1+i]; - } - } -} static void f_bra_cart2spinor_sf(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) @@ -3771,258 +3525,6 @@ static void f_bra_cart2spinor_si(double complex *gsp, FINT nket, } } } -static void f_ket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[3].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[0])*gcart[nbra* 0+i] - + cimag(coeff_c2s[1])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[3])*gcart[nbra* 3+i] - + cimag(coeff_c2s[6])*gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[12])*gcart[nbra*12+i] - + cimag(coeff_c2s[14])*gcart[nbra*14+i]*_Complex_I - + creal(coeff_c2s[17])*gcart[nbra*17+i]; - gsp[1*nbra+i] = creal(coeff_c2s[22])*gcart[nbra* 2+i] - + cimag(coeff_c2s[24])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[27])*gcart[nbra* 7+i] - + creal(coeff_c2s[30])*gcart[nbra*10+i] - + cimag(coeff_c2s[31])*gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[33])*gcart[nbra*13+i] - + creal(coeff_c2s[35])*gcart[nbra*15+i] - + cimag(coeff_c2s[36])*gcart[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[38])*gcart[nbra*18+i]*_Complex_I; - gsp[2*nbra+i] = creal(coeff_c2s[40])*gcart[nbra* 0+i] - + cimag(coeff_c2s[41])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[43])*gcart[nbra* 3+i] - + creal(coeff_c2s[45])*gcart[nbra* 5+i] - + cimag(coeff_c2s[46])*gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[48])*gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[52])*gcart[nbra*12+i] - + creal(coeff_c2s[57])*gcart[nbra*17+i] - + creal(coeff_c2s[59])*gcart[nbra*19+i]; - gsp[3*nbra+i] = creal(coeff_c2s[62])*gcart[nbra* 2+i] - + creal(coeff_c2s[67])*gcart[nbra* 7+i] - + creal(coeff_c2s[69])*gcart[nbra* 9+i] - + creal(coeff_c2s[70])*gcart[nbra*10+i] - + cimag(coeff_c2s[71])*gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[73])*gcart[nbra*13+i] - + creal(coeff_c2s[75])*gcart[nbra*15+i] - + cimag(coeff_c2s[76])*gcart[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[78])*gcart[nbra*18+i]*_Complex_I; - gsp[4*nbra+i] = creal(coeff_c2s[80])*gcart[nbra* 0+i] - + cimag(coeff_c2s[81])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[83])*gcart[nbra* 3+i] - + creal(coeff_c2s[85])*gcart[nbra* 5+i] - + cimag(coeff_c2s[86])*gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[88])*gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[92])*gcart[nbra*12+i] - + cimag(coeff_c2s[94])*gcart[nbra*14+i]*_Complex_I - + creal(coeff_c2s[97])*gcart[nbra*17+i]; - gsp[5*nbra+i] = creal(coeff_c2s[102])*gcart[nbra* 2+i] - + cimag(coeff_c2s[104])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[107])*gcart[nbra* 7+i] - + creal(coeff_c2s[110])*gcart[nbra*10+i] - + cimag(coeff_c2s[111])*gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[113])*gcart[nbra*13+i] - + cimag(coeff_c2s[116])*gcart[nbra*16+i]*_Complex_I; - } - gsp += nbra * 6; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[3].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[10])*gcart[nbra*10+i] - + cimag(coeff_c2s[11])*gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[13])*gcart[nbra*13+i] - + cimag(coeff_c2s[16])*gcart[nbra*16+i]*_Complex_I; - gsp[1*nbra+i] = creal(coeff_c2s[20])*gcart[nbra* 0+i] - + cimag(coeff_c2s[21])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[23])*gcart[nbra* 3+i] - + cimag(coeff_c2s[26])*gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[32])*gcart[nbra*12+i] - + cimag(coeff_c2s[34])*gcart[nbra*14+i]*_Complex_I - + creal(coeff_c2s[37])*gcart[nbra*17+i]; - gsp[2*nbra+i] = creal(coeff_c2s[42])*gcart[nbra* 2+i] - + cimag(coeff_c2s[44])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[47])*gcart[nbra* 7+i] - + creal(coeff_c2s[50])*gcart[nbra*10+i] - + cimag(coeff_c2s[51])*gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[53])*gcart[nbra*13+i] - + creal(coeff_c2s[55])*gcart[nbra*15+i] - + cimag(coeff_c2s[56])*gcart[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[58])*gcart[nbra*18+i]*_Complex_I; - gsp[3*nbra+i] = creal(coeff_c2s[60])*gcart[nbra* 0+i] - + cimag(coeff_c2s[61])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[63])*gcart[nbra* 3+i] - + creal(coeff_c2s[65])*gcart[nbra* 5+i] - + cimag(coeff_c2s[66])*gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[68])*gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[72])*gcart[nbra*12+i] - + creal(coeff_c2s[77])*gcart[nbra*17+i] - + creal(coeff_c2s[79])*gcart[nbra*19+i]; - gsp[4*nbra+i] = creal(coeff_c2s[82])*gcart[nbra* 2+i] - + creal(coeff_c2s[87])*gcart[nbra* 7+i] - + creal(coeff_c2s[89])*gcart[nbra* 9+i] - + creal(coeff_c2s[90])*gcart[nbra*10+i] - + cimag(coeff_c2s[91])*gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[93])*gcart[nbra*13+i] - + creal(coeff_c2s[95])*gcart[nbra*15+i] - + cimag(coeff_c2s[96])*gcart[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[98])*gcart[nbra*18+i]*_Complex_I; - gsp[5*nbra+i] = creal(coeff_c2s[100])*gcart[nbra* 0+i] - + cimag(coeff_c2s[101])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[103])*gcart[nbra* 3+i] - + creal(coeff_c2s[105])*gcart[nbra* 5+i] - + cimag(coeff_c2s[106])*gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[108])*gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[112])*gcart[nbra*12+i] - + cimag(coeff_c2s[114])*gcart[nbra*14+i]*_Complex_I - + creal(coeff_c2s[117])*gcart[nbra*17+i]; - gsp[6*nbra+i] = creal(coeff_c2s[122])*gcart[nbra* 2+i] - + cimag(coeff_c2s[124])*gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127])*gcart[nbra* 7+i] - + creal(coeff_c2s[130])*gcart[nbra*10+i] - + cimag(coeff_c2s[131])*gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[133])*gcart[nbra*13+i] - + cimag(coeff_c2s[136])*gcart[nbra*16+i]*_Complex_I; - gsp[7*nbra+i] = creal(coeff_c2s[140])*gcart[nbra* 0+i] - + cimag(coeff_c2s[141])*gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[143])*gcart[nbra* 3+i] - + cimag(coeff_c2s[146])*gcart[nbra* 6+i]*_Complex_I; - } - } -} -static void f_iket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[3].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[0])*gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[1])*gcart[nbra* 1+i] - + creal(coeff_c2s[3])*gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[6])*gcart[nbra* 6+i] - + creal(coeff_c2s[12])*gcart[nbra*12+i]*_Complex_I - - cimag(coeff_c2s[14])*gcart[nbra*14+i] - + creal(coeff_c2s[17])*gcart[nbra*17+i]*_Complex_I; - gsp[1*nbra+i] = creal(coeff_c2s[22])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[24])*gcart[nbra* 4+i] - + creal(coeff_c2s[27])*gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[30])*gcart[nbra*10+i]*_Complex_I - - cimag(coeff_c2s[31])*gcart[nbra*11+i] - + creal(coeff_c2s[33])*gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[35])*gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[36])*gcart[nbra*16+i] - - cimag(coeff_c2s[38])*gcart[nbra*18+i]; - gsp[2*nbra+i] = creal(coeff_c2s[40])*gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[41])*gcart[nbra* 1+i] - + creal(coeff_c2s[43])*gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[45])*gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[46])*gcart[nbra* 6+i] - - cimag(coeff_c2s[48])*gcart[nbra* 8+i] - + creal(coeff_c2s[52])*gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[57])*gcart[nbra*17+i]*_Complex_I - + creal(coeff_c2s[59])*gcart[nbra*19+i]*_Complex_I; - gsp[3*nbra+i] = creal(coeff_c2s[62])*gcart[nbra* 2+i]*_Complex_I - + creal(coeff_c2s[67])*gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[69])*gcart[nbra* 9+i]*_Complex_I - + creal(coeff_c2s[70])*gcart[nbra*10+i]*_Complex_I - - cimag(coeff_c2s[71])*gcart[nbra*11+i] - + creal(coeff_c2s[73])*gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[75])*gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[76])*gcart[nbra*16+i] - - cimag(coeff_c2s[78])*gcart[nbra*18+i]; - gsp[4*nbra+i] = creal(coeff_c2s[80])*gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[81])*gcart[nbra* 1+i] - + creal(coeff_c2s[83])*gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[85])*gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[86])*gcart[nbra* 6+i] - - cimag(coeff_c2s[88])*gcart[nbra* 8+i] - + creal(coeff_c2s[92])*gcart[nbra*12+i]*_Complex_I - - cimag(coeff_c2s[94])*gcart[nbra*14+i] - + creal(coeff_c2s[97])*gcart[nbra*17+i]*_Complex_I; - gsp[5*nbra+i] = creal(coeff_c2s[102])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[104])*gcart[nbra* 4+i] - + creal(coeff_c2s[107])*gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[110])*gcart[nbra*10+i]*_Complex_I - - cimag(coeff_c2s[111])*gcart[nbra*11+i] - + creal(coeff_c2s[113])*gcart[nbra*13+i]*_Complex_I - - cimag(coeff_c2s[116])*gcart[nbra*16+i]; - } - gsp += nbra * 6; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[3].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[10])*gcart[nbra*10+i]*_Complex_I - - cimag(coeff_c2s[11])*gcart[nbra*11+i] - + creal(coeff_c2s[13])*gcart[nbra*13+i]*_Complex_I - - cimag(coeff_c2s[16])*gcart[nbra*16+i]; - gsp[1*nbra+i] = creal(coeff_c2s[20])*gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[21])*gcart[nbra* 1+i] - + creal(coeff_c2s[23])*gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[26])*gcart[nbra* 6+i] - + creal(coeff_c2s[32])*gcart[nbra*12+i]*_Complex_I - - cimag(coeff_c2s[34])*gcart[nbra*14+i] - + creal(coeff_c2s[37])*gcart[nbra*17+i]*_Complex_I; - gsp[2*nbra+i] = creal(coeff_c2s[42])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[44])*gcart[nbra* 4+i] - + creal(coeff_c2s[47])*gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[50])*gcart[nbra*10+i]*_Complex_I - - cimag(coeff_c2s[51])*gcart[nbra*11+i] - + creal(coeff_c2s[53])*gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[55])*gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[56])*gcart[nbra*16+i] - - cimag(coeff_c2s[58])*gcart[nbra*18+i]; - gsp[3*nbra+i] = creal(coeff_c2s[60])*gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[61])*gcart[nbra* 1+i] - + creal(coeff_c2s[63])*gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[65])*gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[66])*gcart[nbra* 6+i] - - cimag(coeff_c2s[68])*gcart[nbra* 8+i] - + creal(coeff_c2s[72])*gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[77])*gcart[nbra*17+i]*_Complex_I - + creal(coeff_c2s[79])*gcart[nbra*19+i]*_Complex_I; - gsp[4*nbra+i] = creal(coeff_c2s[82])*gcart[nbra* 2+i]*_Complex_I - + creal(coeff_c2s[87])*gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[89])*gcart[nbra* 9+i]*_Complex_I - + creal(coeff_c2s[90])*gcart[nbra*10+i]*_Complex_I - - cimag(coeff_c2s[91])*gcart[nbra*11+i] - + creal(coeff_c2s[93])*gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[95])*gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[96])*gcart[nbra*16+i] - - cimag(coeff_c2s[98])*gcart[nbra*18+i]; - gsp[5*nbra+i] = creal(coeff_c2s[100])*gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[101])*gcart[nbra* 1+i] - + creal(coeff_c2s[103])*gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[105])*gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[106])*gcart[nbra* 6+i] - - cimag(coeff_c2s[108])*gcart[nbra* 8+i] - + creal(coeff_c2s[112])*gcart[nbra*12+i]*_Complex_I - - cimag(coeff_c2s[114])*gcart[nbra*14+i] - + creal(coeff_c2s[117])*gcart[nbra*17+i]*_Complex_I; - gsp[6*nbra+i] = creal(coeff_c2s[122])*gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[124])*gcart[nbra* 4+i] - + creal(coeff_c2s[127])*gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[130])*gcart[nbra*10+i]*_Complex_I - - cimag(coeff_c2s[131])*gcart[nbra*11+i] - + creal(coeff_c2s[133])*gcart[nbra*13+i]*_Complex_I - - cimag(coeff_c2s[136])*gcart[nbra*16+i]; - gsp[7*nbra+i] = creal(coeff_c2s[140])*gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[141])*gcart[nbra* 1+i] - + creal(coeff_c2s[143])*gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[146])*gcart[nbra* 6+i]; - } - } -} static void g_bra_cart2spinor_sf(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) @@ -4673,422 +4175,6 @@ static void g_bra_cart2spinor_si(double complex *gsp, FINT nket, } } } -static void g_ket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[4].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[ 0]) * gcart[nbra* 0+i] - + cimag(coeff_c2s[ 1]) * gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3]) * gcart[nbra* 3+i] - + cimag(coeff_c2s[ 6]) * gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[10]) * gcart[nbra*10+i] - + creal(coeff_c2s[17]) * gcart[nbra*17+i] - + cimag(coeff_c2s[19]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[22]) * gcart[nbra*22+i] - + cimag(coeff_c2s[26]) * gcart[nbra*26+i]*_Complex_I; - gsp[1*nbra+i] = creal(coeff_c2s[32]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[34]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[37]) * gcart[nbra* 7+i] - + cimag(coeff_c2s[41]) * gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[45]) * gcart[nbra*15+i] - + cimag(coeff_c2s[46]) * gcart[nbra*16+i]*_Complex_I - + creal(coeff_c2s[50]) * gcart[nbra*20+i] - + cimag(coeff_c2s[51]) * gcart[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[53]) * gcart[nbra*23+i]*_Complex_I - + creal(coeff_c2s[55]) * gcart[nbra*25+i] - + creal(coeff_c2s[57]) * gcart[nbra*27+i]; - gsp[2*nbra+i] = creal(coeff_c2s[60]) * gcart[nbra* 0+i] - + cimag(coeff_c2s[61]) * gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[65]) * gcart[nbra* 5+i] - + cimag(coeff_c2s[66]) * gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[68]) * gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[70]) * gcart[nbra*10+i] - + creal(coeff_c2s[72]) * gcart[nbra*12+i] - + creal(coeff_c2s[77]) * gcart[nbra*17+i] - + cimag(coeff_c2s[79]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[82]) * gcart[nbra*22+i] - + creal(coeff_c2s[84]) * gcart[nbra*24+i] - + cimag(coeff_c2s[86]) * gcart[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[88]) * gcart[nbra*28+i]*_Complex_I; - gsp[3*nbra+i] = creal(coeff_c2s[92]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[94]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[97]) * gcart[nbra* 7+i] - + creal(coeff_c2s[99]) * gcart[nbra* 9+i] - + cimag(coeff_c2s[101]) * gcart[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[103]) * gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[105]) * gcart[nbra*15+i] - + creal(coeff_c2s[108]) * gcart[nbra*18+i] - + creal(coeff_c2s[110]) * gcart[nbra*20+i] - + creal(coeff_c2s[115]) * gcart[nbra*25+i] - + creal(coeff_c2s[117]) * gcart[nbra*27+i] - + creal(coeff_c2s[119]) * gcart[nbra*29+i]; - gsp[4*nbra+i] = creal(coeff_c2s[120]) * gcart[nbra* 0+i] - + creal(coeff_c2s[123]) * gcart[nbra* 3+i] - + creal(coeff_c2s[125]) * gcart[nbra* 5+i] - + creal(coeff_c2s[130]) * gcart[nbra*10+i] - + creal(coeff_c2s[132]) * gcart[nbra*12+i] - + creal(coeff_c2s[134]) * gcart[nbra*14+i] - + creal(coeff_c2s[137]) * gcart[nbra*17+i] - + cimag(coeff_c2s[139]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[142]) * gcart[nbra*22+i] - + creal(coeff_c2s[144]) * gcart[nbra*24+i] - + cimag(coeff_c2s[146]) * gcart[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[148]) * gcart[nbra*28+i]*_Complex_I; - gsp[5*nbra+i] = creal(coeff_c2s[152]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[154]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[157]) * gcart[nbra* 7+i] - + creal(coeff_c2s[159]) * gcart[nbra* 9+i] - + cimag(coeff_c2s[161]) * gcart[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[163]) * gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[165]) * gcart[nbra*15+i] - + cimag(coeff_c2s[166]) * gcart[nbra*16+i]*_Complex_I - + creal(coeff_c2s[170]) * gcart[nbra*20+i] - + cimag(coeff_c2s[171]) * gcart[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[173]) * gcart[nbra*23+i]*_Complex_I - + creal(coeff_c2s[175]) * gcart[nbra*25+i] - + creal(coeff_c2s[177]) * gcart[nbra*27+i]; - gsp[6*nbra+i] = creal(coeff_c2s[180]) * gcart[nbra* 0+i] - + cimag(coeff_c2s[181]) * gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[185]) * gcart[nbra* 5+i] - + cimag(coeff_c2s[186]) * gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[188]) * gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[190]) * gcart[nbra*10+i] - + creal(coeff_c2s[192]) * gcart[nbra*12+i] - + creal(coeff_c2s[197]) * gcart[nbra*17+i] - + cimag(coeff_c2s[199]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[202]) * gcart[nbra*22+i] - + cimag(coeff_c2s[206]) * gcart[nbra*26+i]*_Complex_I; - gsp[7*nbra+i] = creal(coeff_c2s[212]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[214]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[217]) * gcart[nbra* 7+i] - + cimag(coeff_c2s[221]) * gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[225]) * gcart[nbra*15+i] - + cimag(coeff_c2s[226]) * gcart[nbra*16+i]*_Complex_I - + creal(coeff_c2s[228]) * gcart[nbra*18+i] - + cimag(coeff_c2s[231]) * gcart[nbra*21+i]*_Complex_I - + creal(coeff_c2s[235]) * gcart[nbra*25+i]; - }; - gsp += nbra * 8; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[4].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[15]) * gcart[nbra*15+i] - + cimag(coeff_c2s[16]) * gcart[nbra*16+i]*_Complex_I - + creal(coeff_c2s[18]) * gcart[nbra*18+i] - + cimag(coeff_c2s[21]) * gcart[nbra*21+i]*_Complex_I - + creal(coeff_c2s[25]) * gcart[nbra*25+i]; - gsp[1*nbra+i] = creal(coeff_c2s[30]) * gcart[nbra* 0+i] - + cimag(coeff_c2s[31]) * gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[33]) * gcart[nbra* 3+i] - + cimag(coeff_c2s[36]) * gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[40]) * gcart[nbra*10+i] - + creal(coeff_c2s[47]) * gcart[nbra*17+i] - + cimag(coeff_c2s[49]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[52]) * gcart[nbra*22+i] - + cimag(coeff_c2s[56]) * gcart[nbra*26+i]*_Complex_I; - gsp[2*nbra+i] = creal(coeff_c2s[62]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[64]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[67]) * gcart[nbra* 7+i] - + cimag(coeff_c2s[71]) * gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[75]) * gcart[nbra*15+i] - + cimag(coeff_c2s[76]) * gcart[nbra*16+i]*_Complex_I - + creal(coeff_c2s[80]) * gcart[nbra*20+i] - + cimag(coeff_c2s[81]) * gcart[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[83]) * gcart[nbra*23+i]*_Complex_I - + creal(coeff_c2s[85]) * gcart[nbra*25+i] - + creal(coeff_c2s[87]) * gcart[nbra*27+i]; - gsp[3*nbra+i] = creal(coeff_c2s[90]) * gcart[nbra* 0+i] - + cimag(coeff_c2s[91]) * gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[95]) * gcart[nbra* 5+i] - + cimag(coeff_c2s[96]) * gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[98]) * gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[100]) * gcart[nbra*10+i] - + creal(coeff_c2s[102]) * gcart[nbra*12+i] - + creal(coeff_c2s[107]) * gcart[nbra*17+i] - + cimag(coeff_c2s[109]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[112]) * gcart[nbra*22+i] - + creal(coeff_c2s[114]) * gcart[nbra*24+i] - + cimag(coeff_c2s[116]) * gcart[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[118]) * gcart[nbra*28+i]*_Complex_I; - gsp[4*nbra+i] = creal(coeff_c2s[122]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[124]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127]) * gcart[nbra* 7+i] - + creal(coeff_c2s[129]) * gcart[nbra* 9+i] - + cimag(coeff_c2s[131]) * gcart[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[133]) * gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[135]) * gcart[nbra*15+i] - + creal(coeff_c2s[138]) * gcart[nbra*18+i] - + creal(coeff_c2s[140]) * gcart[nbra*20+i] - + creal(coeff_c2s[145]) * gcart[nbra*25+i] - + creal(coeff_c2s[147]) * gcart[nbra*27+i] - + creal(coeff_c2s[149]) * gcart[nbra*29+i]; - gsp[5*nbra+i] = creal(coeff_c2s[150]) * gcart[nbra* 0+i] - + creal(coeff_c2s[153]) * gcart[nbra* 3+i] - + creal(coeff_c2s[155]) * gcart[nbra* 5+i] - + creal(coeff_c2s[160]) * gcart[nbra*10+i] - + creal(coeff_c2s[162]) * gcart[nbra*12+i] - + creal(coeff_c2s[164]) * gcart[nbra*14+i] - + creal(coeff_c2s[167]) * gcart[nbra*17+i] - + cimag(coeff_c2s[169]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[172]) * gcart[nbra*22+i] - + creal(coeff_c2s[174]) * gcart[nbra*24+i] - + cimag(coeff_c2s[176]) * gcart[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[178]) * gcart[nbra*28+i]*_Complex_I; - gsp[6*nbra+i] = creal(coeff_c2s[182]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[184]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[187]) * gcart[nbra* 7+i] - + creal(coeff_c2s[189]) * gcart[nbra* 9+i] - + cimag(coeff_c2s[191]) * gcart[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[193]) * gcart[nbra*13+i]*_Complex_I - + creal(coeff_c2s[195]) * gcart[nbra*15+i] - + cimag(coeff_c2s[196]) * gcart[nbra*16+i]*_Complex_I - + creal(coeff_c2s[200]) * gcart[nbra*20+i] - + cimag(coeff_c2s[201]) * gcart[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[203]) * gcart[nbra*23+i]*_Complex_I - + creal(coeff_c2s[205]) * gcart[nbra*25+i] - + creal(coeff_c2s[207]) * gcart[nbra*27+i]; - gsp[7*nbra+i] = creal(coeff_c2s[210]) * gcart[nbra* 0+i] - + cimag(coeff_c2s[211]) * gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[215]) * gcart[nbra* 5+i] - + cimag(coeff_c2s[216]) * gcart[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[218]) * gcart[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[220]) * gcart[nbra*10+i] - + creal(coeff_c2s[222]) * gcart[nbra*12+i] - + creal(coeff_c2s[227]) * gcart[nbra*17+i] - + cimag(coeff_c2s[229]) * gcart[nbra*19+i]*_Complex_I - + creal(coeff_c2s[232]) * gcart[nbra*22+i] - + cimag(coeff_c2s[236]) * gcart[nbra*26+i]*_Complex_I; - gsp[8*nbra+i] = creal(coeff_c2s[242]) * gcart[nbra* 2+i] - + cimag(coeff_c2s[244]) * gcart[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[247]) * gcart[nbra* 7+i] - + cimag(coeff_c2s[251]) * gcart[nbra*11+i]*_Complex_I - + creal(coeff_c2s[255]) * gcart[nbra*15+i] - + cimag(coeff_c2s[256]) * gcart[nbra*16+i]*_Complex_I - + creal(coeff_c2s[258]) * gcart[nbra*18+i] - + cimag(coeff_c2s[261]) * gcart[nbra*21+i]*_Complex_I - + creal(coeff_c2s[265]) * gcart[nbra*25+i]; - gsp[9*nbra+i] = creal(coeff_c2s[270]) * gcart[nbra* 0+i] - + cimag(coeff_c2s[271]) * gcart[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[273]) * gcart[nbra* 3+i] - + cimag(coeff_c2s[276]) * gcart[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[280]) * gcart[nbra*10+i]; - } - } -} -static void g_iket_cart2spinor(double complex *gsp, FINT nbra, - double complex *gcart, FINT kappa, FINT l) -{ - const double complex *coeff_c2s; - FINT i; - - if (kappa >= 0) { - coeff_c2s = g_c2s[4].cart2j_lt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[ 0]) * gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[ 1]) * gcart[nbra* 1+i] - + creal(coeff_c2s[ 3]) * gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[ 6]) * gcart[nbra* 6+i] - + creal(coeff_c2s[10]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[17]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[19]) * gcart[nbra*19+i] - + creal(coeff_c2s[22]) * gcart[nbra*22+i]*_Complex_I - - cimag(coeff_c2s[26]) * gcart[nbra*26+i]; - gsp[1*nbra+i] = creal(coeff_c2s[32]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[34]) * gcart[nbra* 4+i] - + creal(coeff_c2s[37]) * gcart[nbra* 7+i]*_Complex_I - - cimag(coeff_c2s[41]) * gcart[nbra*11+i] - + creal(coeff_c2s[45]) * gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[46]) * gcart[nbra*16+i] - + creal(coeff_c2s[50]) * gcart[nbra*20+i]*_Complex_I - - cimag(coeff_c2s[51]) * gcart[nbra*21+i] - - cimag(coeff_c2s[53]) * gcart[nbra*23+i] - + creal(coeff_c2s[55]) * gcart[nbra*25+i]*_Complex_I - + creal(coeff_c2s[57]) * gcart[nbra*27+i]*_Complex_I; - gsp[2*nbra+i] = creal(coeff_c2s[60]) * gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[61]) * gcart[nbra* 1+i] - + creal(coeff_c2s[65]) * gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[66]) * gcart[nbra* 6+i] - - cimag(coeff_c2s[68]) * gcart[nbra* 8+i] - + creal(coeff_c2s[70]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[72]) * gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[77]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[79]) * gcart[nbra*19+i] - + creal(coeff_c2s[82]) * gcart[nbra*22+i]*_Complex_I - + creal(coeff_c2s[84]) * gcart[nbra*24+i]*_Complex_I - - cimag(coeff_c2s[86]) * gcart[nbra*26+i] - - cimag(coeff_c2s[88]) * gcart[nbra*28+i]; - gsp[3*nbra+i] = creal(coeff_c2s[92]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[94]) * gcart[nbra* 4+i] - + creal(coeff_c2s[97]) * gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[99]) * gcart[nbra* 9+i]*_Complex_I - - cimag(coeff_c2s[101]) * gcart[nbra*11+i] - - cimag(coeff_c2s[103]) * gcart[nbra*13+i] - + creal(coeff_c2s[105]) * gcart[nbra*15+i]*_Complex_I - + creal(coeff_c2s[108]) * gcart[nbra*18+i]*_Complex_I - + creal(coeff_c2s[110]) * gcart[nbra*20+i]*_Complex_I - + creal(coeff_c2s[115]) * gcart[nbra*25+i]*_Complex_I - + creal(coeff_c2s[117]) * gcart[nbra*27+i]*_Complex_I - + creal(coeff_c2s[119]) * gcart[nbra*29+i]*_Complex_I; - gsp[4*nbra+i] = creal(coeff_c2s[120]) * gcart[nbra* 0+i]*_Complex_I - + creal(coeff_c2s[123]) * gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[125]) * gcart[nbra* 5+i]*_Complex_I - + creal(coeff_c2s[130]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[132]) * gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[134]) * gcart[nbra*14+i]*_Complex_I - + creal(coeff_c2s[137]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[139]) * gcart[nbra*19+i] - + creal(coeff_c2s[142]) * gcart[nbra*22+i]*_Complex_I - + creal(coeff_c2s[144]) * gcart[nbra*24+i]*_Complex_I - - cimag(coeff_c2s[146]) * gcart[nbra*26+i] - - cimag(coeff_c2s[148]) * gcart[nbra*28+i]; - gsp[5*nbra+i] = creal(coeff_c2s[152]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[154]) * gcart[nbra* 4+i] - + creal(coeff_c2s[157]) * gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[159]) * gcart[nbra* 9+i]*_Complex_I - - cimag(coeff_c2s[161]) * gcart[nbra*11+i] - - cimag(coeff_c2s[163]) * gcart[nbra*13+i] - + creal(coeff_c2s[165]) * gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[166]) * gcart[nbra*16+i] - + creal(coeff_c2s[170]) * gcart[nbra*20+i]*_Complex_I - - cimag(coeff_c2s[171]) * gcart[nbra*21+i] - - cimag(coeff_c2s[173]) * gcart[nbra*23+i] - + creal(coeff_c2s[175]) * gcart[nbra*25+i]*_Complex_I - + creal(coeff_c2s[177]) * gcart[nbra*27+i]*_Complex_I; - gsp[6*nbra+i] = creal(coeff_c2s[180]) * gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[181]) * gcart[nbra* 1+i] - + creal(coeff_c2s[185]) * gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[186]) * gcart[nbra* 6+i] - - cimag(coeff_c2s[188]) * gcart[nbra* 8+i] - + creal(coeff_c2s[190]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[192]) * gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[197]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[199]) * gcart[nbra*19+i] - + creal(coeff_c2s[202]) * gcart[nbra*22+i]*_Complex_I - - cimag(coeff_c2s[206]) * gcart[nbra*26+i]; - gsp[7*nbra+i] = creal(coeff_c2s[212]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[214]) * gcart[nbra* 4+i] - + creal(coeff_c2s[217]) * gcart[nbra* 7+i]*_Complex_I - - cimag(coeff_c2s[221]) * gcart[nbra*11+i] - + creal(coeff_c2s[225]) * gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[226]) * gcart[nbra*16+i] - + creal(coeff_c2s[228]) * gcart[nbra*18+i]*_Complex_I - - cimag(coeff_c2s[231]) * gcart[nbra*21+i] - + creal(coeff_c2s[235]) * gcart[nbra*25+i]*_Complex_I; - }; - gsp += nbra * 8; - } - if (kappa <= 0) { - coeff_c2s = g_c2s[4].cart2j_gt_l; - for (i = 0; i < nbra; i++) { - gsp[0*nbra+i] = creal(coeff_c2s[15]) * gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[16]) * gcart[nbra*16+i] - + creal(coeff_c2s[18]) * gcart[nbra*18+i]*_Complex_I - - cimag(coeff_c2s[21]) * gcart[nbra*21+i] - + creal(coeff_c2s[25]) * gcart[nbra*25+i]*_Complex_I; - gsp[1*nbra+i] = creal(coeff_c2s[30]) * gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[31]) * gcart[nbra* 1+i] - + creal(coeff_c2s[33]) * gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[36]) * gcart[nbra* 6+i] - + creal(coeff_c2s[40]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[47]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[49]) * gcart[nbra*19+i] - + creal(coeff_c2s[52]) * gcart[nbra*22+i]*_Complex_I - - cimag(coeff_c2s[56]) * gcart[nbra*26+i]; - gsp[2*nbra+i] = creal(coeff_c2s[62]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[64]) * gcart[nbra* 4+i] - + creal(coeff_c2s[67]) * gcart[nbra* 7+i]*_Complex_I - - cimag(coeff_c2s[71]) * gcart[nbra*11+i] - + creal(coeff_c2s[75]) * gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[76]) * gcart[nbra*16+i] - + creal(coeff_c2s[80]) * gcart[nbra*20+i]*_Complex_I - - cimag(coeff_c2s[81]) * gcart[nbra*21+i] - - cimag(coeff_c2s[83]) * gcart[nbra*23+i] - + creal(coeff_c2s[85]) * gcart[nbra*25+i]*_Complex_I - + creal(coeff_c2s[87]) * gcart[nbra*27+i]*_Complex_I; - gsp[3*nbra+i] = creal(coeff_c2s[90]) * gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[91]) * gcart[nbra* 1+i] - + creal(coeff_c2s[95]) * gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[96]) * gcart[nbra* 6+i] - - cimag(coeff_c2s[98]) * gcart[nbra* 8+i] - + creal(coeff_c2s[100]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[102]) * gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[107]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[109]) * gcart[nbra*19+i] - + creal(coeff_c2s[112]) * gcart[nbra*22+i]*_Complex_I - + creal(coeff_c2s[114]) * gcart[nbra*24+i]*_Complex_I - - cimag(coeff_c2s[116]) * gcart[nbra*26+i] - - cimag(coeff_c2s[118]) * gcart[nbra*28+i]; - gsp[4*nbra+i] = creal(coeff_c2s[122]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[124]) * gcart[nbra* 4+i] - + creal(coeff_c2s[127]) * gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[129]) * gcart[nbra* 9+i]*_Complex_I - - cimag(coeff_c2s[131]) * gcart[nbra*11+i] - - cimag(coeff_c2s[133]) * gcart[nbra*13+i] - + creal(coeff_c2s[135]) * gcart[nbra*15+i]*_Complex_I - + creal(coeff_c2s[138]) * gcart[nbra*18+i]*_Complex_I - + creal(coeff_c2s[140]) * gcart[nbra*20+i]*_Complex_I - + creal(coeff_c2s[145]) * gcart[nbra*25+i]*_Complex_I - + creal(coeff_c2s[147]) * gcart[nbra*27+i]*_Complex_I - + creal(coeff_c2s[149]) * gcart[nbra*29+i]*_Complex_I; - gsp[5*nbra+i] = creal(coeff_c2s[150]) * gcart[nbra* 0+i]*_Complex_I - + creal(coeff_c2s[153]) * gcart[nbra* 3+i]*_Complex_I - + creal(coeff_c2s[155]) * gcart[nbra* 5+i]*_Complex_I - + creal(coeff_c2s[160]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[162]) * gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[164]) * gcart[nbra*14+i]*_Complex_I - + creal(coeff_c2s[167]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[169]) * gcart[nbra*19+i] - + creal(coeff_c2s[172]) * gcart[nbra*22+i]*_Complex_I - + creal(coeff_c2s[174]) * gcart[nbra*24+i]*_Complex_I - - cimag(coeff_c2s[176]) * gcart[nbra*26+i] - - cimag(coeff_c2s[178]) * gcart[nbra*28+i]; - gsp[6*nbra+i] = creal(coeff_c2s[182]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[184]) * gcart[nbra* 4+i] - + creal(coeff_c2s[187]) * gcart[nbra* 7+i]*_Complex_I - + creal(coeff_c2s[189]) * gcart[nbra* 9+i]*_Complex_I - - cimag(coeff_c2s[191]) * gcart[nbra*11+i] - - cimag(coeff_c2s[193]) * gcart[nbra*13+i] - + creal(coeff_c2s[195]) * gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[196]) * gcart[nbra*16+i] - + creal(coeff_c2s[200]) * gcart[nbra*20+i]*_Complex_I - - cimag(coeff_c2s[201]) * gcart[nbra*21+i] - - cimag(coeff_c2s[203]) * gcart[nbra*23+i] - + creal(coeff_c2s[205]) * gcart[nbra*25+i]*_Complex_I - + creal(coeff_c2s[207]) * gcart[nbra*27+i]*_Complex_I; - gsp[7*nbra+i] = creal(coeff_c2s[210]) * gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[211]) * gcart[nbra* 1+i] - + creal(coeff_c2s[215]) * gcart[nbra* 5+i]*_Complex_I - - cimag(coeff_c2s[216]) * gcart[nbra* 6+i] - - cimag(coeff_c2s[218]) * gcart[nbra* 8+i] - + creal(coeff_c2s[220]) * gcart[nbra*10+i]*_Complex_I - + creal(coeff_c2s[222]) * gcart[nbra*12+i]*_Complex_I - + creal(coeff_c2s[227]) * gcart[nbra*17+i]*_Complex_I - - cimag(coeff_c2s[229]) * gcart[nbra*19+i] - + creal(coeff_c2s[232]) * gcart[nbra*22+i]*_Complex_I - - cimag(coeff_c2s[236]) * gcart[nbra*26+i]; - gsp[8*nbra+i] = creal(coeff_c2s[242]) * gcart[nbra* 2+i]*_Complex_I - - cimag(coeff_c2s[244]) * gcart[nbra* 4+i] - + creal(coeff_c2s[247]) * gcart[nbra* 7+i]*_Complex_I - - cimag(coeff_c2s[251]) * gcart[nbra*11+i] - + creal(coeff_c2s[255]) * gcart[nbra*15+i]*_Complex_I - - cimag(coeff_c2s[256]) * gcart[nbra*16+i] - + creal(coeff_c2s[258]) * gcart[nbra*18+i]*_Complex_I - - cimag(coeff_c2s[261]) * gcart[nbra*21+i] - + creal(coeff_c2s[265]) * gcart[nbra*25+i]*_Complex_I; - gsp[9*nbra+i] = creal(coeff_c2s[270]) * gcart[nbra* 0+i]*_Complex_I - - cimag(coeff_c2s[271]) * gcart[nbra* 1+i] - + creal(coeff_c2s[273]) * gcart[nbra* 3+i]*_Complex_I - - cimag(coeff_c2s[276]) * gcart[nbra* 6+i] - + creal(coeff_c2s[280]) * gcart[nbra*10+i]*_Complex_I; - } - } -} void (*c2s_bra_spinor_e1sf[])() = { s_bra_cart2spinor_e1sf, @@ -5128,44 +4214,6 @@ void (*c2s_bra_spinor_sf[])() = { a_bra_cart2spinor_sf, }; -void (*c2s_ket_spinor[])() = { - s_ket_cart2spinor, - p_ket_cart2spinor, - d_ket_cart2spinor, - f_ket_cart2spinor, - g_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, - a_ket_cart2spinor, -}; - -void (*c2s_iket_spinor[])() = { - s_iket_cart2spinor, - p_iket_cart2spinor, - d_iket_cart2spinor, - f_iket_cart2spinor, - g_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, - a_iket_cart2spinor, -}; - void (*c2s_bra_spinor_si[])() = { s_bra_cart2spinor_si, p_bra_cart2spinor_si, @@ -5195,7 +4243,7 @@ static void a_ket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, const double complex Z0 = 0; const double complex Z1 = 1; const char TRANS_N = 'N'; - FINT nf = (l+1)*(l+2)/2; + FINT nf = _len_cart[l]; FINT nf2 = nf * 2; FINT nd = _len_spinor(kappa, l); const double complex *coeff_c2s; @@ -5221,7 +4269,7 @@ static void a_iket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, const double complex Z0 = 0; const double complex ZI = 0 + 1 * _Complex_I; const char TRANS_N = 'N'; - FINT nf = (l+1)*(l+2)/2; + FINT nf = _len_cart[l]; FINT nf2 = nf * 2; FINT nd = _len_spinor(kappa, l); const double complex *coeff_c2s; @@ -5240,28 +4288,51 @@ static void a_iket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, free(tmp); } -static void a_ket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void a_ket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { const double complex Z0 = 0; const double complex Z1 = 1; const char TRANS_N = 'N'; - FINT nf = (l+1)*(l+2)/2; + FINT nf = _len_cart[l]; + FINT nf2 = nf * 2; + FINT nd = _len_spinor(kappa, l); + const double complex *coeff_c2s; + + if (kappa < 0) { // j = l + 1/2 + coeff_c2s = g_c2s[l].cart2j_gt_l; + } else { + coeff_c2s = g_c2s[l].cart2j_lt_l; + } + zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf, + &Z1, gcarta, &nbra, coeff_c2s , &nf2, &Z0, gsp, &lds); + zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf, + &Z1, gcartb, &nbra, coeff_c2s+nf, &nf2, &Z1, gsp, &lds); +} + +static void a_iket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) +{ + const double complex Z0 = 0; + const double complex Z1 = 1; + const double complex ZI = 0 + 1 * _Complex_I; + const char TRANS_N = 'N'; + FINT nf = _len_cart[l]; FINT nf2 = nf * 2; FINT nd = _len_spinor(kappa, l); const double complex *coeff_c2s; - double complex *gcart1 = gcart + nbra * nf2; if (kappa < 0) { // j = l + 1/2 coeff_c2s = g_c2s[l].cart2j_gt_l; } else { coeff_c2s = g_c2s[l].cart2j_lt_l; } - zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf2, - &Z1, gcart, &nbra, coeff_c2s, &nf2, &Z0, gspa, &lds); - zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf2, - &Z1, gcart1, &nbra, coeff_c2s, &nf2, &Z0, gspb, &lds); + zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf, + &ZI, gcarta, &nbra, coeff_c2s , &nf2, &Z0, gsp, &lds); + zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf, + &ZI, gcartb, &nbra, coeff_c2s+nf, &nf2, &Z1, gsp, &lds); } // cket = conjugated ket. Equivalent to applying bra on columns @@ -5272,7 +4343,7 @@ static void a_cket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, const double complex Z0 = 0; const double complex Z1 = 1; const char TRANS_N = 'N'; - FINT nf = (l+1)*(l+2)/2; + FINT nf = _len_cart[l]; FINT nf2 = nf * 2; FINT nd = _len_spinor(kappa, l); const double complex *coeff_c2s; @@ -5296,18 +4367,17 @@ static void a_cket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, free(tmp); } -static void a_cket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void a_cket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { const double complex Z0 = 0; const double complex Z1 = 1; const char TRANS_N = 'N'; - FINT nf = (l+1)*(l+2)/2; + FINT nf = _len_cart[l]; FINT nf2 = nf * 2; FINT nd = _len_spinor(kappa, l); const double complex *coeff_c2s; - double complex *gcart1 = gcart + nbra * nf2; double complex *coeff_conj = malloc(sizeof(double complex)*nf2*nd); FINT i; @@ -5319,10 +4389,10 @@ static void a_cket_cart2spinor_si(double complex *gspa, double complex *gspb, for (i = 0; i < nf2 * nd; i++) { coeff_conj[i] = conj(coeff_c2s[i]); } - zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf2, - &Z1, gcart, &nbra, coeff_conj, &nf2, &Z0, gspa, &lds); - zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf2, - &Z1, gcart1, &nbra, coeff_conj, &nf2, &Z0, gspb, &lds); + zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf, + &Z1, gcarta, &nbra, coeff_conj , &nf2, &Z0, gsp, &lds); + zgemm_(&TRANS_N, &TRANS_N, &nbra, &nd, &nf, + &Z1, gcartb, &nbra, coeff_conj+nf, &nf2, &Z1, gsp, &lds); free(coeff_conj); } @@ -5350,20 +4420,24 @@ static void s_iket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, gspb[lds+i] = 0; } } -static void s_ket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void s_ket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart11 = gcart; - double complex *gcart12 = gcart11 + nbra; - double complex *gcart21 = gcart12 + nbra; - double complex *gcart22 = gcart21 + nbra; FINT i; for (i = 0; i < nbra; i++) { - gspa[ i] = gcart12[i]; - gspa[lds+i] = gcart11[i]; - gspb[ i] = gcart22[i]; - gspb[lds+i] = gcart21[i]; + gsp[ i] = gcartb[i]; + gsp[lds+i] = gcarta[i]; + } +} +static void s_iket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) +{ + FINT i; + for (i = 0; i < nbra; i++) { + gsp[ i] = gcartb[i] * _Complex_I; + gsp[lds+i] = gcarta[i] * _Complex_I; } } @@ -5483,56 +4557,73 @@ static void p_iket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void p_ket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void p_ket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*6; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[1].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[ i] = creal(coeff_c2s[ 0])*gcart [nbra*0+i] - + cimag(coeff_c2s[ 1])*gcart [nbra*1+i]*_Complex_I - + creal(coeff_c2s[ 5])*gcart [nbra*5+i]; - gspa[lds+i] = creal(coeff_c2s[ 8])*gcart [nbra*2+i] - + creal(coeff_c2s[ 9])*gcart [nbra*3+i] - + cimag(coeff_c2s[10])*gcart [nbra*4+i]*_Complex_I; - gspb[ i] = creal(coeff_c2s[ 0])*gcart1[nbra*0+i] - + cimag(coeff_c2s[ 1])*gcart1[nbra*1+i]*_Complex_I - + creal(coeff_c2s[ 5])*gcart1[nbra*5+i]; - gspb[lds+i] = creal(coeff_c2s[ 8])*gcart1[nbra*2+i] - + creal(coeff_c2s[ 9])*gcart1[nbra*3+i] - + cimag(coeff_c2s[10])*gcart1[nbra*4+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0] + + cimag(coeff_c2s[ 1])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 5])*gcartb[i+nbra*2]; + gsp[i+lds*1] = creal(coeff_c2s[ 8])*gcarta[i+nbra*2] + + creal(coeff_c2s[ 9])*gcartb[i+nbra*0] + + cimag(coeff_c2s[10])*gcartb[i+nbra*1]*_Complex_I; } - gspa += lds * 2; - gspb += lds * 2; + gsp += lds * 2; + } + if (kappa <= 0) { + coeff_c2s = g_c2s[1].cart2j_gt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 3])*gcartb[i+nbra*0] + + cimag(coeff_c2s[ 4])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 6])*gcarta[i+nbra*0] + + cimag(coeff_c2s[ 7])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[11])*gcartb[i+nbra*2]; + gsp[i+lds*2] = creal(coeff_c2s[14])*gcarta[i+nbra*2] + + creal(coeff_c2s[15])*gcartb[i+nbra*0] + + cimag(coeff_c2s[16])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[18])*gcarta[i+nbra*0] + + cimag(coeff_c2s[19])*gcarta[i+nbra*1]*_Complex_I; + } + } +} +static void p_iket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) +{ + const double complex *coeff_c2s; + FINT i; + + if (kappa >= 0) { + coeff_c2s = g_c2s[1].cart2j_lt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 1])*gcarta[i+nbra*1] + + creal(coeff_c2s[ 5])*gcartb[i+nbra*2]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 8])*gcarta[i+nbra*2]*_Complex_I + + creal(coeff_c2s[ 9])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[10])*gcartb[i+nbra*1]; + } + gsp += lds * 2; } if (kappa <= 0) { coeff_c2s = g_c2s[1].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 3])*gcart [nbra*3+i] - + cimag(coeff_c2s[ 4])*gcart [nbra*4+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[ 6])*gcart [nbra*0+i] - + cimag(coeff_c2s[ 7])*gcart [nbra*1+i]*_Complex_I - + creal(coeff_c2s[11])*gcart [nbra*5+i]; - gspa[2*lds+i] = creal(coeff_c2s[14])*gcart [nbra*2+i] - + creal(coeff_c2s[15])*gcart [nbra*3+i] - + cimag(coeff_c2s[16])*gcart [nbra*4+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[18])*gcart [nbra*0+i] - + cimag(coeff_c2s[19])*gcart [nbra*1+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 3])*gcart1[nbra*3+i] - + cimag(coeff_c2s[ 4])*gcart1[nbra*4+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[ 6])*gcart1[nbra*0+i] - + cimag(coeff_c2s[ 7])*gcart1[nbra*1+i]*_Complex_I - + creal(coeff_c2s[11])*gcart1[nbra*5+i]; - gspb[2*lds+i] = creal(coeff_c2s[14])*gcart1[nbra*2+i] - + creal(coeff_c2s[15])*gcart1[nbra*3+i] - + cimag(coeff_c2s[16])*gcart1[nbra*4+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[18])*gcart1[nbra*0+i] - + cimag(coeff_c2s[19])*gcart1[nbra*1+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 3])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 4])*gcartb[i+nbra*1]; + gsp[i+lds*1] = creal(coeff_c2s[ 6])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 7])*gcarta[i+nbra*1] + + creal(coeff_c2s[11])*gcartb[i+nbra*2]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[14])*gcarta[i+nbra*2]*_Complex_I + + creal(coeff_c2s[15])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[16])*gcartb[i+nbra*1]; + gsp[i+lds*3] = creal(coeff_c2s[18])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[19])*gcarta[i+nbra*1]; } } } @@ -5594,56 +4685,38 @@ static void p_cket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void p_cket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void p_cket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*6; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[1].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[ i] = creal(coeff_c2s[ 0])*gcart [nbra*0+i] - - cimag(coeff_c2s[ 1])*gcart [nbra*1+i]*_Complex_I - + creal(coeff_c2s[ 5])*gcart [nbra*5+i]; - gspa[lds+i] = creal(coeff_c2s[ 8])*gcart [nbra*2+i] - + creal(coeff_c2s[ 9])*gcart [nbra*3+i] - - cimag(coeff_c2s[10])*gcart [nbra*4+i]*_Complex_I; - gspb[ i] = creal(coeff_c2s[ 0])*gcart1[nbra*0+i] - - cimag(coeff_c2s[ 1])*gcart1[nbra*1+i]*_Complex_I - + creal(coeff_c2s[ 5])*gcart1[nbra*5+i]; - gspb[lds+i] = creal(coeff_c2s[ 8])*gcart1[nbra*2+i] - + creal(coeff_c2s[ 9])*gcart1[nbra*3+i] - - cimag(coeff_c2s[10])*gcart1[nbra*4+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0] + - cimag(coeff_c2s[ 1])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 5])*gcartb[i+nbra*2]; + gsp[i+lds*1] = creal(coeff_c2s[ 8])*gcarta[i+nbra*2] + + creal(coeff_c2s[ 9])*gcartb[i+nbra*0] + - cimag(coeff_c2s[10])*gcartb[i+nbra*1]*_Complex_I; } - gspa += lds * 2; - gspb += lds * 2; + gsp += lds * 2; } if (kappa <= 0) { coeff_c2s = g_c2s[1].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 3])*gcart [nbra*3+i] - - cimag(coeff_c2s[ 4])*gcart [nbra*4+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[ 6])*gcart [nbra*0+i] - - cimag(coeff_c2s[ 7])*gcart [nbra*1+i]*_Complex_I - + creal(coeff_c2s[11])*gcart [nbra*5+i]; - gspa[2*lds+i] = creal(coeff_c2s[14])*gcart [nbra*2+i] - + creal(coeff_c2s[15])*gcart [nbra*3+i] - - cimag(coeff_c2s[16])*gcart [nbra*4+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[18])*gcart [nbra*0+i] - - cimag(coeff_c2s[19])*gcart [nbra*1+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 3])*gcart1[nbra*3+i] - - cimag(coeff_c2s[ 4])*gcart1[nbra*4+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[ 6])*gcart1[nbra*0+i] - - cimag(coeff_c2s[ 7])*gcart1[nbra*1+i]*_Complex_I - + creal(coeff_c2s[11])*gcart1[nbra*5+i]; - gspb[2*lds+i] = creal(coeff_c2s[14])*gcart1[nbra*2+i] - + creal(coeff_c2s[15])*gcart1[nbra*3+i] - - cimag(coeff_c2s[16])*gcart1[nbra*4+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[18])*gcart1[nbra*0+i] - - cimag(coeff_c2s[19])*gcart1[nbra*1+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 3])*gcartb[i+nbra*0] + - cimag(coeff_c2s[ 4])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 6])*gcarta[i+nbra*0] + - cimag(coeff_c2s[ 7])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[11])*gcartb[i+nbra*2]; + gsp[i+lds*2] = creal(coeff_c2s[14])*gcarta[i+nbra*2] + + creal(coeff_c2s[15])*gcartb[i+nbra*0] + - cimag(coeff_c2s[16])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[18])*gcarta[i+nbra*0] + - cimag(coeff_c2s[19])*gcarta[i+nbra*1]*_Complex_I; } } } @@ -5856,116 +4929,133 @@ static void d_iket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void d_ket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void d_ket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*12; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[2].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 0])*gcart [nbra* 0+i] - + creal(coeff_c2s[ 3])*gcart [nbra* 3+i] - + cimag(coeff_c2s[ 1])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 8])*gcart [nbra* 8+i] - + cimag(coeff_c2s[10])*gcart [nbra*10+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[14])*gcart [nbra* 2+i] - + cimag(coeff_c2s[16])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[18])*gcart [nbra* 6+i] - + creal(coeff_c2s[21])*gcart [nbra* 9+i] - + creal(coeff_c2s[23])*gcart [nbra*11+i]; - gspa[2*lds+i] = creal(coeff_c2s[24])*gcart [nbra* 0+i] - + creal(coeff_c2s[27])*gcart [nbra* 3+i] - + creal(coeff_c2s[29])*gcart [nbra* 5+i] - + creal(coeff_c2s[32])*gcart [nbra* 8+i] - + cimag(coeff_c2s[34])*gcart [nbra*10+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[38])*gcart [nbra* 2+i] - + cimag(coeff_c2s[40])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[42])*gcart [nbra* 6+i] - + creal(coeff_c2s[45])*gcart [nbra* 9+i] - + cimag(coeff_c2s[43])*gcart [nbra* 7+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 0])*gcart1[nbra* 0+i] - + creal(coeff_c2s[ 3])*gcart1[nbra* 3+i] - + cimag(coeff_c2s[ 1])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 8])*gcart1[nbra* 8+i] - + cimag(coeff_c2s[10])*gcart1[nbra*10+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[14])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[16])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[18])*gcart1[nbra* 6+i] - + creal(coeff_c2s[21])*gcart1[nbra* 9+i] - + creal(coeff_c2s[23])*gcart1[nbra*11+i]; - gspb[2*lds+i] = creal(coeff_c2s[24])*gcart1[nbra* 0+i] - + creal(coeff_c2s[27])*gcart1[nbra* 3+i] - + creal(coeff_c2s[29])*gcart1[nbra* 5+i] - + creal(coeff_c2s[32])*gcart1[nbra* 8+i] - + cimag(coeff_c2s[34])*gcart1[nbra*10+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[38])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[40])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[42])*gcart1[nbra* 6+i] - + creal(coeff_c2s[45])*gcart1[nbra* 9+i] - + cimag(coeff_c2s[43])*gcart1[nbra* 7+i]*_Complex_I; - } - gspa += lds * 4; - gspb += lds * 4; + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0] + + creal(coeff_c2s[ 3])*gcarta[i+nbra*3] + + cimag(coeff_c2s[ 1])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 8])*gcartb[i+nbra*2] + + cimag(coeff_c2s[10])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[14])*gcarta[i+nbra*2] + + cimag(coeff_c2s[16])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[18])*gcartb[i+nbra*0] + + creal(coeff_c2s[21])*gcartb[i+nbra*3] + + creal(coeff_c2s[23])*gcartb[i+nbra*5]; + gsp[i+lds*2] = creal(coeff_c2s[24])*gcarta[i+nbra*0] + + creal(coeff_c2s[27])*gcarta[i+nbra*3] + + creal(coeff_c2s[29])*gcarta[i+nbra*5] + + creal(coeff_c2s[32])*gcartb[i+nbra*2] + + cimag(coeff_c2s[34])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[38])*gcarta[i+nbra*2] + + cimag(coeff_c2s[40])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[42])*gcartb[i+nbra*0] + + creal(coeff_c2s[45])*gcartb[i+nbra*3] + + cimag(coeff_c2s[43])*gcartb[i+nbra*1]*_Complex_I; + } + gsp += lds * 4; + } + if (kappa <= 0) { + coeff_c2s = g_c2s[2].cart2j_gt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 6])*gcartb[i+nbra*0] + + creal(coeff_c2s[ 9])*gcartb[i+nbra*3] + + cimag(coeff_c2s[ 7])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[12])*gcarta[i+nbra*0] + + creal(coeff_c2s[15])*gcarta[i+nbra*3] + + cimag(coeff_c2s[13])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[20])*gcartb[i+nbra*2] + + cimag(coeff_c2s[22])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[26])*gcarta[i+nbra*2] + + cimag(coeff_c2s[28])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[30])*gcartb[i+nbra*0] + + creal(coeff_c2s[33])*gcartb[i+nbra*3] + + creal(coeff_c2s[35])*gcartb[i+nbra*5]; + gsp[i+lds*3] = creal(coeff_c2s[36])*gcarta[i+nbra*0] + + creal(coeff_c2s[39])*gcarta[i+nbra*3] + + creal(coeff_c2s[41])*gcarta[i+nbra*5] + + creal(coeff_c2s[44])*gcartb[i+nbra*2] + + cimag(coeff_c2s[46])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[50])*gcarta[i+nbra*2] + + cimag(coeff_c2s[52])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[54])*gcartb[i+nbra*0] + + creal(coeff_c2s[57])*gcartb[i+nbra*3] + + cimag(coeff_c2s[55])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[60])*gcarta[i+nbra*0] + + creal(coeff_c2s[63])*gcarta[i+nbra*3] + + cimag(coeff_c2s[61])*gcarta[i+nbra*1]*_Complex_I; + } + } +} +static void d_iket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) +{ + const double complex *coeff_c2s; + FINT i; + + if (kappa >= 0) { + coeff_c2s = g_c2s[2].cart2j_lt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0]*_Complex_I + + creal(coeff_c2s[ 3])*gcarta[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[ 1])*gcarta[i+nbra*1] + + creal(coeff_c2s[ 8])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[10])*gcartb[i+nbra*4]; + gsp[i+lds*1] = creal(coeff_c2s[14])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[16])*gcarta[i+nbra*4] + + creal(coeff_c2s[18])*gcartb[i+nbra*0]*_Complex_I + + creal(coeff_c2s[21])*gcartb[i+nbra*3]*_Complex_I + + creal(coeff_c2s[23])*gcartb[i+nbra*5]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[24])*gcarta[i+nbra*0]*_Complex_I + + creal(coeff_c2s[27])*gcarta[i+nbra*3]*_Complex_I + + creal(coeff_c2s[29])*gcarta[i+nbra*5]*_Complex_I + + creal(coeff_c2s[32])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[34])*gcartb[i+nbra*4]; + gsp[i+lds*3] = creal(coeff_c2s[38])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[40])*gcarta[i+nbra*4] + + creal(coeff_c2s[42])*gcartb[i+nbra*0]*_Complex_I + + creal(coeff_c2s[45])*gcartb[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[43])*gcartb[i+nbra*1]; + } + gsp += lds * 4; } if (kappa <= 0) { coeff_c2s = g_c2s[2].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 6])*gcart [nbra* 6+i] - + creal(coeff_c2s[ 9])*gcart [nbra* 9+i] - + cimag(coeff_c2s[ 7])*gcart [nbra* 7+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[12])*gcart [nbra* 0+i] - + creal(coeff_c2s[15])*gcart [nbra* 3+i] - + cimag(coeff_c2s[13])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[20])*gcart [nbra* 8+i] - + cimag(coeff_c2s[22])*gcart [nbra*10+i]*_Complex_I; - gspa[2*lds+i] = creal(coeff_c2s[26])*gcart [nbra* 2+i] - + cimag(coeff_c2s[28])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[30])*gcart [nbra* 6+i] - + creal(coeff_c2s[33])*gcart [nbra* 9+i] - + creal(coeff_c2s[35])*gcart [nbra*11+i]; - gspa[3*lds+i] = creal(coeff_c2s[36])*gcart [nbra* 0+i] - + creal(coeff_c2s[39])*gcart [nbra* 3+i] - + creal(coeff_c2s[41])*gcart [nbra* 5+i] - + creal(coeff_c2s[44])*gcart [nbra* 8+i] - + cimag(coeff_c2s[46])*gcart [nbra*10+i]*_Complex_I; - gspa[4*lds+i] = creal(coeff_c2s[50])*gcart [nbra* 2+i] - + cimag(coeff_c2s[52])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[54])*gcart [nbra* 6+i] - + creal(coeff_c2s[57])*gcart [nbra* 9+i] - + cimag(coeff_c2s[55])*gcart [nbra* 7+i]*_Complex_I; - gspa[5*lds+i] = creal(coeff_c2s[60])*gcart [nbra* 0+i] - + creal(coeff_c2s[63])*gcart [nbra* 3+i] - + cimag(coeff_c2s[61])*gcart [nbra* 1+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 6])*gcart1[nbra* 6+i] - + creal(coeff_c2s[ 9])*gcart1[nbra* 9+i] - + cimag(coeff_c2s[ 7])*gcart1[nbra* 7+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[12])*gcart1[nbra* 0+i] - + creal(coeff_c2s[15])*gcart1[nbra* 3+i] - + cimag(coeff_c2s[13])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[20])*gcart1[nbra* 8+i] - + cimag(coeff_c2s[22])*gcart1[nbra*10+i]*_Complex_I; - gspb[2*lds+i] = creal(coeff_c2s[26])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[28])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[30])*gcart1[nbra* 6+i] - + creal(coeff_c2s[33])*gcart1[nbra* 9+i] - + creal(coeff_c2s[35])*gcart1[nbra*11+i]; - gspb[3*lds+i] = creal(coeff_c2s[36])*gcart1[nbra* 0+i] - + creal(coeff_c2s[39])*gcart1[nbra* 3+i] - + creal(coeff_c2s[41])*gcart1[nbra* 5+i] - + creal(coeff_c2s[44])*gcart1[nbra* 8+i] - + cimag(coeff_c2s[46])*gcart1[nbra*10+i]*_Complex_I; - gspb[4*lds+i] = creal(coeff_c2s[50])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[52])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[54])*gcart1[nbra* 6+i] - + creal(coeff_c2s[57])*gcart1[nbra* 9+i] - + cimag(coeff_c2s[55])*gcart1[nbra* 7+i]*_Complex_I; - gspb[5*lds+i] = creal(coeff_c2s[60])*gcart1[nbra* 0+i] - + creal(coeff_c2s[63])*gcart1[nbra* 3+i] - + cimag(coeff_c2s[61])*gcart1[nbra* 1+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 6])*gcartb[i+nbra*0]*_Complex_I + + creal(coeff_c2s[ 9])*gcartb[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[ 7])*gcartb[i+nbra*1]; + gsp[i+lds*1] = creal(coeff_c2s[12])*gcarta[i+nbra*0]*_Complex_I + + creal(coeff_c2s[15])*gcarta[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[13])*gcarta[i+nbra*1] + + creal(coeff_c2s[20])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[22])*gcartb[i+nbra*4]; + gsp[i+lds*2] = creal(coeff_c2s[26])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[28])*gcarta[i+nbra*4] + + creal(coeff_c2s[30])*gcartb[i+nbra*0]*_Complex_I + + creal(coeff_c2s[33])*gcartb[i+nbra*3]*_Complex_I + + creal(coeff_c2s[35])*gcartb[i+nbra*5]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[36])*gcarta[i+nbra*0]*_Complex_I + + creal(coeff_c2s[39])*gcarta[i+nbra*3]*_Complex_I + + creal(coeff_c2s[41])*gcarta[i+nbra*5]*_Complex_I + + creal(coeff_c2s[44])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[46])*gcartb[i+nbra*4]; + gsp[i+lds*4] = creal(coeff_c2s[50])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[52])*gcarta[i+nbra*4] + + creal(coeff_c2s[54])*gcartb[i+nbra*0]*_Complex_I + + creal(coeff_c2s[57])*gcartb[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[55])*gcartb[i+nbra*1]; + gsp[i+lds*5] = creal(coeff_c2s[60])*gcarta[i+nbra*0]*_Complex_I + + creal(coeff_c2s[63])*gcarta[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[61])*gcarta[i+nbra*1]; } } } @@ -6074,116 +5164,68 @@ static void d_cket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void d_cket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void d_cket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*12; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[2].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 0])*gcart [nbra* 0+i] - + creal(coeff_c2s[ 3])*gcart [nbra* 3+i] - - cimag(coeff_c2s[ 1])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 8])*gcart [nbra* 8+i] - - cimag(coeff_c2s[10])*gcart [nbra*10+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[14])*gcart [nbra* 2+i] - - cimag(coeff_c2s[16])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[18])*gcart [nbra* 6+i] - + creal(coeff_c2s[21])*gcart [nbra* 9+i] - + creal(coeff_c2s[23])*gcart [nbra*11+i]; - gspa[2*lds+i] = creal(coeff_c2s[24])*gcart [nbra* 0+i] - + creal(coeff_c2s[27])*gcart [nbra* 3+i] - + creal(coeff_c2s[29])*gcart [nbra* 5+i] - + creal(coeff_c2s[32])*gcart [nbra* 8+i] - - cimag(coeff_c2s[34])*gcart [nbra*10+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[38])*gcart [nbra* 2+i] - - cimag(coeff_c2s[40])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[42])*gcart [nbra* 6+i] - + creal(coeff_c2s[45])*gcart [nbra* 9+i] - - cimag(coeff_c2s[43])*gcart [nbra* 7+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 0])*gcart1[nbra* 0+i] - + creal(coeff_c2s[ 3])*gcart1[nbra* 3+i] - - cimag(coeff_c2s[ 1])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 8])*gcart1[nbra* 8+i] - - cimag(coeff_c2s[10])*gcart1[nbra*10+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[14])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[16])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[18])*gcart1[nbra* 6+i] - + creal(coeff_c2s[21])*gcart1[nbra* 9+i] - + creal(coeff_c2s[23])*gcart1[nbra*11+i]; - gspb[2*lds+i] = creal(coeff_c2s[24])*gcart1[nbra* 0+i] - + creal(coeff_c2s[27])*gcart1[nbra* 3+i] - + creal(coeff_c2s[29])*gcart1[nbra* 5+i] - + creal(coeff_c2s[32])*gcart1[nbra* 8+i] - - cimag(coeff_c2s[34])*gcart1[nbra*10+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[38])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[40])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[42])*gcart1[nbra* 6+i] - + creal(coeff_c2s[45])*gcart1[nbra* 9+i] - - cimag(coeff_c2s[43])*gcart1[nbra* 7+i]*_Complex_I; - } - gspa += lds * 4; - gspb += lds * 4; + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0] + + creal(coeff_c2s[ 3])*gcarta[i+nbra*3] + - cimag(coeff_c2s[ 1])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 8])*gcartb[i+nbra*2] + - cimag(coeff_c2s[10])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[14])*gcarta[i+nbra*2] + - cimag(coeff_c2s[16])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[18])*gcartb[i+nbra*0] + + creal(coeff_c2s[21])*gcartb[i+nbra*3] + + creal(coeff_c2s[23])*gcartb[i+nbra*5]; + gsp[i+lds*2] = creal(coeff_c2s[24])*gcarta[i+nbra*0] + + creal(coeff_c2s[27])*gcarta[i+nbra*3] + + creal(coeff_c2s[29])*gcarta[i+nbra*5] + + creal(coeff_c2s[32])*gcartb[i+nbra*2] + - cimag(coeff_c2s[34])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[38])*gcarta[i+nbra*2] + - cimag(coeff_c2s[40])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[42])*gcartb[i+nbra*0] + + creal(coeff_c2s[45])*gcartb[i+nbra*3] + - cimag(coeff_c2s[43])*gcartb[i+nbra*1]*_Complex_I; + } + gsp += lds * 4; } if (kappa <= 0) { coeff_c2s = g_c2s[2].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 6])*gcart [nbra* 6+i] - + creal(coeff_c2s[ 9])*gcart [nbra* 9+i] - - cimag(coeff_c2s[ 7])*gcart [nbra* 7+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[12])*gcart [nbra* 0+i] - + creal(coeff_c2s[15])*gcart [nbra* 3+i] - - cimag(coeff_c2s[13])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[20])*gcart [nbra* 8+i] - - cimag(coeff_c2s[22])*gcart [nbra*10+i]*_Complex_I; - gspa[2*lds+i] = creal(coeff_c2s[26])*gcart [nbra* 2+i] - - cimag(coeff_c2s[28])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[30])*gcart [nbra* 6+i] - + creal(coeff_c2s[33])*gcart [nbra* 9+i] - + creal(coeff_c2s[35])*gcart [nbra*11+i]; - gspa[3*lds+i] = creal(coeff_c2s[36])*gcart [nbra* 0+i] - + creal(coeff_c2s[39])*gcart [nbra* 3+i] - + creal(coeff_c2s[41])*gcart [nbra* 5+i] - + creal(coeff_c2s[44])*gcart [nbra* 8+i] - - cimag(coeff_c2s[46])*gcart [nbra*10+i]*_Complex_I; - gspa[4*lds+i] = creal(coeff_c2s[50])*gcart [nbra* 2+i] - - cimag(coeff_c2s[52])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[54])*gcart [nbra* 6+i] - + creal(coeff_c2s[57])*gcart [nbra* 9+i] - - cimag(coeff_c2s[55])*gcart [nbra* 7+i]*_Complex_I; - gspa[5*lds+i] = creal(coeff_c2s[60])*gcart [nbra* 0+i] - + creal(coeff_c2s[63])*gcart [nbra* 3+i] - - cimag(coeff_c2s[61])*gcart [nbra* 1+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 6])*gcart1[nbra* 6+i] - + creal(coeff_c2s[ 9])*gcart1[nbra* 9+i] - - cimag(coeff_c2s[ 7])*gcart1[nbra* 7+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[12])*gcart1[nbra* 0+i] - + creal(coeff_c2s[15])*gcart1[nbra* 3+i] - - cimag(coeff_c2s[13])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[20])*gcart1[nbra* 8+i] - - cimag(coeff_c2s[22])*gcart1[nbra*10+i]*_Complex_I; - gspb[2*lds+i] = creal(coeff_c2s[26])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[28])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[30])*gcart1[nbra* 6+i] - + creal(coeff_c2s[33])*gcart1[nbra* 9+i] - + creal(coeff_c2s[35])*gcart1[nbra*11+i]; - gspb[3*lds+i] = creal(coeff_c2s[36])*gcart1[nbra* 0+i] - + creal(coeff_c2s[39])*gcart1[nbra* 3+i] - + creal(coeff_c2s[41])*gcart1[nbra* 5+i] - + creal(coeff_c2s[44])*gcart1[nbra* 8+i] - - cimag(coeff_c2s[46])*gcart1[nbra*10+i]*_Complex_I; - gspb[4*lds+i] = creal(coeff_c2s[50])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[52])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[54])*gcart1[nbra* 6+i] - + creal(coeff_c2s[57])*gcart1[nbra* 9+i] - - cimag(coeff_c2s[55])*gcart1[nbra* 7+i]*_Complex_I; - gspb[5*lds+i] = creal(coeff_c2s[60])*gcart1[nbra* 0+i] - + creal(coeff_c2s[63])*gcart1[nbra* 3+i] - - cimag(coeff_c2s[61])*gcart1[nbra* 1+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 6])*gcartb[i+nbra*0] + + creal(coeff_c2s[ 9])*gcartb[i+nbra*3] + - cimag(coeff_c2s[ 7])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[12])*gcarta[i+nbra*0] + + creal(coeff_c2s[15])*gcarta[i+nbra*3] + - cimag(coeff_c2s[13])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[20])*gcartb[i+nbra*2] + - cimag(coeff_c2s[22])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[26])*gcarta[i+nbra*2] + - cimag(coeff_c2s[28])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[30])*gcartb[i+nbra*0] + + creal(coeff_c2s[33])*gcartb[i+nbra*3] + + creal(coeff_c2s[35])*gcartb[i+nbra*5]; + gsp[i+lds*3] = creal(coeff_c2s[36])*gcarta[i+nbra*0] + + creal(coeff_c2s[39])*gcarta[i+nbra*3] + + creal(coeff_c2s[41])*gcarta[i+nbra*5] + + creal(coeff_c2s[44])*gcartb[i+nbra*2] + - cimag(coeff_c2s[46])*gcartb[i+nbra*4]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[50])*gcarta[i+nbra*2] + - cimag(coeff_c2s[52])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[54])*gcartb[i+nbra*0] + + creal(coeff_c2s[57])*gcartb[i+nbra*3] + - cimag(coeff_c2s[55])*gcartb[i+nbra*1]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[60])*gcarta[i+nbra*0] + + creal(coeff_c2s[63])*gcarta[i+nbra*3] + - cimag(coeff_c2s[61])*gcarta[i+nbra*1]*_Complex_I; } } } @@ -6548,240 +5590,257 @@ static void f_iket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void f_ket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void f_ket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*20; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[3].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 0])*gcart [nbra* 0+i] - + cimag(coeff_c2s[ 1])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3])*gcart [nbra* 3+i] - + cimag(coeff_c2s[ 6])*gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 12])*gcart [nbra*12+i] - + cimag(coeff_c2s[ 14])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 17])*gcart [nbra*17+i]; - gspa[1*lds+i] = creal(coeff_c2s[ 22])*gcart [nbra* 2+i] - + cimag(coeff_c2s[ 24])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 27])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 30])*gcart [nbra*10+i] - + cimag(coeff_c2s[ 31])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 33])*gcart [nbra*13+i] - + creal(coeff_c2s[ 35])*gcart [nbra*15+i] - + cimag(coeff_c2s[ 36])*gcart [nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 38])*gcart [nbra*18+i]*_Complex_I; - gspa[2*lds+i] = creal(coeff_c2s[ 40])*gcart [nbra* 0+i] - + cimag(coeff_c2s[ 41])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 43])*gcart [nbra* 3+i] - + creal(coeff_c2s[ 45])*gcart [nbra* 5+i] - + cimag(coeff_c2s[ 46])*gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 48])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 52])*gcart [nbra*12+i] - + creal(coeff_c2s[ 57])*gcart [nbra*17+i] - + creal(coeff_c2s[ 59])*gcart [nbra*19+i]; - gspa[3*lds+i] = creal(coeff_c2s[ 62])*gcart [nbra* 2+i] - + creal(coeff_c2s[ 67])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 69])*gcart [nbra* 9+i] - + creal(coeff_c2s[ 70])*gcart [nbra*10+i] - + cimag(coeff_c2s[ 71])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 73])*gcart [nbra*13+i] - + creal(coeff_c2s[ 75])*gcart [nbra*15+i] - + cimag(coeff_c2s[ 76])*gcart [nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 78])*gcart [nbra*18+i]*_Complex_I; - gspa[4*lds+i] = creal(coeff_c2s[ 80])*gcart [nbra* 0+i] - + cimag(coeff_c2s[ 81])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 83])*gcart [nbra* 3+i] - + creal(coeff_c2s[ 85])*gcart [nbra* 5+i] - + cimag(coeff_c2s[ 86])*gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 88])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 92])*gcart [nbra*12+i] - + cimag(coeff_c2s[ 94])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 97])*gcart [nbra*17+i]; - gspa[5*lds+i] = creal(coeff_c2s[102])*gcart [nbra* 2+i] - + cimag(coeff_c2s[104])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[107])*gcart [nbra* 7+i] - + creal(coeff_c2s[110])*gcart [nbra*10+i] - + cimag(coeff_c2s[111])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[113])*gcart [nbra*13+i] - + cimag(coeff_c2s[116])*gcart [nbra*16+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 0])*gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 1])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3])*gcart1[nbra* 3+i] - + cimag(coeff_c2s[ 6])*gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 12])*gcart1[nbra*12+i] - + cimag(coeff_c2s[ 14])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 17])*gcart1[nbra*17+i]; - gspb[1*lds+i] = creal(coeff_c2s[ 22])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[ 24])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 27])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 30])*gcart1[nbra*10+i] - + cimag(coeff_c2s[ 31])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 33])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 35])*gcart1[nbra*15+i] - + cimag(coeff_c2s[ 36])*gcart1[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 38])*gcart1[nbra*18+i]*_Complex_I; - gspb[2*lds+i] = creal(coeff_c2s[ 40])*gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 41])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 43])*gcart1[nbra* 3+i] - + creal(coeff_c2s[ 45])*gcart1[nbra* 5+i] - + cimag(coeff_c2s[ 46])*gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 48])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 52])*gcart1[nbra*12+i] - + creal(coeff_c2s[ 57])*gcart1[nbra*17+i] - + creal(coeff_c2s[ 59])*gcart1[nbra*19+i]; - gspb[3*lds+i] = creal(coeff_c2s[ 62])*gcart1[nbra* 2+i] - + creal(coeff_c2s[ 67])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 69])*gcart1[nbra* 9+i] - + creal(coeff_c2s[ 70])*gcart1[nbra*10+i] - + cimag(coeff_c2s[ 71])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 73])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 75])*gcart1[nbra*15+i] - + cimag(coeff_c2s[ 76])*gcart1[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 78])*gcart1[nbra*18+i]*_Complex_I; - gspb[4*lds+i] = creal(coeff_c2s[ 80])*gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 81])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 83])*gcart1[nbra* 3+i] - + creal(coeff_c2s[ 85])*gcart1[nbra* 5+i] - + cimag(coeff_c2s[ 86])*gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 88])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 92])*gcart1[nbra*12+i] - + cimag(coeff_c2s[ 94])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 97])*gcart1[nbra*17+i]; - gspb[5*lds+i] = creal(coeff_c2s[102])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[104])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[107])*gcart1[nbra* 7+i] - + creal(coeff_c2s[110])*gcart1[nbra*10+i] - + cimag(coeff_c2s[111])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[113])*gcart1[nbra*13+i] - + cimag(coeff_c2s[116])*gcart1[nbra*16+i]*_Complex_I; - } - gspa += lds * 6; - gspb += lds * 6; + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0] + + cimag(coeff_c2s[ 1])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 3])*gcarta[i+nbra*3] + + cimag(coeff_c2s[ 6])*gcarta[i+nbra*6]*_Complex_I + + creal(coeff_c2s[ 12])*gcartb[i+nbra*2] + + cimag(coeff_c2s[ 14])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 17])*gcartb[i+nbra*7]; + gsp[i+lds*1] = creal(coeff_c2s[ 22])*gcarta[i+nbra*2] + + cimag(coeff_c2s[ 24])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 27])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 30])*gcartb[i+nbra*0] + + cimag(coeff_c2s[ 31])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 33])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 35])*gcartb[i+nbra*5] + + cimag(coeff_c2s[ 36])*gcartb[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[ 38])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[ 40])*gcarta[i+nbra*0] + + cimag(coeff_c2s[ 41])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 43])*gcarta[i+nbra*3] + + creal(coeff_c2s[ 45])*gcarta[i+nbra*5] + + cimag(coeff_c2s[ 46])*gcarta[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[ 48])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[ 52])*gcartb[i+nbra*2] + + creal(coeff_c2s[ 57])*gcartb[i+nbra*7] + + creal(coeff_c2s[ 59])*gcartb[i+nbra*9]; + gsp[i+lds*3] = creal(coeff_c2s[ 62])*gcarta[i+nbra*2] + + creal(coeff_c2s[ 67])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 69])*gcarta[i+nbra*9] + + creal(coeff_c2s[ 70])*gcartb[i+nbra*0] + + cimag(coeff_c2s[ 71])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 73])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 75])*gcartb[i+nbra*5] + + cimag(coeff_c2s[ 76])*gcartb[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[ 78])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[ 80])*gcarta[i+nbra*0] + + cimag(coeff_c2s[ 81])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 83])*gcarta[i+nbra*3] + + creal(coeff_c2s[ 85])*gcarta[i+nbra*5] + + cimag(coeff_c2s[ 86])*gcarta[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[ 88])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[ 92])*gcartb[i+nbra*2] + + cimag(coeff_c2s[ 94])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 97])*gcartb[i+nbra*7]; + gsp[i+lds*5] = creal(coeff_c2s[102])*gcarta[i+nbra*2] + + cimag(coeff_c2s[104])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[107])*gcarta[i+nbra*7] + + creal(coeff_c2s[110])*gcartb[i+nbra*0] + + cimag(coeff_c2s[111])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[113])*gcartb[i+nbra*3] + + cimag(coeff_c2s[116])*gcartb[i+nbra*6]*_Complex_I; + } + gsp += lds * 6; + } + if (kappa <= 0) { + coeff_c2s = g_c2s[3].cart2j_gt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 10])*gcartb[i+nbra*0] + + cimag(coeff_c2s[ 11])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 13])*gcartb[i+nbra*3] + + cimag(coeff_c2s[ 16])*gcartb[i+nbra*6]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 20])*gcarta[i+nbra*0] + + cimag(coeff_c2s[ 21])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 23])*gcarta[i+nbra*3] + + cimag(coeff_c2s[ 26])*gcarta[i+nbra*6]*_Complex_I + + creal(coeff_c2s[ 32])*gcartb[i+nbra*2] + + cimag(coeff_c2s[ 34])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 37])*gcartb[i+nbra*7]; + gsp[i+lds*2] = creal(coeff_c2s[ 42])*gcarta[i+nbra*2] + + cimag(coeff_c2s[ 44])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 47])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 50])*gcartb[i+nbra*0] + + cimag(coeff_c2s[ 51])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 53])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 55])*gcartb[i+nbra*5] + + cimag(coeff_c2s[ 56])*gcartb[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[ 58])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[ 60])*gcarta[i+nbra*0] + + cimag(coeff_c2s[ 61])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 63])*gcarta[i+nbra*3] + + creal(coeff_c2s[ 65])*gcarta[i+nbra*5] + + cimag(coeff_c2s[ 66])*gcarta[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[ 68])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[ 72])*gcartb[i+nbra*2] + + creal(coeff_c2s[ 77])*gcartb[i+nbra*7] + + creal(coeff_c2s[ 79])*gcartb[i+nbra*9]; + gsp[i+lds*4] = creal(coeff_c2s[ 82])*gcarta[i+nbra*2] + + creal(coeff_c2s[ 87])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 89])*gcarta[i+nbra*9] + + creal(coeff_c2s[ 90])*gcartb[i+nbra*0] + + cimag(coeff_c2s[ 91])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 93])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 95])*gcartb[i+nbra*5] + + cimag(coeff_c2s[ 96])*gcartb[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[ 98])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[100])*gcarta[i+nbra*0] + + cimag(coeff_c2s[101])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[103])*gcarta[i+nbra*3] + + creal(coeff_c2s[105])*gcarta[i+nbra*5] + + cimag(coeff_c2s[106])*gcarta[i+nbra*6]*_Complex_I + + cimag(coeff_c2s[108])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[112])*gcartb[i+nbra*2] + + cimag(coeff_c2s[114])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[117])*gcartb[i+nbra*7]; + gsp[i+lds*6] = creal(coeff_c2s[122])*gcarta[i+nbra*2] + + cimag(coeff_c2s[124])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[127])*gcarta[i+nbra*7] + + creal(coeff_c2s[130])*gcartb[i+nbra*0] + + cimag(coeff_c2s[131])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[133])*gcartb[i+nbra*3] + + cimag(coeff_c2s[136])*gcartb[i+nbra*6]*_Complex_I; + gsp[i+lds*7] = creal(coeff_c2s[140])*gcarta[i+nbra*0] + + cimag(coeff_c2s[141])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[143])*gcarta[i+nbra*3] + + cimag(coeff_c2s[146])*gcarta[i+nbra*6]*_Complex_I; + } + } +} +static void f_iket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) +{ + const double complex *coeff_c2s; + FINT i; + + if (kappa >= 0) { + coeff_c2s = g_c2s[3].cart2j_lt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 1])*gcarta[i+nbra*1] + + creal(coeff_c2s[ 3])*gcarta[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[ 6])*gcarta[i+nbra*6] + + creal(coeff_c2s[ 12])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[ 14])*gcartb[i+nbra*4] + + creal(coeff_c2s[ 17])*gcartb[i+nbra*7]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 22])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[ 24])*gcarta[i+nbra*4] + + creal(coeff_c2s[ 27])*gcarta[i+nbra*7]*_Complex_I + + creal(coeff_c2s[ 30])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 31])*gcartb[i+nbra*1] + + creal(coeff_c2s[ 33])*gcartb[i+nbra*3]*_Complex_I + + creal(coeff_c2s[ 35])*gcartb[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[ 36])*gcartb[i+nbra*6] + - cimag(coeff_c2s[ 38])*gcartb[i+nbra*8]; + gsp[i+lds*2] = creal(coeff_c2s[ 40])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 41])*gcarta[i+nbra*1] + + creal(coeff_c2s[ 43])*gcarta[i+nbra*3]*_Complex_I + + creal(coeff_c2s[ 45])*gcarta[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[ 46])*gcarta[i+nbra*6] + - cimag(coeff_c2s[ 48])*gcarta[i+nbra*8] + + creal(coeff_c2s[ 52])*gcartb[i+nbra*2]*_Complex_I + + creal(coeff_c2s[ 57])*gcartb[i+nbra*7]*_Complex_I + + creal(coeff_c2s[ 59])*gcartb[i+nbra*9]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[ 62])*gcarta[i+nbra*2]*_Complex_I + + creal(coeff_c2s[ 67])*gcarta[i+nbra*7]*_Complex_I + + creal(coeff_c2s[ 69])*gcarta[i+nbra*9]*_Complex_I + + creal(coeff_c2s[ 70])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 71])*gcartb[i+nbra*1] + + creal(coeff_c2s[ 73])*gcartb[i+nbra*3]*_Complex_I + + creal(coeff_c2s[ 75])*gcartb[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[ 76])*gcartb[i+nbra*6] + - cimag(coeff_c2s[ 78])*gcartb[i+nbra*8]; + gsp[i+lds*4] = creal(coeff_c2s[ 80])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 81])*gcarta[i+nbra*1] + + creal(coeff_c2s[ 83])*gcarta[i+nbra*3]*_Complex_I + + creal(coeff_c2s[ 85])*gcarta[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[ 86])*gcarta[i+nbra*6] + - cimag(coeff_c2s[ 88])*gcarta[i+nbra*8] + + creal(coeff_c2s[ 92])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[ 94])*gcartb[i+nbra*4] + + creal(coeff_c2s[ 97])*gcartb[i+nbra*7]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[102])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[104])*gcarta[i+nbra*4] + + creal(coeff_c2s[107])*gcarta[i+nbra*7]*_Complex_I + + creal(coeff_c2s[110])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[111])*gcartb[i+nbra*1] + + creal(coeff_c2s[113])*gcartb[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[116])*gcartb[i+nbra*6]; + } + gsp += lds * 6; } if (kappa <= 0) { coeff_c2s = g_c2s[3].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 10])*gcart [nbra*10+i] - + cimag(coeff_c2s[ 11])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 13])*gcart [nbra*13+i] - + cimag(coeff_c2s[ 16])*gcart [nbra*16+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[ 20])*gcart [nbra* 0+i] - + cimag(coeff_c2s[ 21])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 23])*gcart [nbra* 3+i] - + cimag(coeff_c2s[ 26])*gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 32])*gcart [nbra*12+i] - + cimag(coeff_c2s[ 34])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 37])*gcart [nbra*17+i]; - gspa[2*lds+i] = creal(coeff_c2s[ 42])*gcart [nbra* 2+i] - + cimag(coeff_c2s[ 44])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 47])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 50])*gcart [nbra*10+i] - + cimag(coeff_c2s[ 51])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 53])*gcart [nbra*13+i] - + creal(coeff_c2s[ 55])*gcart [nbra*15+i] - + cimag(coeff_c2s[ 56])*gcart [nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 58])*gcart [nbra*18+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[ 60])*gcart [nbra* 0+i] - + cimag(coeff_c2s[ 61])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 63])*gcart [nbra* 3+i] - + creal(coeff_c2s[ 65])*gcart [nbra* 5+i] - + cimag(coeff_c2s[ 66])*gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 68])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 72])*gcart [nbra*12+i] - + creal(coeff_c2s[ 77])*gcart [nbra*17+i] - + creal(coeff_c2s[ 79])*gcart [nbra*19+i]; - gspa[4*lds+i] = creal(coeff_c2s[ 82])*gcart [nbra* 2+i] - + creal(coeff_c2s[ 87])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 89])*gcart [nbra* 9+i] - + creal(coeff_c2s[ 90])*gcart [nbra*10+i] - + cimag(coeff_c2s[ 91])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 93])*gcart [nbra*13+i] - + creal(coeff_c2s[ 95])*gcart [nbra*15+i] - + cimag(coeff_c2s[ 96])*gcart [nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 98])*gcart [nbra*18+i]*_Complex_I; - gspa[5*lds+i] = creal(coeff_c2s[100])*gcart [nbra* 0+i] - + cimag(coeff_c2s[101])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[103])*gcart [nbra* 3+i] - + creal(coeff_c2s[105])*gcart [nbra* 5+i] - + cimag(coeff_c2s[106])*gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[108])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[112])*gcart [nbra*12+i] - + cimag(coeff_c2s[114])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[117])*gcart [nbra*17+i]; - gspa[6*lds+i] = creal(coeff_c2s[122])*gcart [nbra* 2+i] - + cimag(coeff_c2s[124])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127])*gcart [nbra* 7+i] - + creal(coeff_c2s[130])*gcart [nbra*10+i] - + cimag(coeff_c2s[131])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[133])*gcart [nbra*13+i] - + cimag(coeff_c2s[136])*gcart [nbra*16+i]*_Complex_I; - gspa[7*lds+i] = creal(coeff_c2s[140])*gcart [nbra* 0+i] - + cimag(coeff_c2s[141])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[143])*gcart [nbra* 3+i] - + cimag(coeff_c2s[146])*gcart [nbra* 6+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 10])*gcart1[nbra*10+i] - + cimag(coeff_c2s[ 11])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 13])*gcart1[nbra*13+i] - + cimag(coeff_c2s[ 16])*gcart1[nbra*16+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[ 20])*gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 21])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 23])*gcart1[nbra* 3+i] - + cimag(coeff_c2s[ 26])*gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 32])*gcart1[nbra*12+i] - + cimag(coeff_c2s[ 34])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 37])*gcart1[nbra*17+i]; - gspb[2*lds+i] = creal(coeff_c2s[ 42])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[ 44])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 47])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 50])*gcart1[nbra*10+i] - + cimag(coeff_c2s[ 51])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 53])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 55])*gcart1[nbra*15+i] - + cimag(coeff_c2s[ 56])*gcart1[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 58])*gcart1[nbra*18+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[ 60])*gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 61])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 63])*gcart1[nbra* 3+i] - + creal(coeff_c2s[ 65])*gcart1[nbra* 5+i] - + cimag(coeff_c2s[ 66])*gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 68])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 72])*gcart1[nbra*12+i] - + creal(coeff_c2s[ 77])*gcart1[nbra*17+i] - + creal(coeff_c2s[ 79])*gcart1[nbra*19+i]; - gspb[4*lds+i] = creal(coeff_c2s[ 82])*gcart1[nbra* 2+i] - + creal(coeff_c2s[ 87])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 89])*gcart1[nbra* 9+i] - + creal(coeff_c2s[ 90])*gcart1[nbra*10+i] - + cimag(coeff_c2s[ 91])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 93])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 95])*gcart1[nbra*15+i] - + cimag(coeff_c2s[ 96])*gcart1[nbra*16+i]*_Complex_I - + cimag(coeff_c2s[ 98])*gcart1[nbra*18+i]*_Complex_I; - gspb[5*lds+i] = creal(coeff_c2s[100])*gcart1[nbra* 0+i] - + cimag(coeff_c2s[101])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[103])*gcart1[nbra* 3+i] - + creal(coeff_c2s[105])*gcart1[nbra* 5+i] - + cimag(coeff_c2s[106])*gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[108])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[112])*gcart1[nbra*12+i] - + cimag(coeff_c2s[114])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[117])*gcart1[nbra*17+i]; - gspb[6*lds+i] = creal(coeff_c2s[122])*gcart1[nbra* 2+i] - + cimag(coeff_c2s[124])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127])*gcart1[nbra* 7+i] - + creal(coeff_c2s[130])*gcart1[nbra*10+i] - + cimag(coeff_c2s[131])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[133])*gcart1[nbra*13+i] - + cimag(coeff_c2s[136])*gcart1[nbra*16+i]*_Complex_I; - gspb[7*lds+i] = creal(coeff_c2s[140])*gcart1[nbra* 0+i] - + cimag(coeff_c2s[141])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[143])*gcart1[nbra* 3+i] - + cimag(coeff_c2s[146])*gcart1[nbra* 6+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 10])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 11])*gcartb[i+nbra*1] + + creal(coeff_c2s[ 13])*gcartb[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[ 16])*gcartb[i+nbra*6]; + gsp[i+lds*1] = creal(coeff_c2s[ 20])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 21])*gcarta[i+nbra*1] + + creal(coeff_c2s[ 23])*gcarta[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[ 26])*gcarta[i+nbra*6] + + creal(coeff_c2s[ 32])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[ 34])*gcartb[i+nbra*4] + + creal(coeff_c2s[ 37])*gcartb[i+nbra*7]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[ 42])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[ 44])*gcarta[i+nbra*4] + + creal(coeff_c2s[ 47])*gcarta[i+nbra*7]*_Complex_I + + creal(coeff_c2s[ 50])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 51])*gcartb[i+nbra*1] + + creal(coeff_c2s[ 53])*gcartb[i+nbra*3]*_Complex_I + + creal(coeff_c2s[ 55])*gcartb[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[ 56])*gcartb[i+nbra*6] + - cimag(coeff_c2s[ 58])*gcartb[i+nbra*8]; + gsp[i+lds*3] = creal(coeff_c2s[ 60])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 61])*gcarta[i+nbra*1] + + creal(coeff_c2s[ 63])*gcarta[i+nbra*3]*_Complex_I + + creal(coeff_c2s[ 65])*gcarta[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[ 66])*gcarta[i+nbra*6] + - cimag(coeff_c2s[ 68])*gcarta[i+nbra*8] + + creal(coeff_c2s[ 72])*gcartb[i+nbra*2]*_Complex_I + + creal(coeff_c2s[ 77])*gcartb[i+nbra*7]*_Complex_I + + creal(coeff_c2s[ 79])*gcartb[i+nbra*9]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[ 82])*gcarta[i+nbra*2]*_Complex_I + + creal(coeff_c2s[ 87])*gcarta[i+nbra*7]*_Complex_I + + creal(coeff_c2s[ 89])*gcarta[i+nbra*9]*_Complex_I + + creal(coeff_c2s[ 90])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[ 91])*gcartb[i+nbra*1] + + creal(coeff_c2s[ 93])*gcartb[i+nbra*3]*_Complex_I + + creal(coeff_c2s[ 95])*gcartb[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[ 96])*gcartb[i+nbra*6] + - cimag(coeff_c2s[ 98])*gcartb[i+nbra*8]; + gsp[i+lds*5] = creal(coeff_c2s[100])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[101])*gcarta[i+nbra*1] + + creal(coeff_c2s[103])*gcarta[i+nbra*3]*_Complex_I + + creal(coeff_c2s[105])*gcarta[i+nbra*5]*_Complex_I + - cimag(coeff_c2s[106])*gcarta[i+nbra*6] + - cimag(coeff_c2s[108])*gcarta[i+nbra*8] + + creal(coeff_c2s[112])*gcartb[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[114])*gcartb[i+nbra*4] + + creal(coeff_c2s[117])*gcartb[i+nbra*7]*_Complex_I; + gsp[i+lds*6] = creal(coeff_c2s[122])*gcarta[i+nbra*2]*_Complex_I + - cimag(coeff_c2s[124])*gcarta[i+nbra*4] + + creal(coeff_c2s[127])*gcarta[i+nbra*7]*_Complex_I + + creal(coeff_c2s[130])*gcartb[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[131])*gcartb[i+nbra*1] + + creal(coeff_c2s[133])*gcartb[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[136])*gcartb[i+nbra*6]; + gsp[i+lds*7] = creal(coeff_c2s[140])*gcarta[i+nbra*0]*_Complex_I + - cimag(coeff_c2s[141])*gcarta[i+nbra*1] + + creal(coeff_c2s[143])*gcarta[i+nbra*3]*_Complex_I + - cimag(coeff_c2s[146])*gcarta[i+nbra*6]; } } } @@ -6966,240 +6025,130 @@ static void f_cket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void f_cket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void f_cket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*20; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[3].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 0])*gcart [nbra* 0+i] - - cimag(coeff_c2s[ 1])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3])*gcart [nbra* 3+i] - - cimag(coeff_c2s[ 6])*gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 12])*gcart [nbra*12+i] - - cimag(coeff_c2s[ 14])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 17])*gcart [nbra*17+i]; - gspa[1*lds+i] = creal(coeff_c2s[ 22])*gcart [nbra* 2+i] - - cimag(coeff_c2s[ 24])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 27])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 30])*gcart [nbra*10+i] - - cimag(coeff_c2s[ 31])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 33])*gcart [nbra*13+i] - + creal(coeff_c2s[ 35])*gcart [nbra*15+i] - - cimag(coeff_c2s[ 36])*gcart [nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 38])*gcart [nbra*18+i]*_Complex_I; - gspa[2*lds+i] = creal(coeff_c2s[ 40])*gcart [nbra* 0+i] - - cimag(coeff_c2s[ 41])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 43])*gcart [nbra* 3+i] - + creal(coeff_c2s[ 45])*gcart [nbra* 5+i] - - cimag(coeff_c2s[ 46])*gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 48])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 52])*gcart [nbra*12+i] - + creal(coeff_c2s[ 57])*gcart [nbra*17+i] - + creal(coeff_c2s[ 59])*gcart [nbra*19+i]; - gspa[3*lds+i] = creal(coeff_c2s[ 62])*gcart [nbra* 2+i] - + creal(coeff_c2s[ 67])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 69])*gcart [nbra* 9+i] - + creal(coeff_c2s[ 70])*gcart [nbra*10+i] - - cimag(coeff_c2s[ 71])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 73])*gcart [nbra*13+i] - + creal(coeff_c2s[ 75])*gcart [nbra*15+i] - - cimag(coeff_c2s[ 76])*gcart [nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 78])*gcart [nbra*18+i]*_Complex_I; - gspa[4*lds+i] = creal(coeff_c2s[ 80])*gcart [nbra* 0+i] - - cimag(coeff_c2s[ 81])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 83])*gcart [nbra* 3+i] - + creal(coeff_c2s[ 85])*gcart [nbra* 5+i] - - cimag(coeff_c2s[ 86])*gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 88])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 92])*gcart [nbra*12+i] - - cimag(coeff_c2s[ 94])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 97])*gcart [nbra*17+i]; - gspa[5*lds+i] = creal(coeff_c2s[102])*gcart [nbra* 2+i] - - cimag(coeff_c2s[104])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[107])*gcart [nbra* 7+i] - + creal(coeff_c2s[110])*gcart [nbra*10+i] - - cimag(coeff_c2s[111])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[113])*gcart [nbra*13+i] - - cimag(coeff_c2s[116])*gcart [nbra*16+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 0])*gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 1])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3])*gcart1[nbra* 3+i] - - cimag(coeff_c2s[ 6])*gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 12])*gcart1[nbra*12+i] - - cimag(coeff_c2s[ 14])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 17])*gcart1[nbra*17+i]; - gspb[1*lds+i] = creal(coeff_c2s[ 22])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[ 24])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 27])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 30])*gcart1[nbra*10+i] - - cimag(coeff_c2s[ 31])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 33])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 35])*gcart1[nbra*15+i] - - cimag(coeff_c2s[ 36])*gcart1[nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 38])*gcart1[nbra*18+i]*_Complex_I; - gspb[2*lds+i] = creal(coeff_c2s[ 40])*gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 41])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 43])*gcart1[nbra* 3+i] - + creal(coeff_c2s[ 45])*gcart1[nbra* 5+i] - - cimag(coeff_c2s[ 46])*gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 48])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 52])*gcart1[nbra*12+i] - + creal(coeff_c2s[ 57])*gcart1[nbra*17+i] - + creal(coeff_c2s[ 59])*gcart1[nbra*19+i]; - gspb[3*lds+i] = creal(coeff_c2s[ 62])*gcart1[nbra* 2+i] - + creal(coeff_c2s[ 67])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 69])*gcart1[nbra* 9+i] - + creal(coeff_c2s[ 70])*gcart1[nbra*10+i] - - cimag(coeff_c2s[ 71])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 73])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 75])*gcart1[nbra*15+i] - - cimag(coeff_c2s[ 76])*gcart1[nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 78])*gcart1[nbra*18+i]*_Complex_I; - gspb[4*lds+i] = creal(coeff_c2s[ 80])*gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 81])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 83])*gcart1[nbra* 3+i] - + creal(coeff_c2s[ 85])*gcart1[nbra* 5+i] - - cimag(coeff_c2s[ 86])*gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 88])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 92])*gcart1[nbra*12+i] - - cimag(coeff_c2s[ 94])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 97])*gcart1[nbra*17+i]; - gspb[5*lds+i] = creal(coeff_c2s[102])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[104])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[107])*gcart1[nbra* 7+i] - + creal(coeff_c2s[110])*gcart1[nbra*10+i] - - cimag(coeff_c2s[111])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[113])*gcart1[nbra*13+i] - - cimag(coeff_c2s[116])*gcart1[nbra*16+i]*_Complex_I; - } - gspa += lds * 6; - gspb += lds * 6; + gsp[i+lds*0] = creal(coeff_c2s[ 0])*gcarta[i+nbra*0] + - cimag(coeff_c2s[ 1])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 3])*gcarta[i+nbra*3] + - cimag(coeff_c2s[ 6])*gcarta[i+nbra*6]*_Complex_I + + creal(coeff_c2s[ 12])*gcartb[i+nbra*2] + - cimag(coeff_c2s[ 14])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 17])*gcartb[i+nbra*7]; + gsp[i+lds*1] = creal(coeff_c2s[ 22])*gcarta[i+nbra*2] + - cimag(coeff_c2s[ 24])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 27])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 30])*gcartb[i+nbra*0] + - cimag(coeff_c2s[ 31])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 33])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 35])*gcartb[i+nbra*5] + - cimag(coeff_c2s[ 36])*gcartb[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[ 38])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[ 40])*gcarta[i+nbra*0] + - cimag(coeff_c2s[ 41])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 43])*gcarta[i+nbra*3] + + creal(coeff_c2s[ 45])*gcarta[i+nbra*5] + - cimag(coeff_c2s[ 46])*gcarta[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[ 48])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[ 52])*gcartb[i+nbra*2] + + creal(coeff_c2s[ 57])*gcartb[i+nbra*7] + + creal(coeff_c2s[ 59])*gcartb[i+nbra*9]; + gsp[i+lds*3] = creal(coeff_c2s[ 62])*gcarta[i+nbra*2] + + creal(coeff_c2s[ 67])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 69])*gcarta[i+nbra*9] + + creal(coeff_c2s[ 70])*gcartb[i+nbra*0] + - cimag(coeff_c2s[ 71])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 73])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 75])*gcartb[i+nbra*5] + - cimag(coeff_c2s[ 76])*gcartb[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[ 78])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[ 80])*gcarta[i+nbra*0] + - cimag(coeff_c2s[ 81])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 83])*gcarta[i+nbra*3] + + creal(coeff_c2s[ 85])*gcarta[i+nbra*5] + - cimag(coeff_c2s[ 86])*gcarta[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[ 88])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[ 92])*gcartb[i+nbra*2] + - cimag(coeff_c2s[ 94])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 97])*gcartb[i+nbra*7]; + gsp[i+lds*5] = creal(coeff_c2s[102])*gcarta[i+nbra*2] + - cimag(coeff_c2s[104])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[107])*gcarta[i+nbra*7] + + creal(coeff_c2s[110])*gcartb[i+nbra*0] + - cimag(coeff_c2s[111])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[113])*gcartb[i+nbra*3] + - cimag(coeff_c2s[116])*gcartb[i+nbra*6]*_Complex_I; + } + gsp += lds * 6; } if (kappa <= 0) { coeff_c2s = g_c2s[3].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 10])*gcart [nbra*10+i] - - cimag(coeff_c2s[ 11])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 13])*gcart [nbra*13+i] - - cimag(coeff_c2s[ 16])*gcart [nbra*16+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[ 20])*gcart [nbra* 0+i] - - cimag(coeff_c2s[ 21])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 23])*gcart [nbra* 3+i] - - cimag(coeff_c2s[ 26])*gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 32])*gcart [nbra*12+i] - - cimag(coeff_c2s[ 34])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 37])*gcart [nbra*17+i]; - gspa[2*lds+i] = creal(coeff_c2s[ 42])*gcart [nbra* 2+i] - - cimag(coeff_c2s[ 44])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 47])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 50])*gcart [nbra*10+i] - - cimag(coeff_c2s[ 51])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 53])*gcart [nbra*13+i] - + creal(coeff_c2s[ 55])*gcart [nbra*15+i] - - cimag(coeff_c2s[ 56])*gcart [nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 58])*gcart [nbra*18+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[ 60])*gcart [nbra* 0+i] - - cimag(coeff_c2s[ 61])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 63])*gcart [nbra* 3+i] - + creal(coeff_c2s[ 65])*gcart [nbra* 5+i] - - cimag(coeff_c2s[ 66])*gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 68])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 72])*gcart [nbra*12+i] - + creal(coeff_c2s[ 77])*gcart [nbra*17+i] - + creal(coeff_c2s[ 79])*gcart [nbra*19+i]; - gspa[4*lds+i] = creal(coeff_c2s[ 82])*gcart [nbra* 2+i] - + creal(coeff_c2s[ 87])*gcart [nbra* 7+i] - + creal(coeff_c2s[ 89])*gcart [nbra* 9+i] - + creal(coeff_c2s[ 90])*gcart [nbra*10+i] - - cimag(coeff_c2s[ 91])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 93])*gcart [nbra*13+i] - + creal(coeff_c2s[ 95])*gcart [nbra*15+i] - - cimag(coeff_c2s[ 96])*gcart [nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 98])*gcart [nbra*18+i]*_Complex_I; - gspa[5*lds+i] = creal(coeff_c2s[100])*gcart [nbra* 0+i] - - cimag(coeff_c2s[101])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[103])*gcart [nbra* 3+i] - + creal(coeff_c2s[105])*gcart [nbra* 5+i] - - cimag(coeff_c2s[106])*gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[108])*gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[112])*gcart [nbra*12+i] - - cimag(coeff_c2s[114])*gcart [nbra*14+i]*_Complex_I - + creal(coeff_c2s[117])*gcart [nbra*17+i]; - gspa[6*lds+i] = creal(coeff_c2s[122])*gcart [nbra* 2+i] - - cimag(coeff_c2s[124])*gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127])*gcart [nbra* 7+i] - + creal(coeff_c2s[130])*gcart [nbra*10+i] - - cimag(coeff_c2s[131])*gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[133])*gcart [nbra*13+i] - - cimag(coeff_c2s[136])*gcart [nbra*16+i]*_Complex_I; - gspa[7*lds+i] = creal(coeff_c2s[140])*gcart [nbra* 0+i] - - cimag(coeff_c2s[141])*gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[143])*gcart [nbra* 3+i] - - cimag(coeff_c2s[146])*gcart [nbra* 6+i]*_Complex_I; - gspb[0*lds+i] = creal(coeff_c2s[ 10])*gcart1[nbra*10+i] - - cimag(coeff_c2s[ 11])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 13])*gcart1[nbra*13+i] - - cimag(coeff_c2s[ 16])*gcart1[nbra*16+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[ 20])*gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 21])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 23])*gcart1[nbra* 3+i] - - cimag(coeff_c2s[ 26])*gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 32])*gcart1[nbra*12+i] - - cimag(coeff_c2s[ 34])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[ 37])*gcart1[nbra*17+i]; - gspb[2*lds+i] = creal(coeff_c2s[ 42])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[ 44])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 47])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 50])*gcart1[nbra*10+i] - - cimag(coeff_c2s[ 51])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 53])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 55])*gcart1[nbra*15+i] - - cimag(coeff_c2s[ 56])*gcart1[nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 58])*gcart1[nbra*18+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[ 60])*gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 61])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 63])*gcart1[nbra* 3+i] - + creal(coeff_c2s[ 65])*gcart1[nbra* 5+i] - - cimag(coeff_c2s[ 66])*gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 68])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 72])*gcart1[nbra*12+i] - + creal(coeff_c2s[ 77])*gcart1[nbra*17+i] - + creal(coeff_c2s[ 79])*gcart1[nbra*19+i]; - gspb[4*lds+i] = creal(coeff_c2s[ 82])*gcart1[nbra* 2+i] - + creal(coeff_c2s[ 87])*gcart1[nbra* 7+i] - + creal(coeff_c2s[ 89])*gcart1[nbra* 9+i] - + creal(coeff_c2s[ 90])*gcart1[nbra*10+i] - - cimag(coeff_c2s[ 91])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 93])*gcart1[nbra*13+i] - + creal(coeff_c2s[ 95])*gcart1[nbra*15+i] - - cimag(coeff_c2s[ 96])*gcart1[nbra*16+i]*_Complex_I - - cimag(coeff_c2s[ 98])*gcart1[nbra*18+i]*_Complex_I; - gspb[5*lds+i] = creal(coeff_c2s[100])*gcart1[nbra* 0+i] - - cimag(coeff_c2s[101])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[103])*gcart1[nbra* 3+i] - + creal(coeff_c2s[105])*gcart1[nbra* 5+i] - - cimag(coeff_c2s[106])*gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[108])*gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[112])*gcart1[nbra*12+i] - - cimag(coeff_c2s[114])*gcart1[nbra*14+i]*_Complex_I - + creal(coeff_c2s[117])*gcart1[nbra*17+i]; - gspb[6*lds+i] = creal(coeff_c2s[122])*gcart1[nbra* 2+i] - - cimag(coeff_c2s[124])*gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127])*gcart1[nbra* 7+i] - + creal(coeff_c2s[130])*gcart1[nbra*10+i] - - cimag(coeff_c2s[131])*gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[133])*gcart1[nbra*13+i] - - cimag(coeff_c2s[136])*gcart1[nbra*16+i]*_Complex_I; - gspb[7*lds+i] = creal(coeff_c2s[140])*gcart1[nbra* 0+i] - - cimag(coeff_c2s[141])*gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[143])*gcart1[nbra* 3+i] - - cimag(coeff_c2s[146])*gcart1[nbra* 6+i]*_Complex_I; + gsp[i+lds*0] = creal(coeff_c2s[ 10])*gcartb[i+nbra*0] + - cimag(coeff_c2s[ 11])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 13])*gcartb[i+nbra*3] + - cimag(coeff_c2s[ 16])*gcartb[i+nbra*6]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 20])*gcarta[i+nbra*0] + - cimag(coeff_c2s[ 21])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 23])*gcarta[i+nbra*3] + - cimag(coeff_c2s[ 26])*gcarta[i+nbra*6]*_Complex_I + + creal(coeff_c2s[ 32])*gcartb[i+nbra*2] + - cimag(coeff_c2s[ 34])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 37])*gcartb[i+nbra*7]; + gsp[i+lds*2] = creal(coeff_c2s[ 42])*gcarta[i+nbra*2] + - cimag(coeff_c2s[ 44])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[ 47])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 50])*gcartb[i+nbra*0] + - cimag(coeff_c2s[ 51])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 53])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 55])*gcartb[i+nbra*5] + - cimag(coeff_c2s[ 56])*gcartb[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[ 58])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[ 60])*gcarta[i+nbra*0] + - cimag(coeff_c2s[ 61])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 63])*gcarta[i+nbra*3] + + creal(coeff_c2s[ 65])*gcarta[i+nbra*5] + - cimag(coeff_c2s[ 66])*gcarta[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[ 68])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[ 72])*gcartb[i+nbra*2] + + creal(coeff_c2s[ 77])*gcartb[i+nbra*7] + + creal(coeff_c2s[ 79])*gcartb[i+nbra*9]; + gsp[i+lds*4] = creal(coeff_c2s[ 82])*gcarta[i+nbra*2] + + creal(coeff_c2s[ 87])*gcarta[i+nbra*7] + + creal(coeff_c2s[ 89])*gcarta[i+nbra*9] + + creal(coeff_c2s[ 90])*gcartb[i+nbra*0] + - cimag(coeff_c2s[ 91])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[ 93])*gcartb[i+nbra*3] + + creal(coeff_c2s[ 95])*gcartb[i+nbra*5] + - cimag(coeff_c2s[ 96])*gcartb[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[ 98])*gcartb[i+nbra*8]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[100])*gcarta[i+nbra*0] + - cimag(coeff_c2s[101])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[103])*gcarta[i+nbra*3] + + creal(coeff_c2s[105])*gcarta[i+nbra*5] + - cimag(coeff_c2s[106])*gcarta[i+nbra*6]*_Complex_I + - cimag(coeff_c2s[108])*gcarta[i+nbra*8]*_Complex_I + + creal(coeff_c2s[112])*gcartb[i+nbra*2] + - cimag(coeff_c2s[114])*gcartb[i+nbra*4]*_Complex_I + + creal(coeff_c2s[117])*gcartb[i+nbra*7]; + gsp[i+lds*6] = creal(coeff_c2s[122])*gcarta[i+nbra*2] + - cimag(coeff_c2s[124])*gcarta[i+nbra*4]*_Complex_I + + creal(coeff_c2s[127])*gcarta[i+nbra*7] + + creal(coeff_c2s[130])*gcartb[i+nbra*0] + - cimag(coeff_c2s[131])*gcartb[i+nbra*1]*_Complex_I + + creal(coeff_c2s[133])*gcartb[i+nbra*3] + - cimag(coeff_c2s[136])*gcartb[i+nbra*6]*_Complex_I; + gsp[i+lds*7] = creal(coeff_c2s[140])*gcarta[i+nbra*0] + - cimag(coeff_c2s[141])*gcarta[i+nbra*1]*_Complex_I + + creal(coeff_c2s[143])*gcarta[i+nbra*3] + - cimag(coeff_c2s[146])*gcarta[i+nbra*6]*_Complex_I; } } } @@ -7764,404 +6713,212 @@ static void g_iket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void g_ket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void g_ket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*30; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[4].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 0]) * gcart [nbra* 0+i] - + cimag(coeff_c2s[ 1]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3]) * gcart [nbra* 3+i] - + cimag(coeff_c2s[ 6]) * gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 10]) * gcart [nbra*10+i] - + creal(coeff_c2s[ 17]) * gcart [nbra*17+i] - + cimag(coeff_c2s[ 19]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 22]) * gcart [nbra*22+i] - + cimag(coeff_c2s[ 26]) * gcart [nbra*26+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[ 32]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[ 34]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 37]) * gcart [nbra* 7+i] - + cimag(coeff_c2s[ 41]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 45]) * gcart [nbra*15+i] - + cimag(coeff_c2s[ 46]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 50]) * gcart [nbra*20+i] - + cimag(coeff_c2s[ 51]) * gcart [nbra*21+i]*_Complex_I - + cimag(coeff_c2s[ 53]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 55]) * gcart [nbra*25+i] - + creal(coeff_c2s[ 57]) * gcart [nbra*27+i]; - gspa[2*lds+i] = creal(coeff_c2s[ 60]) * gcart [nbra* 0+i] - + cimag(coeff_c2s[ 61]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 65]) * gcart [nbra* 5+i] - + cimag(coeff_c2s[ 66]) * gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 68]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 70]) * gcart [nbra*10+i] - + creal(coeff_c2s[ 72]) * gcart [nbra*12+i] - + creal(coeff_c2s[ 77]) * gcart [nbra*17+i] - + cimag(coeff_c2s[ 79]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 82]) * gcart [nbra*22+i] - + creal(coeff_c2s[ 84]) * gcart [nbra*24+i] - + cimag(coeff_c2s[ 86]) * gcart [nbra*26+i]*_Complex_I - + cimag(coeff_c2s[ 88]) * gcart [nbra*28+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[ 92]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[ 94]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 97]) * gcart [nbra* 7+i] - + creal(coeff_c2s[ 99]) * gcart [nbra* 9+i] - + cimag(coeff_c2s[101]) * gcart [nbra*11+i]*_Complex_I - + cimag(coeff_c2s[103]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[105]) * gcart [nbra*15+i] - + creal(coeff_c2s[108]) * gcart [nbra*18+i] - + creal(coeff_c2s[110]) * gcart [nbra*20+i] - + creal(coeff_c2s[115]) * gcart [nbra*25+i] - + creal(coeff_c2s[117]) * gcart [nbra*27+i] - + creal(coeff_c2s[119]) * gcart [nbra*29+i]; - gspa[4*lds+i] = creal(coeff_c2s[120]) * gcart [nbra* 0+i] - + creal(coeff_c2s[123]) * gcart [nbra* 3+i] - + creal(coeff_c2s[125]) * gcart [nbra* 5+i] - + creal(coeff_c2s[130]) * gcart [nbra*10+i] - + creal(coeff_c2s[132]) * gcart [nbra*12+i] - + creal(coeff_c2s[134]) * gcart [nbra*14+i] - + creal(coeff_c2s[137]) * gcart [nbra*17+i] - + cimag(coeff_c2s[139]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[142]) * gcart [nbra*22+i] - + creal(coeff_c2s[144]) * gcart [nbra*24+i] - + cimag(coeff_c2s[146]) * gcart [nbra*26+i]*_Complex_I - + cimag(coeff_c2s[148]) * gcart [nbra*28+i]*_Complex_I; - gspa[5*lds+i] = creal(coeff_c2s[152]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[154]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[157]) * gcart [nbra* 7+i] - + creal(coeff_c2s[159]) * gcart [nbra* 9+i] - + cimag(coeff_c2s[161]) * gcart [nbra*11+i]*_Complex_I - + cimag(coeff_c2s[163]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[165]) * gcart [nbra*15+i] - + cimag(coeff_c2s[166]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[170]) * gcart [nbra*20+i] - + cimag(coeff_c2s[171]) * gcart [nbra*21+i]*_Complex_I - + cimag(coeff_c2s[173]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[175]) * gcart [nbra*25+i] - + creal(coeff_c2s[177]) * gcart [nbra*27+i]; - gspa[6*lds+i] = creal(coeff_c2s[180]) * gcart [nbra* 0+i] - + cimag(coeff_c2s[181]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[185]) * gcart [nbra* 5+i] - + cimag(coeff_c2s[186]) * gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[188]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[190]) * gcart [nbra*10+i] - + creal(coeff_c2s[192]) * gcart [nbra*12+i] - + creal(coeff_c2s[197]) * gcart [nbra*17+i] - + cimag(coeff_c2s[199]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[202]) * gcart [nbra*22+i] - + cimag(coeff_c2s[206]) * gcart [nbra*26+i]*_Complex_I; - gspa[7*lds+i] = creal(coeff_c2s[212]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[214]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[217]) * gcart [nbra* 7+i] - + cimag(coeff_c2s[221]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[225]) * gcart [nbra*15+i] - + cimag(coeff_c2s[226]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[228]) * gcart [nbra*18+i] - + cimag(coeff_c2s[231]) * gcart [nbra*21+i]*_Complex_I - + creal(coeff_c2s[235]) * gcart [nbra*25+i]; - gspb[0*lds+i] = creal(coeff_c2s[ 0]) * gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 1]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3]) * gcart1[nbra* 3+i] - + cimag(coeff_c2s[ 6]) * gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 10]) * gcart1[nbra*10+i] - + creal(coeff_c2s[ 17]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[ 19]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 22]) * gcart1[nbra*22+i] - + cimag(coeff_c2s[ 26]) * gcart1[nbra*26+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[ 32]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[ 34]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 37]) * gcart1[nbra* 7+i] - + cimag(coeff_c2s[ 41]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 45]) * gcart1[nbra*15+i] - + cimag(coeff_c2s[ 46]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 50]) * gcart1[nbra*20+i] - + cimag(coeff_c2s[ 51]) * gcart1[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[ 53]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 55]) * gcart1[nbra*25+i] - + creal(coeff_c2s[ 57]) * gcart1[nbra*27+i]; - gspb[2*lds+i] = creal(coeff_c2s[ 60]) * gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 61]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 65]) * gcart1[nbra* 5+i] - + cimag(coeff_c2s[ 66]) * gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 68]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 70]) * gcart1[nbra*10+i] - + creal(coeff_c2s[ 72]) * gcart1[nbra*12+i] - + creal(coeff_c2s[ 77]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[ 79]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 82]) * gcart1[nbra*22+i] - + creal(coeff_c2s[ 84]) * gcart1[nbra*24+i] - + cimag(coeff_c2s[ 86]) * gcart1[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[ 88]) * gcart1[nbra*28+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[ 92]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[ 94]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 97]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[ 99]) * gcart1[nbra* 9+i] - + cimag(coeff_c2s[101]) * gcart1[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[103]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[105]) * gcart1[nbra*15+i] - + creal(coeff_c2s[108]) * gcart1[nbra*18+i] - + creal(coeff_c2s[110]) * gcart1[nbra*20+i] - + creal(coeff_c2s[115]) * gcart1[nbra*25+i] - + creal(coeff_c2s[117]) * gcart1[nbra*27+i] - + creal(coeff_c2s[119]) * gcart1[nbra*29+i]; - gspb[4*lds+i] = creal(coeff_c2s[120]) * gcart1[nbra* 0+i] - + creal(coeff_c2s[123]) * gcart1[nbra* 3+i] - + creal(coeff_c2s[125]) * gcart1[nbra* 5+i] - + creal(coeff_c2s[130]) * gcart1[nbra*10+i] - + creal(coeff_c2s[132]) * gcart1[nbra*12+i] - + creal(coeff_c2s[134]) * gcart1[nbra*14+i] - + creal(coeff_c2s[137]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[139]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[142]) * gcart1[nbra*22+i] - + creal(coeff_c2s[144]) * gcart1[nbra*24+i] - + cimag(coeff_c2s[146]) * gcart1[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[148]) * gcart1[nbra*28+i]*_Complex_I; - gspb[5*lds+i] = creal(coeff_c2s[152]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[154]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[157]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[159]) * gcart1[nbra* 9+i] - + cimag(coeff_c2s[161]) * gcart1[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[163]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[165]) * gcart1[nbra*15+i] - + cimag(coeff_c2s[166]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[170]) * gcart1[nbra*20+i] - + cimag(coeff_c2s[171]) * gcart1[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[173]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[175]) * gcart1[nbra*25+i] - + creal(coeff_c2s[177]) * gcart1[nbra*27+i]; - gspb[6*lds+i] = creal(coeff_c2s[180]) * gcart1[nbra* 0+i] - + cimag(coeff_c2s[181]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[185]) * gcart1[nbra* 5+i] - + cimag(coeff_c2s[186]) * gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[188]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[190]) * gcart1[nbra*10+i] - + creal(coeff_c2s[192]) * gcart1[nbra*12+i] - + creal(coeff_c2s[197]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[199]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[202]) * gcart1[nbra*22+i] - + cimag(coeff_c2s[206]) * gcart1[nbra*26+i]*_Complex_I; - gspb[7*lds+i] = creal(coeff_c2s[212]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[214]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[217]) * gcart1[nbra* 7+i] - + cimag(coeff_c2s[221]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[225]) * gcart1[nbra*15+i] - + cimag(coeff_c2s[226]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[228]) * gcart1[nbra*18+i] - + cimag(coeff_c2s[231]) * gcart1[nbra*21+i]*_Complex_I - + creal(coeff_c2s[235]) * gcart1[nbra*25+i]; - }; - gspa += lds * 8; - gspb += lds * 8; + gsp[i+lds*0] = creal(coeff_c2s[ 0]) * gcarta[i+nbra* 0] + + cimag(coeff_c2s[ 1]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 3]) * gcarta[i+nbra* 3] + + cimag(coeff_c2s[ 6]) * gcarta[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[ 10]) * gcarta[i+nbra*10] + + creal(coeff_c2s[ 17]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[ 19]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 22]) * gcartb[i+nbra* 7] + + cimag(coeff_c2s[ 26]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 32]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[ 34]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 37]) * gcarta[i+nbra* 7] + + cimag(coeff_c2s[ 41]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[ 45]) * gcartb[i+nbra* 0] + + cimag(coeff_c2s[ 46]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 50]) * gcartb[i+nbra* 5] + + cimag(coeff_c2s[ 51]) * gcartb[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[ 53]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[ 55]) * gcartb[i+nbra*10] + + creal(coeff_c2s[ 57]) * gcartb[i+nbra*12]; + gsp[i+lds*2] = creal(coeff_c2s[ 60]) * gcarta[i+nbra* 0] + + cimag(coeff_c2s[ 61]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 65]) * gcarta[i+nbra* 5] + + cimag(coeff_c2s[ 66]) * gcarta[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[ 68]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[ 70]) * gcarta[i+nbra*10] + + creal(coeff_c2s[ 72]) * gcarta[i+nbra*12] + + creal(coeff_c2s[ 77]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[ 79]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 82]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[ 84]) * gcartb[i+nbra* 9] + + cimag(coeff_c2s[ 86]) * gcartb[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[ 88]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[ 92]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[ 94]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 97]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[ 99]) * gcarta[i+nbra* 9] + + cimag(coeff_c2s[101]) * gcarta[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[103]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[105]) * gcartb[i+nbra* 0] + + creal(coeff_c2s[108]) * gcartb[i+nbra* 3] + + creal(coeff_c2s[110]) * gcartb[i+nbra* 5] + + creal(coeff_c2s[115]) * gcartb[i+nbra*10] + + creal(coeff_c2s[117]) * gcartb[i+nbra*12] + + creal(coeff_c2s[119]) * gcartb[i+nbra*14]; + gsp[i+lds*4] = creal(coeff_c2s[120]) * gcarta[i+nbra* 0] + + creal(coeff_c2s[123]) * gcarta[i+nbra* 3] + + creal(coeff_c2s[125]) * gcarta[i+nbra* 5] + + creal(coeff_c2s[130]) * gcarta[i+nbra*10] + + creal(coeff_c2s[132]) * gcarta[i+nbra*12] + + creal(coeff_c2s[134]) * gcarta[i+nbra*14] + + creal(coeff_c2s[137]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[139]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[142]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[144]) * gcartb[i+nbra* 9] + + cimag(coeff_c2s[146]) * gcartb[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[148]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[152]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[154]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[157]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[159]) * gcarta[i+nbra* 9] + + cimag(coeff_c2s[161]) * gcarta[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[163]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[165]) * gcartb[i+nbra* 0] + + cimag(coeff_c2s[166]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[170]) * gcartb[i+nbra* 5] + + cimag(coeff_c2s[171]) * gcartb[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[173]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[175]) * gcartb[i+nbra*10] + + creal(coeff_c2s[177]) * gcartb[i+nbra*12]; + gsp[i+lds*6] = creal(coeff_c2s[180]) * gcarta[i+nbra* 0] + + cimag(coeff_c2s[181]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[185]) * gcarta[i+nbra* 5] + + cimag(coeff_c2s[186]) * gcarta[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[188]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[190]) * gcarta[i+nbra*10] + + creal(coeff_c2s[192]) * gcarta[i+nbra*12] + + creal(coeff_c2s[197]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[199]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[202]) * gcartb[i+nbra* 7] + + cimag(coeff_c2s[206]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*7] = creal(coeff_c2s[212]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[214]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[217]) * gcarta[i+nbra* 7] + + cimag(coeff_c2s[221]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[225]) * gcartb[i+nbra* 0] + + cimag(coeff_c2s[226]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[228]) * gcartb[i+nbra* 3] + + cimag(coeff_c2s[231]) * gcartb[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[235]) * gcartb[i+nbra*10]; + } + gsp += lds * 8; } if (kappa <= 0) { coeff_c2s = g_c2s[4].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 15]) * gcart [nbra*15+i] - + cimag(coeff_c2s[ 16]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 18]) * gcart [nbra*18+i] - + cimag(coeff_c2s[ 21]) * gcart [nbra*21+i]*_Complex_I - + creal(coeff_c2s[ 25]) * gcart [nbra*25+i]; - gspa[1*lds+i] = creal(coeff_c2s[ 30]) * gcart [nbra* 0+i] - + cimag(coeff_c2s[ 31]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 33]) * gcart [nbra* 3+i] - + cimag(coeff_c2s[ 36]) * gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 40]) * gcart [nbra*10+i] - + creal(coeff_c2s[ 47]) * gcart [nbra*17+i] - + cimag(coeff_c2s[ 49]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 52]) * gcart [nbra*22+i] - + cimag(coeff_c2s[ 56]) * gcart [nbra*26+i]*_Complex_I; - gspa[2*lds+i] = creal(coeff_c2s[ 62]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[ 64]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 67]) * gcart [nbra* 7+i] - + cimag(coeff_c2s[ 71]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 75]) * gcart [nbra*15+i] - + cimag(coeff_c2s[ 76]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 80]) * gcart [nbra*20+i] - + cimag(coeff_c2s[ 81]) * gcart [nbra*21+i]*_Complex_I - + cimag(coeff_c2s[ 83]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 85]) * gcart [nbra*25+i] - + creal(coeff_c2s[ 87]) * gcart [nbra*27+i]; - gspa[3*lds+i] = creal(coeff_c2s[ 90]) * gcart [nbra* 0+i] - + cimag(coeff_c2s[ 91]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 95]) * gcart [nbra* 5+i] - + cimag(coeff_c2s[ 96]) * gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 98]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[100]) * gcart [nbra*10+i] - + creal(coeff_c2s[102]) * gcart [nbra*12+i] - + creal(coeff_c2s[107]) * gcart [nbra*17+i] - + cimag(coeff_c2s[109]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[112]) * gcart [nbra*22+i] - + creal(coeff_c2s[114]) * gcart [nbra*24+i] - + cimag(coeff_c2s[116]) * gcart [nbra*26+i]*_Complex_I - + cimag(coeff_c2s[118]) * gcart [nbra*28+i]*_Complex_I; - gspa[4*lds+i] = creal(coeff_c2s[122]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[124]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127]) * gcart [nbra* 7+i] - + creal(coeff_c2s[129]) * gcart [nbra* 9+i] - + cimag(coeff_c2s[131]) * gcart [nbra*11+i]*_Complex_I - + cimag(coeff_c2s[133]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[135]) * gcart [nbra*15+i] - + creal(coeff_c2s[138]) * gcart [nbra*18+i] - + creal(coeff_c2s[140]) * gcart [nbra*20+i] - + creal(coeff_c2s[145]) * gcart [nbra*25+i] - + creal(coeff_c2s[147]) * gcart [nbra*27+i] - + creal(coeff_c2s[149]) * gcart [nbra*29+i]; - gspa[5*lds+i] = creal(coeff_c2s[150]) * gcart [nbra* 0+i] - + creal(coeff_c2s[153]) * gcart [nbra* 3+i] - + creal(coeff_c2s[155]) * gcart [nbra* 5+i] - + creal(coeff_c2s[160]) * gcart [nbra*10+i] - + creal(coeff_c2s[162]) * gcart [nbra*12+i] - + creal(coeff_c2s[164]) * gcart [nbra*14+i] - + creal(coeff_c2s[167]) * gcart [nbra*17+i] - + cimag(coeff_c2s[169]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[172]) * gcart [nbra*22+i] - + creal(coeff_c2s[174]) * gcart [nbra*24+i] - + cimag(coeff_c2s[176]) * gcart [nbra*26+i]*_Complex_I - + cimag(coeff_c2s[178]) * gcart [nbra*28+i]*_Complex_I; - gspa[6*lds+i] = creal(coeff_c2s[182]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[184]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[187]) * gcart [nbra* 7+i] - + creal(coeff_c2s[189]) * gcart [nbra* 9+i] - + cimag(coeff_c2s[191]) * gcart [nbra*11+i]*_Complex_I - + cimag(coeff_c2s[193]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[195]) * gcart [nbra*15+i] - + cimag(coeff_c2s[196]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[200]) * gcart [nbra*20+i] - + cimag(coeff_c2s[201]) * gcart [nbra*21+i]*_Complex_I - + cimag(coeff_c2s[203]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[205]) * gcart [nbra*25+i] - + creal(coeff_c2s[207]) * gcart [nbra*27+i]; - gspa[7*lds+i] = creal(coeff_c2s[210]) * gcart [nbra* 0+i] - + cimag(coeff_c2s[211]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[215]) * gcart [nbra* 5+i] - + cimag(coeff_c2s[216]) * gcart [nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[218]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[220]) * gcart [nbra*10+i] - + creal(coeff_c2s[222]) * gcart [nbra*12+i] - + creal(coeff_c2s[227]) * gcart [nbra*17+i] - + cimag(coeff_c2s[229]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[232]) * gcart [nbra*22+i] - + cimag(coeff_c2s[236]) * gcart [nbra*26+i]*_Complex_I; - gspa[8*lds+i] = creal(coeff_c2s[242]) * gcart [nbra* 2+i] - + cimag(coeff_c2s[244]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[247]) * gcart [nbra* 7+i] - + cimag(coeff_c2s[251]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[255]) * gcart [nbra*15+i] - + cimag(coeff_c2s[256]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[258]) * gcart [nbra*18+i] - + cimag(coeff_c2s[261]) * gcart [nbra*21+i]*_Complex_I - + creal(coeff_c2s[265]) * gcart [nbra*25+i]; - gspa[9*lds+i] = creal(coeff_c2s[270]) * gcart [nbra* 0+i] - + cimag(coeff_c2s[271]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[273]) * gcart [nbra* 3+i] - + cimag(coeff_c2s[276]) * gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[280]) * gcart [nbra*10+i]; - gspb[0*lds+i] = creal(coeff_c2s[ 15]) * gcart1[nbra*15+i] - + cimag(coeff_c2s[ 16]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 18]) * gcart1[nbra*18+i] - + cimag(coeff_c2s[ 21]) * gcart1[nbra*21+i]*_Complex_I - + creal(coeff_c2s[ 25]) * gcart1[nbra*25+i]; - gspb[1*lds+i] = creal(coeff_c2s[ 30]) * gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 31]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 33]) * gcart1[nbra* 3+i] - + cimag(coeff_c2s[ 36]) * gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 40]) * gcart1[nbra*10+i] - + creal(coeff_c2s[ 47]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[ 49]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 52]) * gcart1[nbra*22+i] - + cimag(coeff_c2s[ 56]) * gcart1[nbra*26+i]*_Complex_I; - gspb[2*lds+i] = creal(coeff_c2s[ 62]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[ 64]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 67]) * gcart1[nbra* 7+i] - + cimag(coeff_c2s[ 71]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 75]) * gcart1[nbra*15+i] - + cimag(coeff_c2s[ 76]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 80]) * gcart1[nbra*20+i] - + cimag(coeff_c2s[ 81]) * gcart1[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[ 83]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 85]) * gcart1[nbra*25+i] - + creal(coeff_c2s[ 87]) * gcart1[nbra*27+i]; - gspb[3*lds+i] = creal(coeff_c2s[ 90]) * gcart1[nbra* 0+i] - + cimag(coeff_c2s[ 91]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 95]) * gcart1[nbra* 5+i] - + cimag(coeff_c2s[ 96]) * gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[ 98]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[100]) * gcart1[nbra*10+i] - + creal(coeff_c2s[102]) * gcart1[nbra*12+i] - + creal(coeff_c2s[107]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[109]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[112]) * gcart1[nbra*22+i] - + creal(coeff_c2s[114]) * gcart1[nbra*24+i] - + cimag(coeff_c2s[116]) * gcart1[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[118]) * gcart1[nbra*28+i]*_Complex_I; - gspb[4*lds+i] = creal(coeff_c2s[122]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[124]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[129]) * gcart1[nbra* 9+i] - + cimag(coeff_c2s[131]) * gcart1[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[133]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[135]) * gcart1[nbra*15+i] - + creal(coeff_c2s[138]) * gcart1[nbra*18+i] - + creal(coeff_c2s[140]) * gcart1[nbra*20+i] - + creal(coeff_c2s[145]) * gcart1[nbra*25+i] - + creal(coeff_c2s[147]) * gcart1[nbra*27+i] - + creal(coeff_c2s[149]) * gcart1[nbra*29+i]; - gspb[5*lds+i] = creal(coeff_c2s[150]) * gcart1[nbra* 0+i] - + creal(coeff_c2s[153]) * gcart1[nbra* 3+i] - + creal(coeff_c2s[155]) * gcart1[nbra* 5+i] - + creal(coeff_c2s[160]) * gcart1[nbra*10+i] - + creal(coeff_c2s[162]) * gcart1[nbra*12+i] - + creal(coeff_c2s[164]) * gcart1[nbra*14+i] - + creal(coeff_c2s[167]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[169]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[172]) * gcart1[nbra*22+i] - + creal(coeff_c2s[174]) * gcart1[nbra*24+i] - + cimag(coeff_c2s[176]) * gcart1[nbra*26+i]*_Complex_I - + cimag(coeff_c2s[178]) * gcart1[nbra*28+i]*_Complex_I; - gspb[6*lds+i] = creal(coeff_c2s[182]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[184]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[187]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[189]) * gcart1[nbra* 9+i] - + cimag(coeff_c2s[191]) * gcart1[nbra*11+i]*_Complex_I - + cimag(coeff_c2s[193]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[195]) * gcart1[nbra*15+i] - + cimag(coeff_c2s[196]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[200]) * gcart1[nbra*20+i] - + cimag(coeff_c2s[201]) * gcart1[nbra*21+i]*_Complex_I - + cimag(coeff_c2s[203]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[205]) * gcart1[nbra*25+i] - + creal(coeff_c2s[207]) * gcart1[nbra*27+i]; - gspb[7*lds+i] = creal(coeff_c2s[210]) * gcart1[nbra* 0+i] - + cimag(coeff_c2s[211]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[215]) * gcart1[nbra* 5+i] - + cimag(coeff_c2s[216]) * gcart1[nbra* 6+i]*_Complex_I - + cimag(coeff_c2s[218]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[220]) * gcart1[nbra*10+i] - + creal(coeff_c2s[222]) * gcart1[nbra*12+i] - + creal(coeff_c2s[227]) * gcart1[nbra*17+i] - + cimag(coeff_c2s[229]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[232]) * gcart1[nbra*22+i] - + cimag(coeff_c2s[236]) * gcart1[nbra*26+i]*_Complex_I; - gspb[8*lds+i] = creal(coeff_c2s[242]) * gcart1[nbra* 2+i] - + cimag(coeff_c2s[244]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[247]) * gcart1[nbra* 7+i] - + cimag(coeff_c2s[251]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[255]) * gcart1[nbra*15+i] - + cimag(coeff_c2s[256]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[258]) * gcart1[nbra*18+i] - + cimag(coeff_c2s[261]) * gcart1[nbra*21+i]*_Complex_I - + creal(coeff_c2s[265]) * gcart1[nbra*25+i]; - gspb[9*lds+i] = creal(coeff_c2s[270]) * gcart1[nbra* 0+i] - + cimag(coeff_c2s[271]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[273]) * gcart1[nbra* 3+i] - + cimag(coeff_c2s[276]) * gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[280]) * gcart1[nbra*10+i]; + gsp[i+lds*0] = creal(coeff_c2s[ 15]) * gcartb[i+nbra* 0] + + cimag(coeff_c2s[ 16]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 18]) * gcartb[i+nbra* 3] + + cimag(coeff_c2s[ 21]) * gcartb[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[ 25]) * gcartb[i+nbra*10]; + gsp[i+lds*1] = creal(coeff_c2s[ 30]) * gcarta[i+nbra* 0] + + cimag(coeff_c2s[ 31]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 33]) * gcarta[i+nbra* 3] + + cimag(coeff_c2s[ 36]) * gcarta[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[ 40]) * gcarta[i+nbra*10] + + creal(coeff_c2s[ 47]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[ 49]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 52]) * gcartb[i+nbra* 7] + + cimag(coeff_c2s[ 56]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[ 62]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[ 64]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 67]) * gcarta[i+nbra* 7] + + cimag(coeff_c2s[ 71]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[ 75]) * gcartb[i+nbra* 0] + + cimag(coeff_c2s[ 76]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 80]) * gcartb[i+nbra* 5] + + cimag(coeff_c2s[ 81]) * gcartb[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[ 83]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[ 85]) * gcartb[i+nbra*10] + + creal(coeff_c2s[ 87]) * gcartb[i+nbra*12]; + gsp[i+lds*3] = creal(coeff_c2s[ 90]) * gcarta[i+nbra* 0] + + cimag(coeff_c2s[ 91]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 95]) * gcarta[i+nbra* 5] + + cimag(coeff_c2s[ 96]) * gcarta[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[ 98]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[100]) * gcarta[i+nbra*10] + + creal(coeff_c2s[102]) * gcarta[i+nbra*12] + + creal(coeff_c2s[107]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[109]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[112]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[114]) * gcartb[i+nbra* 9] + + cimag(coeff_c2s[116]) * gcartb[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[118]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[122]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[124]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[127]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[129]) * gcarta[i+nbra* 9] + + cimag(coeff_c2s[131]) * gcarta[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[133]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[135]) * gcartb[i+nbra* 0] + + creal(coeff_c2s[138]) * gcartb[i+nbra* 3] + + creal(coeff_c2s[140]) * gcartb[i+nbra* 5] + + creal(coeff_c2s[145]) * gcartb[i+nbra*10] + + creal(coeff_c2s[147]) * gcartb[i+nbra*12] + + creal(coeff_c2s[149]) * gcartb[i+nbra*14]; + gsp[i+lds*5] = creal(coeff_c2s[150]) * gcarta[i+nbra* 0] + + creal(coeff_c2s[153]) * gcarta[i+nbra* 3] + + creal(coeff_c2s[155]) * gcarta[i+nbra* 5] + + creal(coeff_c2s[160]) * gcarta[i+nbra*10] + + creal(coeff_c2s[162]) * gcarta[i+nbra*12] + + creal(coeff_c2s[164]) * gcarta[i+nbra*14] + + creal(coeff_c2s[167]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[169]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[172]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[174]) * gcartb[i+nbra* 9] + + cimag(coeff_c2s[176]) * gcartb[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[178]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*6] = creal(coeff_c2s[182]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[184]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[187]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[189]) * gcarta[i+nbra* 9] + + cimag(coeff_c2s[191]) * gcarta[i+nbra*11]*_Complex_I + + cimag(coeff_c2s[193]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[195]) * gcartb[i+nbra* 0] + + cimag(coeff_c2s[196]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[200]) * gcartb[i+nbra* 5] + + cimag(coeff_c2s[201]) * gcartb[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[203]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[205]) * gcartb[i+nbra*10] + + creal(coeff_c2s[207]) * gcartb[i+nbra*12]; + gsp[i+lds*7] = creal(coeff_c2s[210]) * gcarta[i+nbra* 0] + + cimag(coeff_c2s[211]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[215]) * gcarta[i+nbra* 5] + + cimag(coeff_c2s[216]) * gcarta[i+nbra* 6]*_Complex_I + + cimag(coeff_c2s[218]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[220]) * gcarta[i+nbra*10] + + creal(coeff_c2s[222]) * gcarta[i+nbra*12] + + creal(coeff_c2s[227]) * gcartb[i+nbra* 2] + + cimag(coeff_c2s[229]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[232]) * gcartb[i+nbra* 7] + + cimag(coeff_c2s[236]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*8] = creal(coeff_c2s[242]) * gcarta[i+nbra* 2] + + cimag(coeff_c2s[244]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[247]) * gcarta[i+nbra* 7] + + cimag(coeff_c2s[251]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[255]) * gcartb[i+nbra* 0] + + cimag(coeff_c2s[256]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[258]) * gcartb[i+nbra* 3] + + cimag(coeff_c2s[261]) * gcartb[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[265]) * gcartb[i+nbra*10]; + gsp[i+lds*9] = creal(coeff_c2s[270]) * gcarta[i+nbra* 0] + + cimag(coeff_c2s[271]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[273]) * gcarta[i+nbra* 3] + + cimag(coeff_c2s[276]) * gcarta[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[280]) * gcarta[i+nbra*10]; } } } @@ -8446,404 +7203,421 @@ static void g_cket_cart2spinor_e1sf(double complex *gspa, double complex *gspb, } } } -static void g_cket_cart2spinor_si(double complex *gspa, double complex *gspb, - double complex *gcart, +static void g_iket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, FINT lds, FINT nbra, FINT kappa, FINT l) { - double complex *gcart1 = gcart + nbra*30; const double complex *coeff_c2s; FINT i; if (kappa >= 0) { coeff_c2s = g_c2s[4].cart2j_lt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 0]) * gcart [nbra* 0+i] - - cimag(coeff_c2s[ 1]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3]) * gcart [nbra* 3+i] - - cimag(coeff_c2s[ 6]) * gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 10]) * gcart [nbra*10+i] - + creal(coeff_c2s[ 17]) * gcart [nbra*17+i] - - cimag(coeff_c2s[ 19]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 22]) * gcart [nbra*22+i] - - cimag(coeff_c2s[ 26]) * gcart [nbra*26+i]*_Complex_I; - gspa[1*lds+i] = creal(coeff_c2s[ 32]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[ 34]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 37]) * gcart [nbra* 7+i] - - cimag(coeff_c2s[ 41]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 45]) * gcart [nbra*15+i] - - cimag(coeff_c2s[ 46]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 50]) * gcart [nbra*20+i] - - cimag(coeff_c2s[ 51]) * gcart [nbra*21+i]*_Complex_I - - cimag(coeff_c2s[ 53]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 55]) * gcart [nbra*25+i] - + creal(coeff_c2s[ 57]) * gcart [nbra*27+i]; - gspa[2*lds+i] = creal(coeff_c2s[ 60]) * gcart [nbra* 0+i] - - cimag(coeff_c2s[ 61]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 65]) * gcart [nbra* 5+i] - - cimag(coeff_c2s[ 66]) * gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 68]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 70]) * gcart [nbra*10+i] - + creal(coeff_c2s[ 72]) * gcart [nbra*12+i] - + creal(coeff_c2s[ 77]) * gcart [nbra*17+i] - - cimag(coeff_c2s[ 79]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 82]) * gcart [nbra*22+i] - + creal(coeff_c2s[ 84]) * gcart [nbra*24+i] - - cimag(coeff_c2s[ 86]) * gcart [nbra*26+i]*_Complex_I - - cimag(coeff_c2s[ 88]) * gcart [nbra*28+i]*_Complex_I; - gspa[3*lds+i] = creal(coeff_c2s[ 92]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[ 94]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 97]) * gcart [nbra* 7+i] - + creal(coeff_c2s[ 99]) * gcart [nbra* 9+i] - - cimag(coeff_c2s[101]) * gcart [nbra*11+i]*_Complex_I - - cimag(coeff_c2s[103]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[105]) * gcart [nbra*15+i] - + creal(coeff_c2s[108]) * gcart [nbra*18+i] - + creal(coeff_c2s[110]) * gcart [nbra*20+i] - + creal(coeff_c2s[115]) * gcart [nbra*25+i] - + creal(coeff_c2s[117]) * gcart [nbra*27+i] - + creal(coeff_c2s[119]) * gcart [nbra*29+i]; - gspa[4*lds+i] = creal(coeff_c2s[120]) * gcart [nbra* 0+i] - + creal(coeff_c2s[123]) * gcart [nbra* 3+i] - + creal(coeff_c2s[125]) * gcart [nbra* 5+i] - + creal(coeff_c2s[130]) * gcart [nbra*10+i] - + creal(coeff_c2s[132]) * gcart [nbra*12+i] - + creal(coeff_c2s[134]) * gcart [nbra*14+i] - + creal(coeff_c2s[137]) * gcart [nbra*17+i] - - cimag(coeff_c2s[139]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[142]) * gcart [nbra*22+i] - + creal(coeff_c2s[144]) * gcart [nbra*24+i] - - cimag(coeff_c2s[146]) * gcart [nbra*26+i]*_Complex_I - - cimag(coeff_c2s[148]) * gcart [nbra*28+i]*_Complex_I; - gspa[5*lds+i] = creal(coeff_c2s[152]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[154]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[157]) * gcart [nbra* 7+i] - + creal(coeff_c2s[159]) * gcart [nbra* 9+i] - - cimag(coeff_c2s[161]) * gcart [nbra*11+i]*_Complex_I - - cimag(coeff_c2s[163]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[165]) * gcart [nbra*15+i] - - cimag(coeff_c2s[166]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[170]) * gcart [nbra*20+i] - - cimag(coeff_c2s[171]) * gcart [nbra*21+i]*_Complex_I - - cimag(coeff_c2s[173]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[175]) * gcart [nbra*25+i] - + creal(coeff_c2s[177]) * gcart [nbra*27+i]; - gspa[6*lds+i] = creal(coeff_c2s[180]) * gcart [nbra* 0+i] - - cimag(coeff_c2s[181]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[185]) * gcart [nbra* 5+i] - - cimag(coeff_c2s[186]) * gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[188]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[190]) * gcart [nbra*10+i] - + creal(coeff_c2s[192]) * gcart [nbra*12+i] - + creal(coeff_c2s[197]) * gcart [nbra*17+i] - - cimag(coeff_c2s[199]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[202]) * gcart [nbra*22+i] - - cimag(coeff_c2s[206]) * gcart [nbra*26+i]*_Complex_I; - gspa[7*lds+i] = creal(coeff_c2s[212]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[214]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[217]) * gcart [nbra* 7+i] - - cimag(coeff_c2s[221]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[225]) * gcart [nbra*15+i] - - cimag(coeff_c2s[226]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[228]) * gcart [nbra*18+i] - - cimag(coeff_c2s[231]) * gcart [nbra*21+i]*_Complex_I - + creal(coeff_c2s[235]) * gcart [nbra*25+i]; - gspb[0*lds+i] = creal(coeff_c2s[ 0]) * gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 1]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 3]) * gcart1[nbra* 3+i] - - cimag(coeff_c2s[ 6]) * gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 10]) * gcart1[nbra*10+i] - + creal(coeff_c2s[ 17]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[ 19]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 22]) * gcart1[nbra*22+i] - - cimag(coeff_c2s[ 26]) * gcart1[nbra*26+i]*_Complex_I; - gspb[1*lds+i] = creal(coeff_c2s[ 32]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[ 34]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 37]) * gcart1[nbra* 7+i] - - cimag(coeff_c2s[ 41]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 45]) * gcart1[nbra*15+i] - - cimag(coeff_c2s[ 46]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 50]) * gcart1[nbra*20+i] - - cimag(coeff_c2s[ 51]) * gcart1[nbra*21+i]*_Complex_I - - cimag(coeff_c2s[ 53]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 55]) * gcart1[nbra*25+i] - + creal(coeff_c2s[ 57]) * gcart1[nbra*27+i]; - gspb[2*lds+i] = creal(coeff_c2s[ 60]) * gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 61]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 65]) * gcart1[nbra* 5+i] - - cimag(coeff_c2s[ 66]) * gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 68]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[ 70]) * gcart1[nbra*10+i] - + creal(coeff_c2s[ 72]) * gcart1[nbra*12+i] - + creal(coeff_c2s[ 77]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[ 79]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 82]) * gcart1[nbra*22+i] - + creal(coeff_c2s[ 84]) * gcart1[nbra*24+i] - - cimag(coeff_c2s[ 86]) * gcart1[nbra*26+i]*_Complex_I - - cimag(coeff_c2s[ 88]) * gcart1[nbra*28+i]*_Complex_I; - gspb[3*lds+i] = creal(coeff_c2s[ 92]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[ 94]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 97]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[ 99]) * gcart1[nbra* 9+i] - - cimag(coeff_c2s[101]) * gcart1[nbra*11+i]*_Complex_I - - cimag(coeff_c2s[103]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[105]) * gcart1[nbra*15+i] - + creal(coeff_c2s[108]) * gcart1[nbra*18+i] - + creal(coeff_c2s[110]) * gcart1[nbra*20+i] - + creal(coeff_c2s[115]) * gcart1[nbra*25+i] - + creal(coeff_c2s[117]) * gcart1[nbra*27+i] - + creal(coeff_c2s[119]) * gcart1[nbra*29+i]; - gspb[4*lds+i] = creal(coeff_c2s[120]) * gcart1[nbra* 0+i] - + creal(coeff_c2s[123]) * gcart1[nbra* 3+i] - + creal(coeff_c2s[125]) * gcart1[nbra* 5+i] - + creal(coeff_c2s[130]) * gcart1[nbra*10+i] - + creal(coeff_c2s[132]) * gcart1[nbra*12+i] - + creal(coeff_c2s[134]) * gcart1[nbra*14+i] - + creal(coeff_c2s[137]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[139]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[142]) * gcart1[nbra*22+i] - + creal(coeff_c2s[144]) * gcart1[nbra*24+i] - - cimag(coeff_c2s[146]) * gcart1[nbra*26+i]*_Complex_I - - cimag(coeff_c2s[148]) * gcart1[nbra*28+i]*_Complex_I; - gspb[5*lds+i] = creal(coeff_c2s[152]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[154]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[157]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[159]) * gcart1[nbra* 9+i] - - cimag(coeff_c2s[161]) * gcart1[nbra*11+i]*_Complex_I - - cimag(coeff_c2s[163]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[165]) * gcart1[nbra*15+i] - - cimag(coeff_c2s[166]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[170]) * gcart1[nbra*20+i] - - cimag(coeff_c2s[171]) * gcart1[nbra*21+i]*_Complex_I - - cimag(coeff_c2s[173]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[175]) * gcart1[nbra*25+i] - + creal(coeff_c2s[177]) * gcart1[nbra*27+i]; - gspb[6*lds+i] = creal(coeff_c2s[180]) * gcart1[nbra* 0+i] - - cimag(coeff_c2s[181]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[185]) * gcart1[nbra* 5+i] - - cimag(coeff_c2s[186]) * gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[188]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[190]) * gcart1[nbra*10+i] - + creal(coeff_c2s[192]) * gcart1[nbra*12+i] - + creal(coeff_c2s[197]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[199]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[202]) * gcart1[nbra*22+i] - - cimag(coeff_c2s[206]) * gcart1[nbra*26+i]*_Complex_I; - gspb[7*lds+i] = creal(coeff_c2s[212]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[214]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[217]) * gcart1[nbra* 7+i] - - cimag(coeff_c2s[221]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[225]) * gcart1[nbra*15+i] - - cimag(coeff_c2s[226]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[228]) * gcart1[nbra*18+i] - - cimag(coeff_c2s[231]) * gcart1[nbra*21+i]*_Complex_I - + creal(coeff_c2s[235]) * gcart1[nbra*25+i]; - }; - gspa += lds * 8; - gspb += lds * 8; + gsp[i+lds*0] = creal(coeff_c2s[ 0]) * gcarta[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[ 1]) * gcarta[i+nbra* 1] + + creal(coeff_c2s[ 3]) * gcarta[i+nbra* 3]*_Complex_I + - cimag(coeff_c2s[ 6]) * gcarta[i+nbra* 6] + + creal(coeff_c2s[ 10]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[ 17]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[ 19]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[ 22]) * gcartb[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[ 26]) * gcartb[i+nbra*11]; + gsp[i+lds*1] = creal(coeff_c2s[ 32]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[ 34]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[ 37]) * gcarta[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[ 41]) * gcarta[i+nbra*11] + + creal(coeff_c2s[ 45]) * gcartb[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[ 46]) * gcartb[i+nbra* 1] + + creal(coeff_c2s[ 50]) * gcartb[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[ 51]) * gcartb[i+nbra* 6] + - cimag(coeff_c2s[ 53]) * gcartb[i+nbra* 8] + + creal(coeff_c2s[ 55]) * gcartb[i+nbra*10]*_Complex_I + + creal(coeff_c2s[ 57]) * gcartb[i+nbra*12]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[ 60]) * gcarta[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[ 61]) * gcarta[i+nbra* 1] + + creal(coeff_c2s[ 65]) * gcarta[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[ 66]) * gcarta[i+nbra* 6] + - cimag(coeff_c2s[ 68]) * gcarta[i+nbra* 8] + + creal(coeff_c2s[ 70]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[ 72]) * gcarta[i+nbra*12]*_Complex_I + + creal(coeff_c2s[ 77]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[ 79]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[ 82]) * gcartb[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[ 84]) * gcartb[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[ 86]) * gcartb[i+nbra*11] + - cimag(coeff_c2s[ 88]) * gcartb[i+nbra*13]; + gsp[i+lds*3] = creal(coeff_c2s[ 92]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[ 94]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[ 97]) * gcarta[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[ 99]) * gcarta[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[101]) * gcarta[i+nbra*11] + - cimag(coeff_c2s[103]) * gcarta[i+nbra*13] + + creal(coeff_c2s[105]) * gcartb[i+nbra* 0]*_Complex_I + + creal(coeff_c2s[108]) * gcartb[i+nbra* 3]*_Complex_I + + creal(coeff_c2s[110]) * gcartb[i+nbra* 5]*_Complex_I + + creal(coeff_c2s[115]) * gcartb[i+nbra*10]*_Complex_I + + creal(coeff_c2s[117]) * gcartb[i+nbra*12]*_Complex_I + + creal(coeff_c2s[119]) * gcartb[i+nbra*14]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[120]) * gcarta[i+nbra* 0]*_Complex_I + + creal(coeff_c2s[123]) * gcarta[i+nbra* 3]*_Complex_I + + creal(coeff_c2s[125]) * gcarta[i+nbra* 5]*_Complex_I + + creal(coeff_c2s[130]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[132]) * gcarta[i+nbra*12]*_Complex_I + + creal(coeff_c2s[134]) * gcarta[i+nbra*14]*_Complex_I + + creal(coeff_c2s[137]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[139]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[142]) * gcartb[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[144]) * gcartb[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[146]) * gcartb[i+nbra*11] + - cimag(coeff_c2s[148]) * gcartb[i+nbra*13]; + gsp[i+lds*5] = creal(coeff_c2s[152]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[154]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[157]) * gcarta[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[159]) * gcarta[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[161]) * gcarta[i+nbra*11] + - cimag(coeff_c2s[163]) * gcarta[i+nbra*13] + + creal(coeff_c2s[165]) * gcartb[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[166]) * gcartb[i+nbra* 1] + + creal(coeff_c2s[170]) * gcartb[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[171]) * gcartb[i+nbra* 6] + - cimag(coeff_c2s[173]) * gcartb[i+nbra* 8] + + creal(coeff_c2s[175]) * gcartb[i+nbra*10]*_Complex_I + + creal(coeff_c2s[177]) * gcartb[i+nbra*12]*_Complex_I; + gsp[i+lds*6] = creal(coeff_c2s[180]) * gcarta[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[181]) * gcarta[i+nbra* 1] + + creal(coeff_c2s[185]) * gcarta[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[186]) * gcarta[i+nbra* 6] + - cimag(coeff_c2s[188]) * gcarta[i+nbra* 8] + + creal(coeff_c2s[190]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[192]) * gcarta[i+nbra*12]*_Complex_I + + creal(coeff_c2s[197]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[199]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[202]) * gcartb[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[206]) * gcartb[i+nbra*11]; + gsp[i+lds*7] = creal(coeff_c2s[212]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[214]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[217]) * gcarta[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[221]) * gcarta[i+nbra*11] + + creal(coeff_c2s[225]) * gcartb[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[226]) * gcartb[i+nbra* 1] + + creal(coeff_c2s[228]) * gcartb[i+nbra* 3]*_Complex_I + - cimag(coeff_c2s[231]) * gcartb[i+nbra* 6] + + creal(coeff_c2s[235]) * gcartb[i+nbra*10]*_Complex_I; + } + gsp += lds * 8; + } + if (kappa <= 0) { + coeff_c2s = g_c2s[4].cart2j_gt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 15]) * gcartb[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[ 16]) * gcartb[i+nbra* 1] + + creal(coeff_c2s[ 18]) * gcartb[i+nbra* 3]*_Complex_I + - cimag(coeff_c2s[ 21]) * gcartb[i+nbra* 6] + + creal(coeff_c2s[ 25]) * gcartb[i+nbra*10]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 30]) * gcarta[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[ 31]) * gcarta[i+nbra* 1] + + creal(coeff_c2s[ 33]) * gcarta[i+nbra* 3]*_Complex_I + - cimag(coeff_c2s[ 36]) * gcarta[i+nbra* 6] + + creal(coeff_c2s[ 40]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[ 47]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[ 49]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[ 52]) * gcartb[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[ 56]) * gcartb[i+nbra*11]; + gsp[i+lds*2] = creal(coeff_c2s[ 62]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[ 64]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[ 67]) * gcarta[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[ 71]) * gcarta[i+nbra*11] + + creal(coeff_c2s[ 75]) * gcartb[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[ 76]) * gcartb[i+nbra* 1] + + creal(coeff_c2s[ 80]) * gcartb[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[ 81]) * gcartb[i+nbra* 6] + - cimag(coeff_c2s[ 83]) * gcartb[i+nbra* 8] + + creal(coeff_c2s[ 85]) * gcartb[i+nbra*10]*_Complex_I + + creal(coeff_c2s[ 87]) * gcartb[i+nbra*12]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[ 90]) * gcarta[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[ 91]) * gcarta[i+nbra* 1] + + creal(coeff_c2s[ 95]) * gcarta[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[ 96]) * gcarta[i+nbra* 6] + - cimag(coeff_c2s[ 98]) * gcarta[i+nbra* 8] + + creal(coeff_c2s[100]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[102]) * gcarta[i+nbra*12]*_Complex_I + + creal(coeff_c2s[107]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[109]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[112]) * gcartb[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[114]) * gcartb[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[116]) * gcartb[i+nbra*11] + - cimag(coeff_c2s[118]) * gcartb[i+nbra*13]; + gsp[i+lds*4] = creal(coeff_c2s[122]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[124]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[127]) * gcarta[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[129]) * gcarta[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[131]) * gcarta[i+nbra*11] + - cimag(coeff_c2s[133]) * gcarta[i+nbra*13] + + creal(coeff_c2s[135]) * gcartb[i+nbra* 0]*_Complex_I + + creal(coeff_c2s[138]) * gcartb[i+nbra* 3]*_Complex_I + + creal(coeff_c2s[140]) * gcartb[i+nbra* 5]*_Complex_I + + creal(coeff_c2s[145]) * gcartb[i+nbra*10]*_Complex_I + + creal(coeff_c2s[147]) * gcartb[i+nbra*12]*_Complex_I + + creal(coeff_c2s[149]) * gcartb[i+nbra*14]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[150]) * gcarta[i+nbra* 0]*_Complex_I + + creal(coeff_c2s[153]) * gcarta[i+nbra* 3]*_Complex_I + + creal(coeff_c2s[155]) * gcarta[i+nbra* 5]*_Complex_I + + creal(coeff_c2s[160]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[162]) * gcarta[i+nbra*12]*_Complex_I + + creal(coeff_c2s[164]) * gcarta[i+nbra*14]*_Complex_I + + creal(coeff_c2s[167]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[169]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[172]) * gcartb[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[174]) * gcartb[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[176]) * gcartb[i+nbra*11] + - cimag(coeff_c2s[178]) * gcartb[i+nbra*13]; + gsp[i+lds*6] = creal(coeff_c2s[182]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[184]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[187]) * gcarta[i+nbra* 7]*_Complex_I + + creal(coeff_c2s[189]) * gcarta[i+nbra* 9]*_Complex_I + - cimag(coeff_c2s[191]) * gcarta[i+nbra*11] + - cimag(coeff_c2s[193]) * gcarta[i+nbra*13] + + creal(coeff_c2s[195]) * gcartb[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[196]) * gcartb[i+nbra* 1] + + creal(coeff_c2s[200]) * gcartb[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[201]) * gcartb[i+nbra* 6] + - cimag(coeff_c2s[203]) * gcartb[i+nbra* 8] + + creal(coeff_c2s[205]) * gcartb[i+nbra*10]*_Complex_I + + creal(coeff_c2s[207]) * gcartb[i+nbra*12]*_Complex_I; + gsp[i+lds*7] = creal(coeff_c2s[210]) * gcarta[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[211]) * gcarta[i+nbra* 1] + + creal(coeff_c2s[215]) * gcarta[i+nbra* 5]*_Complex_I + - cimag(coeff_c2s[216]) * gcarta[i+nbra* 6] + - cimag(coeff_c2s[218]) * gcarta[i+nbra* 8] + + creal(coeff_c2s[220]) * gcarta[i+nbra*10]*_Complex_I + + creal(coeff_c2s[222]) * gcarta[i+nbra*12]*_Complex_I + + creal(coeff_c2s[227]) * gcartb[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[229]) * gcartb[i+nbra* 4] + + creal(coeff_c2s[232]) * gcartb[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[236]) * gcartb[i+nbra*11]; + gsp[i+lds*8] = creal(coeff_c2s[242]) * gcarta[i+nbra* 2]*_Complex_I + - cimag(coeff_c2s[244]) * gcarta[i+nbra* 4] + + creal(coeff_c2s[247]) * gcarta[i+nbra* 7]*_Complex_I + - cimag(coeff_c2s[251]) * gcarta[i+nbra*11] + + creal(coeff_c2s[255]) * gcartb[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[256]) * gcartb[i+nbra* 1] + + creal(coeff_c2s[258]) * gcartb[i+nbra* 3]*_Complex_I + - cimag(coeff_c2s[261]) * gcartb[i+nbra* 6] + + creal(coeff_c2s[265]) * gcartb[i+nbra*10]*_Complex_I; + gsp[i+lds*9] = creal(coeff_c2s[270]) * gcarta[i+nbra* 0]*_Complex_I + - cimag(coeff_c2s[271]) * gcarta[i+nbra* 1] + + creal(coeff_c2s[273]) * gcarta[i+nbra* 3]*_Complex_I + - cimag(coeff_c2s[276]) * gcarta[i+nbra* 6] + + creal(coeff_c2s[280]) * gcarta[i+nbra*10]*_Complex_I; + } + } +} +static void g_cket_cart2spinor_si(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) +{ + const double complex *coeff_c2s; + FINT i; + + if (kappa >= 0) { + coeff_c2s = g_c2s[4].cart2j_lt_l; + for (i = 0; i < nbra; i++) { + gsp[i+lds*0] = creal(coeff_c2s[ 0]) * gcarta[i+nbra* 0] + - cimag(coeff_c2s[ 1]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 3]) * gcarta[i+nbra* 3] + - cimag(coeff_c2s[ 6]) * gcarta[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[ 10]) * gcarta[i+nbra*10] + + creal(coeff_c2s[ 17]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[ 19]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 22]) * gcartb[i+nbra* 7] + - cimag(coeff_c2s[ 26]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*1] = creal(coeff_c2s[ 32]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[ 34]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 37]) * gcarta[i+nbra* 7] + - cimag(coeff_c2s[ 41]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[ 45]) * gcartb[i+nbra* 0] + - cimag(coeff_c2s[ 46]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 50]) * gcartb[i+nbra* 5] + - cimag(coeff_c2s[ 51]) * gcartb[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[ 53]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[ 55]) * gcartb[i+nbra*10] + + creal(coeff_c2s[ 57]) * gcartb[i+nbra*12]; + gsp[i+lds*2] = creal(coeff_c2s[ 60]) * gcarta[i+nbra* 0] + - cimag(coeff_c2s[ 61]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 65]) * gcarta[i+nbra* 5] + - cimag(coeff_c2s[ 66]) * gcarta[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[ 68]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[ 70]) * gcarta[i+nbra*10] + + creal(coeff_c2s[ 72]) * gcarta[i+nbra*12] + + creal(coeff_c2s[ 77]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[ 79]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 82]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[ 84]) * gcartb[i+nbra* 9] + - cimag(coeff_c2s[ 86]) * gcartb[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[ 88]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*3] = creal(coeff_c2s[ 92]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[ 94]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 97]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[ 99]) * gcarta[i+nbra* 9] + - cimag(coeff_c2s[101]) * gcarta[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[103]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[105]) * gcartb[i+nbra* 0] + + creal(coeff_c2s[108]) * gcartb[i+nbra* 3] + + creal(coeff_c2s[110]) * gcartb[i+nbra* 5] + + creal(coeff_c2s[115]) * gcartb[i+nbra*10] + + creal(coeff_c2s[117]) * gcartb[i+nbra*12] + + creal(coeff_c2s[119]) * gcartb[i+nbra*14]; + gsp[i+lds*4] = creal(coeff_c2s[120]) * gcarta[i+nbra* 0] + + creal(coeff_c2s[123]) * gcarta[i+nbra* 3] + + creal(coeff_c2s[125]) * gcarta[i+nbra* 5] + + creal(coeff_c2s[130]) * gcarta[i+nbra*10] + + creal(coeff_c2s[132]) * gcarta[i+nbra*12] + + creal(coeff_c2s[134]) * gcarta[i+nbra*14] + + creal(coeff_c2s[137]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[139]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[142]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[144]) * gcartb[i+nbra* 9] + - cimag(coeff_c2s[146]) * gcartb[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[148]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*5] = creal(coeff_c2s[152]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[154]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[157]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[159]) * gcarta[i+nbra* 9] + - cimag(coeff_c2s[161]) * gcarta[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[163]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[165]) * gcartb[i+nbra* 0] + - cimag(coeff_c2s[166]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[170]) * gcartb[i+nbra* 5] + - cimag(coeff_c2s[171]) * gcartb[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[173]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[175]) * gcartb[i+nbra*10] + + creal(coeff_c2s[177]) * gcartb[i+nbra*12]; + gsp[i+lds*6] = creal(coeff_c2s[180]) * gcarta[i+nbra* 0] + - cimag(coeff_c2s[181]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[185]) * gcarta[i+nbra* 5] + - cimag(coeff_c2s[186]) * gcarta[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[188]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[190]) * gcarta[i+nbra*10] + + creal(coeff_c2s[192]) * gcarta[i+nbra*12] + + creal(coeff_c2s[197]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[199]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[202]) * gcartb[i+nbra* 7] + - cimag(coeff_c2s[206]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*7] = creal(coeff_c2s[212]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[214]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[217]) * gcarta[i+nbra* 7] + - cimag(coeff_c2s[221]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[225]) * gcartb[i+nbra* 0] + - cimag(coeff_c2s[226]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[228]) * gcartb[i+nbra* 3] + - cimag(coeff_c2s[231]) * gcartb[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[235]) * gcartb[i+nbra*10]; + } + gsp += lds * 8; } if (kappa <= 0) { coeff_c2s = g_c2s[4].cart2j_gt_l; for (i = 0; i < nbra; i++) { - gspa[0*lds+i] = creal(coeff_c2s[ 15]) * gcart [nbra*15+i] - - cimag(coeff_c2s[ 16]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 18]) * gcart [nbra*18+i] - - cimag(coeff_c2s[ 21]) * gcart [nbra*21+i]*_Complex_I - + creal(coeff_c2s[ 25]) * gcart [nbra*25+i]; - gspa[1*lds+i] = creal(coeff_c2s[ 30]) * gcart [nbra* 0+i] - - cimag(coeff_c2s[ 31]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 33]) * gcart [nbra* 3+i] - - cimag(coeff_c2s[ 36]) * gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 40]) * gcart [nbra*10+i] - + creal(coeff_c2s[ 47]) * gcart [nbra*17+i] - - cimag(coeff_c2s[ 49]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 52]) * gcart [nbra*22+i] - - cimag(coeff_c2s[ 56]) * gcart [nbra*26+i]*_Complex_I; - gspa[2*lds+i] = creal(coeff_c2s[ 62]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[ 64]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 67]) * gcart [nbra* 7+i] - - cimag(coeff_c2s[ 71]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 75]) * gcart [nbra*15+i] - - cimag(coeff_c2s[ 76]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 80]) * gcart [nbra*20+i] - - cimag(coeff_c2s[ 81]) * gcart [nbra*21+i]*_Complex_I - - cimag(coeff_c2s[ 83]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 85]) * gcart [nbra*25+i] - + creal(coeff_c2s[ 87]) * gcart [nbra*27+i]; - gspa[3*lds+i] = creal(coeff_c2s[ 90]) * gcart [nbra* 0+i] - - cimag(coeff_c2s[ 91]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 95]) * gcart [nbra* 5+i] - - cimag(coeff_c2s[ 96]) * gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 98]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[100]) * gcart [nbra*10+i] - + creal(coeff_c2s[102]) * gcart [nbra*12+i] - + creal(coeff_c2s[107]) * gcart [nbra*17+i] - - cimag(coeff_c2s[109]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[112]) * gcart [nbra*22+i] - + creal(coeff_c2s[114]) * gcart [nbra*24+i] - - cimag(coeff_c2s[116]) * gcart [nbra*26+i]*_Complex_I - - cimag(coeff_c2s[118]) * gcart [nbra*28+i]*_Complex_I; - gspa[4*lds+i] = creal(coeff_c2s[122]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[124]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127]) * gcart [nbra* 7+i] - + creal(coeff_c2s[129]) * gcart [nbra* 9+i] - - cimag(coeff_c2s[131]) * gcart [nbra*11+i]*_Complex_I - - cimag(coeff_c2s[133]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[135]) * gcart [nbra*15+i] - + creal(coeff_c2s[138]) * gcart [nbra*18+i] - + creal(coeff_c2s[140]) * gcart [nbra*20+i] - + creal(coeff_c2s[145]) * gcart [nbra*25+i] - + creal(coeff_c2s[147]) * gcart [nbra*27+i] - + creal(coeff_c2s[149]) * gcart [nbra*29+i]; - gspa[5*lds+i] = creal(coeff_c2s[150]) * gcart [nbra* 0+i] - + creal(coeff_c2s[153]) * gcart [nbra* 3+i] - + creal(coeff_c2s[155]) * gcart [nbra* 5+i] - + creal(coeff_c2s[160]) * gcart [nbra*10+i] - + creal(coeff_c2s[162]) * gcart [nbra*12+i] - + creal(coeff_c2s[164]) * gcart [nbra*14+i] - + creal(coeff_c2s[167]) * gcart [nbra*17+i] - - cimag(coeff_c2s[169]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[172]) * gcart [nbra*22+i] - + creal(coeff_c2s[174]) * gcart [nbra*24+i] - - cimag(coeff_c2s[176]) * gcart [nbra*26+i]*_Complex_I - - cimag(coeff_c2s[178]) * gcart [nbra*28+i]*_Complex_I; - gspa[6*lds+i] = creal(coeff_c2s[182]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[184]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[187]) * gcart [nbra* 7+i] - + creal(coeff_c2s[189]) * gcart [nbra* 9+i] - - cimag(coeff_c2s[191]) * gcart [nbra*11+i]*_Complex_I - - cimag(coeff_c2s[193]) * gcart [nbra*13+i]*_Complex_I - + creal(coeff_c2s[195]) * gcart [nbra*15+i] - - cimag(coeff_c2s[196]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[200]) * gcart [nbra*20+i] - - cimag(coeff_c2s[201]) * gcart [nbra*21+i]*_Complex_I - - cimag(coeff_c2s[203]) * gcart [nbra*23+i]*_Complex_I - + creal(coeff_c2s[205]) * gcart [nbra*25+i] - + creal(coeff_c2s[207]) * gcart [nbra*27+i]; - gspa[7*lds+i] = creal(coeff_c2s[210]) * gcart [nbra* 0+i] - - cimag(coeff_c2s[211]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[215]) * gcart [nbra* 5+i] - - cimag(coeff_c2s[216]) * gcart [nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[218]) * gcart [nbra* 8+i]*_Complex_I - + creal(coeff_c2s[220]) * gcart [nbra*10+i] - + creal(coeff_c2s[222]) * gcart [nbra*12+i] - + creal(coeff_c2s[227]) * gcart [nbra*17+i] - - cimag(coeff_c2s[229]) * gcart [nbra*19+i]*_Complex_I - + creal(coeff_c2s[232]) * gcart [nbra*22+i] - - cimag(coeff_c2s[236]) * gcart [nbra*26+i]*_Complex_I; - gspa[8*lds+i] = creal(coeff_c2s[242]) * gcart [nbra* 2+i] - - cimag(coeff_c2s[244]) * gcart [nbra* 4+i]*_Complex_I - + creal(coeff_c2s[247]) * gcart [nbra* 7+i] - - cimag(coeff_c2s[251]) * gcart [nbra*11+i]*_Complex_I - + creal(coeff_c2s[255]) * gcart [nbra*15+i] - - cimag(coeff_c2s[256]) * gcart [nbra*16+i]*_Complex_I - + creal(coeff_c2s[258]) * gcart [nbra*18+i] - - cimag(coeff_c2s[261]) * gcart [nbra*21+i]*_Complex_I - + creal(coeff_c2s[265]) * gcart [nbra*25+i]; - gspa[9*lds+i] = creal(coeff_c2s[270]) * gcart [nbra* 0+i] - - cimag(coeff_c2s[271]) * gcart [nbra* 1+i]*_Complex_I - + creal(coeff_c2s[273]) * gcart [nbra* 3+i] - - cimag(coeff_c2s[276]) * gcart [nbra* 6+i]*_Complex_I - + creal(coeff_c2s[280]) * gcart [nbra*10+i]; - gspb[0*lds+i] = creal(coeff_c2s[ 15]) * gcart1[nbra*15+i] - - cimag(coeff_c2s[ 16]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 18]) * gcart1[nbra*18+i] - - cimag(coeff_c2s[ 21]) * gcart1[nbra*21+i]*_Complex_I - + creal(coeff_c2s[ 25]) * gcart1[nbra*25+i]; - gspb[1*lds+i] = creal(coeff_c2s[ 30]) * gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 31]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 33]) * gcart1[nbra* 3+i] - - cimag(coeff_c2s[ 36]) * gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[ 40]) * gcart1[nbra*10+i] - + creal(coeff_c2s[ 47]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[ 49]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[ 52]) * gcart1[nbra*22+i] - - cimag(coeff_c2s[ 56]) * gcart1[nbra*26+i]*_Complex_I; - gspb[2*lds+i] = creal(coeff_c2s[ 62]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[ 64]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[ 67]) * gcart1[nbra* 7+i] - - cimag(coeff_c2s[ 71]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[ 75]) * gcart1[nbra*15+i] - - cimag(coeff_c2s[ 76]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[ 80]) * gcart1[nbra*20+i] - - cimag(coeff_c2s[ 81]) * gcart1[nbra*21+i]*_Complex_I - - cimag(coeff_c2s[ 83]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[ 85]) * gcart1[nbra*25+i] - + creal(coeff_c2s[ 87]) * gcart1[nbra*27+i]; - gspb[3*lds+i] = creal(coeff_c2s[ 90]) * gcart1[nbra* 0+i] - - cimag(coeff_c2s[ 91]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[ 95]) * gcart1[nbra* 5+i] - - cimag(coeff_c2s[ 96]) * gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[ 98]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[100]) * gcart1[nbra*10+i] - + creal(coeff_c2s[102]) * gcart1[nbra*12+i] - + creal(coeff_c2s[107]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[109]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[112]) * gcart1[nbra*22+i] - + creal(coeff_c2s[114]) * gcart1[nbra*24+i] - - cimag(coeff_c2s[116]) * gcart1[nbra*26+i]*_Complex_I - - cimag(coeff_c2s[118]) * gcart1[nbra*28+i]*_Complex_I; - gspb[4*lds+i] = creal(coeff_c2s[122]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[124]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[127]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[129]) * gcart1[nbra* 9+i] - - cimag(coeff_c2s[131]) * gcart1[nbra*11+i]*_Complex_I - - cimag(coeff_c2s[133]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[135]) * gcart1[nbra*15+i] - + creal(coeff_c2s[138]) * gcart1[nbra*18+i] - + creal(coeff_c2s[140]) * gcart1[nbra*20+i] - + creal(coeff_c2s[145]) * gcart1[nbra*25+i] - + creal(coeff_c2s[147]) * gcart1[nbra*27+i] - + creal(coeff_c2s[149]) * gcart1[nbra*29+i]; - gspb[5*lds+i] = creal(coeff_c2s[150]) * gcart1[nbra* 0+i] - + creal(coeff_c2s[153]) * gcart1[nbra* 3+i] - + creal(coeff_c2s[155]) * gcart1[nbra* 5+i] - + creal(coeff_c2s[160]) * gcart1[nbra*10+i] - + creal(coeff_c2s[162]) * gcart1[nbra*12+i] - + creal(coeff_c2s[164]) * gcart1[nbra*14+i] - + creal(coeff_c2s[167]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[169]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[172]) * gcart1[nbra*22+i] - + creal(coeff_c2s[174]) * gcart1[nbra*24+i] - - cimag(coeff_c2s[176]) * gcart1[nbra*26+i]*_Complex_I - - cimag(coeff_c2s[178]) * gcart1[nbra*28+i]*_Complex_I; - gspb[6*lds+i] = creal(coeff_c2s[182]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[184]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[187]) * gcart1[nbra* 7+i] - + creal(coeff_c2s[189]) * gcart1[nbra* 9+i] - - cimag(coeff_c2s[191]) * gcart1[nbra*11+i]*_Complex_I - - cimag(coeff_c2s[193]) * gcart1[nbra*13+i]*_Complex_I - + creal(coeff_c2s[195]) * gcart1[nbra*15+i] - - cimag(coeff_c2s[196]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[200]) * gcart1[nbra*20+i] - - cimag(coeff_c2s[201]) * gcart1[nbra*21+i]*_Complex_I - - cimag(coeff_c2s[203]) * gcart1[nbra*23+i]*_Complex_I - + creal(coeff_c2s[205]) * gcart1[nbra*25+i] - + creal(coeff_c2s[207]) * gcart1[nbra*27+i]; - gspb[7*lds+i] = creal(coeff_c2s[210]) * gcart1[nbra* 0+i] - - cimag(coeff_c2s[211]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[215]) * gcart1[nbra* 5+i] - - cimag(coeff_c2s[216]) * gcart1[nbra* 6+i]*_Complex_I - - cimag(coeff_c2s[218]) * gcart1[nbra* 8+i]*_Complex_I - + creal(coeff_c2s[220]) * gcart1[nbra*10+i] - + creal(coeff_c2s[222]) * gcart1[nbra*12+i] - + creal(coeff_c2s[227]) * gcart1[nbra*17+i] - - cimag(coeff_c2s[229]) * gcart1[nbra*19+i]*_Complex_I - + creal(coeff_c2s[232]) * gcart1[nbra*22+i] - - cimag(coeff_c2s[236]) * gcart1[nbra*26+i]*_Complex_I; - gspb[8*lds+i] = creal(coeff_c2s[242]) * gcart1[nbra* 2+i] - - cimag(coeff_c2s[244]) * gcart1[nbra* 4+i]*_Complex_I - + creal(coeff_c2s[247]) * gcart1[nbra* 7+i] - - cimag(coeff_c2s[251]) * gcart1[nbra*11+i]*_Complex_I - + creal(coeff_c2s[255]) * gcart1[nbra*15+i] - - cimag(coeff_c2s[256]) * gcart1[nbra*16+i]*_Complex_I - + creal(coeff_c2s[258]) * gcart1[nbra*18+i] - - cimag(coeff_c2s[261]) * gcart1[nbra*21+i]*_Complex_I - + creal(coeff_c2s[265]) * gcart1[nbra*25+i]; - gspb[9*lds+i] = creal(coeff_c2s[270]) * gcart1[nbra* 0+i] - - cimag(coeff_c2s[271]) * gcart1[nbra* 1+i]*_Complex_I - + creal(coeff_c2s[273]) * gcart1[nbra* 3+i] - - cimag(coeff_c2s[276]) * gcart1[nbra* 6+i]*_Complex_I - + creal(coeff_c2s[280]) * gcart1[nbra*10+i]; + gsp[i+lds*0] = creal(coeff_c2s[ 15]) * gcartb[i+nbra* 0] + - cimag(coeff_c2s[ 16]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 18]) * gcartb[i+nbra* 3] + - cimag(coeff_c2s[ 21]) * gcartb[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[ 25]) * gcartb[i+nbra*10]; + gsp[i+lds*1] = creal(coeff_c2s[ 30]) * gcarta[i+nbra* 0] + - cimag(coeff_c2s[ 31]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 33]) * gcarta[i+nbra* 3] + - cimag(coeff_c2s[ 36]) * gcarta[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[ 40]) * gcarta[i+nbra*10] + + creal(coeff_c2s[ 47]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[ 49]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 52]) * gcartb[i+nbra* 7] + - cimag(coeff_c2s[ 56]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*2] = creal(coeff_c2s[ 62]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[ 64]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[ 67]) * gcarta[i+nbra* 7] + - cimag(coeff_c2s[ 71]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[ 75]) * gcartb[i+nbra* 0] + - cimag(coeff_c2s[ 76]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 80]) * gcartb[i+nbra* 5] + - cimag(coeff_c2s[ 81]) * gcartb[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[ 83]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[ 85]) * gcartb[i+nbra*10] + + creal(coeff_c2s[ 87]) * gcartb[i+nbra*12]; + gsp[i+lds*3] = creal(coeff_c2s[ 90]) * gcarta[i+nbra* 0] + - cimag(coeff_c2s[ 91]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[ 95]) * gcarta[i+nbra* 5] + - cimag(coeff_c2s[ 96]) * gcarta[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[ 98]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[100]) * gcarta[i+nbra*10] + + creal(coeff_c2s[102]) * gcarta[i+nbra*12] + + creal(coeff_c2s[107]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[109]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[112]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[114]) * gcartb[i+nbra* 9] + - cimag(coeff_c2s[116]) * gcartb[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[118]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*4] = creal(coeff_c2s[122]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[124]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[127]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[129]) * gcarta[i+nbra* 9] + - cimag(coeff_c2s[131]) * gcarta[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[133]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[135]) * gcartb[i+nbra* 0] + + creal(coeff_c2s[138]) * gcartb[i+nbra* 3] + + creal(coeff_c2s[140]) * gcartb[i+nbra* 5] + + creal(coeff_c2s[145]) * gcartb[i+nbra*10] + + creal(coeff_c2s[147]) * gcartb[i+nbra*12] + + creal(coeff_c2s[149]) * gcartb[i+nbra*14]; + gsp[i+lds*5] = creal(coeff_c2s[150]) * gcarta[i+nbra* 0] + + creal(coeff_c2s[153]) * gcarta[i+nbra* 3] + + creal(coeff_c2s[155]) * gcarta[i+nbra* 5] + + creal(coeff_c2s[160]) * gcarta[i+nbra*10] + + creal(coeff_c2s[162]) * gcarta[i+nbra*12] + + creal(coeff_c2s[164]) * gcarta[i+nbra*14] + + creal(coeff_c2s[167]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[169]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[172]) * gcartb[i+nbra* 7] + + creal(coeff_c2s[174]) * gcartb[i+nbra* 9] + - cimag(coeff_c2s[176]) * gcartb[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[178]) * gcartb[i+nbra*13]*_Complex_I; + gsp[i+lds*6] = creal(coeff_c2s[182]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[184]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[187]) * gcarta[i+nbra* 7] + + creal(coeff_c2s[189]) * gcarta[i+nbra* 9] + - cimag(coeff_c2s[191]) * gcarta[i+nbra*11]*_Complex_I + - cimag(coeff_c2s[193]) * gcarta[i+nbra*13]*_Complex_I + + creal(coeff_c2s[195]) * gcartb[i+nbra* 0] + - cimag(coeff_c2s[196]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[200]) * gcartb[i+nbra* 5] + - cimag(coeff_c2s[201]) * gcartb[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[203]) * gcartb[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[205]) * gcartb[i+nbra*10] + + creal(coeff_c2s[207]) * gcartb[i+nbra*12]; + gsp[i+lds*7] = creal(coeff_c2s[210]) * gcarta[i+nbra* 0] + - cimag(coeff_c2s[211]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[215]) * gcarta[i+nbra* 5] + - cimag(coeff_c2s[216]) * gcarta[i+nbra* 6]*_Complex_I + - cimag(coeff_c2s[218]) * gcarta[i+nbra* 8]*_Complex_I + + creal(coeff_c2s[220]) * gcarta[i+nbra*10] + + creal(coeff_c2s[222]) * gcarta[i+nbra*12] + + creal(coeff_c2s[227]) * gcartb[i+nbra* 2] + - cimag(coeff_c2s[229]) * gcartb[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[232]) * gcartb[i+nbra* 7] + - cimag(coeff_c2s[236]) * gcartb[i+nbra*11]*_Complex_I; + gsp[i+lds*8] = creal(coeff_c2s[242]) * gcarta[i+nbra* 2] + - cimag(coeff_c2s[244]) * gcarta[i+nbra* 4]*_Complex_I + + creal(coeff_c2s[247]) * gcarta[i+nbra* 7] + - cimag(coeff_c2s[251]) * gcarta[i+nbra*11]*_Complex_I + + creal(coeff_c2s[255]) * gcartb[i+nbra* 0] + - cimag(coeff_c2s[256]) * gcartb[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[258]) * gcartb[i+nbra* 3] + - cimag(coeff_c2s[261]) * gcartb[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[265]) * gcartb[i+nbra*10]; + gsp[i+lds*9] = creal(coeff_c2s[270]) * gcarta[i+nbra* 0] + - cimag(coeff_c2s[271]) * gcarta[i+nbra* 1]*_Complex_I + + creal(coeff_c2s[273]) * gcarta[i+nbra* 3] + - cimag(coeff_c2s[276]) * gcarta[i+nbra* 6]*_Complex_I + + creal(coeff_c2s[280]) * gcarta[i+nbra*10]; } } } @@ -8886,7 +7660,9 @@ void (*c2s_iket_spinor_e1sf[])() = { a_iket_cart2spinor_e1sf, }; -void (*c2s_ket_spinor_si[])() = { +void (*c2s_ket_spinor_si[])(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) = { s_ket_cart2spinor_si, p_ket_cart2spinor_si, d_ket_cart2spinor_si, @@ -8905,6 +7681,27 @@ void (*c2s_ket_spinor_si[])() = { a_ket_cart2spinor_si, }; +void (*c2s_iket_spinor_si[])(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) = { + s_iket_cart2spinor_si, + p_iket_cart2spinor_si, + d_iket_cart2spinor_si, + f_iket_cart2spinor_si, + g_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, + a_iket_cart2spinor_si, +}; + void (*c2s_cket_spinor_e1sf[])() = { s_ket_cart2spinor_e1sf, p_cket_cart2spinor_e1sf, @@ -8924,7 +7721,9 @@ void (*c2s_cket_spinor_e1sf[])() = { a_cket_cart2spinor_e1sf, }; -void (*c2s_cket_spinor_si[])() = { +void (*c2s_cket_spinor_si[])(double complex *gsp, + double complex *gcarta, double complex *gcartb, + FINT lds, FINT nbra, FINT kappa, FINT l) = { s_ket_cart2spinor_si, p_cket_cart2spinor_si, d_cket_cart2spinor_si, @@ -9242,6 +8041,21 @@ void c2s_zset0(double complex *out, FINT *dims, FINT *counts) } } +void c2s_grids_dset0(double *out, FINT *dims, FINT *counts) +{ + FINT counts1[4] = {counts[2], counts[0], counts[1], counts[3]}; + FINT dims1[4] = {dims[2], dims[0], dims[1],dims [3]}; + c2s_dset0(out, dims1, counts1); +} + +void c2s_grids_zset0(double complex *out, FINT *dims, FINT *counts) +{ + FINT counts1[4] = {counts[2], counts[0], counts[1], counts[3]}; + FINT dims1[4] = {dims[2], dims[0], dims[1],dims [3]}; + c2s_zset0(out, dims1, counts1); +} + + /* * use f_ket to transform k,l for gctr(i,j,k,l), where * sizsph = nbra * (2*l+1) @@ -9292,9 +8106,9 @@ static double *sph2e_inner(double *gsph, double *gcart, // spinor_stride = Ng * _len_spinor(kappa, l); // cart_stride = Ng * (l+1)*(l+2)/2; // nbra = Ng; -static void *spinor_e1sf_inner(double complex *gspinor, double *gcart, - FINT kappa, FINT l, FINT nbra, FINT ncall, - FINT spinor_stride, FINT cart_stride) +static void spinor_e1sf_inner(double complex *gspinor, double *gcart, + FINT kappa, FINT l, FINT nbra, FINT ncall, + FINT spinor_stride, FINT cart_stride) { double complex *gspa = gspinor; double complex *gspb = gspinor + ncall * spinor_stride; @@ -9304,16 +8118,17 @@ static void *spinor_e1sf_inner(double complex *gspinor, double *gcart, gcart+n*cart_stride, nbra, nbra, kappa, l); } } -static void *spinor_si_inner(double complex *gspinor, double complex *gcart, - FINT kappa, FINT l, FINT nbra, FINT ncall, - FINT spinor_stride, FINT cart_stride) +static void spinor_si_inner(double complex *gspinor, double complex *gcart, + FINT kappa, FINT l, FINT nbra, FINT ncall, + FINT spinor_stride, FINT cart_stride) { - double complex *gspa = gspinor; - double complex *gspb = gspinor + ncall * spinor_stride; + double complex *gcarta = gcart; + double complex *gcartb = gcart + ncall * cart_stride; FINT n; for (n = 0; n < ncall; n++) { - (*c2s_cket_spinor_si[l])(gspa+n*spinor_stride, gspb+n*spinor_stride, - gcart+n*cart_stride, nbra, nbra, kappa, l); + (*c2s_cket_spinor_si[l])(gspinor+n*spinor_stride, + gcarta+n*cart_stride, gcartb+n*cart_stride, + nbra, nbra, kappa, l); } } @@ -9386,7 +8201,7 @@ void c2s_sf_1e(double complex *opij, double *gctr, FINT *dims, for (jc = 0; jc < j_ctr; jc++) { for (ic = 0; ic < i_ctr; ic++) { (c2s_bra_spinor_e1sf[i_l])(tmp1, nfj, gctr, i_kp, i_l); - (c2s_ket_spinor[j_l])(tmp2, di, tmp1, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(tmp2, tmp1, tmp1+di*nfj, di, di, j_kp, j_l); zcopy_ij(opij+ofj*jc+di*ic, tmp2, ni, nj, di, dj); gctr += nf; } } @@ -9420,7 +8235,7 @@ void c2s_sf_1ei(double complex *opij, double *gctr, FINT *dims, for (jc = 0; jc < j_ctr; jc++) { for (ic = 0; ic < i_ctr; ic++) { (c2s_bra_spinor_e1sf[i_l])(tmp1, nfj, gctr, i_kp, i_l); - (c2s_iket_spinor[j_l])(tmp2, di, tmp1, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(tmp2, tmp1, tmp1+di*nfj, di, di, j_kp, j_l); zcopy_ij(opij+ofj*jc+di*ic, tmp2, ni, nj, di, dj); gctr += nf; } } @@ -9473,7 +8288,7 @@ void c2s_si_1e(double complex *opij, double *gctr, FINT *dims, CINTdcmplx_np(nf, tmp1+nfi*nf2j, gc_y, gc_x); CINTdcmplx_pn(nf, tmp1+nfi*nf2j+nf, gc_1, gc_z); (c2s_bra_spinor_si[i_l])(tmp2, nf2j, tmp1, i_kp, i_l); - (c2s_ket_spinor[j_l])(tmp1, di, tmp2, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(tmp1, tmp2, tmp2+di*nfj, di, di, j_kp, j_l); zcopy_ij(opij+ofj*jc+di*ic, tmp1, ni, nj, di, dj); gc_x += nf; @@ -9525,7 +8340,7 @@ void c2s_si_1ei(double complex *opij, double *gctr, FINT *dims, CINTdcmplx_np(nf, tmp1+nfi*nf2j, gc_y, gc_x); CINTdcmplx_pn(nf, tmp1+nfi*nf2j+nf, gc_1, gc_z); (c2s_bra_spinor_si[i_l])(tmp2, nf2j, tmp1, i_kp, i_l); - (c2s_iket_spinor[j_l])(tmp1, di, tmp2, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(tmp1, tmp2, tmp2+di*nfj, di, di, j_kp, j_l); zcopy_ij(opij+ofj*jc+di*ic, tmp1, ni, nj, di, dj); gc_x += nf; @@ -9545,8 +8360,9 @@ void c2s_sph_1e_grids(double *out, double *gctr, FINT *dims, FINT j_ctr = envs->x_ctr[1]; FINT di = i_l * 2 + 1; FINT dj = j_l * 2 + 1; - FINT ni = dims[1]; - FINT nj = dims[2]; + FINT ni = dims[0]; + FINT nj = dims[1]; + size_t Ng = dims[2]; FINT ofj = ni * dj; FINT nfi = envs->nfi; FINT nf = envs->nf; @@ -9567,8 +8383,8 @@ void c2s_sph_1e_grids(double *out, double *gctr, FINT *dims, for (ic = 0; ic < i_ctr; ic++) { tmp1 = (c2s_ket_sph[j_l])(buf1, gctr, bgrids_nfi, bgrids_nfi, j_l); tmp1 = sph2e_inner(buf2, tmp1, i_l, bgrids, dj, bgrids_di, bgrids_nfi); - pij = out + ((size_t)ngrids) * (ofj * jc + di * ic) + grids_offset; - dcopy_grids_ij(pij, tmp1, dims[0], ni, nj, bgrids, di, dj); + pij = out + Ng * (ofj * jc + di * ic) + grids_offset; + dcopy_grids_ij(pij, tmp1, Ng, ni, nj, bgrids, di, dj); gctr += bgrids * nf; } } } @@ -9580,8 +8396,9 @@ void c2s_cart_1e_grids(double *out, double *gctr, FINT *dims, FINT ngrids = envs->ngrids; FINT i_ctr = envs->x_ctr[0]; FINT j_ctr = envs->x_ctr[1]; - FINT ni = dims[1]; - FINT nj = dims[2]; + FINT ni = dims[0]; + FINT nj = dims[1]; + size_t Ng = dims[2]; FINT nfi = envs->nfi; FINT nfj = envs->nfj; FINT nf = envs->nf; @@ -9594,8 +8411,8 @@ void c2s_cart_1e_grids(double *out, double *gctr, FINT *dims, bgrids = MIN(ngrids - grids_offset, GRID_BLKSIZE); for (jc = 0; jc < j_ctr; jc++) { for (ic = 0; ic < i_ctr; ic++) { - pij = out + ((size_t)ngrids) * (ofj * jc + nfi * ic) + grids_offset; - dcopy_grids_ij(pij, gctr, ngrids, ni, nj, bgrids, nfi, nfj); + pij = out + Ng * (ofj * jc + nfi * ic) + grids_offset; + dcopy_grids_ij(pij, gctr, Ng, ni, nj, bgrids, nfi, nfj); gctr += bgrids * nf; } } } @@ -9620,8 +8437,9 @@ void c2s_sf_1e_grids(double complex *out, double *gctr, FINT *dims, FINT j_ctr = envs->x_ctr[1]; FINT di = _len_spinor(i_kp, i_l); FINT dj = _len_spinor(j_kp, j_l); - FINT ni = dims[1]; - FINT nj = dims[2]; + FINT ni = dims[0]; + FINT nj = dims[1]; + size_t Ng = dims[2]; FINT ofj = ni * dj; FINT nfi = envs->nfi; FINT nfj = envs->nfj; @@ -9641,9 +8459,9 @@ void c2s_sf_1e_grids(double complex *out, double *gctr, FINT *dims, for (jc = 0; jc < j_ctr; jc++) { for (ic = 0; ic < i_ctr; ic++) { spinor_e1sf_inner(tmp1, gctr, i_kp, i_l, bgrids, nfj, bgrids_di, bgrids_nfi); - (c2s_ket_spinor[j_l])(tmp2, bgrids_di, tmp1, j_kp, j_l); - pij = out + ((size_t)ngrids) * (ofj * jc + di * ic) + grids_offset; - zcopy_grids_ij(pij, tmp2, ngrids, ni, nj, bgrids, di, dj); + (c2s_ket_spinor_si[j_l])(tmp2, tmp1, tmp1+bgrids_di*nfj, bgrids_di, bgrids_di, j_kp, j_l); + pij = out + Ng * (ofj * jc + di * ic) + grids_offset; + zcopy_grids_ij(pij, tmp2, Ng, ni, nj, bgrids, di, dj); gctr += bgrids * nf; } } } @@ -9664,8 +8482,9 @@ void c2s_sf_1e_gridsi(double complex *out, double *gctr, FINT *dims, FINT j_ctr = envs->x_ctr[1]; FINT di = _len_spinor(i_kp, i_l); FINT dj = _len_spinor(j_kp, j_l); - FINT ni = dims[1]; - FINT nj = dims[2]; + FINT ni = dims[0]; + FINT nj = dims[1]; + size_t Ng = dims[2]; FINT ofj = ni * dj; FINT nfi = envs->nfi; FINT nfj = envs->nfj; @@ -9685,9 +8504,9 @@ void c2s_sf_1e_gridsi(double complex *out, double *gctr, FINT *dims, for (jc = 0; jc < j_ctr; jc++) { for (ic = 0; ic < i_ctr; ic++) { spinor_e1sf_inner(tmp1, gctr, i_kp, i_l, bgrids, nfj, bgrids_di, bgrids_nfi); - (c2s_iket_spinor[j_l])(tmp2, bgrids_di, tmp1, j_kp, j_l); - pij = out + ((size_t)ngrids) * (ofj * jc + di * ic) + grids_offset; - zcopy_grids_ij(pij, tmp2, ngrids, ni, nj, bgrids, di, dj); + (c2s_iket_spinor_si[j_l])(tmp2, tmp1, tmp1+bgrids_di*nfj, bgrids_di, bgrids_di, j_kp, j_l); + pij = out + Ng * (ofj * jc + di * ic) + grids_offset; + zcopy_grids_ij(pij, tmp2, Ng, ni, nj, bgrids, di, dj); gctr += bgrids * nf; } } } @@ -9708,8 +8527,9 @@ void c2s_si_1e_grids(double complex *out, double *gctr, FINT *dims, FINT j_ctr = envs->x_ctr[1]; FINT di = _len_spinor(i_kp, i_l); FINT dj = _len_spinor(j_kp, j_l); - FINT ni = dims[1]; - FINT nj = dims[2]; + FINT ni = dims[0]; + FINT nj = dims[1]; + size_t Ng = dims[2]; FINT ofj = ni * dj; FINT nfi = envs->nfi; FINT nfj = envs->nfj; @@ -9719,9 +8539,9 @@ void c2s_si_1e_grids(double complex *out, double *gctr, FINT *dims, FINT ic, jc, grids_offset; FINT bgrids, bgrids_di, bgrids_nfi, bgrids_nf; double *gc_x = gctr; - double *gc_y = gc_x + GRID_BLKSIZE * nf * i_ctr * j_ctr; - double *gc_z = gc_y + GRID_BLKSIZE * nf * i_ctr * j_ctr; - double *gc_1 = gc_z + GRID_BLKSIZE * nf * i_ctr * j_ctr; + double *gc_y = gc_x + ngrids * nf * i_ctr * j_ctr; + double *gc_z = gc_y + ngrids * nf * i_ctr * j_ctr; + double *gc_1 = gc_z + ngrids * nf * i_ctr * j_ctr; double complex *tmp1, *tmp2, *pij; MALLOC_INSTACK(tmp1, GRID_BLKSIZE * nf2i*nf2j); MALLOC_INSTACK(tmp2, GRID_BLKSIZE * di *nf2j); @@ -9742,10 +8562,10 @@ void c2s_si_1e_grids(double complex *out, double *gctr, FINT *dims, CINTdcmplx_np(bgrids_nf, tmp1+bgrids_nfi*nf2j , gc_y, gc_x); CINTdcmplx_pn(bgrids_nf, tmp1+bgrids_nfi*nf2j+bgrids_nf, gc_1, gc_z); - spinor_si_inner(tmp2, tmp1, i_kp, i_l, bgrids, nf2j, bgrids_di, bgrids_nfi*2); - (c2s_ket_spinor[j_l])(tmp1, bgrids_di, tmp2, j_kp, j_l); - pij = out + ((size_t)ngrids) * (ofj * jc + di * ic) + grids_offset; - zcopy_grids_ij(pij, tmp1, ngrids, ni, nj, bgrids, di, dj); + spinor_si_inner(tmp2, tmp1, i_kp, i_l, bgrids, nf2j, bgrids_di, bgrids_nfi); + (c2s_ket_spinor_si[j_l])(tmp1, tmp2, tmp2+bgrids_di*nfj, bgrids_di, bgrids_di, j_kp, j_l); + pij = out + Ng * (ofj * jc + di * ic) + grids_offset; + zcopy_grids_ij(pij, tmp1, Ng, ni, nj, bgrids, di, dj); gc_x += bgrids_nf; gc_y += bgrids_nf; gc_z += bgrids_nf; @@ -9769,8 +8589,9 @@ void c2s_si_1e_gridsi(double complex *out, double *gctr, FINT *dims, FINT j_ctr = envs->x_ctr[1]; FINT di = _len_spinor(i_kp, i_l); FINT dj = _len_spinor(j_kp, j_l); - FINT ni = dims[1]; - FINT nj = dims[2]; + FINT ni = dims[0]; + FINT nj = dims[1]; + size_t Ng = dims[2]; FINT ofj = ni * dj; FINT nfi = envs->nfi; FINT nfj = envs->nfj; @@ -9780,9 +8601,9 @@ void c2s_si_1e_gridsi(double complex *out, double *gctr, FINT *dims, FINT ic, jc, grids_offset; FINT bgrids, bgrids_di, bgrids_nfi, bgrids_nf; double *gc_x = gctr; - double *gc_y = gc_x + GRID_BLKSIZE * nf * i_ctr * j_ctr; - double *gc_z = gc_y + GRID_BLKSIZE * nf * i_ctr * j_ctr; - double *gc_1 = gc_z + GRID_BLKSIZE * nf * i_ctr * j_ctr; + double *gc_y = gc_x + ngrids * nf * i_ctr * j_ctr; + double *gc_z = gc_y + ngrids * nf * i_ctr * j_ctr; + double *gc_1 = gc_z + ngrids * nf * i_ctr * j_ctr; double complex *tmp1, *tmp2, *pij; MALLOC_INSTACK(tmp1, GRID_BLKSIZE * nf2i*nf2j); MALLOC_INSTACK(tmp2, GRID_BLKSIZE * di *nf2j); @@ -9803,10 +8624,10 @@ void c2s_si_1e_gridsi(double complex *out, double *gctr, FINT *dims, CINTdcmplx_np(bgrids_nf, tmp1+bgrids_nfi*nf2j , gc_y, gc_x); CINTdcmplx_pn(bgrids_nf, tmp1+bgrids_nfi*nf2j+bgrids_nf, gc_1, gc_z); - spinor_si_inner(tmp2, tmp1, i_kp, i_l, bgrids, nf2j, bgrids_di, bgrids_nfi*2); - (c2s_iket_spinor[j_l])(tmp1, bgrids_di, tmp2, j_kp, j_l); - pij = out + ((size_t)ngrids) * (ofj * jc + di * ic) + grids_offset; - zcopy_grids_ij(pij, tmp1, ngrids, ni, nj, bgrids, di, dj); + spinor_si_inner(tmp2, tmp1, i_kp, i_l, bgrids, nf2j, bgrids_di, bgrids_nfi); + (c2s_iket_spinor_si[j_l])(tmp1, tmp2, tmp2+bgrids_di*nfj, bgrids_di, bgrids_di, j_kp, j_l); + pij = out + Ng * (ofj * jc + di * ic) + grids_offset; + zcopy_grids_ij(pij, tmp1, Ng, ni, nj, bgrids, di, dj); gc_x += bgrids_nf; gc_y += bgrids_nf; gc_z += bgrids_nf; @@ -9914,7 +8735,7 @@ void c2s_sf_2e1(double complex *opij, double *gctr, FINT *dims, for (i = 0; i < i_ctr * j_ctr * k_ctr * l_ctr; i++) { (c2s_bra_spinor_e1sf[i_l])(tmp1, d_j, gctr, i_kp, i_l); - (c2s_ket_spinor[j_l])(opij, d_i, tmp1, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(opij, tmp1, tmp1+d_i*nfj, d_i, d_i, j_kp, j_l); gctr += nf; opij += no; } @@ -9950,7 +8771,7 @@ void c2s_sf_2e1i(double complex *opij, double *gctr, FINT *dims, for (i = 0; i < i_ctr * j_ctr * k_ctr * l_ctr; i++) { (c2s_bra_spinor_e1sf[i_l])(tmp1, d_j, gctr, i_kp, i_l); - (c2s_iket_spinor[j_l])(opij, d_i, tmp1, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(opij, tmp1, tmp1+d_i*nfj, d_i, d_i, j_kp, j_l); gctr += nf; opij += no; } @@ -10015,7 +8836,7 @@ void c2s_sf_2e2(double complex *fijkl, double complex *opij, FINT *dims, for (ic = 0; ic < i_ctr; ic++) { zswap_ik_jl(tmp1, opij, di, dj, nfk, nfl); (c2s_bra_spinor_sf[k_l])(tmp2, d_l, tmp1, k_kp, k_l); - (c2s_ket_spinor[l_l])(tmp1, d_k, tmp2, l_kp, l_l); + (c2s_ket_spinor_si[l_l])(tmp1, tmp2, tmp2+d_k*nfl, d_k, d_k, l_kp, l_l); pfijkl = fijkl + (ofl * lc + ofk * kc + ofj * jc + di * ic); zcopy_kijl(pfijkl, tmp1, ni, nj, nk, nl, di, dj, dk, dl); @@ -10075,7 +8896,7 @@ void c2s_sf_2e2i(double complex *fijkl, double complex *opij, FINT *dims, for (ic = 0; ic < i_ctr; ic++) { zswap_ik_jl(tmp1, opij, di, dj, nfk, nfl); (c2s_bra_spinor_sf[k_l])(tmp2, d_l, tmp1, k_kp, k_l); - (c2s_iket_spinor[l_l])(tmp1, d_k, tmp2, l_kp, l_l); + (c2s_iket_spinor_si[l_l])(tmp1, tmp2, tmp2+d_k*nfl, d_k, d_k, l_kp, l_l); pfijkl = fijkl + (ofl * lc + ofk * kc + ofj * jc + di * ic); zcopy_kijl(pfijkl, tmp1, ni, nj, nk, nl, di, dj, dk, dl); @@ -10137,7 +8958,7 @@ void c2s_si_2e1(double complex *opij, double *gctr, FINT *dims, CINTdcmplx_np(nf, tmp1+nfi*d_j, gc_y, gc_x); CINTdcmplx_pn(nf, tmp1+nfi*d_j+nf, gc_1, gc_z); (c2s_bra_spinor_si[i_l])(tmp2, d_j, tmp1, i_kp, i_l); - (c2s_ket_spinor[j_l])(opij, d_i, tmp2, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(opij, tmp2, tmp2+d_i*nfj, d_i, d_i, j_kp, j_l); gc_x += nf; gc_y += nf; gc_z += nf; @@ -10193,7 +9014,7 @@ void c2s_si_2e1i(double complex *opij, double *gctr, FINT *dims, CINTdcmplx_np(nf, tmp1+nfi*d_j, gc_y, gc_x); CINTdcmplx_pn(nf, tmp1+nfi*d_j+nf, gc_1, gc_z); (c2s_bra_spinor_si[i_l])(tmp2, d_j, tmp1, i_kp, i_l); - (c2s_iket_spinor[j_l])(opij, d_i, tmp2, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(opij, tmp2, tmp2+d_i*nfj, d_i, d_i, j_kp, j_l); gc_x += nf; gc_y += nf; gc_z += nf; @@ -10304,7 +9125,7 @@ void c2s_si_2e2(double complex *fijkl, double complex *opij, FINT *dims, for (ic = 0; ic < i_ctr; ic++) { si2e_swap(tmp1, ox, oy, oz, o1, di, dj, nfk, nfl); (c2s_bra_spinor_si[k_l])(tmp2, d_l, tmp1, k_kp, k_l); - (c2s_ket_spinor[l_l])(tmp1, d_k, tmp2, l_kp, l_l); + (c2s_ket_spinor_si[l_l])(tmp1, tmp2, tmp2+d_k*nfl, d_k, d_k, l_kp, l_l); pfijkl = fijkl + (ofl * lc + ofk * kc + ofj * jc + di * ic); zcopy_kijl(pfijkl, tmp1, ni, nj, nk, nl, di, dj, dk, dl); @@ -10372,7 +9193,7 @@ void c2s_si_2e2i(double complex *fijkl, double complex *opij, FINT *dims, for (ic = 0; ic < i_ctr; ic++) { si2e_swap(tmp1, ox, oy, oz, o1, di, dj, nfk, nfl); (c2s_bra_spinor_si[k_l])(tmp2, d_l, tmp1, k_kp, k_l); - (c2s_iket_spinor[l_l])(tmp1, d_k, tmp2, l_kp, l_l); + (c2s_iket_spinor_si[l_l])(tmp1, tmp2, tmp2+d_k*nfl, d_k, d_k, l_kp, l_l); pfijkl = fijkl + (ofl * lc + ofk * kc + ofj * jc + di * ic); zcopy_kijl(pfijkl, tmp1, ni, nj, nk, nl, di, dj, dk, dl); @@ -10611,7 +9432,7 @@ void c2s_sf_3c2e1(double complex *opijk, double *gctr, FINT *dims, for (ic = 0; ic < i_ctr; ic++) { pbuf = sph2e_inner(buf, gctr, k_l, nfi, nfj, nfi*dk, nfik); (c2s_bra_spinor_e1sf[i_l])(tmp1, d_j, pbuf, i_kp, i_l); - (c2s_ket_spinor[j_l])(tmp2, d_i, tmp1, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(tmp2, tmp1, tmp1+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp2, ni, nj, nk, 1, di, dj, dk, 1); gctr += nf; @@ -10664,7 +9485,7 @@ void c2s_sf_3c2e1i(double complex *opijk, double *gctr, FINT *dims, for (ic = 0; ic < i_ctr; ic++) { pbuf = sph2e_inner(buf, gctr, k_l, nfi, nfj, nfi*dk, nfik); (c2s_bra_spinor_e1sf[i_l])(tmp1, d_j, pbuf, i_kp, i_l); - (c2s_iket_spinor[j_l])(tmp2, d_i, tmp1, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(tmp2, tmp1, tmp1+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp2, ni, nj, nk, 1, di, dj, dk, 1); gctr += nf; @@ -10743,7 +9564,7 @@ void c2s_si_3c2e1(double complex *opijk, double *gctr, FINT *dims, CINTdcmplx_np(nfijdk, tmp1+nfi*d_j, pbufy, pbufx); CINTdcmplx_pn(nfijdk, tmp1+nfi*d_j+nfijdk, pbuf1, pbufz); (c2s_bra_spinor_si[i_l])(tmp2, d_j, tmp1, i_kp, i_l); - (c2s_ket_spinor[j_l])(tmp3, d_i, tmp2, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(tmp3, tmp2, tmp2+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp3, ni, nj, nk, 1, di, dj, dk, 1); gc_x += nf; @@ -10823,7 +9644,7 @@ void c2s_si_3c2e1i(double complex *opijk, double *gctr, FINT *dims, CINTdcmplx_np(nfijdk, tmp1+nfi*d_j, pbufy, pbufx); CINTdcmplx_pn(nfijdk, tmp1+nfi*d_j+nfijdk, pbuf1, pbufz); (c2s_bra_spinor_si[i_l])(tmp2, d_j, tmp1, i_kp, i_l); - (c2s_iket_spinor[j_l])(tmp3, d_i, tmp2, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(tmp3, tmp2, tmp2+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp3, ni, nj, nk, 1, di, dj, dk, 1); gc_x += nf; @@ -10872,7 +9693,7 @@ void c2s_sf_3c2e1_ssc(double complex *opijk, double *gctr, FINT *dims, for (jc = 0; jc < j_ctr; jc++) { for (ic = 0; ic < i_ctr; ic++) { (c2s_bra_spinor_e1sf[i_l])(tmp1, d_j, gctr, i_kp, i_l); - (c2s_ket_spinor[j_l])(tmp2, d_i, tmp1, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(tmp2, tmp1, tmp1+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp2, ni, nj, nk, 1, di, dj, nfk, 1); gctr += nf; @@ -10918,7 +9739,7 @@ void c2s_sf_3c2e1i_ssc(double complex *opijk, double *gctr, FINT *dims, for (jc = 0; jc < j_ctr; jc++) { for (ic = 0; ic < i_ctr; ic++) { (c2s_bra_spinor_e1sf[i_l])(tmp1, d_j, gctr, i_kp, i_l); - (c2s_iket_spinor[j_l])(tmp2, d_i, tmp1, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(tmp2, tmp1, tmp1+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp2, ni, nj, nk, 1, di, dj, nfk, 1); gctr += nf; @@ -10980,7 +9801,7 @@ void c2s_si_3c2e1_ssc(double complex *opijk, double *gctr, FINT *dims, CINTdcmplx_np(nfijdk, tmp1+nfi*d_j, gc_y, gc_x); CINTdcmplx_pn(nfijdk, tmp1+nfi*d_j+nfijdk, gc_1, gc_z); (c2s_bra_spinor_si[i_l])(tmp2, d_j, tmp1, i_kp, i_l); - (c2s_ket_spinor[j_l])(tmp3, d_i, tmp2, j_kp, j_l); + (c2s_ket_spinor_si[j_l])(tmp3, tmp2, tmp2+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp3, ni, nj, nk, 1, di, dj, nfk, 1); gc_x += nf; @@ -11045,7 +9866,7 @@ void c2s_si_3c2e1i_ssc(double complex *opijk, double *gctr, FINT *dims, CINTdcmplx_np(nfijdk, tmp1+nfi*d_j, gc_y, gc_x); CINTdcmplx_pn(nfijdk, tmp1+nfi*d_j+nfijdk, gc_1, gc_z); (c2s_bra_spinor_si[i_l])(tmp2, d_j, tmp1, i_kp, i_l); - (c2s_iket_spinor[j_l])(tmp3, d_i, tmp2, j_kp, j_l); + (c2s_iket_spinor_si[j_l])(tmp3, tmp2, tmp2+d_i*nfj, d_i, d_i, j_kp, j_l); pijk = opijk + ofk * kc + ofj * jc + di * ic; zcopy_iklj(pijk, tmp3, ni, nj, nk, 1, di, dj, nfk, 1); gc_x += nf; @@ -11104,12 +9925,14 @@ void CINTc2s_bra_spinor_sf(double complex *gsp, FINT nket, void CINTc2s_ket_spinor(double complex *gsp, FINT nbra, double complex *gcart, FINT kappa, FINT l) { - (c2s_ket_spinor[l])(gsp, nbra, gcart, kappa, l); + FINT nf = _len_cart[l]; + (c2s_ket_spinor_si[l])(gsp, gcart, gcart+nbra*nf, nbra, nbra, kappa, l); } void CINTc2s_iket_spinor(double complex *gsp, FINT nbra, double complex *gcart, FINT kappa, FINT l) { - (c2s_iket_spinor[l])(gsp, nbra, gcart, kappa, l); + FINT nf = _len_cart[l]; + (c2s_iket_spinor_si[l])(gsp, gcart, gcart+nbra*nf, nbra, nbra, kappa, l); } void CINTc2s_bra_spinor_si(double complex *gsp, FINT nket, double complex *gcart, FINT kappa, FINT l) @@ -11158,7 +9981,7 @@ void CINTc2s_ket_spinor_si1(double complex *gspa, double complex *gspb, double * double *gc_y = gc_x + nctr*ngc; double *gc_z = gc_y + nctr*ngc; double *gc_1 = gc_z + nctr*ngc; - double complex *tmp = malloc(sizeof(double complex)*ngc*4); + double complex *tmp = malloc(sizeof(double complex)*ngc*2); FINT k; for (k = 0; k < nctr; k++) { @@ -11166,11 +9989,12 @@ void CINTc2s_ket_spinor_si1(double complex *gspa, double complex *gspb, double * //cmplx( gctr.POS_Y, gctr.POS_X) CINTdcmplx_pp(ngc, tmp , gc_1+k*ngc, gc_z+k*ngc); CINTdcmplx_pp(ngc, tmp+ngc , gc_y+k*ngc, gc_x+k*ngc); + (c2s_ket_spinor_si[l])(gspa, tmp, tmp+ngc, lds, ldc, kappa, l); //cmplx(-gctr.POS_Y, gctr.POS_X) //cmplx( gctr.POS_1,-gctr.POS_Z) - CINTdcmplx_np(ngc, tmp+ngc*2, gc_y+k*ngc, gc_x+k*ngc); - CINTdcmplx_pn(ngc, tmp+ngc*3, gc_1+k*ngc, gc_z+k*ngc); - (c2s_ket_spinor_si[l])(gspa, gspb, tmp, lds, ldc, kappa, l); + CINTdcmplx_np(ngc, tmp , gc_y+k*ngc, gc_x+k*ngc); + CINTdcmplx_pn(ngc, tmp+ngc, gc_1+k*ngc, gc_z+k*ngc); + (c2s_ket_spinor_si[l])(gspb, tmp, tmp+ngc, lds, ldc, kappa, l); gspa += deg * lds; gspb += deg * lds; } @@ -11186,7 +10010,7 @@ void CINTc2s_iket_spinor_si1(double complex *gspa, double complex *gspb, double double *gc_y = gc_x + nctr*ngc; double *gc_z = gc_y + nctr*ngc; double *gc_1 = gc_z + nctr*ngc; - double complex *tmp = malloc(sizeof(double complex)*ngc*4); + double complex *tmp = malloc(sizeof(double complex)*ngc*2); FINT k; for (k = 0; k < nctr; k++) { @@ -11194,11 +10018,12 @@ void CINTc2s_iket_spinor_si1(double complex *gspa, double complex *gspb, double //i*cmplx( gctr.POS_Y, gctr.POS_X) CINTdcmplx_np(ngc, tmp , gc_z+k*ngc, gc_1+k*ngc); CINTdcmplx_np(ngc, tmp+ngc , gc_x+k*ngc, gc_y+k*ngc); + (c2s_ket_spinor_si[l])(gspa, tmp, tmp+ngc, lds, ldc, kappa, l); //i*cmplx(-gctr.POS_Y, gctr.POS_X) //i*cmplx( gctr.POS_1,-gctr.POS_Z) - CINTdcmplx_nn(ngc, tmp+ngc*2, gc_x+k*ngc, gc_y+k*ngc); - CINTdcmplx_pp(ngc, tmp+ngc*3, gc_z+k*ngc, gc_1+k*ngc); - (c2s_ket_spinor_si[l])(gspa, gspb, tmp, lds, ldc, kappa, l); + CINTdcmplx_nn(ngc, tmp , gc_x+k*ngc, gc_y+k*ngc); + CINTdcmplx_pp(ngc, tmp+ngc, gc_z+k*ngc, gc_1+k*ngc); + (c2s_ket_spinor_si[l])(gspb, tmp, tmp+ngc, lds, ldc, kappa, l); gspa += deg * lds; gspb += deg * lds; } diff --git a/src/cart2sph.h b/src/cart2sph.h index 52b849e0..e945969c 100644 --- a/src/cart2sph.h +++ b/src/cart2sph.h @@ -64,6 +64,8 @@ void c2s_cart_3c1e(double *fijkl, double *gctr, FINT *dims, CINTEnvVars *envs, d void c2s_dset0(double *out, FINT *dims, FINT *counts); void c2s_zset0(double complex *out, FINT *dims, FINT *counts); +void c2s_grids_dset0(double *out, FINT *dims, FINT *counts); +void c2s_grids_zset0(double complex *out, FINT *dims, FINT *counts); /************************************************* * diff --git a/src/cint1e.c b/src/cint1e.c index c71b25ac..5216483d 100644 --- a/src/cint1e.c +++ b/src/cint1e.c @@ -13,196 +13,168 @@ #include "misc.h" #include "cart2sph.h" #include "c2f.h" -#include "rys_roots.h" +#define PRIM2CTR0(ctrsymb, gp, ngp) \ + if (ctrsymb##_ctr > 1) {\ + if (*ctrsymb##empty) { \ + CINTprim_to_ctr_0(gctr##ctrsymb, gp, c##ctrsymb+ctrsymb##p, \ + ngp, ctrsymb##_prim, ctrsymb##_ctr, \ + non0ctr##ctrsymb[ctrsymb##p], \ + non0idx##ctrsymb+ctrsymb##p*ctrsymb##_ctr); \ + } else { \ + CINTprim_to_ctr_1(gctr##ctrsymb, gp, c##ctrsymb+ctrsymb##p, \ + ngp, ctrsymb##_prim, ctrsymb##_ctr, \ + non0ctr##ctrsymb[ctrsymb##p], \ + non0idx##ctrsymb+ctrsymb##p*ctrsymb##_ctr); \ + } \ + } \ + *ctrsymb##empty = 0 + +static void make_g1e_gout(double *gout, double *g, double fac, FINT *idx, + CINTEnvVars *envs, FINT empty, FINT int1e_type); /* * 1e GTO integral basic loop for < i|j>, no 1/r */ -FINT CINT1e_loop(double *gctr, CINTEnvVars *envs, double *cache) +FINT CINT1e_loop(double *gctr, CINTEnvVars *envs, double *cache, FINT int1e_type) { - FINT *shls = envs->shls; + FINT *shls = envs->shls; FINT *bas = envs->bas; double *env = envs->env; FINT i_sh = shls[0]; FINT j_sh = shls[1]; - FINT i_l = envs->i_l; - FINT j_l = envs->j_l; FINT i_ctr = envs->x_ctr[0]; FINT j_ctr = envs->x_ctr[1]; FINT i_prim = bas(NPRIM_OF, i_sh); FINT j_prim = bas(NPRIM_OF, j_sh); - FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor; - FINT nf = envs->nf; - double *ri = envs->ri; - double *rj = envs->rj; double *ai = env + bas(PTR_EXP, i_sh); double *aj = env + bas(PTR_EXP, j_sh); double *ci = env + bas(PTR_COEFF, i_sh); double *cj = env + bas(PTR_COEFF, j_sh); - FINT ip, jp, n; - FINT has_value = 0; - FINT *idx = malloc(sizeof(FINT) * nf * 3); - double aij, dij, eij, rrij; - double *g, *gout, *gctri; - MALLOC_INSTACK(g, envs->g_size * 3 * ((1<gbits)+1)); // +1 as buffer - MALLOC_INSTACK(gout, nf * n_comp); - MALLOC_INSTACK(gctri, nf * i_ctr * n_comp); - CINTg1e_index_xyz(idx, envs); + FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor; - rrij = CINTsquare_dist(ri, rj); - double fac = envs->common_factor * CINTcommon_fac_sp(i_l) * CINTcommon_fac_sp(j_l); double expcutoff = envs->expcutoff; - - for (jp = 0; jp < j_prim; jp++) { - envs->aj = aj[jp]; - n = nf * i_ctr * n_comp; - CINTdset0(n, gctri); - for (ip = 0; ip < i_prim; ip++) { - envs->ai = ai[ip]; - aij = ai[ip] + aj[jp]; - eij = (ai[ip] * aj[jp] / aij) * rrij; - if (eij > expcutoff) - continue; - has_value = 1; - - dij = exp(-eij) / (aij * sqrt(aij)) * fac; - CINTg_ovlp(g, ai[ip], aj[jp], dij, envs); - - CINTdset0(nf * n_comp, gout); - (*envs->f_gout)(gout, g, idx, envs, 1); - - n = nf * n_comp; - CINTprim_to_ctr(gctri, n, gout, 1, i_prim, i_ctr, ci+ip); - } - n = nf * i_ctr; - CINTprim_to_ctr(gctr, n, gctri, n_comp, j_prim, j_ctr, cj+jp); + double *log_maxci, *log_maxcj; + PairData *pdata_base, *pdata_ij; + MALLOC_INSTACK(log_maxci, i_prim+j_prim); + MALLOC_INSTACK(pdata_base, i_prim*j_prim); + log_maxcj = log_maxci + i_prim; + CINTOpt_log_max_pgto_coeff(log_maxci, ci, i_prim, i_ctr); + CINTOpt_log_max_pgto_coeff(log_maxcj, cj, j_prim, j_ctr); + if (CINTset_pairdata(pdata_base, ai, aj, envs->ri, envs->rj, + log_maxci, log_maxcj, envs->li_ceil, envs->lj_ceil, + i_prim, j_prim, SQUARE(envs->rirj), expcutoff)) { + return 0; } - free(idx); - return has_value; -} -/* - * For given charge distribution, calculate temporary parameter tau. - * The charge parameter zeta is defined as rho(r) = Norm * exp(-zeta*r^2) - */ -double CINTnuc_mod(double aij, FINT nuc_id, FINT *atm, double *env) -{ - double zeta; - if (nuc_id < 0) { - zeta = env[PTR_RINV_ZETA]; - } else if (atm(NUC_MOD_OF, nuc_id) == GAUSSIAN_NUC) { - zeta = env[atm(PTR_ZETA, nuc_id)]; + double fac1i, fac1j, expij; + FINT ip, jp; + FINT empty[4] = {1, 1, 1, 1}; + FINT *gempty = empty + 0; + FINT *iempty = empty + 1; + FINT *jempty = empty + 2; + double *rij; + FINT *idx; + MALLOC_INSTACK(idx, envs->nf * 3); + CINTg1e_index_xyz(idx, envs); + + FINT *non0ctri, *non0ctrj; + FINT *non0idxi, *non0idxj; + MALLOC_INSTACK(non0ctri, i_prim+j_prim+i_prim*i_ctr+j_prim*j_ctr); + non0ctrj = non0ctri + i_prim; + non0idxi = non0ctrj + j_prim; + non0idxj = non0idxi + i_prim*i_ctr; + CINTOpt_non0coeff_byshell(non0idxi, non0ctri, ci, i_prim, i_ctr); + CINTOpt_non0coeff_byshell(non0idxj, non0ctrj, cj, j_prim, j_ctr); + + const FINT nc = i_ctr * j_ctr; + // (irys,i,j,k,l,coord,0:1); +1 for nabla-r12 + const FINT leng = envs->g_size * 3 * ((1<gbits)+1); + const FINT lenj = envs->nf * nc * n_comp; // gctrj + const FINT leni = envs->nf * i_ctr * n_comp; // gctri + const FINT len0 = envs->nf * n_comp; // gout + const FINT len = leng + lenj + leni + len0; + double *g, *gout, *gctri, *gctrj; + MALLOC_INSTACK(g, len); // must be allocated last in this function + double *g1 = g + leng; + if (n_comp == 1) { + gctrj = gctr; } else { - zeta = 0; + gctrj = g1; + g1 += lenj; } - - if (zeta > 0) { - return sqrt(zeta / (aij + zeta)); + if (j_ctr == 1) { + gctri = gctrj; + iempty = jempty; } else { - return 1; + gctri = g1; + g1 += leni; } -} - -/* - * 1e GTO integral basic loop for < i|1/r|j>, no 1/r - * if nuc_id >= 0: nuclear attraction, use nuclear model - * if nuc_id < 0: 1/r potential, do not use nuclear model - */ -FINT CINT1e_nuc_loop(double *gctr, CINTEnvVars *envs, double fac, FINT nuc_id, double *cache) -{ - FINT *shls = envs->shls; - FINT *atm = envs->atm; - FINT *bas = envs->bas; - double *env = envs->env; - FINT i_sh = shls[0]; - FINT j_sh = shls[1]; - FINT i_l = envs->i_l; - FINT j_l = envs->j_l; - FINT i_ctr = envs->x_ctr[0]; - FINT j_ctr = envs->x_ctr[1]; - FINT i_prim = bas(NPRIM_OF, i_sh); - FINT j_prim = bas(NPRIM_OF, j_sh); - FINT nf = envs->nf; - FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor; - double *ri = envs->ri; - double *rj = envs->rj; - double *ai = env + bas(PTR_EXP, i_sh); - double *aj = env + bas(PTR_EXP, j_sh); - double *ci = env + bas(PTR_COEFF, i_sh); - double *cj = env + bas(PTR_COEFF, j_sh); - FINT ip, jp, i, n; - FINT has_value = 0; - double tau; - double *cr; - double x, u[MXRYSROOTS], w[MXRYSROOTS]; - FINT *idx = malloc(sizeof(FINT) * nf * 3); - double rij[3], aij, dij, eij, rrij, t2; - double *g, *gout, *gctri; - MALLOC_INSTACK(g, envs->g_size * 3 * ((1<gbits)+1)); // +1 as buffer - MALLOC_INSTACK(gout, nf * n_comp); - MALLOC_INSTACK(gctri, nf * i_ctr * n_comp); - double expcutoff = envs->expcutoff; - - if (nuc_id < 0) { - cr = &env[PTR_RINV_ORIG]; + if (i_ctr == 1) { + gout = gctri; + gempty = iempty; } else { - cr = &env[atm(PTR_COORD, nuc_id)]; + gout = g1; } - CINTg1e_index_xyz(idx, envs); - - rrij = CINTsquare_dist(ri, rj); - fac *= envs->common_factor * CINTcommon_fac_sp(i_l) * CINTcommon_fac_sp(j_l); + double common_factor = envs->common_factor + * CINTcommon_fac_sp(envs->i_l) * CINTcommon_fac_sp(envs->j_l); + pdata_ij = pdata_base; for (jp = 0; jp < j_prim; jp++) { envs->aj = aj[jp]; - n = nf * i_ctr * n_comp; - CINTdset0(n, gctri); - for (ip = 0; ip < i_prim; ip++) { - envs->ai = ai[ip]; - aij = ai[ip] + aj[jp]; - eij = (ai[ip] * aj[jp] / aij) * rrij; - if (eij > expcutoff) + if (j_ctr == 1) { + fac1j = common_factor * cj[jp]; + } else { + fac1j = common_factor; + *iempty = 1; + } + for (ip = 0; ip < i_prim; ip++, pdata_ij++) { + if (pdata_ij->cceij > expcutoff) { continue; - has_value = 1; - - rij[0] = (ai[ip] * ri[0] + aj[jp] * rj[0]) / aij; - rij[1] = (ai[ip] * ri[1] + aj[jp] * rj[1]) / aij; - rij[2] = (ai[ip] * ri[2] + aj[jp] * rj[2]) / aij; - tau = CINTnuc_mod(aij, nuc_id, atm, env); - x = aij * CINTsquare_dist(rij, cr) * tau * tau; - CINTrys_roots(envs->nrys_roots, x, u, w); - - dij = exp(-eij) / aij * fac; - CINTdset0(nf * n_comp, gout); - for (i = 0; i < envs->nrys_roots; i++) { - t2 = u[i] / (1 + u[i]) * tau * tau; - CINTg_nuc(g, aij, rij, cr, t2, - dij * w[i] * tau, envs); - - (*envs->f_gout)(gout, g, idx, envs, 1); } - - n = nf * n_comp; - CINTprim_to_ctr(gctri, n, gout, 1, i_prim, i_ctr, ci+ip); + envs->ai = ai[ip]; + expij = pdata_ij->eij; + rij = pdata_ij->rij; + envs->rij = rij; + if (i_ctr == 1) { + fac1i = fac1j*ci[ip]*expij; + } else { + fac1i = fac1j*expij; + } + make_g1e_gout(gout, g, fac1i, idx, envs, *gempty, int1e_type); + PRIM2CTR0(i, gout, envs->nf*n_comp); + } + if (!*iempty) { + PRIM2CTR0(j, gctri, envs->nf*i_ctr*n_comp); } - n = nf * i_ctr; - CINTprim_to_ctr(gctr, n, gctri, n_comp, j_prim, j_ctr, cj+jp); } - free(idx); - return has_value; + + if (n_comp > 1 && !*jempty) { + CINTdmat_transpose(gctr, gctrj, envs->nf*nc, n_comp); + } + return !*jempty; } CACHE_SIZE_T int1e_cache_size(CINTEnvVars *envs) { + FINT *shls = envs->shls; + FINT *bas = envs->bas; + FINT i_prim = bas(NPRIM_OF, shls[0]); + FINT j_prim = bas(NPRIM_OF, shls[1]); FINT *x_ctr = envs->x_ctr; FINT nc = envs->nf * x_ctr[0] * x_ctr[1]; FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor; FINT leng = envs->g_size*3*((1<gbits)+1); + FINT lenj = envs->nf * nc * n_comp; + FINT leni = envs->nf * x_ctr[0] * n_comp; FINT len0 = envs->nf*n_comp; - FINT cache_size = MAX(leng+len0*2+nc*n_comp*3, + FINT pdata_size = (i_prim*j_prim * 5 + + i_prim * x_ctr[0] + + j_prim * x_ctr[1] + +(i_prim+j_prim)*2 + envs->nf*3); + FINT cache_size = MAX(nc*n_comp + leng+lenj+leni+len0 + pdata_size, nc*n_comp + envs->nf*8*OF_CMPLX); return cache_size; } @@ -228,37 +200,7 @@ CACHE_SIZE_T CINT1e_drv(double *out, FINT *dims, CINTEnvVars *envs, double *gctr; MALLOC_INSTACK(gctr, nc*n_comp); - FINT nout; - FINT n; - FINT has_value = 0; - FINT *atm = envs->atm; - double *env = envs->env; - double charge_fac; - - CINTdset0(nc*n_comp, gctr); - - switch (int1e_type) { - case INT1E_TYPE_OVLP: - has_value = CINT1e_loop(gctr, envs, cache); - break; - case INT1E_TYPE_RINV: - has_value = CINT1e_nuc_loop(gctr, envs, 1, -1, cache); - break; - default: - for (n = 0; n < envs->natm; n++) { - if (atm(NUC_MOD_OF,n) == FRAC_CHARGE_NUC) { - charge_fac = -env[atm(PTR_FRAC_CHARGE,n)]; - } else if (atm(CHARGE_OF,n) != 0) { - charge_fac = -abs(atm(CHARGE_OF,n)); - } else { - charge_fac = 0; - } - if (charge_fac != 0) { - has_value = CINT1e_nuc_loop(gctr, envs, charge_fac, n, cache) - || has_value; - } - } - } + FINT has_value = CINT1e_loop(gctr, envs, cache, int1e_type); FINT counts[4]; if (dims == NULL) { @@ -271,10 +213,20 @@ CACHE_SIZE_T CINT1e_drv(double *out, FINT *dims, CINTEnvVars *envs, counts[0] = envs->nfi * x_ctr[0]; counts[1] = envs->nfj * x_ctr[1]; } - nout = dims[0] * dims[1]; - for (n = 0; n < n_comp; n++) { - (*f_c2s)(out+nout*n, gctr+nc*n, dims, envs, cache); + counts[2] = 1; + counts[3] = 1; + FINT nout = dims[0] * dims[1]; + FINT n; + if (has_value) { + for (n = 0; n < n_comp; n++) { + (*f_c2s)(out+nout*n, gctr+nc*n, dims, envs, cache); + } + } else { + for (n = 0; n < n_comp; n++) { + c2s_dset0(out+nout*n, dims, counts); + } } + if (stack != NULL) { free(stack); } @@ -298,29 +250,7 @@ CACHE_SIZE_T CINT1e_spinor_drv(double complex *out, FINT *dims, CINTEnvVars *env double *gctr; MALLOC_INSTACK(gctr, nc*envs->ncomp_tensor); - FINT nout; - FINT n; - FINT has_value = 0; - FINT *atm = envs->atm; - double charge_fac; - - CINTdset0(nc*envs->ncomp_tensor, gctr); - switch (int1e_type) { - case INT1E_TYPE_OVLP: - has_value = CINT1e_loop(gctr, envs, cache); - break; - case INT1E_TYPE_RINV: - has_value = CINT1e_nuc_loop(gctr, envs, 1, -1, cache); - break; - default: - for (n = 0; n < envs->natm; n++) { - if (atm(CHARGE_OF,n) != 0) { - charge_fac = -abs(atm(CHARGE_OF,n)); - has_value = CINT1e_nuc_loop(gctr, envs, charge_fac, n, cache) - || has_value; - } - } - } + FINT has_value = CINT1e_loop(gctr, envs, cache, int1e_type); FINT counts[4]; if (dims == NULL) { @@ -328,19 +258,176 @@ CACHE_SIZE_T CINT1e_spinor_drv(double complex *out, FINT *dims, CINTEnvVars *env } counts[0] = CINTcgto_spinor(envs->shls[0], envs->bas); counts[1] = CINTcgto_spinor(envs->shls[1], envs->bas); - nout = dims[0] * dims[1]; - for (n = 0; n < envs->ncomp_tensor; n++) { - (*f_c2s)(out+nout*n, gctr+nc*n, dims, envs, cache); + counts[2] = 1; + counts[3] = 1; + FINT nout = dims[0] * dims[1]; + FINT n; + if (has_value) { + for (n = 0; n < envs->ncomp_tensor; n++) { + (*f_c2s)(out+nout*n, gctr+nc*n, dims, envs, cache); + } + } else { + for (n = 0; n < envs->ncomp_tensor; n++) { + c2s_zset0(out+nout*n, dims, counts); + } } + if (stack != NULL) { free(stack); } return has_value; } -void int1e_optimizer(CINTOpt **opt, FINT *atm, FINT natm, - FINT *bas, FINT nbas, double *env) +static void make_g1e_gout(double *gout, double *g, double fac, FINT *idx, + CINTEnvVars *envs, FINT empty, FINT int1e_type) +{ + FINT ia; + switch (int1e_type) { + case 0: + CINTg1e_ovlp(g, fac, envs); + (*envs->f_gout)(gout, g, idx, envs, empty); + break; + case 1: + CINTg1e_nuc(g, fac, envs, -1); + (*envs->f_gout)(gout, g, idx, envs, empty); + break; + case 2: + for (ia = 0; ia < envs->natm; ia++) { + CINTg1e_nuc(g, fac, envs, ia); + (*envs->f_gout)(gout, g, idx, envs, (empty && ia == 0)); + } + break; + } +} + +void CINTgout1e(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT empty) +{ + FINT nf = envs->nf; + FINT n, ix, iy, iz; + if (empty) { + for (n = 0; n < nf; n++) { + ix = idx[n*3+0]; + iy = idx[n*3+1]; + iz = idx[n*3+2]; + gout[n] = g[ix] * g[iy] * g[iz]; + } + } else { + for (n = 0; n < nf; n++) { + ix = idx[n*3+0]; + iy = idx[n*3+1]; + iz = idx[n*3+2]; + gout[n] += g[ix] * g[iy] * g[iz]; + } + } +} + +void CINTgout1e_nuc(double *gout, double *g, FINT *idx, CINTEnvVars *envs, FINT empty) +{ + FINT nf = envs->nf; + FINT nrys_roots = envs->nrys_roots; + FINT n, i; + double *gx, *gy, *gz; + double s; + + if (empty) { + for (n = 0; n < nf; n++) { + gx = g + idx[n*3+0]; + gy = g + idx[n*3+1]; + gz = g + idx[n*3+2]; + s = 0; + for (i = 0; i < nrys_roots; i++) { + s += gx[i] * gy[i] * gz[i]; + } + gout[n] = s; + } + } else { + for (n = 0; n < nf; n++) { + gx = g + idx[n*3+0]; + gy = g + idx[n*3+1]; + gz = g + idx[n*3+2]; + s = 0; + for (i = 0; i < nrys_roots; i++) { + s += gx[i] * gy[i] * gz[i]; + } + gout[n] += s; + } + } +} + +CACHE_SIZE_T int1e_ovlp_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) +{ + FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; + CINTEnvVars envs; + CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); + envs.f_gout = &CINTgout1e; + return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 0); +} + +CACHE_SIZE_T int1e_ovlp_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) +{ + FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; + CINTEnvVars envs; + CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); + envs.f_gout = &CINTgout1e; + return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 0); +} + +CACHE_SIZE_T int1e_ovlp_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) +{ + FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; + CINTEnvVars envs; + CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); + envs.f_gout = &CINTgout1e; + return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 0); +} + +void int1e_ovlp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env) +{ + *opt = NULL; +} + +CACHE_SIZE_T int1e_nuc_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) +{ + FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; + CINTEnvVars envs; + CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); + envs.f_gout = &CINTgout1e_nuc; + return CINT1e_drv(out, dims, &envs, cache, &c2s_sph_1e, 2); +} + +CACHE_SIZE_T int1e_nuc_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) +{ + FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; + CINTEnvVars envs; + CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); + envs.f_gout = &CINTgout1e_nuc; + return CINT1e_drv(out, dims, &envs, cache, &c2s_cart_1e, 2); +} + +CACHE_SIZE_T int1e_nuc_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) +{ + FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; + CINTEnvVars envs; + CINTinit_int1e_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); + envs.f_gout = &CINTgout1e_nuc; + return CINT1e_spinor_drv(out, dims, &envs, cache, &c2s_sf_1e, 2); +} + +void int1e_nuc_optimizer(CINTOpt **opt, FINT *atm, FINT natm, + FINT *bas, FINT nbas, double *env) { *opt = NULL; } + +ALL_CINT(int1e_ovlp); +ALL_CINT(int1e_nuc); +ALL_CINT_FORTRAN_(int1e_ovlp); +ALL_CINT_FORTRAN_(int1e_nuc); diff --git a/src/cint1e.h b/src/cint1e.h index a4dde296..94529ae8 100644 --- a/src/cint1e.h +++ b/src/cint1e.h @@ -6,7 +6,7 @@ #include #include "config.h" -FINT CINT1e_loop(double *gctr, CINTEnvVars *envs, double *cache); +FINT CINT1e_loop(double *gctr, CINTEnvVars *envs, double *cache, FINT int1e_type); FINT CINT1e_nuc_loop(double *gctr, CINTEnvVars *envs, double fac, FINT nuc_id, double *cache); diff --git a/src/cint1e_a.c b/src/cint1e_a.c index 68103fd8..3480c054 100644 --- a/src/cint1e_a.c +++ b/src/cint1e_a.c @@ -33,7 +33,11 @@ static void CINTgout1e_int1e_r2_origi(double *gout, double *g, FINT *idx, CINTEn s = g3[ix+0]*g0[iy+0]*g0[iz+0]; s+= g0[ix+0]*g3[iy+0]*g0[iz+0]; s+= g0[ix+0]*g0[iy+0]*g3[iz+0]; - gout[n] += s; + if (empty) { + gout[n] = s; + } else { + gout[n] += s; + } } } void int1e_r2_origi_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { @@ -105,7 +109,11 @@ static void CINTgout1e_int1e_r4_origi(double *gout, double *g, FINT *idx, CINTEn s+= g0[ix+0]*g15[iy+0]*g0[iz+0]; s+= g0[ix+0]*g12[iy+0]*g3[iz+0] * 2; s+= g0[ix+0]*g0[iy+0]*g15[iz+0]; - gout[n] += s; + if (empty) { + gout[n] = s; + } else { + gout[n] += s; + } } } void int1e_r4_origi_optimizer(CINTOpt **opt, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env) { diff --git a/src/cint1e_grids.c b/src/cint1e_grids.c index 6eb0857d..fa9766f5 100644 --- a/src/cint1e_grids.c +++ b/src/cint1e_grids.c @@ -33,16 +33,13 @@ static void _transpose_comps(double *gctr, double *gctrj, FINT bgrids, FINT dij, FINT ngrids, FINT n_comp); -FINT CINT1e_grids_loop(double *gctr, CINTEnvVars *envs, double fac, double *cache) +FINT CINT1e_grids_loop(double *gctr, CINTEnvVars *envs, double *cache) { FINT *shls = envs->shls; - FINT *atm = envs->atm; FINT *bas = envs->bas; double *env = envs->env; FINT i_sh = shls[0]; FINT j_sh = shls[1]; - FINT i_l = envs->i_l; - FINT j_l = envs->j_l; FINT i_ctr = envs->x_ctr[0]; FINT j_ctr = envs->x_ctr[1]; FINT i_prim = bas(NPRIM_OF, i_sh); @@ -51,8 +48,6 @@ FINT CINT1e_grids_loop(double *gctr, CINTEnvVars *envs, double fac, double *cach FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor; FINT ngrids = envs->ngrids; double *grids = envs->grids; - double *ri = envs->ri; - double *rj = envs->rj; double *ai = env + bas(PTR_EXP, i_sh); double *aj = env + bas(PTR_EXP, j_sh); double *ci = env + bas(PTR_COEFF, i_sh); @@ -74,7 +69,7 @@ FINT CINT1e_grids_loop(double *gctr, CINTEnvVars *envs, double fac, double *cach double fac1i, fac1j, expij; double *rij; - FINT ip, jp, i, n, grids_offset, bgrids; + FINT ip, jp, i, grids_offset, bgrids; FINT empty[4] = {1, 1, 1, 1}; FINT *gempty = empty + 0; FINT *iempty = empty + 1; @@ -100,12 +95,13 @@ FINT CINT1e_grids_loop(double *gctr, CINTEnvVars *envs, double fac, double *cach const FINT leni = GRID_BLKSIZE * nf * i_ctr * n_comp; // gctri const FINT len0 = GRID_BLKSIZE * nf * n_comp; // gout const FINT len = leng + lenj + leni + len0; - double *g; - MALLOC_ALIGN8_INSTACK(g, len); // must be allocated last in this function + double *gridsT; + MALLOC_ALIGN8_INSTACK(gridsT, len + GRID_BLKSIZE * 3); // must be allocated last in this function + double *g = gridsT + GRID_BLKSIZE * 3; double *g1 = g + leng; double *gout, *gctri, *gctrj; if (n_comp == 1) { - gctrj = gctr + grids_offset * nf * nc; + gctrj = gctr; } else { gctrj = g1; g1 += lenj; @@ -127,6 +123,12 @@ FINT CINT1e_grids_loop(double *gctr, CINTEnvVars *envs, double fac, double *cach for (grids_offset = 0; grids_offset < ngrids; grids_offset += GRID_BLKSIZE) { envs->grids_offset = grids_offset; bgrids = MIN(ngrids - grids_offset, GRID_BLKSIZE); + for (i = 0; i < bgrids; i++) { + gridsT[i+GRID_BLKSIZE*0] = grids[(grids_offset+i)*3+0]; + gridsT[i+GRID_BLKSIZE*1] = grids[(grids_offset+i)*3+1]; + gridsT[i+GRID_BLKSIZE*2] = grids[(grids_offset+i)*3+2]; + } + empty[0] = 1; empty[1] = 1; empty[2] = 1; @@ -157,16 +159,13 @@ FINT CINT1e_grids_loop(double *gctr, CINTEnvVars *envs, double fac, double *cach expij = pdata_ij->eij; rij = pdata_ij->rij; envs->rij = rij; - envs->rijrx[0] = rij[0] - envs->rx_in_rijrx[0]; - envs->rijrx[1] = rij[1] - envs->rx_in_rijrx[1]; - envs->rijrx[2] = rij[2] - envs->rx_in_rijrx[2]; if (i_ctr == 1) { fac1i = fac1j*ci[ip]*expij; } else { fac1i = fac1j*expij; } - CINTg0_1e_grids(g, fac1i, envs, cache); + CINTg0_1e_grids(g, fac1i, envs, cache, gridsT); (*envs->f_gout)(gout, g, idx, envs, *gempty); PRIM2CTR(i, gout, bgrids * nf * n_comp); } @@ -220,7 +219,7 @@ size_t int1e_grids_cache_size(CINTEnvVars *envs) size_t leni = len0 * x_ctr[0]; size_t lenj = leni * x_ctr[1]; size_t cache_size = MAX(nc*n_comp + leng + len0 + leni + lenj + pdata_size + - GRID_BLKSIZE*MAX(n_comp, nroots+5), + GRID_BLKSIZE*MAX(n_comp, nroots+8), nc*n_comp + GRID_BLKSIZE * nf*8*OF_CMPLX); return cache_size + 32; } @@ -231,7 +230,6 @@ size_t int1e_grids_cache_size(CINTEnvVars *envs) CACHE_SIZE_T CINT1e_grids_drv(double *out, FINT *dims, CINTEnvVars *envs, double *cache, void (*f_c2s)()) { - FINT ngrids = envs->ngrids; if (out == NULL) { return int1e_grids_cache_size(envs); } @@ -248,21 +246,21 @@ CACHE_SIZE_T CINT1e_grids_drv(double *out, FINT *dims, CINTEnvVars *envs, double *gctr; MALLOC_ALIGN8_INSTACK(gctr, nc * n_comp); - FINT has_value = CINT1e_grids_loop(gctr, envs, 1, cache); + FINT has_value = CINT1e_grids_loop(gctr, envs, cache); FINT counts[4]; if (dims == NULL) { dims = counts; } if (f_c2s == &c2s_sph_1e_grids) { - counts[0] = envs->ngrids; - counts[1] = (envs->i_l*2+1) * x_ctr[0]; - counts[2] = (envs->j_l*2+1) * x_ctr[1]; + counts[0] = (envs->i_l*2+1) * x_ctr[0]; + counts[1] = (envs->j_l*2+1) * x_ctr[1]; + counts[2] = envs->ngrids; counts[3] = 1; } else if (f_c2s == &c2s_cart_1e_grids) { - counts[0] = envs->ngrids; - counts[1] = envs->nfi * x_ctr[0]; - counts[2] = envs->nfj * x_ctr[1]; + counts[0] = envs->nfi * x_ctr[0]; + counts[1] = envs->nfj * x_ctr[1]; + counts[2] = envs->ngrids; counts[3] = 1; } FINT nout = dims[0] * dims[1] * dims[2]; @@ -273,7 +271,7 @@ CACHE_SIZE_T CINT1e_grids_drv(double *out, FINT *dims, CINTEnvVars *envs, } } else { for (n = 0; n < n_comp; n++) { - c2s_dset0(out+nout*n, dims, counts); + c2s_grids_dset0(out+nout*n, dims, counts); } } if (stack != NULL) { @@ -285,14 +283,12 @@ CACHE_SIZE_T CINT1e_grids_drv(double *out, FINT *dims, CINTEnvVars *envs, CACHE_SIZE_T CINT1e_grids_spinor_drv(double complex *out, FINT *dims, CINTEnvVars *envs, double *cache, void (*f_c2s)()) { - FINT ngrids = envs->ngrids; if (out == NULL) { return int1e_grids_cache_size(envs); } FINT *x_ctr = envs->x_ctr; FINT ngrids_nf = envs->ngrids * envs->nf; - FINT nc = ngrids_nf * x_ctr[0] * x_ctr[1]; - FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor; + FINT nc = ngrids_nf * x_ctr[0] * x_ctr[1] * envs->ncomp_e1; double *stack = NULL; if (cache == NULL) { size_t cache_size = int1e_grids_cache_size(envs); @@ -300,27 +296,27 @@ CACHE_SIZE_T CINT1e_grids_spinor_drv(double complex *out, FINT *dims, CINTEnvVar cache = stack; } double *gctr; - MALLOC_ALIGN8_INSTACK(gctr, nc * n_comp); + MALLOC_ALIGN8_INSTACK(gctr, nc * envs->ncomp_tensor); - FINT has_value = CINT1e_grids_loop(gctr, envs, 1, cache); + FINT has_value = CINT1e_grids_loop(gctr, envs, cache); FINT counts[4]; if (dims == NULL) { dims = counts; } - counts[0] = envs->ngrids; - counts[1] = CINTcgto_spinor(envs->shls[0], envs->bas); - counts[2] = CINTcgto_spinor(envs->shls[1], envs->bas); + counts[0] = CINTcgto_spinor(envs->shls[0], envs->bas); + counts[1] = CINTcgto_spinor(envs->shls[1], envs->bas); + counts[2] = envs->ngrids; counts[3] = 1; FINT nout = dims[0] * dims[1] * dims[2]; FINT n; if (has_value) { - for (n = 0; n < n_comp; n++) { + for (n = 0; n < envs->ncomp_tensor; n++) { (*f_c2s)(out+nout*n, gctr+nc*n, dims, envs, cache); } } else { - for (n = 0; n < n_comp; n++) { - c2s_zset0(out+nout*n, dims, counts); + for (n = 0; n < envs->ncomp_tensor; n++) { + c2s_grids_zset0(out+nout*n, dims, counts); } } if (stack != NULL) { @@ -332,7 +328,7 @@ CACHE_SIZE_T CINT1e_grids_spinor_drv(double complex *out, FINT *dims, CINTEnvVar CACHE_SIZE_T int1e_grids_sph(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { - FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; + FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; CINTEnvVars envs; CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_grids; @@ -349,7 +345,7 @@ void int1e_grids_optimizer(CINTOpt **opt, FINT *atm, FINT natm, CACHE_SIZE_T int1e_grids_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { - FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; + FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; CINTEnvVars envs; CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_grids; @@ -359,7 +355,7 @@ CACHE_SIZE_T int1e_grids_cart(double *out, FINT *dims, FINT *shls, FINT *atm, FI CACHE_SIZE_T int1e_grids_spinor(double complex *out, FINT *dims, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env, CINTOpt *opt, double *cache) { - FINT ng[] = {0, 0, 0, 0, 0, 1, 1, 1}; + FINT ng[] = {0, 0, 0, 0, 0, 1, 0, 1}; CINTEnvVars envs; CINTinit_int1e_grids_EnvVars(&envs, ng, shls, atm, natm, bas, nbas, env); envs.f_gout = &CINTgout1e_grids; diff --git a/src/cint2c2e_gtg.c b/src/cint2c2e_gtg.c index 376eb814..6d819654 100644 --- a/src/cint2c2e_gtg.c +++ b/src/cint2c2e_gtg.c @@ -26,7 +26,7 @@ void int2c2e_gtg_optimizer(CINTOpt **opt, FINT *atm, FINT natm, } #define ALL_CINT(NAME) \ -CACHE_SIZE_T c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_sph(out, NULL, shls, atm, natm, bas, nbas, env, opt, NULL); \ } \ diff --git a/src/cint2e_coulerf.c b/src/cint2e_coulerf.c index 79c5f79c..5da3fe23 100644 --- a/src/cint2e_coulerf.c +++ b/src/cint2e_coulerf.c @@ -30,7 +30,7 @@ void int2e_coulerf_optimizer(CINTOpt **opt, FINT *atm, FINT natm, } #define ALL_CINT(NAME) \ -CACHE_SIZE_T c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_sph(out, NULL, shls, atm, natm, bas, nbas, env, opt, NULL); \ } \ diff --git a/src/cint2e_f12.c b/src/cint2e_f12.c index 0f20fee4..1ded8973 100644 --- a/src/cint2e_f12.c +++ b/src/cint2e_f12.c @@ -42,7 +42,7 @@ void int2e_yp_optimizer(CINTOpt **opt, FINT *atm, FINT natm, } #define ALL_CINT(NAME) \ -CACHE_SIZE_T c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_sph(out, NULL, shls, atm, natm, bas, nbas, env, opt, NULL); \ } \ diff --git a/src/cint2e_gtg.c b/src/cint2e_gtg.c index 57e7c499..65ab4002 100644 --- a/src/cint2e_gtg.c +++ b/src/cint2e_gtg.c @@ -28,7 +28,7 @@ void int2e_gtg_optimizer(CINTOpt **opt, FINT *atm, FINT natm, } #define ALL_CINT(NAME) \ -CACHE_SIZE_T c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_sph(out, NULL, shls, atm, natm, bas, nbas, env, opt, NULL); \ } \ diff --git a/src/cint3c1e.c b/src/cint3c1e.c index a61371c0..bd05d075 100644 --- a/src/cint3c1e.c +++ b/src/cint3c1e.c @@ -398,7 +398,7 @@ CACHE_SIZE_T CINT3c1e_drv(double *out, FINT *dims, CINTEnvVars *envs, CINTOpt *o PAIRDATA_NON0IDX_SIZE(pdata_size); FINT leng = envs->g_size*3*((1<gbits)+1); FINT len0 = envs->nf*n_comp; - CACHE_SIZE_T cache_size = MAX(leng+len0+nc*n_comp*4 + pdata_size, + FINT cache_size = MAX(leng+len0+nc*n_comp*4 + pdata_size, nc*n_comp+envs->nf*3); return cache_size; } @@ -407,7 +407,7 @@ CACHE_SIZE_T CINT3c1e_drv(double *out, FINT *dims, CINTEnvVars *envs, CINTOpt *o PAIRDATA_NON0IDX_SIZE(pdata_size); FINT leng = envs->g_size*3*((1<gbits)+1); FINT len0 = envs->nf*n_comp; - size_t cache_size = MAX(leng+len0+nc*n_comp*4 + pdata_size, + FINT cache_size = MAX(leng+len0+nc*n_comp*4 + pdata_size, nc*n_comp+envs->nf*3); stack = malloc(sizeof(double)*cache_size); cache = stack; diff --git a/src/cint3c2e_gtg.c b/src/cint3c2e_gtg.c index 85e98878..6602e8aa 100644 --- a/src/cint3c2e_gtg.c +++ b/src/cint3c2e_gtg.c @@ -26,7 +26,7 @@ void int3c2e_gtg_optimizer(CINTOpt **opt, FINT *atm, FINT natm, } #define ALL_CINT(NAME) \ -CACHE_SIZE_T c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_sph(out, NULL, shls, atm, natm, bas, nbas, env, opt, NULL); \ } \ diff --git a/src/cint_bas.h b/src/cint_bas.h index e4927f70..ac9eac56 100644 --- a/src/cint_bas.h +++ b/src/cint_bas.h @@ -4,10 +4,7 @@ * basic cGTO function */ -#include "cint_const.h" - -#define bas(SLOT,I) bas[BAS_SLOTS * (I) + (SLOT)] -#define atm(SLOT,I) atm[ATM_SLOTS * (I) + (SLOT)] +#include "config.h" FINT CINTlen_cart(const FINT l); FINT CINTlen_spinor(const FINT bas_id, const FINT *bas); diff --git a/src/cint_const.h b/src/cint_const.h deleted file mode 100644 index 97505189..00000000 --- a/src/cint_const.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2013- Qiming Sun - * - * This macro define the parameters for cgto bas - */ - -// global parameters in env -// Overall cutoff for integral prescreening, value needs to be ~ln(threshold) -#define PTR_EXPCUTOFF 0 -// R_C of (r-R_C) in dipole, GIAO operators -#define PTR_COMMON_ORIG 1 -// R_O in 1/|r-R_O| -#define PTR_RINV_ORIG 4 -// ZETA parameter for Gaussian charge distribution (Gaussian nuclear model) -#define PTR_RINV_ZETA 7 -// omega parameter in range-separated coulomb operator -// LR interaction: erf(omega*r12)/r12 if omega > 0 -// SR interaction: erfc(omega*r12)/r12 if omega < 0 -#define PTR_RANGE_OMEGA 8 -// Yukawa potential and Slater-type geminal e^{-zeta r} -#define PTR_F12_ZETA 9 -// Gaussian type geminal e^{-zeta r^2} -#define PTR_GTG_ZETA 10 -#define NGRIDS 11 -#define PTR_GRIDS 12 -#define PTR_ENV_START 20 - -// slots of atm -#define CHARGE_OF 0 -#define PTR_COORD 1 -#define NUC_MOD_OF 2 -#define PTR_ZETA 3 -#define PTR_FRAC_CHARGE 3 -#define RESERVE_ATMLOT1 4 -#define RESERVE_ATMLOT2 5 -#define ATM_SLOTS 6 - - -// slots of bas -#define ATOM_OF 0 -#define ANG_OF 1 -#define NPRIM_OF 2 -#define NCTR_OF 3 -#define KAPPA_OF 4 -#define PTR_EXP 5 -#define PTR_COEFF 6 -#define RESERVE_BASLOT 7 -#define BAS_SLOTS 8 - -// slots of gout -#define POSX 0 -#define POSY 1 -#define POSZ 2 -#define POS1 3 -#define POSXX 0 -#define POSYX 1 -#define POSZX 2 -#define POS1X 3 -#define POSXY 4 -#define POSYY 5 -#define POSZY 6 -#define POS1Y 7 -#define POSXZ 8 -#define POSYZ 9 -#define POSZZ 10 -#define POS1Z 11 -#define POSX1 12 -#define POSY1 13 -#define POSZ1 14 -#define POS11 15 - -// tensor -#define TSRX 0 -#define TSRY 1 -#define TSRZ 2 -#define TSRXX 0 -#define TSRXY 1 -#define TSRXZ 2 -#define TSRYX 3 -#define TSRYY 4 -#define TSRYZ 5 -#define TSRZX 6 -#define TSRZY 7 -#define TSRZZ 8 - -// ng[*] -#define IINC 0 -#define JINC 1 -#define KINC 2 -#define LINC 3 -#define GSHIFT 4 -#define POS_E1 5 -#define POS_E2 6 -#define TENSOR 7 - -#include "config.h" - -#define MXRYSROOTS 32 // > ANG_MAX*2+1 for 4c2e -#define ANG_MAX 15 // l = 0..15 -#define LMAX1 16 // > ANG_MAX -#define CART_MAX 136 // > (ANG_MAX*(ANG_MAX+1)/2) -#define SHLS_MAX 0x7fffffff -#define NPRIM_MAX 64 -#define NCTR_MAX 64 - -#define EXPCUTOFF 60 -#ifndef MIN_EXPCUTOFF -// ~ 1e-15 -#define MIN_EXPCUTOFF 40 -#endif - -#define OF_CMPLX 2 - -#define PI 3.1415926535897932384626433832795028 -#ifndef M_PI -#define M_PI PI -#endif -#define SQRTPI 1.7724538509055160272981674833411451 - -#define POINT_NUC 1 -#define GAUSSIAN_NUC 2 -#define FRAC_CHARGE_NUC 3 - -#define GRID_BLKSIZE 120 diff --git a/src/config.h.in b/src/config.h.in index 074e47fb..02e84f70 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -1,18 +1,4 @@ -#cmakedefine I8 -#ifdef I8 -#include -#define FINT int64_t -#else -#define FINT int -#endif - -#cmakedefine RETURNI8 -#ifdef RETURNI8 -#include -#define CACHE_SIZE_T int64_t -#else -#define CACHE_SIZE_T FINT -#endif +#include "cint.h" #cmakedefine HAVE_EXPL #cmakedefine HAVE_SQRTL @@ -22,3 +8,28 @@ #cmakedefine WITH_RANGE_COULOMB +#ifndef M_PI +#define M_PI 3.1415926535897932384626433832795028 +#endif +#define SQRTPI 1.7724538509055160272981674833411451 + +// ng[*] +#define IINC 0 +#define JINC 1 +#define KINC 2 +#define LINC 3 +#define GSHIFT 4 +#define POS_E1 5 +#define POS_E2 6 +#define SLOT_RYS_ROOTS 6 +#define TENSOR 7 + +#define EXPCUTOFF 60 +#ifndef MIN_EXPCUTOFF +// ~ 1e-15 +#define MIN_EXPCUTOFF 40 +#endif + +#define OF_CMPLX 2 + +#define GRID_BLKSIZE 104 diff --git a/src/fblas.h b/src/fblas.h index 75fdae8b..7e28746a 100644 --- a/src/fblas.h +++ b/src/fblas.h @@ -8,7 +8,7 @@ extern "C" { #endif #include -#include "config.h" +#include "cint.h" double dasum_(const FINT *n, const double *dx, const FINT *incx); void dscal_(const FINT *n, const double *da, double *dx, const FINT *incx); diff --git a/src/fmt.c b/src/fmt.c index 966f9832..b9789f11 100644 --- a/src/fmt.c +++ b/src/fmt.c @@ -15,7 +15,7 @@ #include #include -#include "cint_const.h" +#include "config.h" #include "rys_roots.h" #define SML_FLOAT64 (DBL_EPSILON * .5) #define SML_FLOAT80 2.0e-20 diff --git a/src/g1e.c b/src/g1e.c index dd68b26d..a6a37325 100644 --- a/src/g1e.c +++ b/src/g1e.c @@ -9,6 +9,7 @@ #include "cint_bas.h" #include "misc.h" #include "g1e.h" +#include "rys_roots.h" void CINTinit_int1e_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, @@ -31,9 +32,6 @@ void CINTinit_int1e_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, envs->nfi = (envs->i_l+1)*(envs->i_l+2)/2; envs->nfj = (envs->j_l+1)*(envs->j_l+2)/2; envs->nf = envs->nfi * envs->nfj; - - envs->ri = env + atm(PTR_COORD, bas(ATOM_OF, i_sh)); - envs->rj = env + atm(PTR_COORD, bas(ATOM_OF, j_sh)); envs->common_factor = 1; if (env[PTR_EXPCUTOFF] == 0) { envs->expcutoff = EXPCUTOFF; @@ -41,13 +39,40 @@ void CINTinit_int1e_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, envs->expcutoff = MAX(MIN_EXPCUTOFF, env[PTR_EXPCUTOFF]); } + envs->li_ceil = envs->i_l + ng[IINC]; + envs->lj_ceil = envs->j_l + ng[JINC]; + envs->ri = env + atm(PTR_COORD, bas(ATOM_OF, i_sh)); + envs->rj = env + atm(PTR_COORD, bas(ATOM_OF, j_sh)); + envs->gbits = ng[GSHIFT]; envs->ncomp_e1 = ng[POS_E1]; envs->ncomp_tensor = ng[TENSOR]; + if (ng[SLOT_RYS_ROOTS] > 0) { + envs->nrys_roots = ng[SLOT_RYS_ROOTS]; + } else { + envs->nrys_roots = (envs->li_ceil + envs->lj_ceil)/2 + 1; + } - envs->li_ceil = envs->i_l + ng[IINC]; - envs->lj_ceil = envs->j_l + ng[JINC]; - envs->nrys_roots =(envs->li_ceil + envs->lj_ceil)/2 + 1; + FINT dli, dlj; + FINT ibase = envs->li_ceil > envs->lj_ceil; + if (ibase) { + dli = envs->li_ceil + envs->lj_ceil + 1; + dlj = envs->lj_ceil + 1; + envs->rirj[0] = envs->ri[0] - envs->rj[0]; + envs->rirj[1] = envs->ri[1] - envs->rj[1]; + envs->rirj[2] = envs->ri[2] - envs->rj[2]; + } else { + dli = envs->li_ceil + 1; + dlj = envs->li_ceil + envs->lj_ceil + 1; + envs->rirj[0] = envs->rj[0] - envs->ri[0]; + envs->rirj[1] = envs->rj[1] - envs->ri[1]; + envs->rirj[2] = envs->rj[2] - envs->ri[2]; + } + envs->g_stride_i = envs->nrys_roots; + envs->g_stride_j = envs->nrys_roots * dli; + envs->g_size = envs->nrys_roots * dli * dlj; + envs->g_stride_k = envs->g_size; + envs->g_stride_l = envs->g_size; assert(i_sh < SHLS_MAX); assert(j_sh < SHLS_MAX); @@ -58,13 +83,6 @@ void CINTinit_int1e_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, assert(bas(ATOM_OF,i_sh) < natm); assert(bas(ATOM_OF,j_sh) < natm); assert(envs->nrys_roots < MXRYSROOTS); - - FINT dli = envs->li_ceil + envs->lj_ceil + 1; - FINT dlj = envs->lj_ceil + 1; - envs->g_stride_i = 1; - envs->g_stride_j = dli; - envs->g_stride_k = dli * dlj; - envs->g_size = dli * dlj; } void CINTg1e_index_xyz(FINT *idx, CINTEnvVars *envs) @@ -103,96 +121,201 @@ void CINTg1e_index_xyz(FINT *idx, CINTEnvVars *envs) } -void CINTg_ovlp(double *g, double ai, double aj, double fac, CINTEnvVars *envs) +FINT CINTg1e_ovlp(double *g, double fac, CINTEnvVars *envs) { - const FINT nmax = envs->li_ceil + envs->lj_ceil; - const FINT lj = envs->lj_ceil; - const FINT dj = envs->g_stride_j; - const double aij = ai + aj; - const double *ri = envs->ri; - const double *rj = envs->rj; - FINT i, j, ptr; - double rirj[3], ririj[3]; double *gx = g; double *gy = g + envs->g_size; double *gz = g + envs->g_size * 2; - - rirj[0] = ri[0] - rj[0]; - rirj[1] = ri[1] - rj[1]; - rirj[2] = ri[2] - rj[2]; - ririj[0] = ri[0] - (ai * ri[0] + aj * rj[0]) / aij; - ririj[1] = ri[1] - (ai * ri[1] + aj * rj[1]) / aij; - ririj[2] = ri[2] - (ai * ri[2] + aj * rj[2]) / aij; + double aij = envs->ai + envs->aj; gx[0] = 1; gy[0] = 1; - gz[0] = SQRTPI * M_PI * fac; - if (nmax > 0) { - gx[1] = -ririj[0] * gx[0]; - gy[1] = -ririj[1] * gy[0]; - gz[1] = -ririj[2] * gz[0]; + gz[0] = fac * SQRTPI*M_PI / (aij * sqrt(aij)); + + FINT nmax = envs->li_ceil + envs->lj_ceil; + if (nmax == 0) { + return 1; } + double *rij = envs->rij; + double *rirj = envs->rirj; + FINT lj, di, dj; + FINT i, j, n, ptr; + double *rx; + if (envs->li_ceil > envs->lj_ceil) { + // li = envs->li_ceil; + lj = envs->lj_ceil; + di = envs->g_stride_i; + dj = envs->g_stride_j; + rx = envs->ri; + } else { + // li = envs->lj_ceil; + lj = envs->li_ceil; + di = envs->g_stride_j; + dj = envs->g_stride_i; + rx = envs->rj; + } + double rijrx[3]; + rijrx[0] = rij[0] - rx[0]; + rijrx[1] = rij[1] - rx[1]; + rijrx[2] = rij[2] - rx[2]; + + gx[di] = rijrx[0] * gx[0]; + gy[di] = rijrx[1] * gy[0]; + gz[di] = rijrx[2] * gz[0]; + + double aij2 = .5 / aij; for (i = 1; i < nmax; i++) { - gx[i+1] = 0.5 * i / aij * gx[i-1] - ririj[0] * gx[i]; - gy[i+1] = 0.5 * i / aij * gy[i-1] - ririj[1] * gy[i]; - gz[i+1] = 0.5 * i / aij * gz[i-1] - ririj[2] * gz[i]; + gx[(i+1)*di] = i * aij2 * gx[(i-1)*di] + rijrx[0] * gx[i*di]; + gy[(i+1)*di] = i * aij2 * gy[(i-1)*di] + rijrx[1] * gy[i*di]; + gz[(i+1)*di] = i * aij2 * gz[(i-1)*di] + rijrx[2] * gz[i*di]; } for (j = 1; j <= lj; j++) { ptr = dj * j; - for (i = ptr; i <= ptr + nmax - j; i++) { - gx[i] = gx[i+1-dj] + rirj[0] * gx[i-dj]; - gy[i] = gy[i+1-dj] + rirj[1] * gy[i-dj]; - gz[i] = gz[i+1-dj] + rirj[2] * gz[i-dj]; + for (i = 0, n = ptr; i <= nmax-j; i++, n+=di) { + gx[n] = gx[n+di-dj] + rirj[0] * gx[n-dj]; + gy[n] = gy[n+di-dj] + rirj[1] * gy[n-dj]; + gz[n] = gz[n+di-dj] + rirj[2] * gz[n-dj]; } } + return 1; } -void CINTg_nuc(double *g, double aij, double *rij, - double *cr, double t2, double fac, CINTEnvVars *envs) +/* + * Calculate temporary parameter tau for nuclear charge distribution. + * The charge parameter zeta is defined as rho(r) = Norm * exp(-zeta*r^2) + */ +double CINTnuc_mod(double aij, FINT nuc_id, FINT *atm, double *env) { - const FINT nmax = envs->li_ceil + envs->lj_ceil; - const FINT lj = envs->lj_ceil; - const FINT dj = envs->g_stride_j; - const double *ri = envs->ri; - const double *rj = envs->rj; - FINT i, j, ptr; - double rir0[3], rirj[3]; + double zeta; + if (nuc_id < 0) { + zeta = env[PTR_RINV_ZETA]; + } else if (atm(NUC_MOD_OF, nuc_id) == GAUSSIAN_NUC) { + zeta = env[atm(PTR_ZETA, nuc_id)]; + } else { + zeta = 0; + } + + if (zeta > 0) { + return sqrt(zeta / (aij + zeta)); + } else { + return 1; + } +} + +FINT CINTg1e_nuc(double *g, double fac, CINTEnvVars *envs, FINT nuc_id) +{ + FINT nrys_roots = envs->nrys_roots; + FINT *atm = envs->atm; + double *env = envs->env; + double *rij = envs->rij; double *gx = g; double *gy = g + envs->g_size; double *gz = g + envs->g_size * 2; - - rir0[0] = ri[0] - (rij[0] + t2 * (cr[0] - rij[0])); - rir0[1] = ri[1] - (rij[1] + t2 * (cr[1] - rij[1])); - rir0[2] = ri[2] - (rij[2] + t2 * (cr[2] - rij[2])); - rirj[0] = ri[0] - rj[0]; - rirj[1] = ri[1] - rj[1]; - rirj[2] = ri[2] - rj[2]; - - gx[0] = 1; - gy[0] = 1; - gz[0] = 2 * M_PI * fac; - if (nmax > 0) { - gx[1] = -rir0[0] * gx[0]; - gy[1] = -rir0[1] * gy[0]; - gz[1] = -rir0[2] * gz[0]; + double u[MXRYSROOTS]; + double *w = gz; + double *cr; + FINT i, j, n; + double crij[3]; + double x, fac1; + double aij = envs->ai + envs->aj; + double tau = CINTnuc_mod(aij, nuc_id, atm, env); + + if (nuc_id < 0) { + fac1 = 2*M_PI * fac * tau / aij; + cr = env + PTR_RINV_ORIG; + } else if (atm(NUC_MOD_OF, nuc_id) == FRAC_CHARGE_NUC) { + fac1 = 2*M_PI * -env[atm[PTR_FRAC_CHARGE+nuc_id*ATM_SLOTS]] * fac * tau / aij; + cr = env + atm(PTR_COORD, nuc_id); + } else { + fac1 = 2*M_PI * -fabs(atm[CHARGE_OF+nuc_id*ATM_SLOTS]) * fac * tau / aij; + cr = env + atm(PTR_COORD, nuc_id); + } + crij[0] = cr[0] - rij[0]; + crij[1] = cr[1] - rij[1]; + crij[2] = cr[2] - rij[2]; + x = aij * tau * tau * SQUARE(crij); + CINTrys_roots(nrys_roots, x, u, w); + + for (i = 0; i < nrys_roots; i++) { + gx[i] = 1; + gy[i] = 1; + gz[i] *= fac1; + } + FINT nmax = envs->li_ceil + envs->lj_ceil; + if (nmax == 0) { + return 1; } - for (i = 1; i < nmax; i++) { - gx[i+1] = 0.5 * (1 - t2) * i / aij * gx[i-1] - rir0[0] * gx[i]; - gy[i+1] = 0.5 * (1 - t2) * i / aij * gy[i-1] - rir0[1] * gy[i]; - gz[i+1] = 0.5 * (1 - t2) * i / aij * gz[i-1] - rir0[2] * gz[i]; + double *p0x, *p0y, *p0z; + double *p1x, *p1y, *p1z; + double *p2x, *p2y, *p2z; + FINT lj, di, dj; + double *rx; + if (envs->li_ceil > envs->lj_ceil) { + // li = envs->li_ceil; + lj = envs->lj_ceil; + di = envs->g_stride_i; + dj = envs->g_stride_j; + rx = envs->ri; + } else { + // li = envs->lj_ceil; + lj = envs->li_ceil; + di = envs->g_stride_j; + dj = envs->g_stride_i; + rx = envs->rj; + } + double rijrx = rij[0] - rx[0]; + double rijry = rij[1] - rx[1]; + double rijrz = rij[2] - rx[2]; + double aij2 = 0.5 / aij; + double ru, rt, r0, r1, r2; + + p0x = gx + di; + p0y = gy + di; + p0z = gz + di; + p1x = gx - di; + p1y = gy - di; + p1z = gz - di; + for (n = 0; n < nrys_roots; n++) { + ru = tau * tau * u[n] / (1 + u[n]); + rt = aij2 - aij2 * ru; + r0 = rijrx + ru * crij[0]; + r1 = rijry + ru * crij[1]; + r2 = rijrz + ru * crij[2]; + + p0x[n] = r0 * gx[n]; + p0y[n] = r1 * gy[n]; + p0z[n] = r2 * gz[n]; + for (i = 1; i < nmax; i++) { + p0x[n+i*di] = i * rt * p1x[n+i*di] + r0 * gx[n+i*di]; + p0y[n+i*di] = i * rt * p1y[n+i*di] + r1 * gy[n+i*di]; + p0z[n+i*di] = i * rt * p1z[n+i*di] + r2 * gz[n+i*di]; + } } + double rirjx = envs->rirj[0]; + double rirjy = envs->rirj[1]; + double rirjz = envs->rirj[2]; for (j = 1; j <= lj; j++) { - ptr = dj * j; - for (i = ptr; i <= ptr + nmax - j; i++) { - gx[i] = gx[i+1-dj] + rirj[0] * gx[i-dj]; - gy[i] = gy[i+1-dj] + rirj[1] * gy[i-dj]; - gz[i] = gz[i+1-dj] + rirj[2] * gz[i-dj]; - } + p0x = gx + j * dj; + p0y = gy + j * dj; + p0z = gz + j * dj; + p1x = p0x - dj; + p1y = p0y - dj; + p1z = p0z - dj; + p2x = p1x + di; + p2y = p1y + di; + p2z = p1z + di; + for (i = 0; i <= nmax - j; i++) { + for (n = 0; n < nrys_roots; n++) { + p0x[n+i*di] = p2x[n+i*di] + rirjx * p1x[n+i*di]; + p0y[n+i*di] = p2y[n+i*di] + rirjy * p1y[n+i*di]; + p0z[n+i*di] = p2z[n+i*di] + rirjz * p1z[n+i*di]; + } } } + return 1; } void CINTnabla1i_1e(double *f, double *g, diff --git a/src/g1e.h b/src/g1e.h index 0f5b8a18..c98abbc9 100644 --- a/src/g1e.h +++ b/src/g1e.h @@ -19,12 +19,11 @@ typedef struct { FINT i_l; FINT j_l; FINT k_l; - union {FINT l_l; FINT grids_offset;}; + FINT l_l; FINT nfi; // number of cartesian components FINT nfj; - FINT nfk; - // in int2e or int3c2e, the number of cartensian components of the fourth shell - // in int1e_grids, the number of grids + // in int1e_grids, the grids_offset and the number of grids + union {FINT nfk; FINT grids_offset;}; union {FINT nfl; FINT ngrids;}; FINT nf; // = nfi*nfj*nfk*nfl; FINT _padding; @@ -32,7 +31,7 @@ typedef struct { FINT gbits; FINT ncomp_e1; // = 1 if spin free, = 4 when spin included, it - FINT ncomp_e2; // corresponds to POSX,POSY,POSZ,POS1, see cint_const.h + FINT ncomp_e2; // corresponds to POSX,POSY,POSZ,POS1, see cint.h FINT ncomp_tensor; // e.g. = 3 for gradients /* values may diff based on the g0_2d4d algorithm */ @@ -89,10 +88,9 @@ void CINTinit_int3c1e_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, void CINTg1e_index_xyz(FINT *idx, CINTEnvVars *envs); -void CINTg_ovlp(double *g, double ai, double aj, double fac, CINTEnvVars *envs); +FINT CINTg1e_ovlp(double *g, double fac, CINTEnvVars *envs); -void CINTg_nuc(double *g, double aij, double *rij, - double *cr, double t2, double fac, CINTEnvVars *envs); +FINT CINTg1e_nuc(double *g, double fac, CINTEnvVars *envs, FINT nuc_id); void CINTnabla1i_1e(double *f, double *g, FINT li, FINT lj, FINT lk, CINTEnvVars *envs); diff --git a/src/g1e_grids.c b/src/g1e_grids.c index cb255774..a0df569e 100644 --- a/src/g1e_grids.c +++ b/src/g1e_grids.c @@ -18,8 +18,8 @@ void CINTinit_int1e_grids_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, FINT *bas, FINT nbas, double *env) { CINTinit_int1e_EnvVars(envs, ng, shls, atm, natm, bas, nbas, env); - FINT ngrids = (FINT)env[NGRIDS]; - double *grids = env + (size_t)env[PTR_GRIDS]; + FINT ngrids = shls[3] - shls[2]; + double *grids = env + (size_t)env[PTR_GRIDS] + shls[2] * 3; envs->ngrids = ngrids; envs->grids = grids; @@ -32,30 +32,21 @@ void CINTinit_int1e_grids_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, if (ibase) { dli = envs->li_ceil + envs->lj_ceil + 1; dlj = envs->lj_ceil + 1; - } else { - dli = envs->li_ceil + 1; - dlj = envs->li_ceil + envs->lj_ceil + 1; - } - envs->g_stride_i = GRID_BLKSIZE * nroots; - envs->g_stride_j = GRID_BLKSIZE * nroots * dli; - envs->g_size = GRID_BLKSIZE * nroots * dli * dlj; - envs->f_g0_2e = &CINTg0_1e_grids; - - if (ibase) { - envs->g2d_ijmax = envs->g_stride_i; - envs->rx_in_rijrx = envs->ri; envs->rirj[0] = envs->ri[0] - envs->rj[0]; envs->rirj[1] = envs->ri[1] - envs->rj[1]; envs->rirj[2] = envs->ri[2] - envs->rj[2]; - envs->f_g0_2d4d = &CINTg0_1e_grids_igtj; } else { - envs->g2d_ijmax = envs->g_stride_j; - envs->rx_in_rijrx = envs->rj; + dli = envs->li_ceil + 1; + dlj = envs->li_ceil + envs->lj_ceil + 1; envs->rirj[0] = envs->rj[0] - envs->ri[0]; envs->rirj[1] = envs->rj[1] - envs->ri[1]; envs->rirj[2] = envs->rj[2] - envs->ri[2]; - envs->f_g0_2d4d = &CINTg0_1e_grids_iltj; } + envs->g_stride_i = GRID_BLKSIZE * nroots; + envs->g_stride_j = GRID_BLKSIZE * nroots * dli; + envs->g_size = GRID_BLKSIZE * nroots * dli * dlj; + envs->g_stride_k = envs->g_size; + envs->g_stride_l = envs->g_size; } #define RGSQUARE(r, ig) (r[ig+GRID_BLKSIZE*0]*r[ig+GRID_BLKSIZE*0] + \ @@ -63,12 +54,11 @@ void CINTinit_int1e_grids_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, r[ig+GRID_BLKSIZE*2]*r[ig+GRID_BLKSIZE*2]) FINT CINTg0_1e_grids(double *g, const double fac, CINTEnvVars *envs, - double *cache) + double *cache, double *gridsT) { FINT ngrids = envs->ngrids; FINT bgrids = MIN(ngrids - envs->grids_offset, GRID_BLKSIZE); FINT nroots = envs->nrys_roots; - double *grids = envs->grids + envs->grids_offset * 3; double *gx = g; double *gy = g + envs->g_size; double *gz = g + envs->g_size * 2; @@ -91,13 +81,13 @@ FINT CINTg0_1e_grids(double *g, const double fac, CINTEnvVars *envs, } } for (ig = 0; ig < bgrids; ig++) { - rijrg[ig+GRID_BLKSIZE*0] = grids[ig*3+0] - rij[0]; + rijrg[ig+GRID_BLKSIZE*0] = gridsT[ig+GRID_BLKSIZE*0] - rij[0]; } for (ig = 0; ig < bgrids; ig++) { - rijrg[ig+GRID_BLKSIZE*1] = grids[ig*3+1] - rij[1]; + rijrg[ig+GRID_BLKSIZE*1] = gridsT[ig+GRID_BLKSIZE*1] - rij[1]; } for (ig = 0; ig < bgrids; ig++) { - rijrg[ig+GRID_BLKSIZE*2] = grids[ig*3+2] - rij[2]; + rijrg[ig+GRID_BLKSIZE*2] = gridsT[ig+GRID_BLKSIZE*2] - rij[2]; } #ifdef WITH_RANGE_COULOMB @@ -163,18 +153,33 @@ FINT CINTg0_1e_grids(double *g, const double fac, CINTEnvVars *envs, return 1; } - FINT lj = envs->lj_ceil; - FINT di = envs->g2d_ijmax; - FINT dj = envs->g_stride_j; + double *rirj = envs->rirj; + FINT lj, di, dj; + double *rx; + if (envs->li_ceil > envs->lj_ceil) { + //li = envs->li_ceil; + lj = envs->lj_ceil; + di = envs->g_stride_i; + dj = envs->g_stride_j; + rx = envs->ri; + } else { + //li = envs->lj_ceil; + lj = envs->li_ceil; + di = envs->g_stride_j; + dj = envs->g_stride_i; + rx = envs->rj; + } + double rijrx[3]; + rijrx[0] = rij[0] - rx[0]; + rijrx[1] = rij[1] - rx[1]; + rijrx[2] = rij[2] - rx[2]; - double *rijrx = envs->rijrx; double *p0x, *p0y, *p0z; double *p1x, *p1y, *p1z; double *p2x, *p2y, *p2z; double *rirg; MALLOC_ALIGN8_INSTACK(rirg, GRID_BLKSIZE*2); double *t2 = rirg + GRID_BLKSIZE; - double tmp; double aij2 = 0.5 / aij; for (n = 0; n < nroots; n++) { @@ -233,28 +238,6 @@ FINT CINTg0_1e_grids(double *g, const double fac, CINTEnvVars *envs, } } - (*envs->f_g0_2d4d)(g, envs); - return 1; -} - -void CINTg0_1e_grids_igtj(double *g, CINTEnvVars *envs) -{ - FINT ngrids = envs->ngrids; - FINT bgrids = MIN(ngrids - envs->grids_offset, GRID_BLKSIZE); - FINT nroots = envs->nrys_roots; - FINT nmax = envs->li_ceil + envs->lj_ceil; - FINT lj = envs->lj_ceil; - FINT di = envs->g_stride_i; - FINT dj = envs->g_stride_j; - double *gx = g; - double *gy = g + envs->g_size; - double *gz = g + envs->g_size * 2; - double *p0x, *p0y, *p0z; - double *p1x, *p1y, *p1z; - double *p2x, *p2y, *p2z; - double *rirj = envs->rirj; - FINT i, j, ig, n; - for (j = 1; j <= lj; j++) { for (i = 0; i <= nmax - j; i++) { p0x = gx + j * dj + i * di; @@ -282,53 +265,7 @@ void CINTg0_1e_grids_igtj(double *g, CINTEnvVars *envs) p0z[ig+GRID_BLKSIZE*n] = p2z[ig+GRID_BLKSIZE*n] + rirj[2] * p1z[ig+GRID_BLKSIZE*n]; } } } } -} - -void CINTg0_1e_grids_iltj(double *g, CINTEnvVars *envs) -{ - FINT ngrids = envs->ngrids; - FINT bgrids = MIN(ngrids - envs->grids_offset, GRID_BLKSIZE); - FINT nroots = envs->nrys_roots; - FINT nmax = envs->li_ceil + envs->lj_ceil; - FINT li = envs->li_ceil; - FINT di = envs->g_stride_i; - FINT dj = envs->g_stride_j; - double *gx = g; - double *gy = g + envs->g_size; - double *gz = g + envs->g_size * 2; - double *p0x, *p0y, *p0z; - double *p1x, *p1y, *p1z; - double *p2x, *p2y, *p2z; - double *rirj = envs->rirj; - FINT i, j, ig, n; - - for (i = 1; i <= li; i++) { - for (j = 0; j <= nmax-i; j++) { - p0x = gx + j * dj + i * di; - p0y = gy + j * dj + i * di; - p0z = gz + j * dj + i * di; - p1x = p0x - di; - p1y = p0y - di; - p1z = p0z - di; - p2x = p1x + dj; - p2y = p1y + dj; - p2z = p1z + dj; - - for (n = 0; n < nroots; n++) { - for (ig = 0; ig < bgrids; ig++) { - p0x[ig+GRID_BLKSIZE*n] = p2x[ig+GRID_BLKSIZE*n] + rirj[0] * p1x[ig+GRID_BLKSIZE*n]; - } } - - for (n = 0; n < nroots; n++) { - for (ig = 0; ig < bgrids; ig++) { - p0y[ig+GRID_BLKSIZE*n] = p2y[ig+GRID_BLKSIZE*n] + rirj[1] * p1y[ig+GRID_BLKSIZE*n]; - } } - - for (n = 0; n < nroots; n++) { - for (ig = 0; ig < bgrids; ig++) { - p0z[ig+GRID_BLKSIZE*n] = p2z[ig+GRID_BLKSIZE*n] + rirj[2] * p1z[ig+GRID_BLKSIZE*n]; - } } - } } + return 1; } void CINTgout1e_grids(double *gout, double *g, FINT *idx, diff --git a/src/g1e_grids.h b/src/g1e_grids.h index abd11c12..a68c21d0 100644 --- a/src/g1e_grids.h +++ b/src/g1e_grids.h @@ -1,7 +1,7 @@ void CINTinit_int1e_grids_EnvVars(CINTEnvVars *envs, FINT *ng, FINT *shls, FINT *atm, FINT natm, FINT *bas, FINT nbas, double *env); -FINT CINTg0_1e_grids(double *g, const double fac, CINTEnvVars *envs, double *cache); +FINT CINTg0_1e_grids(double *g, const double fac, CINTEnvVars *envs, double *cache, double *gridsT); void CINTg0_1e_grids_igtj(double *g, CINTEnvVars *envs); void CINTg0_1e_grids_iltj(double *g, CINTEnvVars *envs); diff --git a/src/g2e.c b/src/g2e.c index 0ab9fefe..3f48f64f 100644 --- a/src/g2e.c +++ b/src/g2e.c @@ -7,7 +7,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "cint_bas.h" #include "rys_roots.h" #include "misc.h" @@ -442,15 +442,14 @@ void CINTg0_lj2d_4d(double *g, const CINTEnvVars *envs) p2z = gz - dk + dl; for (j = 0; j <= lj; j++) { for (k = 1; k <= lk; k++) { - for (l = 0; l <= mmax-k; l++) { - ptr = j*dj + l*dl + k*dk; - for (n = ptr; n < ptr+dk; n++) { - gx[n] = rx * p1x[n] + p2x[n]; - gy[n] = ry * p1y[n] + p2y[n]; - gz[n] = rz * p1z[n] + p2z[n]; - } + for (l = 0; l <= mmax-k; l++) { + ptr = j*dj + l*dl + k*dk; + for (n = ptr; n < ptr+dk; n++) { + gx[n] = rx * p1x[n] + p2x[n]; + gy[n] = ry * p1y[n] + p2y[n]; + gz[n] = rz * p1z[n] + p2z[n]; } - } } + } } } } /* 2d is based on k,j */ void CINTg0_kj2d_4d(double *g, const CINTEnvVars *envs) @@ -513,8 +512,7 @@ void CINTg0_kj2d_4d(double *g, const CINTEnvVars *envs) gy[n] = ry * p1y[n] + p2y[n]; gz[n] = rz * p1z[n] + p2z[n]; } - } - } } + } } } } /* 2d is based on i,l */ void CINTg0_il2d_4d(double *g, const CINTEnvVars *envs) diff --git a/src/g2e.h b/src/g2e.h index 40da4de2..c004ace3 100644 --- a/src/g2e.h +++ b/src/g2e.h @@ -4,7 +4,7 @@ * Provide the intermediate variable g(nroots,i,j,k,l,[xyz]) */ -#include "cint_const.h" +#include "config.h" #include "g1e.h" #ifndef HAVE_BC diff --git a/src/g2e_coulerf.c b/src/g2e_coulerf.c index 57d7ca82..6b1f3fc3 100644 --- a/src/g2e_coulerf.c +++ b/src/g2e_coulerf.c @@ -8,7 +8,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "cint_bas.h" #include "rys_roots.h" #include "g2e.h" diff --git a/src/g2e_f12.c b/src/g2e_f12.c index 4b6661d2..36a959bc 100644 --- a/src/g2e_f12.c +++ b/src/g2e_f12.c @@ -8,7 +8,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "cint_bas.h" #include "rys_roots.h" #include "misc.h" diff --git a/src/g2e_gtg.c b/src/g2e_gtg.c index eb1cdc97..8325bcd4 100644 --- a/src/g2e_gtg.c +++ b/src/g2e_gtg.c @@ -7,7 +7,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "cint_bas.h" #include "misc.h" #include "g2e.h" diff --git a/src/g3c2e.c b/src/g3c2e.c index 218a2710..4b108456 100644 --- a/src/g3c2e.c +++ b/src/g3c2e.c @@ -7,7 +7,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "cint_bas.h" #include "misc.h" #include "g2e.h" diff --git a/src/misc.c b/src/misc.c index 2fd7632f..84aea5a9 100644 --- a/src/misc.c +++ b/src/misc.c @@ -6,7 +6,7 @@ #include #include -#include "cint_const.h" +#include "config.h" void CINTdcmplx_re(const FINT n, double complex *z, const double *re) { diff --git a/src/misc.h b/src/misc.h index 9cee0c0e..0cc80395 100644 --- a/src/misc.h +++ b/src/misc.h @@ -33,7 +33,7 @@ double CINTgto_norm(FINT n, double a); #ifdef WITH_CINT2_INTERFACE #define ALL_CINT(NAME) \ -CACHE_SIZE_T c##NAME##_cart(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_cart(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_cart(out, NULL, shls, atm, natm, bas, nbas, env, opt, NULL); \ } \ @@ -41,7 +41,7 @@ void c##NAME##_cart_optimizer(CINTOpt **opt, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env) { \ NAME##_optimizer(opt, atm, natm, bas, nbas, env); \ } \ -CACHE_SIZE_T c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_sph(out, NULL, shls, atm, natm, bas, nbas, env, opt, NULL); \ } \ @@ -49,7 +49,7 @@ void c##NAME##_sph_optimizer(CINTOpt **opt, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env) { \ NAME##_optimizer(opt, atm, natm, bas, nbas, env); \ } \ -CACHE_SIZE_T c##NAME(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ return NAME##_spinor((double complex *)out, NULL, shls, \ atm, natm, bas, nbas, env, opt, NULL); \ @@ -61,15 +61,15 @@ void c##NAME##_optimizer(CINTOpt **opt, FINT *atm, FINT natm, \ #define ALL_CINT1E(NAME) \ -CACHE_SIZE_T c##NAME##_cart(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_cart(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env) { \ return NAME##_cart(out, NULL, shls, atm, natm, bas, nbas, env, NULL, NULL); \ } \ -CACHE_SIZE_T c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME##_sph(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env) { \ return NAME##_sph(out, NULL, shls, atm, natm, bas, nbas, env, NULL, NULL); \ } \ -CACHE_SIZE_T c##NAME(double *out, FINT *shls, FINT *atm, FINT natm, \ +FINT c##NAME(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env) { \ return NAME##_spinor((double complex *)out, NULL, shls, \ atm, natm, bas, nbas, env, NULL, NULL); \ diff --git a/src/optimizer.c b/src/optimizer.c index 66da4595..2a1fa5b5 100644 --- a/src/optimizer.c +++ b/src/optimizer.c @@ -8,7 +8,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "cint_bas.h" #include "g1e.h" #include "g1e_grids.h" diff --git a/src/rys_roots.c b/src/rys_roots.c index 5e22fbee..a1eb2d04 100644 --- a/src/rys_roots.c +++ b/src/rys_roots.c @@ -14,7 +14,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "rys_roots.h" #ifdef HAVE_QUADMATH_H @@ -1963,13 +1963,13 @@ static int R_lsmit(long double *cs, long double *fmt_ints, int n) int CINTlrys_schmidt(int nroots, double x, double lower, double *roots, double *weights) { - int i, k, j, m, order; + int i, k, j, order; int nroots1 = nroots + 1; long double fmt_ints[MXRYSROOTS * 3 + MXRYSROOTS * MXRYSROOTS]; long double *rt = fmt_ints + nroots1 * 2; long double *cs = rt + nroots1; long double *a; - long double root, poly, wsum, dum; + long double root, poly, dum; if (lower == 0) { lgamma_inc_like(fmt_ints, x, nroots*2); diff --git a/src/rys_roots.h b/src/rys_roots.h index 4cf5ead9..4d427dc9 100644 --- a/src/rys_roots.h +++ b/src/rys_roots.h @@ -1,5 +1,4 @@ #include "config.h" -#include "cint_const.h" void CINTrys_roots(int nroots, double x, double *u, double *w); void CINTsr_rys_roots(int nroots, double x, double lower, double *u, double *w); diff --git a/src/rys_wheeler.c b/src/rys_wheeler.c index 1cbfbf73..e42feedc 100644 --- a/src/rys_wheeler.c +++ b/src/rys_wheeler.c @@ -9,7 +9,7 @@ #include #include #include -#include "cint_const.h" +#include "config.h" #include "rys_roots.h" #define SQRTPIE4 .8862269254527580136490837416705725913987747280611935641069038949264 diff --git a/testsuite/test_c2s.py b/testsuite/test_c2s.py new file mode 100644 index 00000000..565b7d3e --- /dev/null +++ b/testsuite/test_c2s.py @@ -0,0 +1,262 @@ +import sys +import os +import ctypes +import numpy + +_cint = numpy.ctypeslib.load_library('libcint', os.path.abspath(os.path.join(__file__, '../../build'))) + + +PTR_EXPCUTOFF = 0 +PTR_COMMON_ORIG = 1 +PTR_SHIELDING_ORIG = 4 +PTR_RINV_ORIG = 4 +PTR_RINV_ZETA = 7 +PTR_RANGE_OMEGA = 8 +PTR_ENV_START = 20 +NGRIDS = 11 +PTR_GRIDS = 12 + +CHARGE_OF = 0 +PTR_COORD = 1 +NUC_MOD_OF = 2 +PTR_ZETA = 3 +RAD_GRIDS = 4 +ANG_GRIDS = 5 +ATM_SLOTS = 6 + +ATOM_OF = 0 +ANG_OF = 1 +NPRIM_OF = 2 +NCTR_OF = 3 +KAPPA_OF = 4 +PTR_EXP = 5 +PTR_COEFF = 6 +BAS_SLOTS = 8 + +natm = 4 +nbas = 0 +atm = numpy.zeros((natm,ATM_SLOTS), dtype=numpy.int32) +bas = numpy.zeros((1000,BAS_SLOTS), dtype=numpy.int32) +env = numpy.zeros(10000) +off = PTR_ENV_START +for i in range(natm): + atm[i, CHARGE_OF] = (i+1)*2 + atm[i, PTR_COORD] = off + env[off+0] = .2 * (i+1) + env[off+1] = .3 + (i+1) * .5 + env[off+2] = .1 - (i+1) * .5 + off += 3 +off0 = off + +# basis with kappa > 0 +nh = 0 + +bas[nh,ATOM_OF ] = 0 +bas[nh,ANG_OF ] = 1 +bas[nh,KAPPA_OF] = 1 +bas[nh,NPRIM_OF] = 1 +bas[nh,NCTR_OF ] = 1 +bas[nh,PTR_EXP] = off +env[off+0] = 1 +bas[nh,PTR_COEFF] = off + 1 +env[off+1] = 1 +off += 2 +nh += 1 + +bas[nh,ATOM_OF ] = 1 +bas[nh,ANG_OF ] = 2 +bas[nh,KAPPA_OF] = 2 +bas[nh,NPRIM_OF] = 2 +bas[nh,NCTR_OF ] = 2 +bas[nh,PTR_EXP] = off +env[off+0] = 5 +env[off+1] = 3 +bas[nh,PTR_COEFF] = off + 2 +env[off+2] = 1 +env[off+3] = 2 +env[off+4] = 4 +env[off+5] = 1 +off += 6 +nh += 1 + +bas[nh,ATOM_OF ] = 2 +bas[nh,ANG_OF ] = 3 +bas[nh,KAPPA_OF] = 3 +bas[nh,NPRIM_OF] = 1 +bas[nh,NCTR_OF ] = 1 +bas[nh,PTR_EXP ] = off +env[off+0] = 1 +bas[nh,PTR_COEFF] = off + 1 +env[off+1] = 1 +off += 2 +nh += 1 + +bas[nh,ATOM_OF ] = 3 +bas[nh,ANG_OF ] = 4 +bas[nh,KAPPA_OF] = 4 +bas[nh,NPRIM_OF] = 1 +bas[nh,NCTR_OF ] = 1 +bas[nh,PTR_EXP ] = off +env[off+0] = .5 +bas[nh,PTR_COEFF] = off + 1 +env[off+1] = 1. +off = off + 2 +nh += 1 + +nbas = nh + +# basis with kappa < 0 +n = off - off0 +for i in range(n): + env[off+i] = env[off0+i] + +for i in range(nh): + bas[i+nh,ATOM_OF ] = bas[i,ATOM_OF ] + bas[i+nh,ANG_OF ] = bas[i,ANG_OF ] - 1 + bas[i+nh,KAPPA_OF] =-bas[i,KAPPA_OF] + bas[i+nh,NPRIM_OF] = bas[i,NPRIM_OF] + bas[i+nh,NCTR_OF ] = bas[i,NCTR_OF ] + bas[i+nh,PTR_EXP ] = bas[i,PTR_EXP ] + n + bas[i+nh,PTR_COEFF]= bas[i,PTR_COEFF] + n + env[bas[i+nh,PTR_COEFF]] /= 2 * env[bas[i,PTR_EXP]] + +env[bas[5,PTR_COEFF]+0] = env[bas[1,PTR_COEFF]+0] / (2 * env[bas[1,PTR_EXP]+0]) +env[bas[5,PTR_COEFF]+1] = env[bas[1,PTR_COEFF]+1] / (2 * env[bas[1,PTR_EXP]+1]) +env[bas[5,PTR_COEFF]+2] = env[bas[1,PTR_COEFF]+2] / (2 * env[bas[1,PTR_EXP]+0]) +env[bas[5,PTR_COEFF]+3] = env[bas[1,PTR_COEFF]+3] / (2 * env[bas[1,PTR_EXP]+1]) + +natm = ctypes.c_int(natm) +nbas = ctypes.c_int(nbas) +c_atm = atm.ctypes.data_as(ctypes.c_void_p) +c_bas = bas.ctypes.data_as(ctypes.c_void_p) +c_env = env.ctypes.data_as(ctypes.c_void_p) + +def fp(a): + return numpy.dot(a.ravel(), numpy.cos(numpy.arange(a.size))) + +ng = 11 +def random_cart(bas_id, seed=12, dtype='d'): + l = bas[bas_id, ANG_OF] + ncart = (l + 1) * (l + 2) // 2 + numpy.random.seed(seed) + cart = numpy.random.random((ng, ncart)) + if dtype == 'z': + cart = cart + numpy.random.random((ng, ncart)) * 1j + return numpy.asarray(cart, order='F') + +def test_c2s_ket_sph1(name, ref): + v1 = 0 + fn = getattr(_cint, name) + for j in range(nbas.value*2): + l = bas[j, ANG_OF] + dj = (l * 2 + 1) + cart = random_cart(j) + sph = numpy.empty((ng, dj), order='F') + _cint.CINTc2s_ket_sph1(sph.ctypes.data_as(ctypes.c_void_p), cart.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(ng), ctypes.c_int(ng), ctypes.c_int(l)) + v1 += fp(sph) + print(name, abs(ref - v1)) + +def test_c2s_bra_spinor_e1sf(name, ref): + kappa = 0 + v1 = 0 + fn = getattr(_cint, name) + for j in range(nbas.value*2): + l = bas[j, ANG_OF] + dj = (l * 4 + 2) + cart = numpy.asarray(random_cart(j).T, order='F') + gsp = numpy.empty((dj, ng, 2), order='F', dtype=numpy.complex128) + fn(gsp.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(ng), cart.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(kappa), ctypes.c_int(l)) + v1 += fp(gsp) + print(name, ref - abs(v1)) + +def test_c2s_bra_spinor_sf(name, ref): + kappa = 0 + v1 = 0 + fn = getattr(_cint, name) + for j in range(nbas.value*2): + l = bas[j, ANG_OF] + dj = (l * 4 + 2) + cart = numpy.asarray(random_cart(j, dtype='z').T, order='F') + gsp = numpy.empty((dj, ng, 2), order='F', dtype=numpy.complex128) + fn(gsp.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(ng), cart.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(kappa), ctypes.c_int(l)) + v1 += fp(gsp) + print(name, ref - abs(v1)) + +def test_c2s_bra_spinor_si(name, ref): + kappa = 0 + v1 = 0 + fn = getattr(_cint, name) + for j in range(nbas.value*2): + l = bas[j, ANG_OF] + dj = (l * 4 + 2) + cart = numpy.hstack((random_cart(j, dtype='z').T, + random_cart(j, seed=13, dtype='z').T)) + cart = numpy.asarray(cart, order='F') + gsp = numpy.empty((dj, ng), order='F', dtype=numpy.complex128) + fn(gsp.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(ng), cart.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(kappa), ctypes.c_int(l)) + v1 += fp(gsp) + print(name, ref - abs(v1)) + +def test_c2s_ket_spinor(name, ref): + kappa = 0 + v1 = 0 + fn = getattr(_cint, name) + for j in range(nbas.value*2): + l = bas[j, ANG_OF] + dj = (l * 4 + 2) + cart = numpy.hstack((random_cart(j, dtype='z'), + random_cart(j, seed=13, dtype='z'))) + cart = numpy.asarray(cart, order='F') + gsp = numpy.empty((ng, dj), order='F', dtype=numpy.complex128) + fn(gsp.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(ng), cart.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(kappa), ctypes.c_int(l)) + v1 += fp(gsp) + print(name, ref - abs(v1)) + +def test_c2s_ket_spinor_sf1(name, ref): + kappa = 0 + v1 = 0 + fn = getattr(_cint, name) + for j in range(nbas.value*2): + l = bas[j, ANG_OF] + dj = (l * 4 + 2) + cart = random_cart(j) + gsp = numpy.empty((ng, dj, 2), order='F', dtype=numpy.complex128) + fn(gsp[:,:,0].ctypes.data_as(ctypes.c_void_p), + gsp[:,:,1].ctypes.data_as(ctypes.c_void_p), + cart.ctypes.data_as(ctypes.c_void_p), + ctypes.c_int(ng), ctypes.c_int(ng), ctypes.c_int(1), ctypes.c_int(kappa), ctypes.c_int(l)) + v1 += fp(gsp) + print(name, ref - abs(v1)) + +def test_c2s_ket_spinor_si1(name, ref): + kappa = 0 + v1 = 0 + fn = getattr(_cint, name) + for j in range(nbas.value*2): + l = bas[j, ANG_OF] + dj = (l * 4 + 2) + cart = numpy.hstack([random_cart(j, 12), + random_cart(j, 13), + random_cart(j, 14), + random_cart(j, 15)]) + cart = numpy.asarray(cart, order='F') + gsp = numpy.empty((ng, dj, 2), order='F', dtype=numpy.complex128) + fn(gsp[:,:,0].ctypes.data_as(ctypes.c_void_p), + gsp[:,:,1].ctypes.data_as(ctypes.c_void_p), + cart.ctypes.data_as(ctypes.c_void_p), + ctypes.c_int(ng), ctypes.c_int(ng), ctypes.c_int(1), ctypes.c_int(kappa), ctypes.c_int(l)) + v1 += fp(gsp) + print(name, ref - abs(v1)) + +if __name__ == "__main__": + test_c2s_ket_sph1('CINTc2s_ket_sph1', 5.597110704570622) + test_c2s_bra_spinor_e1sf('CINTc2s_bra_spinor_e1sf', 27.53949584857068) + test_c2s_bra_spinor_sf('CINTc2s_bra_spinor_sf', 39.81581797638495) + test_c2s_bra_spinor_si('CINTc2s_bra_spinor_si', 12.00244266438091) + test_c2s_ket_spinor('CINTc2s_ket_spinor', 45.64346086948895) + test_c2s_ket_spinor('CINTc2s_iket_spinor', 45.64346086948895) + + test_c2s_ket_spinor_sf1('CINTc2s_ket_spinor_sf1', 11.375862317579182) + test_c2s_ket_spinor_sf1('CINTc2s_iket_spinor_sf1', 11.375862317579182) + test_c2s_ket_spinor_si1('CINTc2s_ket_spinor_si1', 7.248350912858695) + test_c2s_ket_spinor_si1('CINTc2s_iket_spinor_si1', 7.248350912858695) diff --git a/testsuite/test_cint.py b/testsuite/test_cint.py index 82214904..fd5a5c76 100644 --- a/testsuite/test_cint.py +++ b/testsuite/test_cint.py @@ -327,7 +327,7 @@ def test_int2e_spinor(name, vref, dim, place): def test_int1e_grids_sph(name, vref, dim, place): intor = getattr(_cint, name) intor.restype = ctypes.c_void_p - ngrids = 148 + ngrids = 141 numpy.random.seed(12) grids = numpy.random.random((ngrids, 3)) - 5.2 env_g = numpy.append(env, grids.ravel()) @@ -340,7 +340,7 @@ def test_int1e_grids_sph(name, vref, dim, place): for i in range(j+1): di = (bas[i,ANG_OF] * 2 + 1) * bas[i,NCTR_OF] dj = (bas[j,ANG_OF] * 2 + 1) * bas[j,NCTR_OF] - shls = (ctypes.c_int * 2)(i, j) + shls = (ctypes.c_int * 4)(i, j, 0, ngrids) intor(op, shls, c_atm, natm, c_bas, nbas, env_g.ctypes.data_as(ctypes.c_void_p), opt) v1 += abs(numpy.array(op[:ngrids*di*dj*dim])).sum() @@ -350,6 +350,31 @@ def test_int1e_grids_sph(name, vref, dim, place): else: print("* FAIL: ", name, ". err:", '%.16g' % abs(v1-vref), "/", vref) +def test_int1e_grids_spinor(name, vref, dim, place): + intor = getattr(_cint, name) + intor.restype = ctypes.c_void_p + ngrids = 141 + numpy.random.seed(12) + grids = numpy.random.random((ngrids, 3)) - 5.2 + env_g = numpy.append(env, grids.ravel()) + env_g[NGRIDS] = ngrids + env_g[PTR_GRIDS] = env.size + op = (ctypes.c_double * (1000000 * dim))() + v1 = 0 + cnt = 0 + for j in range(nbas.value*2): + for i in range(j+1): + di = _cint.CINTlen_spinor(i, c_bas, nbas) * bas[i,NCTR_OF] + dj = _cint.CINTlen_spinor(j, c_bas, nbas) * bas[j,NCTR_OF] + shls = (ctypes.c_int * 4)(i, j, 0, ngrids) + intor(op, shls, c_atm, natm, c_bas, nbas, c_env, opt) + v1 += abs(cdouble_to_cmplx(op[:ngrids*di*dj*dim*2])).sum() + cnt += ngrids*di*dj*dim*2 + if close(v1, vref, cnt, place): + print("pass: ", name) + else: + print("* FAIL: ", name, ". err:", '%.16g' % abs(v1-vref), "/", vref) + def test_comp2e_spinor(name1, name_ref, shift, dim, place): intor = getattr(_cint, name1) intor.restype = ctypes.c_void_p @@ -391,7 +416,6 @@ def test_comp2e_spinor(name1, name_ref, shift, dim, place): print("pass: ", name1, "/", name_ref) - if __name__ == "__main__": if "--high-prec" in sys.argv: def close(v1, vref, count, place): @@ -457,11 +481,15 @@ def close(v1, vref, count, place): ): test_int2e_sph(*f) - for f in (('cint1e_grids_sph', 5528.379150052477, 1, 9), - ('cint1e_grids_ip_sph', 3279.928611096705, 1, 9), + for f in (('cint1e_grids_sph', 5262.154357565998, 1, 9), + ('cint1e_grids_ip_sph', 3121.659392012421, 1, 9), ): test_int1e_grids_sph(*f) + for f in (('cint1e_grids_spvsp', 85792.74665645276, 1, 9), + ): + test_int1e_grids_spinor(*f) + test_erf('cint2e_sph', 0.2, 9) test_erf('cint2e_sph', 0.5, 9) test_erf('cint2e_sph', 0.8, 9) @@ -527,4 +555,3 @@ def close(v1, vref, count, place): v1 += abs(opr2-oprr[:,:,0]-oprr[:,:,4]-oprr[:,:,8]).sum() if round(v1/(di*dj), 13): print("* FAIL: ", i, j, v1) - diff --git a/testsuite/test_int1e.py b/testsuite/test_int1e.py index 043627be..ab35656f 100644 --- a/testsuite/test_int1e.py +++ b/testsuite/test_int1e.py @@ -4,8 +4,8 @@ import numpy #_cint2 = ctypes.cdll.LoadLibrary('libcint.so.2.8') -_cint3 = ctypes.cdll.LoadLibrary('libcint.so.3') -#_cint4 = ctypes.cdll.LoadLibrary('libcint.so.4') +#_cint3 = ctypes.cdll.LoadLibrary('libcint.so.3') +_cint = _cint4 = ctypes.cdll.LoadLibrary('libcint.so.4') from pyscf import gto, lib @@ -43,7 +43,7 @@ def make_cintopt(atm, bas, env, intor): natm = c_atm.shape[0] nbas = c_bas.shape[0] cintopt = lib.c_null_ptr() - foptinit = getattr(_cint3, intor+'_optimizer') + foptinit = getattr(_cint, intor+'_optimizer') foptinit(ctypes.byref(cintopt), c_atm.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(natm), c_bas.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(nbas), @@ -56,7 +56,7 @@ def run(intor, comp=1, suffix='_sph', thr=1e-9): else: intor = intor = 'c%s%s'%(intor,suffix) print(intor) - fn1 = getattr(_cint3, intor) + fn1 = getattr(_cint, intor) #fn2 = getattr(_cint2, intor) #cintopt = make_cintopt(mol._atm, mol._bas, mol._env, intor) cintopt = lib.c_null_ptr()