diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index a7745ec..77d4f9a 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -123,6 +123,10 @@ jobs: if: github.repository == 'Becksteinlab/imdclient' runs-on: ubuntu-latest + permissions: + contents: read + packages: read + steps: - uses: actions/checkout@v4 @@ -132,6 +136,13 @@ jobs: df -h ulimit -a + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.NAMD_DOCKER_TOKEN }} + - name: Install conda dependencies uses: conda-incubator/setup-miniconda@v2 with: @@ -161,9 +172,18 @@ jobs: python --version python -m pip install . --no-deps - - name: Pull container + - name: Pull private NAMD container + run: | + docker pull ghcr.io/becksteinlab/streaming-namd-docker:main-common-cpu + + # Uses private container + - name: Run NAMD tests + run: | + pytest -v --color=yes imdclient/tests/test_namd.py + + - name: Pull GROMACS + LAMMPS container run: | - docker pull ghcr.io/becksteinlab/streaming-md-docker:main-Common-CPU + docker pull ghcr.io/becksteinlab/streaming-md-docker:main-common-cpu - name: Run GROMACS tests run: | @@ -172,11 +192,6 @@ jobs: - name: Run LAMMPS tests run: | pytest -v --color=yes imdclient/tests/test_lammps.py - - # SUSPEND until NAMD permissions are resolved - # - name: Run NAMD tests - # run: | - # pytest -v --color=yes imdclient/tests/test_namd.py pylint_check: if: github.repository == 'Becksteinlab/imdclient' diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 62d39fb..b9404e4 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -22,19 +22,36 @@ MDAnalysis IMDReader client when this line is printed to the terminal: IMD: Will wait until I have a connection and IMD_GO orders. +You are now ready to connect to the simulation engine with a client. + NAMD ---- -In NAMD, the simulation will wait for a client connection when the -``IMDon`` option is set to ``yes`` in the NAMD configuration file. -Other options that can be set are detailed -`here `_. -This will produce a simulation that is ready for a client connection with the +To use IMDv3 with NAMD, add the following lines to your NAMD configuration file: + +.. code-block:: none + + IMDon yes + IMDport + IMDwait + IMDfreq + + IMDsendPositions + IMDsendEnergies + IMDsendTime + IMDsendBoxDimensions + IMDsendVelocities + IMDsendForces + IMDwrapPositions + + +Once the simulation is ready for a client connection, it will print following terminal message: .. code-block:: none Info: INTERACTIVE MD AWAITING CONNECTION +You are now ready to connect to the simulation engine with a client. Using IMDClient with MDAnalysis ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/imdclient/tests/base.py b/imdclient/tests/base.py index 41ebfd7..4782e16 100644 --- a/imdclient/tests/base.py +++ b/imdclient/tests/base.py @@ -64,6 +64,10 @@ def assert_allclose_with_logging(a, b, rtol=1e-07, atol=0, equal_nan=False): class IMDv3IntegrationTest: + @pytest.fixture() + def container_name(self): + return "ghcr.io/becksteinlab/streaming-md-docker:main-common-cpu" + @pytest.fixture() def setup_command(self): return None @@ -80,12 +84,13 @@ def docker_client( setup_command, simulation_command, port, + container_name, ): # In CI, container process needs access to tmp_path tmp_path.chmod(0o777) docker_client = docker.from_env() img = docker_client.images.pull( - "ghcr.io/becksteinlab/streaming-md-docker:main-Common-CPU" + container_name, ) # Copy input files into tmp_path for inp in input_files: diff --git a/imdclient/tests/docker_testing/docker.md b/imdclient/tests/docker_testing/docker.md index 32dade9..37f40af 100644 --- a/imdclient/tests/docker_testing/docker.md +++ b/imdclient/tests/docker_testing/docker.md @@ -5,7 +5,7 @@ Ensure [docker](https://www.docker.com/) and the [NVIDIA container toolkit](http To run the container: ```bash -docker pull ghcr.io/becksteinlab/streaming-md-docker:main-Common-GPU +docker pull ghcr.io/becksteinlab/streaming-md-docker:main-common-gpu docker run -v $PWD/imdclient/data:/home/conda:rw -it --runtime=nvidia --gpus=all \ ghcr.io/becksteinlab/streaming-md-docker:main-Common-GPU diff --git a/imdclient/tests/test_namd.py b/imdclient/tests/test_namd.py index f1312b2..638cdf1 100644 --- a/imdclient/tests/test_namd.py +++ b/imdclient/tests/test_namd.py @@ -26,6 +26,10 @@ class TestIMDv3NAMD(IMDv3IntegrationTest): + @pytest.fixture() + def container_name(self): + return "ghcr.io/becksteinlab/streaming-namd-docker:main-common-cpu" + @pytest.fixture(params=[NAMD_CONF_NST_1, NAMD_CONF_NST_8]) def inp(self, request): return request.param @@ -87,10 +91,8 @@ def test_compare_imd_to_true_traj(self, imd_u, true_u, first_frame): imd_u.trajectory[i - first_frame].dt, atol=1e-03, ) - assert_allclose( - true_u.trajectory[i].data["step"], - imd_u.trajectory[i - first_frame].data["step"], - ) + # step in DCDReader is frame index, not integration step + # don't compare step assert_allclose_with_logging( true_u.trajectory[i].dimensions, imd_u.trajectory[i - first_frame].dimensions, @@ -103,12 +105,11 @@ def test_compare_imd_to_true_traj(self, imd_u, true_u, first_frame): ) # Compare velocities - def test_compare_imd_to_true_traj_vel( - self, imd_u, true_u_vel, first_frame - ): + def test_compare_imd_to_true_traj_vel(self, imd_u, true_u_vel, first_frame): for i in range(first_frame, len(true_u_vel.trajectory)): assert_allclose_with_logging( - true_u_vel.trajectory[i].positions, + # Unit conversion + true_u_vel.trajectory[i].positions * 20.45482706, imd_u.trajectory[i - first_frame].velocities, atol=1e-03, )