From 6c876c62b8c82bb271febaa9340cf9c45a4ed7a4 Mon Sep 17 00:00:00 2001 From: Qiming Sun Date: Wed, 27 Sep 2023 18:54:59 -0700 Subject: [PATCH] Fix bug in g1e_grids.c and update tests --- .github/workflows/ci.yml | 6 +++++- src/g1e_grids.c | 4 ++-- testsuite/test_3c2e.py | 4 ++-- testsuite/test_cart2sph.py | 5 ++--- testsuite/test_cint.py | 3 ++- testsuite/test_int1e_grids.py | 5 ++--- testsuite/test_int2c2e.py | 4 ++-- testsuite/test_int2e_f12_etc.py | 3 ++- testsuite/test_int3c1e.py | 2 +- testsuite/test_int3c2e.py | 4 ++-- 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81a3e38e..ec806345 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: if: startsWith(matrix.os, 'ubuntu') run: | cd ${{ github.workspace }}/testsuite - pip install numpy mpmath + pip install numpy mpmath pyscf python test_rys_roots.py - name: Unittest if: startsWith(matrix.os, 'ubuntu') @@ -35,4 +35,8 @@ jobs: python test_cart2sph.py python test_c2s.py python test_cint4c1e.py + python test_int1e.py python test_int1e_grids.py + python test_int2c2e.py + python test_int3c1e.py + #python test_int2e.py diff --git a/src/g1e_grids.c b/src/g1e_grids.c index 7dc40ae5..8721c789 100644 --- a/src/g1e_grids.c +++ b/src/g1e_grids.c @@ -154,8 +154,8 @@ FINT CINTg0_1e_grids(double *g, double cutoff, for (i = 0; i < rorder; i++) { u[ig+GRID_BLKSIZE*i] = ubuf[i] / (ubuf[i] + 1) * tau2; w[ig+GRID_BLKSIZE*i] = wbuf[i] * fac1; - u[ig+GRID_BLKSIZE*(i+rorder)] = ubuf[i] / (ubuf[i] + 1) * tau_theta; - w[ig+GRID_BLKSIZE*(i+rorder)] = wbuf[i] * fac_theta; + u[ig+GRID_BLKSIZE*(i+rorder)] = ubuf[i+rorder] / (ubuf[i+rorder] + 1) * tau_theta; + w[ig+GRID_BLKSIZE*(i+rorder)] = wbuf[i+rorder] * fac_theta; } } } diff --git a/testsuite/test_3c2e.py b/testsuite/test_3c2e.py index c46ea64f..24d30f5a 100644 --- a/testsuite/test_3c2e.py +++ b/testsuite/test_3c2e.py @@ -13,8 +13,8 @@ import ctypes import numpy -_cint = numpy.ctypeslib.load_library('libcint', os.path.abspath(os.path.join(__file__, '../../build'))) - +_cint = ctypes.CDLL(os.path.abspath(os.path.join(__file__, '../../build/libcint.so')), + mode=os.RTLD_GLOBAL|os.RTLD_NOW) PTR_LIGHT_SPEED = 0 PTR_COMMON_ORIG = 1 diff --git a/testsuite/test_cart2sph.py b/testsuite/test_cart2sph.py index bd1219aa..ec0de6e5 100644 --- a/testsuite/test_cart2sph.py +++ b/testsuite/test_cart2sph.py @@ -10,9 +10,8 @@ sys.path.insert(0, os.path.abspath(os.path.join(__file__, '../../scripts'))) import cart2sph -_cint = np.ctypeslib.load_library('libcint', os.path.abspath(os.path.join(__file__, '../../build'))) -#_cint = np.ctypeslib.load_library( -# 'libcint', os.path.abspath(os.path.join(__file__, '../../../qcint/build'))) +_cint = ctypes.CDLL(os.path.abspath(os.path.join(__file__, '../../build/libcint.so')), + mode=os.RTLD_GLOBAL|os.RTLD_NOW) pauli = np.array([[[0., 1.], [1., 0.]], # x diff --git a/testsuite/test_cint.py b/testsuite/test_cint.py index fd5a5c76..8e2d0f9d 100644 --- a/testsuite/test_cint.py +++ b/testsuite/test_cint.py @@ -13,7 +13,8 @@ import ctypes import numpy -_cint = numpy.ctypeslib.load_library('libcint', os.path.abspath(os.path.join(__file__, '../../build'))) +_cint = ctypes.CDLL(os.path.abspath(os.path.join(__file__, '../../build/libcint.so')), + mode=os.RTLD_GLOBAL|os.RTLD_NOW) PTR_EXPCUTOFF = 0 diff --git a/testsuite/test_int1e_grids.py b/testsuite/test_int1e_grids.py index 345b219d..4595086f 100644 --- a/testsuite/test_int1e_grids.py +++ b/testsuite/test_int1e_grids.py @@ -13,9 +13,8 @@ import ctypes import numpy -_cint = numpy.ctypeslib.load_library( - 'libcint', os.path.abspath(os.path.join(__file__, '../../build'))) - +_cint = ctypes.CDLL(os.path.abspath(os.path.join(__file__, '../../build/libcint.so')), + mode=os.RTLD_GLOBAL|os.RTLD_NOW) PTR_EXPCUTOFF = 0 PTR_COMMON_ORIG = 1 diff --git a/testsuite/test_int2c2e.py b/testsuite/test_int2c2e.py index d2a72ce6..18124a47 100644 --- a/testsuite/test_int2c2e.py +++ b/testsuite/test_int2c2e.py @@ -3,8 +3,8 @@ import ctypes import numpy -_cint = numpy.ctypeslib.load_library('libcint', os.path.abspath(os.path.join(__file__, '../../build'))) -#_cint4 = ctypes.cdll.LoadLibrary('libcint.so.4') +_cint = ctypes.CDLL(os.path.abspath(os.path.join(__file__, '../../build/libcint.so')), + mode=os.RTLD_GLOBAL|os.RTLD_NOW) from pyscf import gto, lib diff --git a/testsuite/test_int2e_f12_etc.py b/testsuite/test_int2e_f12_etc.py index 0b32159f..b4f89367 100644 --- a/testsuite/test_int2e_f12_etc.py +++ b/testsuite/test_int2e_f12_etc.py @@ -3,7 +3,8 @@ import ctypes import numpy -_cint = numpy.ctypeslib.load_library('libcint', os.path.abspath(os.path.join(__file__, '../../build'))) +_cint = ctypes.CDLL(os.path.abspath(os.path.join(__file__, '../../build/libcint.so')), + mode=os.RTLD_GLOBAL|os.RTLD_NOW) from pyscf import gto, lib diff --git a/testsuite/test_int3c1e.py b/testsuite/test_int3c1e.py index 5843d602..8cbb6410 100644 --- a/testsuite/test_int3c1e.py +++ b/testsuite/test_int3c1e.py @@ -63,7 +63,7 @@ def run(intor, comp=1, suffix='_sph', thr=1e-7): intor2 = 'c%s%s'%(intor,suffix) print(intor) fn1 = getattr(_cint, intor3) - fn2 = getattr(_cint4, intor2) + #fn2 = getattr(_cint4, intor2) cintopt = make_cintopt(mol._atm, mol._bas, mol._env, intor) #cintopt = lib.c_null_ptr() args = (mol._atm.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(mol.natm), diff --git a/testsuite/test_int3c2e.py b/testsuite/test_int3c2e.py index 1553bd33..4e312ce9 100644 --- a/testsuite/test_int3c2e.py +++ b/testsuite/test_int3c2e.py @@ -3,8 +3,8 @@ import ctypes import numpy -_cint = numpy.ctypeslib.load_library('libcint', os.path.abspath(os.path.join(__file__, '../../build'))) -#_cint4 = ctypes.cdll.LoadLibrary('libcint.so.4') +_cint = ctypes.CDLL(os.path.abspath(os.path.join(__file__, '../../build/libcint.so')), + mode=os.RTLD_GLOBAL|os.RTLD_NOW) from pyscf import gto, lib