當前位置: 首頁>>代碼示例>>Python>>正文


Python group.GroupBond類代碼示例

本文整理匯總了Python中rmgpy.molecule.group.GroupBond的典型用法代碼示例。如果您正苦於以下問題:Python GroupBond類的具體用法?Python GroupBond怎麽用?Python GroupBond使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了GroupBond類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testIsSpecificCaseOf

 def testIsSpecificCaseOf(self):
     """
     Test the GroupBond.isSpecificCaseOf() method.
     """
     for order1 in self.orderList:
         for order2 in self.orderList:
             bond1 = GroupBond(None, None, order=order1)
             bond2 = GroupBond(None, None, order=order2)
             if order1 == order2 or all([o in order2 for o in order1]):
                 self.assertTrue(bond1.isSpecificCaseOf(bond2))
             else:
                 self.assertFalse(bond1.isSpecificCaseOf(bond2))
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:12,代碼來源:groupTest.py

示例2: testApplyActionDecrementBond

 def testApplyActionDecrementBond(self):
     """
     Test the GroupBond.applyAction() method for a CHANGE_BOND action.
     """
     action = ["CHANGE_BOND", "*1", -1, "*2"]
     for order0 in self.orderList:
         bond0 = GroupBond(None, None, order=order0)
         bond = bond0.copy()
         try:
             bond.applyAction(action)
         except ActionError:
             self.assertTrue("S" in order0 or "B" in order0)
開發者ID:ReactionMechanismGenerator,項目名稱:RMG-Py,代碼行數:12,代碼來源:groupTest.py

示例3: testApplyActionDecrementBond

 def testApplyActionDecrementBond(self):
     """
     Test the GroupBond.applyAction() method for a CHANGE_BOND action.
     """
     action = ['CHANGE_BOND', '*1', -1, '*2']
     for order0 in self.orderList:
         bond0 = GroupBond(None, None, order=order0)
         bond = bond0.copy()
         try:
             bond.applyAction(action)
         except ActionError:
             self.assertTrue(1 in order0 or 1.5 in order0)
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:12,代碼來源:groupTest.py

示例4: testApplyActionLoseRadical

 def testApplyActionLoseRadical(self):
     """
     Test the GroupBond.applyAction() method for a LOSE_RADICAL action.
     """
     action = ['LOSE_RADICAL', '*1', 1]
     for order0 in self.orderList:
         bond0 = GroupBond(None, None, order=order0)
         bond = bond0.copy()
         try:
             bond.applyAction(action)
             self.fail('GroupBond.applyAction() unexpectedly processed a LOSE_RADICAL action.')
         except ActionError:
             pass
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:13,代碼來源:groupTest.py

示例5: testApplyActionFormBond

 def testApplyActionFormBond(self):
     """
     Test the GroupBond.applyAction() method for a FORM_BOND action.
     """
     action = ['FORM_BOND', '*1', 1, '*2']
     for order0 in self.orderList:
         bond0 = GroupBond(None, None, order=order0)
         bond = bond0.copy()
         try:
             bond.applyAction(action)
             self.fail('GroupBond.applyAction() unexpectedly processed a FORM_BOND action.')
         except ActionError:
             pass
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:13,代碼來源:groupTest.py

示例6: testApplyActionGainRadical

 def testApplyActionGainRadical(self):
     """
     Test the GroupBond.applyAction() method for a GAIN_RADICAL action.
     """
     action = ["GAIN_RADICAL", "*1", 1]
     for order0 in self.orderList:
         bond0 = GroupBond(None, None, order=order0)
         bond = bond0.copy()
         try:
             bond.applyAction(action)
             self.fail("GroupBond.applyAction() unexpectedly processed a GAIN_RADICAL action.")
         except ActionError:
             pass
開發者ID:ReactionMechanismGenerator,項目名稱:RMG-Py,代碼行數:13,代碼來源:groupTest.py

