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

Unclear Error When Using to_guess=['bonds'] with Existing Bonds in Topology #4759

Open
yuxuanzhuang opened this issue Oct 24, 2024 · 1 comment · May be fixed by #4761
Open

Unclear Error When Using to_guess=['bonds'] with Existing Bonds in Topology #4759

yuxuanzhuang opened this issue Oct 24, 2024 · 1 comment · May be fixed by #4761
Milestone

Comments

@yuxuanzhuang
Copy link
Contributor

Expected Behavior

The to_guess=['bonds'] option should work correctly even when bonds are already present in the topology. If bonds exist, the function should either skip guessing or provide an appropriate message, unless force_guess is explicitly set.

Actual Behavior

When attempting to use the new guesser with bonds already present in the topology, an unclear error message occurs:

AttributeError: 'NoneType' object has no attribute 'level'

This error does not provide sufficient information about the underlying issue.

Code to reproduce the behavior

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import CONECT

u = mda.Universe(CONECT, to_guess=['bonds'])

> AttributeError: 'NoneType' object has no attribute 'level'

u = mda.Universe(CONECT, force_guess=['bonds'])
print(u.atoms.bonds)
> <TopologyGroup containing 1922 bonds>

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)")
    2.8.0-dev0
  • Which version of Python (python -V)?
    3.11
  • Which operating system?
    MacOS
@lilyminium
Copy link
Member

Hmm, I think conceptually one should be able to guess bonds/angles/dihedrals etc. in the to_guess list, and have the behaviour differ from force_guess -- where MDA adds the guessed items additively with to_guess, and replaces existing bonds etc with force_guess. Thoughts? I prototyped something in #4761 but uncovered another bug in #4762

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 a pull request may close this issue.

3 participants