From 35b5131e2f8b670fdddd052f1468c186aebe720e Mon Sep 17 00:00:00 2001 From: Yingze Wang Date: Sun, 5 Jun 2022 04:12:34 +0800 Subject: [PATCH 1/3] add(CI/CD): unittest workflows --- .github/workflows/ut.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/ut.yml b/.github/workflows/ut.yml index e69de29bb..e219fdcad 100644 --- a/.github/workflows/ut.yml +++ b/.github/workflows/ut.yml @@ -0,0 +1,34 @@ +name: DMFF's python tests. + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + source $CONDA/bin/activate + $CONDA/bin/conda update -n base -c defaults conda + conda install pip + conda update pip + conda install numpy openmm pytest -c conda-forge + pip install jax jax_md + - name: Install DMFF + run: | + source $CONDA/bin/activate + pip install . + - name: Run Tests + run: | + source $CONDA/bin/activate + pytest -vs tests/ From 4af913cdad7d713fba1065df552464d70daf38ef Mon Sep 17 00:00:00 2001 From: Yingze Wang Date: Sun, 5 Jun 2022 04:12:50 +0800 Subject: [PATCH 2/3] add(requirements): dependencies list --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements.txt b/requirements.txt index e69de29bb..7360452fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,3 @@ +numpy>=1.18 +jax>=0.3.7 +jax-md>=0.1.28 From 2b04192e37b3bb7ade94dc8309028fb079364341 Mon Sep 17 00:00:00 2001 From: Yingze Wang Date: Sun, 5 Jun 2022 16:35:48 +0800 Subject: [PATCH 3/3] refine(ut): code prettify in test_nblist --- tests/test_common/test_nblist.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tests/test_common/test_nblist.py b/tests/test_common/test_nblist.py index a8a04724b..dd00f6d5b 100644 --- a/tests/test_common/test_nblist.py +++ b/tests/test_common/test_nblist.py @@ -6,13 +6,14 @@ class TestNeighborList: @pytest.fixture(scope="class", name='nblist') def test_nblist_init(self): - positions = jnp.array([[12.434, 3.404, 1.540], - [13.030, 2.664, 1.322], - [12.312, 3.814, 0.660], - [14.216, 1.424, 1.103], - [14.246, 1.144, 2.054], - [15.155, 1.542, 0.910]]) - + positions = jnp.array([ + [12.434, 3.404, 1.540], + [13.030, 2.664, 1.322], + [12.312, 3.814, 0.660], + [14.216, 1.424, 1.103], + [14.246, 1.144, 2.054], + [15.155, 1.542, 0.910] + ]) box = jnp.array([31.289, 31.289, 31.289]) r_cutoff = 4.0 nbobj = NeighborList(box, r_cutoff) @@ -21,13 +22,14 @@ def test_nblist_init(self): def test_update(self, nblist): - positions = jnp.array([[12.434, 3.404, 1.540], - [13.030, 2.664, 1.322], - [12.312, 3.814, 0.660], - [14.216, 1.424, 1.103], - [14.246, 1.144, 2.054], - [15.155, 1.542, 0.910]]) - + positions = jnp.array([ + [12.434, 3.404, 1.540], + [13.030, 2.664, 1.322], + [12.312, 3.814, 0.660], + [14.216, 1.424, 1.103], + [14.246, 1.144, 2.054], + [15.155, 1.542, 0.910] + ]) nblist.update(positions) def test_pairs(self, nblist):