-
Notifications
You must be signed in to change notification settings - Fork 667
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
Hbond update #3848
Hbond update #3848
Conversation
I expect these changes will spur discussion so I didn't bother with the tests yet. |
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 these changes don't look that controversial. Changing the output schema/columns might break something in the output, but I guess that will shake out when tests are added.
It won't break the output. I've been using it with success for quite some time. I actually forgot I made some of these changes but I want to merge them and then stay current with the package. |
Codecov ReportBase: 94.34% // Head: 94.38% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #3848 +/- ##
===========================================
+ Coverage 94.34% 94.38% +0.03%
===========================================
Files 194 194
Lines 25226 25242 +16
Branches 3402 3406 +4
===========================================
+ Hits 23800 23825 +25
+ Misses 1377 1368 -9
Partials 49 49
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
looking really good! few comments.
870e90d
to
5f9fbab
Compare
5f9fbab
to
bd95900
Compare
else: | ||
hydrogens_list = np.unique( | ||
[ | ||
'type {}'.format(tp) for tp in hydrogens_ag.types |
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'm only quickly going through this so I might be missing something obvious - doesn't this assume that all types are the same? Wouldn't this be a problem if you end up with a type where some of the atoms are outside the bounds of the allowable charges but not others?
My recommendation here would be to default to a unique attribute, like the ix
value, instead of using something that's broad and could pick up stuff outside the intended atomgroup selection.
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.
@IAlibay In most cases an atom type in LAMMPS is all identical with the exception of forcefields such as ReaxFF and COMB. Although you are right that LAMMPS allows for atoms to have individual charges so this could be an issue as forcefields develop...
Here's the issue, these structures look for a list of atom selection strings that represent categories, so if this was on an index basis, the list would be very long, and the resulting output would be useless (representing a single interaction). One could have this structure instead search the atoms of each type and make a long string that specifies the specific indices that meet the charge criteria. However, this string will be unnecessary computational time in 99% of cases, and in the 1% I would argue it would skew the results as these many-body forcefields will continue to fluctuate in charge throughout the simulation, as they are supposed to. I would argue counting "low" or "high" charges in that case wouldn't disrupt the intention of the calculation, it would result in a broken hydrogen bond with a more "realistic" decay time due to local atom environments.
testsuite/MDAnalysisTests/analysis/test_hydrogenbonds_analysis.py
Outdated
Show resolved
Hide resolved
testsuite/MDAnalysisTests/analysis/test_hydrogenbonds_analysis.py
Outdated
Show resolved
Hide resolved
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.
Just the one thing and one issue to raise please.
testsuite/MDAnalysisTests/analysis/test_hydrogenbonds_analysis.py
Outdated
Show resolved
Hide resolved
060e6bb
to
333ef6b
Compare
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.
Minor doc changes + pep 8, please.
I am basically ok with the use of types, given that what we do is messy either way... see comment.
f7185a1
to
2788935
Compare
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 addressing my previous requests. I found a few doc things and suggestions for simplifying code.
I am waiting for @IAlibay (and anyone else) to weigh in on the __group_categories()
function.
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.
Thank you for addressing my requested changes. LGTM!
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.
Just a few minor things.
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.
Other than raising the issue mentioned, all the comments I had have been addressed.
@jaclark5 I've not forgotten about this, it's at the top of my review list over the next few days. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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, thanks for doing this @jaclark5. Sorry it took so long to re-review, but at least it'll make it for the 2.4.0 release 🎉 !
'(resname {} and name {})'.format(r, | ||
p) for r, p in zip(group.resnames, group.names) | ||
]) | ||
else: |
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 still think we should have the option to choose whether or not to default to types here, however for the sake of getting this done I'm going to let it go as-is here, and raise a separate issue to deal with later.
assert any(warning in rec.getMessage() for rec in caplog.records) | ||
|
||
|
||
class TestHydrogenBondAnalysisNoRes(TestHydrogenBondAnalysisIdeal): |
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 doing this, avoiding duplicate code as much as possible really helps us avoid future maintenance debt.
Thank you @jaclark5 , nice work! 🎉 |
Fixes #3847
Changes made in this Pull Request:
PR Checklist