Skip to content

Commit

Permalink
Fixed (hid?) bug in calculateBondSymmetryNumber().
Browse files Browse the repository at this point in the history
The function Structure.split() returns a list of structures that result from
the splitting. In calculateBondSymmetryNumber(), this function was assumed to
return exactly two structures, which it should if things are going normally.
However, this behavior is not guaranteed, so a check was added to ensure that
exactly two structures are returned from split(). If not, the function returns
1, which is as if it was not called for that bond.
  • Loading branch information
jwallen committed Dec 21, 2009
1 parent aaa94eb commit 0d83783
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/rmg/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,10 @@ def calculateBondSymmetryNumber(self, bond):
else:
structure = Structure(self.atoms(), self.bonds())
structure.removeBond(bond)
structure1, structure2 = structure.split()

structures = structure.split()
if len(structures) != 2: return symmetryNumber

structure1, structure2 = structures
if bond.atoms[0] in structure1.atoms(): structure1.removeAtom(bond.atoms[0])
if bond.atoms[1] in structure1.atoms(): structure1.removeAtom(bond.atoms[1])
if bond.atoms[0] in structure2.atoms(): structure2.removeAtom(bond.atoms[0])
Expand Down

0 comments on commit 0d83783

Please sign in to comment.