Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
8cd4455
imdreader et al removed
amruthesht Feb 19, 2025
95a70fa
Chnages to remove IMDReader
amruthesht Mar 12, 2025
fa25049
minimalReader for tests
amruthesht Mar 18, 2025
3c72675
Code Changes
amruthesht Apr 2, 2025
72fa772
Minor changes
amruthesht Apr 2, 2025
9e906f0
Minimal reader and corresponding test-suite clean up
amruthesht Apr 9, 2025
fb0d1b7
Chore: `n_atoms` extracted using `mdanalysis`
amruthesht Apr 9, 2025
5485680
Merge branch 'main' into imdreader-split
orbeckst Apr 9, 2025
bcf6f7c
Merge branch 'main' into imdreader-split
orbeckst Apr 9, 2025
b2bb3c9
Added: `copy` method to `IMDFrame`
amruthesht Apr 10, 2025
db10481
Minor changes
amruthesht Apr 15, 2025
f387059
Fix: dimensions in IMDFrame
amruthesht Apr 15, 2025
4769c4f
Changes: Removed tests for `dt`
amruthesht Apr 16, 2025
4554ad9
Fix: Change how box dimensions are stored
amruthesht Apr 16, 2025
859b0fe
Fix: `close()` method and fix `wait`-related tests
amruthesht Apr 16, 2025
a0cc914
Change: using deepcopy instead and dimensions created by assignment
amruthesht Apr 28, 2025
2afdb82
Fix: minimalReader process_stream behavior to change IMD_WAIT effect
amruthesht May 13, 2025
17fadae
Fix: update NAMD input frequency
amruthesht May 14, 2025
e8e4fc6
Modify/Fix: tests for GROMACS/LAMMPS
amruthesht May 27, 2025
b4ff92e
Fix: GROMACS/LAMMPS tests for step
amruthesht May 28, 2025
b8a7cad
Cleanup: Fix small issues in manual tests
amruthesht Jun 2, 2025
a108f42
Update docs and imports
jaclark5 May 5, 2025
abe3488
Update imports
jaclark5 May 5, 2025
3d4c6a1
Fix: update NAMD steps further
amruthesht May 14, 2025
4340015
Fix import
jaclark5 May 24, 2025
f310986
Fix: PR #64 merge conflicts
amruthesht Jun 2, 2025
dfeee77
Add: `minimalReader` usage
amruthesht Jun 2, 2025
f2e2e48
Chore: fix dependencies for examples
amruthesht Jun 3, 2025
5b6854b
Change: `minimalReader` chnaged to `MinimalReader`
amruthesht Jun 3, 2025
c29c57f
Doc: `MinimalReader` doc update for class
amruthesht Jun 3, 2025
1fa261b
Fix: `pop_full_imdframe` doc comments
amruthesht Jun 3, 2025
c12b91d
Chore: Remove example dependencies installation
amruthesht Jun 3, 2025
7bac503
Fix: indentation `index.rst`
amruthesht Jun 3, 2025
12ec780
Chore: Minor clean ups and changes
amruthesht Jun 19, 2025
f1a1a6f
Change: `minimalreader`-free examples in `usage.rst` and `examples` d…
amruthesht Jun 23, 2025
3c70b6e
Fix: Lammps topology settings for MDA under examples
amruthesht Jun 23, 2025
282c3ed
Fix: remove `process_stream` under `test_wait_after_disconnect`
amruthesht Jun 23, 2025
17e4f71
Doc: add doc_string for `parse_host_port()`
amruthesht Jun 23, 2025
382fc49
Add: Unit tests for `parse_host_port`
amruthesht Jun 23, 2025
4846157
Add: utils test to GH-CI
amruthesht Jun 23, 2025
f34eac6
parse mdp/inp for dt
ljwoods2 Jun 24, 2025
73556cc
Merge branch 'main' into test_dt
orbeckst Jun 24, 2025
7662f5b
Merge branch 'main' into imdreader-split
orbeckst Jun 24, 2025
ebef779
Merge branch 'main' into imdreader-split
orbeckst Jun 24, 2025
56d18ef
Update: `.toml` to fix dependencies
amruthesht Jun 25, 2025
59b4306
Update: CHANGELOG
amruthesht Jun 25, 2025
a329edf
Merge branch 'imdreader-split' into test_dt
ljwoods2 Jun 25, 2025
b5bd892
Merge pull request #71 from Becksteinlab/test_dt
ljwoods2 Jun 25, 2025
c6d52c2
change "minimalreader" to MinimalReader
ljwoods2 Jun 25, 2025
6750a39
fix erroneous merge changes from test_dt branch
ljwoods2 Jun 25, 2025
d8bbab9
undo black diffs for test_dt changes
ljwoods2 Jun 25, 2025
f1336b2
ReFormat: all files
amruthesht Jun 25, 2025
7c6cb4b
Add: NAMD tests for `dt`
amruthesht Jun 25, 2025
45c4a1d
Chore: Minor cleanup and add checks for tests
amruthesht Jun 25, 2025
158bb4c
remove all assertion guards
ljwoods2 Jun 27, 2025
8848d4d
Chore: Minor cleanups
amruthesht Jun 27, 2025
5d063e0
Merge branch 'main' into imdreader-split
orbeckst Jun 27, 2025
0f1f62b
Update: Examples to output simple info
amruthesht Jun 27, 2025
cdbbd1c
Add: Added Amruthesh as contributor/maintainer
amruthesht Jun 27, 2025
2eb3425
Apply suggestions from code review
orbeckst Jun 27, 2025
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
4 changes: 0 additions & 4 deletions .github/workflows/gh-ci.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if coverage is correctly reported but this may be something to figure out once this is merged.

Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ jobs:
- name: Run IMDClient tests
run: |
pytest -n auto -v --cov=imdclient --cov-report=xml --color=yes imdclient/tests/test_imdclient.py

