Skip to content

Conversation

@hansonbjiang
Copy link

Changes

Fix AttributeError when minimize is run without first running addcharge. Now raises UserError with helpful message instead of crashing.

  • Use getattr() to safely access gaff_type and charge attributes
  • Raise UserError when gaff_type is missing (instead of AttributeError)
  • Add unit tests to verify the fix

How to reproduce it:

  1. build start atom "custom built"
  2. minimize #1 dockprep false maxSteps 1000 liveUpdates true

The error showed as
Screenshot 2026-01-02 at 8 08 54 PM

   Fix AttributeError when minimize is run without first running addcharge.
   Now raises UserError with helpful message instead of crashing.

   - Use getattr() to safely access gaff_type and charge attributes
   - Raise UserError when gaff_type is missing (instead of AttributeError)
   - Add unit tests to verify the fix
e-pettersen added a commit that referenced this pull request Jan 6, 2026
AttributeError when gaff_type/charge attribute(s) missing, but unlike that
request, don't silently treat missing charge attributes as zero.
@e-pettersen
Copy link
Collaborator

I am not explicitly accepting this pull request because I do not want missing charge attributes to be silently treated as zero. Nonetheless, I have implemented basically the same logic without the implicit zero charges with this change: 964d1bb

I accepted the test file as is. Thanks for the idea and the code contribution.

@e-pettersen e-pettersen closed this Jan 6, 2026
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.

2 participants