-
Notifications
You must be signed in to change notification settings - Fork 664
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 relprop
for atom selection and corresponding UT
#4841
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4841 +/- ##
===========================================
- Coverage 93.66% 93.64% -0.03%
===========================================
Files 177 189 +12
Lines 21796 22894 +1098
Branches 3067 3069 +2
===========================================
+ Hits 20415 21438 +1023
- Misses 929 1003 +74
- Partials 452 453 +1 ☔ View full report in Codecov by Sentry. |
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.
Looks sensible at first glance.
In addition to the inline comments, could you please also add documentation to core.groups.AtomGroup.select_atoms()
after prop
mdanalysis/package/MDAnalysis/core/groups.py
Line 2995 in ac145ec
def select_atoms(self, sel, *othersel, periodic=True, rtol=1e-05, |
prop
's docs) so that we can see how users would use it.
UPDATE: I added a few more comments after submitting my review. Please look at these, too. In particular, can you please explain the rationale for comparing to the COM of the reference group instead of calculating all distances and then comparing the min?
Additionally, the comparison needs to be able to take into account PBC (periodic=True
).
package/MDAnalysis/core/selection.py
Outdated
values = values[:, col] | ||
sel = self.sel.apply(group) | ||
rel_value = ( | ||
sel.center_of_geometry().reshape(3).astype(np.float32)[col] |
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.
Your docs should make clear that the COM of the second group is used.
Is this what this selection should do? Or should it calculate all-vs-all distances and then compute the min over all distances and then compare this minimal distance to the value?
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.
When using center_of_geometry you also need to think carefully to what value wrap
and unwrap
needs to be set, especially if the user does not get a choice in setting it.
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.
Yes. COG (not COM) is what I want to implement. In my cases, the planar surfaces are used, and taking the average positions of the surfaces is better than the minimal distances as reference. But I can see the case when the minimal distance would be a better choice, for example, for the curved surfaces. I suggest to have a new selecton class. What is your opinion?
Hello @ChiahsinChu! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2025-01-07 05:28:06 UTC |
Implementaton of #4838
Changes made in this Pull Request:
relprop
keyword for atom selectionI will update the User Guide once this implementation (especially the interface to users) is accepted.
PR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4841.org.readthedocs.build/en/4841/