From abf6948fa17e5b4ecbd26de05bf4b1d7b2b2fe3c Mon Sep 17 00:00:00 2001 From: Qiming Sun Date: Tue, 25 Aug 2020 17:14:40 -0700 Subject: [PATCH] Version 3.1.1 Fix bug in (py, pz, px) order --- CMakeLists.txt | 22 ++++++++++++++++++++-- ChangeLog | 2 ++ README | 2 +- src/c2f.c | 2 ++ src/c2f.h | 8 ++++++++ src/cart2sph.c | 17 +++++++++++++---- src/misc.h | 8 ++++++++ 7 files changed, 54 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08d41a9d..f3b5ccde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project (cint C) set(cint_VERSION_MAJOR "3") set(cint_VERSION_MINOR "1") -set(cint_VERSION_PATCH "0") +set(cint_VERSION_PATCH "1") set(cint_VERSION_TWEAK "0") set(cint_VERSION "${cint_VERSION_MAJOR}.${cint_VERSION_MINOR}.${cint_VERSION_PATCH}") set(cint_SOVERSION "${cint_VERSION_MAJOR}") @@ -94,9 +94,27 @@ endif(WITH_GTG) if(PYPZPX) add_definitions(-DPYPZPX) - message("P orbitals are sorted to (py, pz, px)") + message("P orbitals convention (py, pz, px)") +else() + message("P orbitals convention (px, py, pz)") endif(PYPZPX) +option(WITH_FORTRAN "Fortran interface" on) +if(WITH_FORTRAN) + add_definitions(-DWITH_FORTRAN) + message("Enable Fortran interface") +else() + message("Exclude Fortran interface") +endif(WITH_FORTRAN) + +option(WITH_CINT2_INTERFACE "Old libcint (version 2) interface" on) +if(WITH_CINT2_INTERFACE) + add_definitions(-DWITH_CINT2_INTERFACE) + message("Enable old cint (version 2) interface") +else() + message("Exclude old cint (version 2) interface") +endif(WITH_CINT2_INTERFACE) + option(BUILD_SHARED_LIBS "build shared libraries" 1) option(ENABLE_EXAMPLE "build examples" 0) option(ENABLE_TEST "build tests" 0) diff --git a/ChangeLog b/ChangeLog index 2d4b71d6..39a3af94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +Version 3.1.1 (2020-08-25): + * Fix bug in (py, pz, px) order Version 3.1.0 (2020-08-25): * Add convention py, pz, px Version 3.0.20 (2020-05-13): diff --git a/README b/README index 6cb421ff..caffb0ff 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ libcint ======= -version 3.1.0 +version 3.1.1 2020-08-25 diff --git a/src/c2f.c b/src/c2f.c index a3d8ad57..0fa3b5c9 100644 --- a/src/c2f.c +++ b/src/c2f.c @@ -4,6 +4,7 @@ * c to fortran interface */ +#ifdef WITH_FORTRAN #include #include #include "cint_bas.h" @@ -146,3 +147,4 @@ void cintdel_optimizer_(CINTOpt **opt) { cintdel_2e_optimizer_(opt); } +#endif diff --git a/src/c2f.h b/src/c2f.h index 19f5c573..29536898 100644 --- a/src/c2f.h +++ b/src/c2f.h @@ -3,6 +3,7 @@ * */ +#ifdef WITH_FORTRAN #include "config.h" #define ALL_CINT_FORTRAN_(NAME) \ @@ -54,3 +55,10 @@ FINT c##NAME##_(double *out, FINT *shls, FINT *atm, FINT *natm, \ return NAME##_spinor((double complex *)out, NULL, shls, \ atm, *natm, bas, *nbas, env, NULL, NULL); \ } + +#else + +#define ALL_CINT_FORTRAN_(NAME) +#define ALL_CINT1E_FORTRAN_(NAME) + +#endif diff --git a/src/cart2sph.c b/src/cart2sph.c index 68148581..ccd9cf7c 100644 --- a/src/cart2sph.c +++ b/src/cart2sph.c @@ -2993,12 +2993,11 @@ static double *s_ket_cart2spheric1(double *gsph, double *gcart, static double *p_bra_cart2spheric(double *gsph, FINT nket, double *gcart, FINT l) { #ifdef PYPZPX - double *pgcart = gcart; FINT i; for (i = 0; i < nket; i++) { - gsph[i*nket+0] = gcart[i*nket+1]; // py - gsph[i*nket+1] = gcart[i*nket+2]; // pz - gsph[i*nket+2] = gcart[i*nket+0]; // px + gsph[i*3+0] = gcart[i*3+1]; // py + gsph[i*3+1] = gcart[i*3+2]; // pz + gsph[i*3+2] = gcart[i*3+0]; // px } return gsph; #else @@ -8135,8 +8134,18 @@ static double *sph2e_inner(double *gsph, double *gcart, { FINT n; switch (l) { +#ifdef PYPZPX + case 0: + return gcart; + case 1: + for (n = 0; n < ncall; n++) { + p_ket_cart2spheric(gsph+n*sizsph, gcart+n*sizcart, nbra, nbra, l); + } + break; +#else case 0: case 1: return gcart; +#endif case 2: for (n = 0; n < ncall; n++) { d_ket_cart2spheric(gsph+n*sizsph, gcart+n*sizcart, nbra, nbra, l); diff --git a/src/misc.h b/src/misc.h index eee0f689..108fb747 100644 --- a/src/misc.h +++ b/src/misc.h @@ -26,6 +26,7 @@ double CINTgto_norm(FINT n, double a); var = (dtype *)(cache); \ cache = (double *)(var + n); +#ifdef WITH_CINT2_INTERFACE #define ALL_CINT(NAME) \ FINT c##NAME##_cart(double *out, FINT *shls, FINT *atm, FINT natm, \ FINT *bas, FINT nbas, double *env, CINTOpt *opt) { \ @@ -68,3 +69,10 @@ FINT c##NAME(double *out, FINT *shls, FINT *atm, FINT natm, \ return NAME##_spinor((double complex *)out, NULL, shls, \ atm, natm, bas, nbas, env, NULL, NULL); \ } + +#else + +#define ALL_CINT(NAME) +#define ALL_CINT1E(NAME) + +#endif // WITH_CINT2_INTERFACE