示例7: testApplyActionBreakBond

 def testApplyActionBreakBond(self):
     """
     Test the GroupBond.applyAction() method for a BREAK_BOND action.
     """
     action = ["BREAK_BOND", "*1", "S", "*2"]
     for order0 in self.orderList:
         bond0 = GroupBond(None, None, order=order0)
         bond = bond0.copy()
         try:
             bond.applyAction(action)
             self.fail("GroupBond.applyAction() unexpectedly processed a BREAK_BOND action.")
         except ActionError:
             pass
開發者ID:ReactionMechanismGenerator,項目名稱:RMG-Py,代碼行數:13,代碼來源:groupTest.py

示例8: testEquivalent

 def testEquivalent(self):
     """
     Test the GroupBond.equivalent() method.
     """
     for order1 in self.orderList:
         for order2 in self.orderList:
             bond1 = GroupBond(None, None, order=order1)
             bond2 = GroupBond(None, None, order=order2)
             if order1 == order2 or (all([o in order2 for o in order1]) and all([o in order1 for o in order2])):
                 self.assertTrue(bond1.equivalent(bond2))
                 self.assertTrue(bond2.equivalent(bond1))
             else:
                 self.assertFalse(bond1.equivalent(bond2))
                 self.assertFalse(bond2.equivalent(bond1))
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:14,代碼來源:groupTest.py

示例9: testGetOrderStr

 def testGetOrderStr(self):
     """
     test the Bond.getOrderStr() method
     """
     bond = GroupBond(None,None,order = [1,2,3,1.5])
     self.assertEqual(bond.getOrderStr(),['S','D','T','B'])
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:6,代碼來源:groupTest.py

示例10: setUp

 def setUp(self):
     """
     A method called before each unit test in this class.
     """
     self.bond = GroupBond(None, None, order=[2])
     self.orderList = [[1], [2], [3], [1.5], [1,2], [2,1], [2,3], [1,2,3]]
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:6,代碼來源:groupTest.py

示例11: TestGroupBond

class TestGroupBond(unittest.TestCase):
    """
    Contains unit tests of the GroupBond class.
    """

    def setUp(self):
        """
        A method called before each unit test in this class.
        """
        self.bond = GroupBond(None, None, order=[2])
        self.orderList = [[1], [2], [3], [1.5], [1,2], [2,1], [2,3], [1,2,3]]
    
    def testGetOrderStr(self):
        """
        test the Bond.getOrderStr() method
        """
        bond = GroupBond(None,None,order = [1,2,3,1.5])
        self.assertEqual(bond.getOrderStr(),['S','D','T','B'])
        
    def testSetOrderStr(self):
        """
        test the Bond.setOrderStr() method
        """
        
        self.bond.setOrderStr(["B",'T'])
        self.assertEqual(set(self.bond.order), set([3,1.5]))
    
    def testGetOrderNum(self):
        """
        test the Bond.getOrderNum() method
        """
        self.assertEqual(self.bond.getOrderNum(),[2])
        
    def testSetOrderNum(self):
        """
        test the Bond.setOrderNum() method
        """
        
        self.bond.setOrderNum([3,1,2])
        self.assertEqual(self.bond.getOrderStr(),['T','S','D'])
    
    
    def testApplyActionBreakBond(self):
        """
        Test the GroupBond.applyAction() method for a BREAK_BOND action.
        """
        action = ['BREAK_BOND', '*1', 1, '*2']
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
                self.fail('GroupBond.applyAction() unexpectedly processed a BREAK_BOND action.')
            except ActionError:
                pass
    
    def testApplyActionFormBond(self):
        """
        Test the GroupBond.applyAction() method for a FORM_BOND action.
        """
        action = ['FORM_BOND', '*1', 1, '*2']
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
                self.fail('GroupBond.applyAction() unexpectedly processed a FORM_BOND action.')
            except ActionError:
                pass
    
    def testApplyActionIncrementBond(self):
        """
        Test the GroupBond.applyAction() method for a CHANGE_BOND action.
        """
        action = ['CHANGE_BOND', '*1', 1, '*2']
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
            except ActionError:
                self.assertTrue(3 in order0 or 1.5 in order0)
                
    def testApplyActionDecrementBond(self):
        """
        Test the GroupBond.applyAction() method for a CHANGE_BOND action.
        """
        action = ['CHANGE_BOND', '*1', -1, '*2']
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
            except ActionError:
                self.assertTrue(1 in order0 or 1.5 in order0)
            
    def testApplyActionGainRadical(self):
        """
        Test the GroupBond.applyAction() method for a GAIN_RADICAL action.
        """
