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

Added atom ID sort to topopology object representation #4190

Closed
wants to merge 2 commits into from

Conversation

ztimol
Copy link
Contributor

@ztimol ztimol commented Jul 7, 2023

Fixes #4181

Entirely possible I missed something but the change seems pretty straightforward. Atom ID topology representations for bonds, angles, dihedrals and other associated objects are now sorted. Happy to update docs/changelogs if necessary.

Changes made in this Pull Request:

  • Added np sort of atoms IDs to topology representation.
  • Tests updated - representation checks for topology representation matches new sorted representation.

PR Checklist

  • Tests? - All tests appear to pass. Can't seem to identify the 1 check that's flagged in the GH Actions pipeline.
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

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

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on the developer mailing list so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Linter Bot Results:

Hi @ztimol! 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 ⚠️ Possible failure

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/5489556798/jobs/10003862025


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

@codecov
Copy link

codecov bot commented Jul 7, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01 ⚠️

Comparison is base (03447ea) 93.61% compared to head (5f01e05) 93.60%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4190      +/-   ##
===========================================
- Coverage    93.61%   93.60%   -0.01%     
===========================================
  Files          193      193              
  Lines        25170    25170              
  Branches      4059     4059              
===========================================
- Hits         23562    23561       -1     
  Misses        1092     1092              
- Partials       516      517       +1     
Impacted Files Coverage Δ
package/MDAnalysis/core/topologyobjects.py 98.16% <ø> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ztimol ztimol marked this pull request as ready for review July 7, 2023 19:20
Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Thanks for the conttribution @ztimol but I'm not sure this addresses the initial issue.

@@ -116,7 +116,7 @@ def __hash__(self):
return hash((self._u, tuple(self.indices)))

def __repr__(self):
indices = (self.indices if self.indices[0] < self.indices[-1]
indices = np.sort(self.indices if self.indices[0] < self.indices[-1]
Copy link
Member

Choose a reason for hiding this comment

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

Oops didn't add this to my review:

So looking at the initial issue, I think we want to here instead present the internal stored order of the data, not just sorting by indices. That way you know that your dihedral is in the right i,j,k,l order rather than whatever numeric sort returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah of course, thanks. Totally misunderstood the initial issue, makes sense now.

@ztimol ztimol closed this Jul 7, 2023
@ztimol ztimol deleted the issue#4181 branch July 8, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

repr of TopologyObjects should show order of underlying atom IDs
2 participants