From 53a408953db7fa705f9613c94411a8c80ff17f86 Mon Sep 17 00:00:00 2001 From: q-posev Date: Wed, 1 Jun 2022 17:52:52 +0200 Subject: [PATCH] Update the wheels scripts and add benzene data --- .github/workflows/build-wheels.yml | 4 +-- python/build_manylinux_wheels.sh | 7 +++-- python/test/benzene_data.py | 46 ++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 python/test/benzene_data.py diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index f6b8ded..4f8170c 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -152,7 +152,7 @@ jobs: working-directory: python - name: Install Python dependencies - run: pip install --upgrade pip setuptools build delocate + run: pip install --upgrade pip setuptools build delocate pytest - name: Build wheel for a given version of CPython run: | @@ -169,7 +169,7 @@ jobs: working-directory: python - name: Test the wheel - run: python test_api.py + run: pytest -v test_api.py working-directory: python/test - name: Upload produced wheels as artifacts diff --git a/python/build_manylinux_wheels.sh b/python/build_manylinux_wheels.sh index 85705e0..d6fc96f 100755 --- a/python/build_manylinux_wheels.sh +++ b/python/build_manylinux_wheels.sh @@ -82,11 +82,14 @@ function build_wheel_for_py() # install the produced manylinux wheel in the virtual environment python3 -m pip install wheelhouse/trexio-${TR_VERSION}-${CPYTHON}-manylinux*.whl + # install pytest for testing + pip install pytest # run test script - cd test && python3 test_api.py && cd .. + pytest -v test/test_api.py # cleaning - rm -rf -- dist/ build/ trexio.egg-info/ + rm -rf -- dist/ build/ trexio.egg-info/ + rm -- test_file_py.h5 unsafe_test_file_py.h5 # deactivate the current environment deactivate diff --git a/python/test/benzene_data.py b/python/test/benzene_data.py new file mode 100644 index 0000000..e9dd45c --- /dev/null +++ b/python/test/benzene_data.py @@ -0,0 +1,46 @@ + +# for the nucleus group +nucleus_num = 12 + +point_group = 'D6h' + +nucleus_label = ['C', 'C', 'C', 'C', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H'] + +nucleus_charge = [6., 6., 6., 6., 6., 6., 1., 1., 1., 1., 1., 1.] + +nucleus_coord = [ +[ 0.00000000 , 1.39250319 , 0.00000000 ], +[-1.20594314 , 0.69625160 , 0.00000000 ], +[-1.20594314 , -0.69625160 , 0.00000000 ], +[ 0.00000000 , -1.39250319 , 0.00000000 ], +[ 1.20594314 , -0.69625160 , 0.00000000 ], +[ 1.20594314 , 0.69625160 , 0.00000000 ], +[-2.14171677 , 1.23652075 , 0.00000000 ], +[-2.14171677 , -1.23652075 , 0.00000000 ], +[ 0.00000000 , -2.47304151 , 0.00000000 ], +[ 2.14171677 , -1.23652075 , 0.00000000 ], +[ 2.14171677 , 1.23652075 , 0.00000000 ], +[ 0.00000000 , 2.47304151 , 0.00000000 ], +] + +# for the basis_nucleus_index +basis_shell_num = 24 +nucleus_index = [i for i in range(basis_shell_num)] + +# for sparse AO_INT_2E +ao_num = 600 +# prepare the sparse data representation +num_integrals = 100 +indices = [i for i in range(num_integrals*4)] +values = [(3.14 + float(i)) for i in range(num_integrals)] + +# for determinants +mo_num = 150 +int64_num = int((mo_num - 1)/64 + 1) +# prepate the CI data +det_num = 2000 +dets = [i for i in range(det_num * int64_num * 2)] +coeffs = [float(i/det_num) for i in range(det_num)] +coeffs_s2 = [float(i*2/det_num) for i in range(det_num)] + +det_test = [1, 2, 3, 2, 1, 3] \ No newline at end of file