Skip to content

Commit

Permalink
Don't add radicals or lone pairs to surface sites.
Browse files Browse the repository at this point in the history
This may hide bugs, or it may be exactly the right
thing to do. I'm not entirely sure.
But it currently seems like a good idea.

The presumption is: 
surface sites of metals should not have unpaired
or pairs of electrons - they just have a big sea
of delocalized electrons at their disposal.
  • Loading branch information
rwest committed Nov 17, 2019
1 parent b6b8751 commit b727616
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rmgpy/molecule/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ def increment_radical(self):
where `radical` specifies the number of radical electrons to add.
"""
# Set the new radical electron count
if self.is_surface_site(): return # do nothing
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 All @@ -422,6 +422,7 @@ def decrement_radical(self):
where `radical` specifies the number of radical electrons to remove.
"""
cython.declare(radical_electrons=cython.short)
if self.is_surface_site(): return # do nothing
# Set the new radical electron count
radical_electrons = self.radical_electrons = self.radical_electrons - 1
if radical_electrons < 0:
Expand All @@ -444,6 +445,7 @@ def increment_lone_pairs(self):
Update the lone electron pairs pattern as a result of applying a GAIN_PAIR action.
"""
# Set the new lone electron pairs count
if self.is_surface_site(): return # do nothing
self.lone_pairs += 1
if self.lone_pairs <= 0:
raise gr.ActionError('Unable to update Atom due to GAIN_PAIR action: '
Expand All @@ -454,6 +456,7 @@ def decrement_lone_pairs(self):
"""
Update the lone electron pairs pattern as a result of applying a LOSE_PAIR action.
"""
if self.is_surface_site(): return # do nothing
# Set the new lone electron pairs count
self.lone_pairs -= 1
if self.lone_pairs < 0:
Expand Down

0 comments on commit b727616

Please sign in to comment.