-
Notifications
You must be signed in to change notification settings - Fork 663
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 dipole and quadrupole caclulation in AtomGroup #3842
Conversation
Codecov ReportBase: 93.50% // Head: 93.52% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #3842 +/- ##
===========================================
+ Coverage 93.50% 93.52% +0.02%
===========================================
Files 190 190
Lines 24943 25028 +85
Branches 3523 3542 +19
===========================================
+ Hits 23322 23407 +85
Misses 1100 1100
Partials 521 521
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.
Hi @jaclark5, another awesome contribution that is coming along super nicely. I think this would be a well used and useful addition. 🥇
This is mostly a review for style rather than scientific correctness, I will try and circle back for a more detailed look ASAP.
One thing that would be great is if you could make some test cases that are easy to reason about, eg dipole/quadruplepole moments that should be zero by virtue of equally separated charges, or moments that should all be a certain value etc etc.
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 the contribution, this looks quite useful. I'd advocate for extending it to also return dipolevector and quadrupoletensors instead of just scalar moments. Otherwise see various comments on notation. Sorry, did not have time to look at code in depth.
Thanks, I do think returning the quadrupole moment is something that must happen. Most people calculate the quadrupole moment with just the diagonal elements and it's only Gray and Gubbins that specify this method of calculating it will all information in the tensor. Additionally, the quadrupole moment can not be easily adjusted for it's origin and is very origin dependent. All these factors are a lot to handle for a user. I'm willing to add two additional dipole_vector, and quadrupole_tensor though (and then change the definition of dipole_moment) |
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 great, see my comments. :)
maintainer/conda/environment.yml
Outdated
@@ -27,6 +27,7 @@ dependencies: | |||
- tqdm>=4.43.0 | |||
- sphinxcontrib-bibtex | |||
- sphinx_rtd_theme | |||
- pyyaml>=3.02 |
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.
@jaclark5 what is this addition for exactly? I might have missed 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.
The new citation method won't compile without this constraint.
package/requirements.txt
Outdated
@@ -15,6 +15,7 @@ numpy>=1.20.0 | |||
packaging | |||
parmed | |||
pytest | |||
pyyaml>=3.02 |
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.
Why the pyyaml addition?
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 added this constraint to all files that check for the sphinx installation since this constraint allows the citations to be compiled.
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.
Im surprised the docs arn't working normally...
Perhaps fix the CHANGELOG conflicts and re-trigger CI and I'll have a look.
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.
So to be clear, you want me to remove this change and then run the CI so you can see the error? I'm 90% sure that the failure in #3905 is this same failure, so I could also add this change to that PR to show that it's 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.
@hmacdope I tried to look through my browsing history to find the site where I found the answer, but I didn't find it. I thiiiink I took a shot in the dark based on this statement (https://avocado-framework.readthedocs.io/en/latest/releases/44_0.html?highlight=pyyaml#documentation) and it worked.
Here is the link to the check-logs for this PR where you see the same errors that are now presenting in #3905, illustrating that the issue is consistent between the two.https://github.com/MDAnalysis/mdanalysis/actions/runs/3159210367/jobs/5142154816
Also I did give a heads up about this to the citation work that is under development in Oct as seen here:
MDAnalysis/UserGuide#212
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.
Sorry I'm coming here a bit blind to this whole issue, but why requirements.txt
? Is this for an issue with running things locally?
Re: CI, as far as I'm aware either uses optional deps defined in the github action or the environment.yaml file under maintainer.
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.
It was for an issue with compiling the docs with CI, and I can't remember if I had the same issue locally. Although it appears that this is not longer an issue since the other PR with the same issue compiled the docs in CI (#3905). There must have been a change somewhere within the past week that resolved it in a different way.
I'll remove the commits that added these dependencies.
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.
Ok in theory I should be able to remove the two commits involved in this thread (first to add the dependencies and then to remove them). However, I keep making a mess, could I get some advice?
git rebase -i HEAD~30
, this shows a list of all previous commits from both me and the develop branch.- At the commits of interest, I change "pick" to "drop" and then save and quit in vi
- A conflict in the CHANGELOG appears (like always) and asks me to change it. If I do, git adds the change to someone else's commit, so instead I type
git rebase --skip
a million times and the conflict is eventually resolved down the line. - I can then force push these changes to GitHub, however, all commits from the development branch now show up on this PR with the label "@soandso authored, @jaclark5 committed". I don't like this so then I reflog locally to undo everything and force push that.
Is there something I should be doing differently?
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.
We usually squash merge PRs, so history doesn't usually end up being an issue, would this fix things here?
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.
Hey, if you mean that squashing the commits will cancel out the two that I want to remove, then yes :). Ok I think this is good to go then if I've addressed all of @hmacdope's concerns (I think I have).
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.
@jaclark5 I have a bunch of small nit-picks on the formatting and style.
- PEP8 — please leave space after comma, no space after assignment in argument list
- when boldfacing variable names as vectors, please do not boldface subscripts
- please be clear about semantics of equations and just say in words what operations mean because not everyone is using the same symbols for operations
I really like the PR, I just don't want to have to come back to it later and fix up little things. Thank you!
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 nit-picks. I added a bunch of final text fixes and I'll commit them myself in a moment and when all passes and I didn't break the docs then I'll approve.
Sorry, I broke the docs somewhere... |
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 super good just one or two nitpicks. One last annoying request, could we have a toy test with 0 dipole and quadrupole by virtue of symmetry? Would be easy to reason about.
Hey I'll get to these @hmacdope, but I did add a case with exactly zero dipole and quadrupole, namely methane in the tests. Does that not satisfy your intention? Otherwise, I'm going to need a better idea of what you expect. |
No spot on. All good from my end! Just update for new CHANGELOG. I'll approve |
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 going to approve here as my comments have been addressed. See @IAlibay's outstanding review.
Actually I'm going to block here on CI issues, @jaclark5 can you reproduce these locally? |
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 the great contribution.
Went ahead and merged - should be good to merge once CI is green |
The error is: testsuite/MDAnalysisTests/datafiles.py:288:89: E501 line too long (89 > 88 characters) [flake8] This line isn't part of this contribution, but should I fix it anyway? |
Nope, you can ignore that, datafiles is one of those we don't care about re: PEP8. Darken doesn't know not to look at certain files (I think we can set up an file with some excludes, we probably should do that eventually). |
I'm just going to cycle CI again since we just merged a bunch of stuff, if that returns green I think it's good to go. |
Fixes #3841
Changes made in this Pull Request:
PR Checklist