本文整理汇总了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))