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

Bond-Angle-Torsions coordinate module #2668

Merged
merged 55 commits into from
Jul 1, 2020

Conversation

daveminh
Copy link
Contributor

@daveminh daveminh commented Apr 22, 2020

Changes made in this Pull Request:

I've written a module that will convert coordinates between a Cartesian and a Bond-Angle-Torsion coordinate system.

PR Checklist

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

@codecov
Copy link

codecov bot commented Apr 22, 2020

Codecov Report

Merging #2668 into develop will increase coverage by 0.03%.
The diff coverage is 96.95%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2668      +/-   ##
===========================================
+ Coverage    92.18%   92.22%   +0.03%     
===========================================
  Files          183      184       +1     
  Lines        23977    24141     +164     
  Branches      3090     3123      +33     
===========================================
+ Hits         22104    22263     +159     
- Misses        1808     1813       +5     
  Partials        65       65              
Impacted Files Coverage Δ
package/MDAnalysis/analysis/bat.py 96.95% <96.95%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d95282...7431ea2. Read the comment docs.

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.

@daveminh this looks like a very cool contribution! Would it make sense for this to also be available as a on the fly transformation?

package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Show resolved Hide resolved
@richardjgowers richardjgowers self-assigned this Apr 23, 2020
@daveminh
Copy link
Contributor Author

@daveminh this looks like a very cool contribution! Would it make sense for this to also be available as a on the fly transformation?

Thanks for the useful feedback! I will work on addressing each point. This is my first contribution to the project (and actually any community-run open-source project), so I am unfamiliar with some of the practices.

@daveminh
Copy link
Contributor Author

@daveminh this looks like a very cool contribution! Would it make sense for this to also be available as a on the fly transformation?

I'm open to the idea, but I don't think it makes sense as an on-the-fly transformation because it doesn't change the Cartesian coordinates of the system.

@daveminh
Copy link
Contributor Author

