本文整理匯總了Python中rmgpy.molecule.group.GroupAtom.equivalent方法的典型用法代碼示例。如果您正苦於以下問題:Python GroupAtom.equivalent方法的具體用法?Python GroupAtom.equivalent怎麽用?Python GroupAtom.equivalent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rmgpy.molecule.group.GroupAtom
的用法示例。
在下文中一共展示了GroupAtom.equivalent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testEquivalent
# 需要導入模塊: from rmgpy.molecule.group import GroupAtom [as 別名]
# 或者: from rmgpy.molecule.group.GroupAtom import equivalent [as 別名]
def testEquivalent(self):
"""
Test the GroupAtom.equivalent() method.
"""
for label1, atomType1 in atomTypes.iteritems():
for label2, atomType2 in atomTypes.iteritems():
atom1 = GroupAtom(atomType=[atomType1], radicalElectrons=[1], charge=[0], label="*1")
atom2 = GroupAtom(atomType=[atomType2], radicalElectrons=[1], charge=[0], label="*1")
if label1 == label2 or atomType2 in atomType1.generic or atomType1 in atomType2.generic:
self.assertTrue(atom1.equivalent(atom2), "{0!s} is not equivalent to {1!s}".format(atom1, atom2))
self.assertTrue(atom2.equivalent(atom1), "{0!s} is not equivalent to {1!s}".format(atom2, atom1))
else:
self.assertFalse(atom1.equivalent(atom2), "{0!s} is equivalent to {1!s}".format(atom1, atom2))
self.assertFalse(atom2.equivalent(atom1), "{0!s} is equivalent to {1!s}".format(atom2, atom1))
# Now see if charge and radical count are checked properly
for charge in range(3):
for radicals in range(2):
atom3 = GroupAtom(atomType=[atomType1], radicalElectrons=[radicals], charge=[charge], label="*1")
if radicals == 1 and charge == 0:
self.assertTrue(
atom1.equivalent(atom3), "{0!s} is not equivalent to {1!s}".format(atom1, atom3)
)
self.assertTrue(
atom1.equivalent(atom3), "{0!s} is not equivalent to {1!s}".format(atom3, atom1)
)
else:
self.assertFalse(atom1.equivalent(atom3), "{0!s} is equivalent to {1!s}".format(atom1, atom3))
self.assertFalse(atom1.equivalent(atom3), "{0!s} is equivalent to {1!s}".format(atom3, atom1))