#.........這裏部分代碼省略.........
開發者ID:wangyuran,項目名稱:RMG-Py,代碼行數:101,代碼來源:groupTest.py

示例12: setUp

 def setUp(self):
     """
     A method called before each unit test in this class.
     """
     self.bond = GroupBond(None, None, order=['D'])
     self.orderList = [['S'], ['D'], ['T'], ['B'], ['S','D'], ['D','S'], ['D','T'], ['S','D','T']]
開發者ID:Alborzi,項目名稱:RMG-Py,代碼行數:6,代碼來源:groupTest.py

示例13: setUp

 def setUp(self):
     """
     A method called before each unit test in this class.
     """
     self.bond = GroupBond(None, None, order=["D"])
     self.orderList = [["S"], ["D"], ["T"], ["B"], ["S", "D"], ["D", "S"], ["D", "T"], ["S", "D", "T"]]
開發者ID:ReactionMechanismGenerator,項目名稱:RMG-Py,代碼行數:6,代碼來源:groupTest.py

示例14: TestGroupBond

class TestGroupBond(unittest.TestCase):
    """
    Contains unit tests of the GroupBond class.
    """

    def setUp(self):
        """
        A method called before each unit test in this class.
        """
        self.bond = GroupBond(None, None, order=["D"])
        self.orderList = [["S"], ["D"], ["T"], ["B"], ["S", "D"], ["D", "S"], ["D", "T"], ["S", "D", "T"]]

    def testApplyActionBreakBond(self):
        """
        Test the GroupBond.applyAction() method for a BREAK_BOND action.
        """
        action = ["BREAK_BOND", "*1", "S", "*2"]
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
                self.fail("GroupBond.applyAction() unexpectedly processed a BREAK_BOND action.")
            except ActionError:
                pass

    def testApplyActionFormBond(self):
        """
        Test the GroupBond.applyAction() method for a FORM_BOND action.
        """
        action = ["FORM_BOND", "*1", "S", "*2"]
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
                self.fail("GroupBond.applyAction() unexpectedly processed a FORM_BOND action.")
            except ActionError:
                pass

    def testApplyActionIncrementBond(self):
        """
        Test the GroupBond.applyAction() method for a CHANGE_BOND action.
        """
        action = ["CHANGE_BOND", "*1", 1, "*2"]
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
            except ActionError:
                self.assertTrue("T" in order0 or "B" in order0)

    def testApplyActionDecrementBond(self):
        """
        Test the GroupBond.applyAction() method for a CHANGE_BOND action.
        """
        action = ["CHANGE_BOND", "*1", -1, "*2"]
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
            except ActionError:
                self.assertTrue("S" in order0 or "B" in order0)

    def testApplyActionGainRadical(self):
        """
        Test the GroupBond.applyAction() method for a GAIN_RADICAL action.
        """
        action = ["GAIN_RADICAL", "*1", 1]
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
                self.fail("GroupBond.applyAction() unexpectedly processed a GAIN_RADICAL action.")
            except ActionError:
                pass

    def testApplyActionLoseRadical(self):
        """
        Test the GroupBond.applyAction() method for a LOSE_RADICAL action.
        """
        action = ["LOSE_RADICAL", "*1", 1]
        for order0 in self.orderList:
            bond0 = GroupBond(None, None, order=order0)
            bond = bond0.copy()
            try:
                bond.applyAction(action)
                self.fail("GroupBond.applyAction() unexpectedly processed a LOSE_RADICAL action.")
            except ActionError:
                pass

    def testEquivalent(self):
        """
        Test the GroupBond.equivalent() method.
        """
        for order1 in self.orderList:
            for order2 in self.orderList:
#.........這裏部分代碼省略.........
開發者ID:ReactionMechanismGenerator,項目名稱:RMG-Py,代碼行數:101,代碼來源:groupTest.py


注:本文中的rmgpy.molecule.group.GroupBond類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。