The latest commit should resolve all issues except for inclusion in duecredit

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Sorry that review has been taking a while, we were pretty busy with GSoC. I have primarily requests for improving the documentation, see inline comments. Additionally:

  • Your test coverage is still a bit low so you should check the coverage report to see which lines are not covered yet.
  • You checked in a duecredit file and some profraw files; they should be removed.
  • The documentation build failed (see #2238.6) because you still need to reference your bat.rst in the Structure section of package/doc/sphinx/source/documentation_pages/analysis_modules.rst.

package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
testsuite/MDAnalysisTests/analysis/test_bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Show resolved Hide resolved
Copy link
Member

@orbeckst orbeckst 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 addressing my earlier comments.

  • Make BAT.bat a numpy array unless there's a really good reason for a list of np arrays.
  • There are a number of API things where I would like your new class behave more like other classes.
  • We removed almost all load/save methods (see remove save() methods from analysis classes #1745 for details), but in this case it might be justified to keep them. But then load/save need some sanity checks.
  • Various doc things – see comments.

package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
daveminh and others added 3 commits June 17, 2020 18:43
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Thanks. A few more comments inline – some minor formatting and one question regarding renaming of self.bat to perhaps self.bat_trajectory.

package/MDAnalysis/analysis/bat.py Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
ag must have a bonds attribute. If not available,
bonds may be guessed using
:meth:`AtomGroup.guess_bonds <MDAnalysis.core.groups.AtomGroup.guess_bonds>`.
ag must only include one molecule.
Copy link
Member

Choose a reason for hiding this comment

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

Adding the mark-up makes it clear to users that you're referring to the argument from the docs.

package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/bat.py Outdated Show resolved Hide resolved
@orbeckst
Copy link
Member

Looks good to me, @daveminh . I assume when you build the docs locally they look ok? If you want to reorganize your commit history in a few (<5) commits that stand on their own (e.g., feature, tests, CHANGELOG+AUTHORS) then please rewrite your history. Otherwise we will squash everything into a single commit and do a merge.

@richardjgowers any final comments?

@orbeckst
Copy link
Member

orbeckst commented Jun 18, 2020

Regarding OTF transformations (#2668 (review)) one could start thinking about something where you use BAT, modify internal coordinates on the fly, and then pass that as the actual coordinates. Similarly, one could provide BAT as an AUXReader to have the internal coordinates as a parallel trajectory. But that's all beyond the current PR.

Another future improvement might be to select the correct BAT for a given atom – this is currently really complicated because there isn't a 1-to-1 correspondence between the BAT 3N array and the atoms. Not sure what this "topology-like" data structure would be but it could mirror our standard topology.

EDIT: Maybe not really complicated, but more "requires more work than it should to figure out offsets in self.bat".

@daveminh
Copy link
Contributor Author

I see no need to reorganize the history, so please go ahead and squash everything into one commit and do a merge.

Oliver and Richard, thanks for looking things over carefully several times! I've never had code reviewed so thoroughly before. I've also never tried many of the software engineering practices. It was tedious the first time but I'm sure with practice it'll be easier. In time, I hope to be able to develop code that's more broadly useful in the scientific community and better guide my group members to do the same.

Presently I'm not personally planning to pursue more work with BAT itself. Rather I am using it as a stepping stone to a new(ish) class of end-point free energy calculations. I'll probably put in a new pull request around the time I'm ready to submit a paper.

@daveminh
Copy link
Contributor Author

I'm just checking in on this.

@orbeckst
Copy link
Member

ping @richardjgowers

@orbeckst orbeckst dismissed richardjgowers’s stale review July 1, 2020 07:42

stale review, as far as I can tell @richarjgower's requests were addressed

@orbeckst
Copy link
Member

orbeckst commented Jul 1, 2020

@daveminh can you please fix the conflict in CHANGELOG?

I can't do it for you because I don't have permission to modify your branch. There's a way to enable this and then I could have done it myself.

Please ping me when the PR is mergeable and the CI is green. Thanks.

@orbeckst orbeckst self-assigned this Jul 1, 2020
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Sorry to be pedantic, but the CHANGELOG got slightly messed up. Please fix – many thanks.

I'll squash and merge afterwards. Thanks for your patience!

package/CHANGELOG Show resolved Hide resolved
package/CHANGELOG Outdated Show resolved Hide resolved
daveminh and others added 2 commits July 1, 2020 06:57
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
@orbeckst orbeckst merged commit 8314f7d into MDAnalysis:develop Jul 1, 2020
@orbeckst
Copy link
Member

orbeckst commented Jul 1, 2020

Thank you and congratulations for your first contribution to MDAnalysis, @daveminh ! I also sent you an invitation as a MDAnalysis/contributor.

BAT will be in 2.0.0. 🎉

If there are issues related to the module then we will almost certainly ping you and possibly ask you for comments or code reviews. It really helps when original code authors respond so that we can quickly address issues so please look out for @-mentions from MDAnalysis.

@daveminh daveminh deleted the This-is-lame branch July 1, 2020 23:22
PicoCentauri pushed a commit to PicoCentauri/mdanalysis that referenced this pull request Mar 30, 2021
* new MDAnalysis.analysis.bat module: convert between internal bond-angle-torsion and
   Cartesian coordinates (based on published research)
   * standard analysis class
   * can load and save results (numpy format)
   * references with duecredit
* tests
* docs with example
* update CHANGELOG and AUTHORS
IAlibay added a commit that referenced this pull request Dec 18, 2023
orbeckst added a commit that referenced this pull request Dec 21, 2023
Update of AUTHORS and CHANGELOG with inferred author contributions.

*  Removed duplicate mattwthompson in 0.20.0 changelog entry.: mattwthompson was placed twice by accident, this removes this duplication.

* Addition of missing authors.

   An retrospective analysis of the authors found via `git shortlog -s -n --email --branches="develop"` found several commits by authors which were not present in the `AUTHORS.md` file.

    - Zhenbo Li: commited via PR: Started tests for gnm. #803 and Make Travis run tests on OSX. #771,
    - Jenna M. Swarthout via PR Update CoC according to suggestions from current CoC committee #4289 and Point to new reporting form link (owned by conduct@mdanalysis.org) #4298,
    - Bradley Dice via PR   Fix GSD Windows compatibility #2384 ,
    - David Minh via PR #2668

   There seemed to be no indications in the above mentioned PRs that the author did not want to be in the authors file, it looks like it was just forgotten.

* Addition of missing entries from the changelog

   Continued cross referencing of the git shortlog output but also accounting for the changelog identified several individuals that had not been included in the changelog entries for the release they contributed under. They were added to the relevant entry of the changelog based on the merge commit date.

   Please note that for Tone Bengsten, we a) had no github handle (so they were assigned @tbengtsen), and b) no specific commit. Given we know that this individual was including alongside the encore merge, they were assigned to the 0.16.0 release.

* Update CHANGELOG
* PR #1218
* PR #1284 and #1408
* PR #4109
* based on git history
* PRs #803 and #771 (author addition, changelog addition)
* PR #2255 and #2221
* PR #1225
* PR #4289 and #4298
* PR #4031
* PR #4085
* PR #3635
* PR #2356
* PR #2559
* No GH handle - Encore author addition @tbengtsen
* PR #4184
* PR #2614
* PR #2219
* PR #2384
* PR #2668
* Add missing entry for Jenna

Thanks to @fiona-naughton for helping out with digging into this data :)

Co-authored-by: Fiona Naughton <fiona@mdanalysis.org>
Co-authored-by: Oliver Beckstein <orbeckst@mdanalysis.org>
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