-
Notifications
You must be signed in to change notification settings - Fork 133
Add trajectory reporter to openmm workflow #1053
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
Add trajectory reporter to openmm workflow #1053
Conversation
|
Would you mind taking a look @janosh? |
janosh
left a comment
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.
some variables use camelCase instead of snake_case to match OpenMM's style. i'd advocate for consistency with Python conventions. maybe @utf wants to weigh in what atomate's policy is
2 more suggestions:
- could addi progress tracking for long trajectories
- could add compression options for large trajectories
src/atomate2/openmm/utils.py
Outdated
|
|
||
| # Get energies in eV | ||
| kinetic_energy = ( | ||
| state.getKineticEnergy()._value / ev_to_kj_per_mol # noqa: SLF001 |
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.
is there no public openMM API to get these values? seems fragile to rely on _value here which i'm guessing has no backwards compat gurantees?
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.
Good catch. I was a bit more clever and fixed it.
src/atomate2/openmm/utils.py
Outdated
|
|
||
| self._nextModel += 1 | ||
|
|
||
| def __del__(self) -> None: |
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.
what are the implications of using __del__ for file operations? afaik there's no guarantee when it will be called. maybe better to add a explicit save() method instead
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.
Good point. I was mirroring an external API and being a bit. I replaced it with a save method to be more robust.
The core problem is that the Reporters usually append to a file at each step but trajectory doesn't easily support that.
|
There are other EDIT: To be a little clearer. The |
|
looks good! thanks @orionarcher 👍 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1053 +/- ##
========================================
- Coverage 4.32% 4.15% -0.18%
========================================
Files 178 187 +9
Lines 12911 13583 +672
Branches 1278 1360 +82
========================================
+ Hits 559 564 +5
- Misses 12321 12988 +667
Partials 31 31
|
Head branch was pushed to by a user without write access
|
This will need one more loop back @janosh |
* Add trajectory reporter to openmm workflow * respond to janosh review * fix test * slightly stricter asserts in test_trajectory_reporter --------- Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
Summary
Include a summary of major changes in bullet points:
Additional dependencies introduced (if any)
Checklist
Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.
Before a pull request can be merged, the following items must be checked:
The easiest way to handle this is to run the following in the correct sequence on
your local machine. Start with running
ruffandruff formaton your new code. This willautomatically reformat your code to PEP8 conventions and fix many linting issues.
Run ruff on your code.
type check your code.
Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply run
pre-commit installand a check will be run prior to allowing commits.