-
Notifications
You must be signed in to change notification settings - Fork 1
IMDReader removed from imdclient #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
TO-DOs Get rid of any usage or references to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove MDAnalysis from pyproject.toml etc — there shouldn't be a any place in the package where it gets installed or imported.
For right now, streamanalysis is in a weird place. We can leave it in there and test it or we can disable/remove it. Something to discuss.
As discussed, we can use MDAnalysis for testing (reading trajectories) but not for streaming itself. |
1. Added MDA `imdv3-dev` as dependency in `*.toml` and `*.yaml` files 2. Removed stream-analysis, backends and results files. 3. Chnages IMReader imports to MDA imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My primary issue with the current approach is that it still requires IMDReader for testing. The way that we had concluded our discussion (ASU+MDA meeting on 2025-03-03) was the decision
imdclient: allow MDA as test dependency for imdclient tests (but do not allow IMDReader)
In my comment below I am outlining how you can use MDAnalysis to construct a Universe after obtaining the data from the stream as numpy arrays. For this to work you need to write code that only uses imdclient to pull data from a stream.
Changes implemented 1. Removed MDAnalaysis installs for imdv3-dev branch 2. Implemented minimalReader class for tests (under progress) TO-DO 1. Change `test_MDengine.py` to work with minimalReader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minimalReader is progress and now you have to use it in the tests. That's the next big step.
Let's keep the the parse ports function in imdclient.
@amruthesht do you need additional input to make progress here? |
In particular, @ljwoods2 's suggestion from #54 (comment) to just extract the frames in the most simple manner (without even needing to write a class) seems like a good way forward: def extract_all_frames(imdclient, topology_file):
imd_pos = []
imd_vel = []
imd_force = []
while True:
try:
frame = imdclient.get_frame()
imd_pos.append(frame.positions.copy())
...
except EOFError as e:
break
# instantiate in memory universe
# If imd_pos has shape (n_frames, n_atoms, 3) then we should be able to
# get an in-memory universe by just passing the array:
u = mda.Universe(topology_file, np.array(imd_pos))
return u Todo: figure out how to add velocities and forces to the in-memory universe. |
1. Added `minimalReader` inside `tests` folder 2 Fixed tests - independent of `IMDReader` 3. Cleaned up examples - Uses `minimalReader`
1. Modification to remove imdreader reference from `*.md`, `*.toml` et. al. files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle the minimalReader approach seems sensible but does need some refinements.
The MD engine tests are currently failing so this needs to be fixed.
We also currently don't show code coverage so it's not clear that the tests cover everything. Codecoverage checks are something we need to add but in another PR.
Is the goal to use minimalReader to ultimately make the trajectory available to write into TRR? Or to keep it in memory in numpy arrays and compare those directly? You may run into some trouble trying to write from the minimalReader object into TRR since the writer API requires a Universe or AtomGroup |
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is wrong in the NAMD tests where you're still trying to build a Universe directly from a stream instead of using minimalReader.
@hmacdope @jaclark5 @yuxuanzhuang if one of you could also have a look here to help get imdclient updated soon? Thanks. |
@jaclark5 @yuxuanzhuang and myself will all review @orbeckst :) |
@ljwoods2 can you please use approve/request changes for reviews? I am just looking at my own requested changes and will likely approve as soon as they are addressed and leave it to you to assess if your comments have been addressed. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few things todo from my end, mainly
- correctly list dependencies in pyproject.toml
- restructuring and rewriting some of the docs to clearly separate IMDv3 specs from implementation in codes and also document IMDv2.
There was a problem hiding this comment.
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.
docs/source/protocol_v2.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amruthesht why did we remove this information?
I thought we wanted to keep it as documentation of the existing protocol. Unless there was a decision to remove, please put it back in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can reference it as
Although the full IMDv2 protocol is not officially documented anywhere, one can infer it from the examples on the VMD/NAMD pages https://www.ks.uiuc.edu/Research/vmd/imd/ or the implementations in MD packages such as GROMACS. Here we summarize our understanding of IMDv2 as inferred from the GROMACS implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This page should be removed from the public-facing docs until we can rewrite it but I agree, no reason to fully delete it. I wrote it a long time ago and I think our understanding of v2 has improved since then. It's also not formatted well. I'd like to remove it for now, since as you said it can be inferred from above sources, plus we've fully documented v2 as a "diff" in the v3 page with the "Present in IMDv2" table and with notes like this (for example):
"Changed in version 3: In IMDv2, pause acted as a toggle, meaning sending a pause packet twice would pause and then resume the simulation’s execution. In IMDv3, the resume packet is required to resume a paused simulation since pausing is idempotent."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for weighing in @ljwoods2.
Let's keep the page around for now but don't link it (ignore sphinx's complaints). The docs will need a bit more work but we can do this separately.
imdclient/tests/test_utils.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if the other functions are properly tested. We need to look at coverage after this PR is merged.
@amruthesht do you think we'll be able to merge the PR by tomorrow Friday end of day? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending @orbeckst's documentation and pyproject.toml requested changes being completed. Approving now so I don't block tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Just couple of unblocking documentation comments
1. Change order and add `docker-py` in `.toml` 2. Minor header styling chnages in `v3.rst` 3. `autoclass` additions in `IMDClient.py` 4. Reordering - `.yaml` 5. `autoclass` additions to `IMDClient.py`
@amruthesht please also add yourself to AUTHORS. Please ping me when you need a review. |
1. Update `examples/*/client.py` 2. Update examples in `usage.rst` 3. Remove `run.sh` from GROMACS
Thank you @orbeckst, @ljwoods2, @yuxuanzhuang and @jaclark5 for your comments! @orbeckst - I have addressed all outstanding issues, comments and suggestions raised by everyone. We still need to look at coverage and make sure all functions have tests (maybe after this PR is merged), as you pointed out. |
1. Added as contributor in `AUTHORS.md` 2. Added as maintainer in `.toml`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #53
Changes made in this Pull Request:
IMDReader
andStreamReaderBase
has been removed from the main packageRelated development
AnalysisBase
compatible with live simulation streams MDAnalysis/mdanalysis#4828 on what to do with StreamReaderBase.PR Checklist