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

fixes #1795 #2074

Merged
merged 2 commits into from
Sep 21, 2018
Merged

fixes #1795 #2074

merged 2 commits into from
Sep 21, 2018

Conversation

richardjgowers
Copy link
Member

Fixes #1795

Changes made in this Pull Request:

  • SphericalZone and SphericalLayer no longer shift atoms to inside
    primary unit cell when calculating center of reference group

PR Checklist

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

SphericalZone and SphericalLayer no longer shift atoms to inside
primary unit cell when calculating center of reference group
@richardjgowers richardjgowers added this to the 0.19.0 milestone Sep 14, 2018
@richardjgowers
Copy link
Member Author

I think this finally fixes #1795. center_of_geometry(pbc=True) doesn't really make sense for these selections, if anything we need center(unwrap=True) ie #2012 but that's not merged yet. The test that is added is an unwrapped system, so shouldn't change before/after this change.

Copy link
Member

@tylerjereddy tylerjereddy left a comment

Choose a reason for hiding this comment

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

I went back to the code reported as problematic in the original issue and confirmed that the lastest develop (259f778) gives 40 residues on that selection and @richardjgowers feature branch here (e8a7863) gives 5, which is what the issue reporter expects / wants. So, I think mechanically this is fine & we should perhaps merge soon-ish to fix that mechanical issue.

I'd probably feel a little safer if we were to use the exact reported issue example as a regression test, but I trust that the test used here is similar enough & avoids the additional test data file burden.

I do have a few suggestions / comments, that are perhaps better suited to follow-up PRs or at least issues so we don't forget.

  • the docs for sphzone / sphlayer still indicate that the COG / centroid of the ref group is used -- is this still true? If so, do we now gracefully handle the scenarios I was confused about in my diagram?
  • the linked issue / PR discussions for this problem also raised some of my confusion about pbc-related flags in our code base (there's a few of them, it is confusing, etc.); does that persist?
  • I don't know if some of the behavior adjustment here warrants i.e., versionchanged directives in the docs; if a temporary bug just crept in maybe not I suppose

@tylerjereddy
Copy link
Member

The Travis failure is likely unrelated -- we should maybe go ahead and do a crude pinning fix to the NumPy version there I suppose so we don't block PRs & then rebase here maybe.

@richardjgowers
Copy link
Member Author

@tylerjereddy the centroid is still used, but it always assumes that all atoms are in the correct image to calculate this. WRT your sketch, if you had protein/X atoms in either side of the box this selection would fail because it would calculate the centroid as roughly the center of the box. This is exactly what unwrap would fix.

In general pbc=True needs to get replaced with wrap=True (ie consider all atoms in the primary unit cell), and unwrap=True (make sure bonds aren't broken across periodic boundaries) which is what #2012 is about.

@zemanj
Copy link
Member

zemanj commented Sep 17, 2018

In general pbc=True needs to get replaced with wrap=True (ie consider all atoms in the primary unit cell), and unwrap=True (make sure bonds aren't broken across periodic boundaries) which is what #2012 is about.

I agree with @richardjgowers that this can only be fixed for the general case (atom coordinates in arbitrary images) by first wrapping and then unwrapping the system. But even then, PBC have to be taken into account when calculating the COG of the reference group (and afterwards when computing distances, but that's already handled correctly I think).

If I'm not mistaken, this PR currently only works correctly for already unwrapped systems without PBC.

@richardjgowers
Copy link
Member Author

@zemanj yep we need proper unwrap support. But this PR fixes the regression that happened when we started to use pbc=True inside the COG calculation.

@orbeckst
Copy link
Member

Could someone take the responsibility and merge? (I haven't really followed the conversation in depth but nothing has happened over the last 2d and the status is green so naively I'd think one could hit the button...)

@richardjgowers richardjgowers merged commit 55e7475 into develop Sep 21, 2018
@richardjgowers
Copy link
Member Author

I think I addressed @tylerjereddy 's comments, so I'm merging this

tl;dr there's still wrap/unwrap issues, but this fixes the regression that happened

@richardjgowers richardjgowers deleted the issue-1795-pbcsels branch September 21, 2018 15:23
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.

4 participants