- name: Run IMDReader tests
run: |
pytest -n auto -v --cov=imdclient --cov-report=xml --color=yes imdclient/tests/test_imdreader.py

- name: codecov
if: github.event_name != 'schedule'
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ IMDClient was created by Lawson in 2024.


<!-- All contributing authors are listed in this file below.
The repository history at https://github.com/becksteinlab/imdreader
The repository history at https://github.com/becksteinlab/imdclient
and the CHANGELOG show individual code contributions. -->

## Chronological list of authors
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ IMDClient

Receiver for [IMDv3 protocol](https://imdclient.readthedocs.io/en/latest/protocol_v3.html) from simulation engines like Gromacs, LAMMPS, and NAMD.

IMDClient is bound by a [Code of Conduct](https://github.com/becksteinlab/imdreader/blob/main/CODE_OF_CONDUCT.md).
IMDClient is bound by a [Code of Conduct](https://github.com/becksteinlab/imdclient/blob/main/CODE_OF_CONDUCT.md).

### Installation

Expand Down Expand Up @@ -53,8 +53,8 @@ conda activate imdclient
<!-- Install the development and documentation dependencies:

```
conda env update --name imdreader --file devtools/conda-envs/test_env.yaml
conda env update --name imdreader --file docs/requirements.yaml
conda env update --name imdclient --file devtools/conda-envs/test_env.yaml
conda env update --name imdclient --file docs/requirements.yaml
``` -->

Build this package from source:
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: imdreader-docs
name: imdclient-docs
channels:

- conda-forge
Expand Down
15 changes: 10 additions & 5 deletions examples/gromacs/repo_files/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import MDAnalysis as mda
from MDAnalysis.coordinates.IMD import IMDReader
from imdclient.tests.minimalReader import minimalReader
import logging
from imdclient.tests.datafiles import GROMACS_TOP

logger = logging.getLogger("imdclient.IMDClient")
file_handler = logging.FileHandler("imdreader.log")
file_handler = logging.FileHandler("imdclient.log")
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
Expand All @@ -13,8 +13,13 @@
logger.setLevel(logging.INFO)

i = 0
u = mda.Universe(GROMACS_TOP, "imd://localhost:8888")
for ts in u.trajectory:
i += 1
u = minimalReader("imd://localhost:8888")

while True:
try:
u._read_next_frame()
i += 1
except EOFError:
break

logger.info(f"Parsed {i} frames")
8 changes: 4 additions & 4 deletions examples/gromacs/slurm/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
Full walkthrough
================

Create IMDReader mamba env
Create IMDClient mamba env
--------------------------

Assuming you're in a login node to start, get a compute node:
```bash
salloc -p general
```

From the compute node, create env with name "imdreader-test":
From the compute node, create env with name "imdclient-test":
```bash
mkdir -p workspace
cd workspace
git clone https://github.com/Becksteinlab/imdreader.git
git clone https://github.com/Becksteinlab/imdclient.git
cd imdreader
git checkout develop
module load mamba/latest
mamba env create --file devtools/conda-envs/test_env.yaml
source activate imdreader-test
source activate imdclient-test
pip install -e .
```

Expand Down
15 changes: 10 additions & 5 deletions examples/gromacs/slurm/client.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# NOTE: chamge
import MDAnalysis as mda
from MDAnalysis.coordinates.IMD import IMDReader
from imdclient.tests.minimalReader import minimalReader
import logging
from imdclient.tests.datafiles import GROMACS_TOP

logger = logging.getLogger("imdclient.IMDClient")
file_handler = logging.FileHandler("imdreader.log")
file_handler = logging.FileHandler("imdclient.log")
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
Expand All @@ -14,8 +14,13 @@
logger.setLevel(logging.INFO)

i = 0
u = mda.Universe(GROMACS_TOP, "imd://localhost:8888")
for ts in u.trajectory:
i += 1
u = minimalReader("imd://localhost:8888")

while True:
try:
u._read_next_frame()
i += 1
except EOFError:
break

logger.info(f"Parsed {i} frames")
4 changes: 2 additions & 2 deletions examples/gromacs/slurm/imd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env | grep ^SLURM | sort
env | grep CUDA

module load mamba/latest
source activate imdreader-test
source activate imdclient-test

output_dir="output_${SLURM_JOB_ID}"
mkdir -p $output_dir
Expand All @@ -36,7 +36,7 @@ while ! await_gmx_imd; do
sleep 5
done

echo "GROMACS is ready. Running IMDReader"
echo "GROMACS is ready. Running IMD-reader"

python client.py

Expand Down
15 changes: 10 additions & 5 deletions examples/lammps/repo_files/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import MDAnalysis as mda
from MDAnalysis.coordinates.IMD import IMDReader
from imdclient.tests.minimalReader import minimalReader
import logging
from imdclient.tests.datafiles import LAMMPS_TOPOL

logger = logging.getLogger("imdclient.IMDClient")
file_handler = logging.FileHandler("imdreader.log")
file_handler = logging.FileHandler("imdclient.log")
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
Expand All @@ -13,8 +13,13 @@
logger.setLevel(logging.INFO)

i = 0
u = mda.Universe(LAMMPS_TOPOL, "imd://localhost:8888")
for ts in u.trajectory:
i += 1
u = minimalReader("imd://localhost:8888")

while True:
try:
u._read_next_frame()
i += 1
except EOFError:
break

logger.info(f"Parsed {i} frames")
15 changes: 10 additions & 5 deletions examples/namd/repo_files/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import MDAnalysis as mda
from MDAnalysis.coordinates.IMD import IMDReader
from imdclient.tests.minimalReader import minimalReader
import logging
from imdclient.tests.datafiles import NAMD_TOPOL

logger = logging.getLogger("imdclient.IMDClient")
file_handler = logging.FileHandler("imdreader.log")
file_handler = logging.FileHandler("imdclient.log")
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
Expand All @@ -13,8 +13,13 @@
logger.setLevel(logging.INFO)

i = 0
u = mda.Universe(NAMD_TOPOL, "imd://localhost:8888")
for ts in u.trajectory:
i += 1
u = minimalReader("imd://localhost:8888")

while True:
try:
u._read_next_frame()
i += 1
except EOFError:
break

logger.info(f"Parsed {i} frames")
86 changes: 0 additions & 86 deletions imdclient/minimalReader.py

This file was deleted.

9 changes: 2 additions & 7 deletions imdclient/tests/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from imdclient.IMDClient import IMDClient
from .minimalReader import minimalReader
import pytest
from pathlib import Path
import os
Expand Down Expand Up @@ -127,13 +128,7 @@ def docker_client(

@pytest.fixture()
def imd_u(self, docker_client, topol, tmp_path, port):
u = mda.Universe((tmp_path / topol), f"imd://localhost:{port}")
with mda.Writer(
(tmp_path / "imd.trr").as_posix(), u.trajectory.n_atoms
) as w:
for ts in u.trajectory:
w.write(u.atoms)
yield mda.Universe((tmp_path / topol), (tmp_path / "imd.trr"))
u = minimalReader(f"imd://localhost:{port}", process_stream=True)

@pytest.fixture()
def true_u(self, topol, traj, imd_u, tmp_path):
Expand Down
75 changes: 75 additions & 0 deletions imdclient/tests/minimalReader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import logging
import select
import time
from imdclient.IMDClient import IMDClient
from .utils import parse_host_port

logger = logging.getLogger("imdclient.IMDClient")


class minimalReader:
"""
Minimal reader for testing purposes

Parameters
----------
filename : str
a string of the form "host:port" where host is the hostname
or IP address of the listening MD engine server and port
is the port number.
n_atoms : int (optional)
number of atoms in the system. defaults to number of atoms
in the topology. don't set this unless you know what you're doing.
kwargs : dict (optional)
keyword arguments passed to the constructed :class:`IMDClient`
"""

def __init__(self, filename, n_atoms=None, process_stream=False, **kwargs):

self.imd_frame = None

# a trajectory of imd frames
self.trajectory = None

self.n_atoms = n_atoms

host, port = parse_host_port(filename)

# This starts the simulation
self._imdclient = IMDClient(host, port, n_atoms, **kwargs)

imdsinfo = self._imdclient.get_imdsessioninfo()

self._frame = -1

if process_stream:
self._process_stream()

def _read_next_frame(self):
try:
imd_frame = self._imdclient.get_imdframe()
except EOFError:
raise

self._frame += 1
self.imd_frame = imd_frame

logger.debug(f"minimalReader: Loaded frame {self._frame}")

def _add_frame_to_trajectory(self):
# Add the current frame to the trajectory
if self.trajectory is None:
self.trajectory = []
self.trajectory.append(self.imd_frame)
logger.debug(
f"minimalReader: Added frame {self._frame} to trajectory"
)

def _process_stream(self):
# Process the stream of frames
while True:
try:
self._read_next_frame()
self._add_frame_to_trajectory()
except EOFError:
break
Loading
Loading