Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ut.yml
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy>=1.18
jax>=0.3.7
jax-md>=0.1.28
30 changes: 16 additions & 14 deletions tests/test_common/test_nblist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down