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

Deprecate guess_bonds and bond guessing kwargs in Universe #4757

Merged
merged 6 commits into from
Oct 26, 2024

Conversation

lilyminium
Copy link
Member

@lilyminium lilyminium commented Oct 20, 2024

Fixes #4756

Changes made in this Pull Request:

  • Adds deprecation warning to bond keywords

PR Checklist

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

Developers certificate of origin


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

@pep8speaks
Copy link

pep8speaks commented Oct 20, 2024

Hello @lilyminium! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 296:1: W293 blank line contains whitespace
Line 453:80: E501 line too long (81 > 79 characters)

Comment last updated at 2024-10-26 09:43:41 UTC

Copy link

codecov bot commented Oct 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.57%. Comparing base (d7153b9) to head (8465031).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4757      +/-   ##
===========================================
- Coverage    93.59%   93.57%   -0.03%     
===========================================
  Files          177      189      +12     
  Lines        21708    22775    +1067     
  Branches      3052     3052              
===========================================
+ Hits         20318    21312     +994     
- Misses         943     1016      +73     
  Partials       447      447              

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

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.

I only have minor documentation update requests, otherwise looks good.

package/CHANGELOG Outdated Show resolved Hide resolved
"Bond guessing through the `guess_bonds` keyword is deprecated"
" and will be removed in MDAnalysis 3.0. "
"Instead, pass 'bonds', 'angles', and 'dihedrals' to "
"the `to_guess` keyword in Universe for guessing these. "
Copy link
Member

Choose a reason for hiding this comment

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

add a

.. deprecated:: 2.8.0
   Will be removed in 3.0.0. Pass pass into Context creation or Universe.guess_TopologyAttrs.

under each of the deprecated keyword args fudge_factor, vdwradii, lower_bound. Link to Context docs and guess_TopologyAttrs.

Copy link
Member

Choose a reason for hiding this comment

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

Be specific about where the kwargs should go, either Context or guess_TopologyAttrs.

Copy link
Contributor

Choose a reason for hiding this comment

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

A few extra thoughts:

  1. The order of the attributes in ['bonds', 'angles', 'dihedrals'] is important because later attributes depend on the earlier ones. We may want to implement a function that automatically reorders the guessing sequence to ensure proper dependencies are respected?
    2. The correct usage should be force_guess=['bonds', 'angles', 'dihedrals'] instead of to_guess. Refer to Unclear Error When Using to_guess=['bonds'] with Existing Bonds in Topology #4759

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the connectivity topology attrs do have dependencies built in, happily -- there's an existing test that guesses angles without bonds (

def test_guess_angles_with_no_bonds():
"Test guessing angles for atoms with no bonds"
" information without adding bonds to universe "
u = mda.Universe(datafiles.two_water_gro)
u.guess_TopologyAttrs(to_guess=['angles'])
assert hasattr(u, 'angles')
assert not hasattr(u, 'bonds')
). I think that means we don't need to specify the dependencies in order. Hmm... I should add a test that guessing angles/dihedrals does respect the vdwradii, etc. keywords used to control bond guessing though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added in #4761

package/MDAnalysis/core/universe.py Show resolved Hide resolved
"Bond guessing through the `guess_bonds` keyword is deprecated"
" and will be removed in MDAnalysis 3.0. "
"Instead, pass 'bonds', 'angles', and 'dihedrals' to "
"the `to_guess` keyword in Universe for guessing these. "
Copy link
Contributor

Choose a reason for hiding this comment

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

A few extra thoughts:

  1. The order of the attributes in ['bonds', 'angles', 'dihedrals'] is important because later attributes depend on the earlier ones. We may want to implement a function that automatically reorders the guessing sequence to ensure proper dependencies are respected?
    2. The correct usage should be force_guess=['bonds', 'angles', 'dihedrals'] instead of to_guess. Refer to Unclear Error When Using to_guess=['bonds'] with Existing Bonds in Topology #4759

@IAlibay IAlibay added this to the Release 2.8.0 milestone Oct 24, 2024
@lilyminium
Copy link
Member Author

Thanks for the reviews @orbeckst and @yuxuanzhuang! Do the updates resolve your concerns?

Copy link
Contributor

@yuxuanzhuang yuxuanzhuang left a comment

Choose a reason for hiding this comment

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

lgtm!

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.

lgtm, thx

package/MDAnalysis/core/universe.py Outdated Show resolved Hide resolved
@IAlibay IAlibay merged commit 52ff77b into MDAnalysis:develop Oct 26, 2024
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bond guessing double specified in Universe.__init__
5 participants