本文整理匯總了Python中rmgpy.molecule.group.GroupAtom.isSpecificCaseOf方法的典型用法代碼示例。如果您正苦於以下問題:Python GroupAtom.isSpecificCaseOf方法的具體用法?Python GroupAtom.isSpecificCaseOf怎麽用?Python GroupAtom.isSpecificCaseOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rmgpy.molecule.group.GroupAtom
的用法示例。
在下文中一共展示了GroupAtom.isSpecificCaseOf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testIsSpecificCaseOf
# 需要導入模塊: from rmgpy.molecule.group import GroupAtom [as 別名]
# 或者: from rmgpy.molecule.group.GroupAtom import isSpecificCaseOf [as 別名]
def testIsSpecificCaseOf(self):
"""
Test the GroupAtom.isSpecificCaseOf() 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")
# And make more generic types of these two atoms
atom1gen = GroupAtom(atomType=[atomType1], radicalElectrons=[0, 1], charge=[0, 1], label="*1")
atom2gen = GroupAtom(atomType=[atomType2], radicalElectrons=[0, 1], charge=[0, 1], label="*1")
if label1 == label2 or atomType2 in atomType1.generic:
self.assertTrue(
atom1.isSpecificCaseOf(atom2), "{0!s} is not a specific case of {1!s}".format(atom1, atom2)
)
self.assertTrue(
atom1.isSpecificCaseOf(atom2gen),
"{0!s} is not a specific case of {1!s}".format(atom1, atom2gen),
)
self.assertFalse(
atom1gen.isSpecificCaseOf(atom2), "{0!s} is a specific case of {1!s}".format(atom1gen, atom2)
)
else:
self.assertFalse(
atom1.isSpecificCaseOf(atom2), "{0!s} is a specific case of {1!s}".format(atom1, atom2)
)
self.assertFalse(
atom1.isSpecificCaseOf(atom2gen), "{0!s} is a specific case of {1!s}".format(atom1, atom2gen)
)
self.assertFalse(
atom1gen.isSpecificCaseOf(atom2), "{0!s} is a specific case of {1!s}".format(atom1gen, atom2)
)