-
Notifications
You must be signed in to change notification settings - Fork 663
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
WIP, ENH: add TPR position and velocity read support #4873
base: develop
Are you sure you want to change the base?
Conversation
Hello @tylerjereddy! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-12-31 17:39:01 UTC |
@@ -0,0 +1,73 @@ | |||
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- | |||
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 |
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.
header needs expanding to full version
im_excl_grp_size = data.unpack_int() | ||
ndo_int(data, im_excl_grp_size) | ||
# TODO: why is this needed? | ||
data.unpack_int() |
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 above can probably be cleaned up a bit.. probably has some unused vars, etc.
It was produced by careful printf
-ing the GMX source as you might expect. Expanding to support other tpx
versions may not be too bad, although this was fairly time consuming to draft.
# api/legacy/include/gromacs/topology/topology_enums.h | ||
# worst case scenario we hard code it based on | ||
# tpx/GMX version? | ||
SimulationAtomGroupType_size = 10 |
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.
On latest GMX main
branch, this is the data structure in question:
enum class SimulationAtomGroupType : int
{
TemperatureCoupling,
EnergyOutput,
Acceleration,
Freeze,
User1,
User2,
MassCenterVelocityRemoval,
CompressedPositionOutput,
OrientationRestraintsFit,
QuantumMechanics,
Count
};
u = mda.Universe(tpr_file) | ||
assert_allclose(u.atoms.positions[0, ...], exp_first_atom) | ||
assert_allclose(u.atoms.positions[-1, ...], exp_last_atom) | ||
assert_equal(u.atoms.positions.shape, exp_shape) |
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 think we have specific conventions for coordinate reader testing, but for now this is where I've started. Should be easy to expand to include velocities as well.
Cases with only positions and no velocities (etc.) may also be sensible to add, on top of older tpx
files...
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4873 +/- ##
===========================================
- Coverage 93.66% 93.59% -0.08%
===========================================
Files 177 190 +13
Lines 21787 22921 +1134
Branches 3067 3082 +15
===========================================
+ Hits 20406 21452 +1046
- Misses 929 1012 +83
- Partials 452 457 +5 ☔ View full report in Codecov by Sentry. |
@tylerjereddy since this PR is composed of two new files, and the modifications are all in one place, would you mind if I go ahead with #4849? I don't think there would be significant conflicts. |
ok |
Thanks @tylerjereddy. It is now merged. |
* Add support for reading positions from GMX `.tpr` files at `tpx` version `134`.
* Expand `TPRReader()` support to include velocity handling, and add tests/functionality for an additional tpx version (`133`). [ci skip] [skip azp]
d67bccb
to
7583a2e
Compare
I drafted in support/testing for handling velocities as well, plus support/testing for reading positions/velocities from one more Need to poke around the |
* Add `.tpr` position/velocity reading support back to GMX 2023 (tpx version 129), and associated testing. * Add a `.tpr` position/velocity reading test case that has non-zero velocities and many more atoms. This test case currently passes for position retrieval but not for velocity retrieval. [ci skip] [skip azp] [azp skip] [skip ci]
I was able to extend support and testing for I also modernized an old TPR file we had with non-zero velocities (and a large number of atoms) for cobrotoxin via |
.tpr
files attpx
version134
. We've had an issue open to add this capability for almost a decade now.Related to gh-464. This was a fair bit of work so I'd prefer to keep the scope for this specific PR under control and defer as much as possible on the TODO list below:
TODO:
tpx
version.tpr
files (I don't anticipate too much trouble with this, but it may also be helpful if we can scope to a modern version range initially) and add test cases for those older.tpr
files..tpr
reading performance is atrocious anyway and my attempts to fix at WIP, ENH: faster TPR topology building for large systems #4098 have stalled for more than a year, so I suggest we defer performance (and probably even duplication) considerations until after the capability and tests are cemented inPR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4873.org.readthedocs.build/en/4873/