Skip to content

Commit

Permalink
Throw error if increment radical on a surface site.
Browse files Browse the repository at this point in the history
This shouldn't happen, but seems to be somehow.
Hopefully this Assert statement will catch the culprit.
  • Loading branch information
rwest committed Nov 17, 2019
1 parent 270e5fc commit b6b8751
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rmgpy/molecule/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ def increment_radical(self):
"""
# Set the new radical electron count
self.radical_electrons += 1
assert not self.is_surface_site(), "Attempted to increment radical count of a surface site."
if self.radical_electrons <= 0:
raise gr.ActionError('Unable to update Atom due to GAIN_RADICAL action: '
'Invalid radical electron set "{0}".'.format(self.radical_electrons))
Expand Down

0 comments on commit b6b8751

Please sign in to comment.