diff --git a/rmgpy/rmg/modelTest.py b/rmgpy/rmg/modelTest.py index 184edd7ab7e..060307dfa5a 100644 --- a/rmgpy/rmg/modelTest.py +++ b/rmgpy/rmg/modelTest.py @@ -396,7 +396,7 @@ def testInflate(self): """ spcA = Species().fromSMILES('[OH]') spcs = [Species().fromSMILES('CC'), Species().fromSMILES('[CH3]')] - spcTuples = [(spcA, spc) for spc in spcs] + spcTuples = [((spcA, spc), 'H_Abstraction') for spc in spcs] rxns = list(react(*spcTuples)) diff --git a/rmgpy/rmg/reactTest.py b/rmgpy/rmg/reactTest.py index 5e049f0f003..3254b42629c 100644 --- a/rmgpy/rmg/reactTest.py +++ b/rmgpy/rmg/reactTest.py @@ -38,7 +38,7 @@ from rmgpy.species import Species from rmgpy.rmg.main import RMG -from rmgpy.rmg.react import react, react_all, deflate, deflateReaction +from rmgpy.rmg.react import react, react_all ################################################### @@ -85,68 +85,6 @@ def testReactMultiproc(self): self.assertIsNotNone(reactionList) self.assertTrue(all([isinstance(rxn, TemplateReaction) for rxn in reactionList])) - def testDeflate(self): - """ - Test that reaction deflate function works. - """ - molA = Species().fromSMILES('[OH]') - molB = Species().fromSMILES('CC') - molC = Species().fromSMILES('[CH3]') - - reactants = [molA, molB] - - # both reactants were already part of the core: - reactantIndices = [1, 2] - - rxn = Reaction(reactants=[molA, molB], products=[molC], - pairs=[(molA, molC), (molB, molC)]) - - deflate([rxn], reactants, reactantIndices) - - for spc, t in zip(rxn.reactants, [int, int]): - self.assertTrue(isinstance(spc, t)) - self.assertEquals(rxn.reactants, reactantIndices) - for spc in rxn.products: - self.assertTrue(isinstance(spc, Species)) - - # one of the reactants was not yet part of the core: - reactantIndices = [-1, 2] - - rxn = Reaction(reactants=[molA, molB], products=[molC], - pairs=[(molA, molC), (molB, molC)]) - - deflate([rxn], reactants, reactantIndices) - - for spc, t in zip(rxn.reactants, [Species, int]): - self.assertTrue(isinstance(spc, t)) - for spc in rxn.products: - self.assertTrue(isinstance(spc, Species)) - - def testReactStoreIndices(self): - """ - Test that reaction generation keeps track of the original species indices. - """ - - indices = {'[OH]':1, 'CC':2, '[CH3]':3} - - # make it bidirectional so that we can look-up indices as well: - revd=dict([reversed(i) for i in indices.items()]) - indices.update(revd) - - spcA = Species(index=indices['[OH]']).fromSMILES('[OH]') - spcs = [Species(index=indices['CC']).fromSMILES('CC'), - Species(index=indices['[CH3]']).fromSMILES('[CH3]')] - - spcTuples = [(spcA, spc) for spc in spcs] - - reactionList = list(react(*spcTuples)) - self.assertIsNotNone(reactionList) - self.assertEquals(len(reactionList), 3) - for rxn in reactionList: - for i, reactant in enumerate(rxn.reactants): - rxn.reactants[i] = Molecule().fromSMILES(indices[reactant]) - self.assertTrue(rxn.isBalanced()) - def testReactAll(self): """ Test that the reactAll function works. @@ -166,44 +104,6 @@ def testReactAll(self): self.assertIsNotNone(rxns) self.assertTrue(all([isinstance(rxn, TemplateReaction) for rxn in rxns])) - def testDeflateReaction(self): - """ - Test if the deflateReaction function works. - """ - - molA = Species().fromSMILES('[OH]') - molB = Species().fromSMILES('CC') - molC = Species().fromSMILES('[CH3]') - - # both reactants were already part of the core: - reactantIndices = [1, 2] - molDict = {molA.molecule[0]: 1, molB.molecule[0]: 2} - - rxn = Reaction(reactants=[molA, molB], products=[molC], - pairs=[(molA, molC), (molB, molC)]) - - deflateReaction(rxn, molDict) - - for spc, t in zip(rxn.reactants, [int, int]): - self.assertTrue(isinstance(spc, t)) - self.assertEquals(rxn.reactants, reactantIndices) - for spc in rxn.products: - self.assertTrue(isinstance(spc, Species)) - - # one of the reactants was not yet part of the core: - reactantIndices = [-1, 2] - molDict = {molA.molecule[0]: molA, molB.molecule[0]: 2} - - rxn = Reaction(reactants=[molA, molB], products=[molC], - pairs=[(molA, molC), (molB, molC)]) - - deflateReaction(rxn, molDict) - - for spc, t in zip(rxn.reactants, [Species, int]): - self.assertTrue(isinstance(spc, t), 'Species {} is not of type {}'.format(spc,t)) - for spc in rxn.products: - self.assertTrue(isinstance(spc, Species)) - def tearDown(self): """ Reset the loaded database