Skip to content
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

Adding a ref point support for atom selection #4348

Closed
wants to merge 4 commits into from

Conversation

abdulasiraj
Copy link

@abdulasiraj abdulasiraj commented Nov 26, 2023

Fixes #4344

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

Developers certificate of origin


📚 Documentation preview 📚: https://mdanalysis--4348.org.readthedocs.build/en/4348/

Copy link

github-actions bot commented Nov 26, 2023

Linter Bot Results:

Hi @abdulasiraj! Thanks for making this PR. We linted your code and found the following:

Some issues were found with the formatting of your code.

Code Location Outcome
main package ⚠️ Possible failure
testsuite ✅ Passed

Please have a look at the darker-main-code and darker-test-code steps here for more details: https://github.com/MDAnalysis/mdanalysis/actions/runs/8641404169/job/23690877862


Please note: The black linter is purely informational, you can safely ignore these outcomes if there are no flake8 failures!

Copy link

codecov bot commented Nov 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.23%. Comparing base (73acc9b) to head (1b7f3e9).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4348      +/-   ##
===========================================
- Coverage    93.66%   93.23%   -0.44%     
===========================================
  Files          168       12     -156     
  Lines        21248     1079   -20169     
  Branches      3917        0    -3917     
===========================================
- Hits         19902     1006   -18896     
+ Misses         888       73     -815     
+ Partials       458        0     -458     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@richardjgowers richardjgowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good start, this is trying to make refpoint x y z a possible selection as part of a command like sphlayer in the selection language.

The return from _apply here needs to usually be an AtomGroup, as other selections will expected it to provide things like center_of_geometry: https://github.com/MDAnalysis/mdanalysis/blob/develop/package/MDAnalysis/core/selection.py#L348

There's probably two ways to make this work:

  1. you could make the _apply method here return a AtomGroup-like object, so define a PseudoAtomGroup class here that duck types (imitates) all the required methods (like center_of_geometry etc).
  2. instead, make all geometric selections that require a selection, instead have a branch where they can instead parse the refpoint here. This would change the signature of sphlayer 1.0 2.0 selection OR refpoint

Option 2 here is probably more lines of code and seems less elegant, but option 1 seems a little fragile as the pseudo AtomGroup class would require a lot of maintenance to keep it behaving like a real AtomGroup

@orbeckst
Copy link
Member

Thanks for the contribution @abdulasiraj and thanks for the initial round of feedback @richardjgowers .

As there's still a WIP-label in the title I assume that you still want to do a fair amount of work by yourself @abdulasiraj . Once you think it's really ready for review, please change the name and then we can have closer look.

@RMeli RMeli marked this pull request as draft December 16, 2023 17:09
@RMeli RMeli changed the title [WIP] Adding a ref point support for atom selection Adding a ref point support for atom selection Dec 16, 2023
@RMeli
Copy link
Member

RMeli commented Dec 16, 2023

@abdulasiraj I removed the WIP label to the title and converted this PR into a draft, to avoid confusion. Please feel free to mark it as "Ready to review" when it's no longer WIP.

@abdulasiraj
Copy link
Author

That's make more sense. I'll update for sure. Thanks @RMeli

@orbeckst
Copy link
Member

@abdulasiraj are you still working on this PR? Otherwise we will close it.

@orbeckst orbeckst added the close? Evaluate if issue/PR is stale and can be closed. label Mar 25, 2024
@abdulasiraj
Copy link
Author

Hi @orbeckst, I'll complete it in few days hopefully. just got time to work on it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close? Evaluate if issue/PR is stale and can be closed. Component-Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add reference point to geometric selections
4 participants