4545
4646import rmgpy .constants as constants
4747from rmgpy .thermo import NASAPolynomial , NASA , ThermoData , Wilhoit
48- from rmgpy .molecule import Molecule , Atom , Bond , Group
48+ from rmgpy .molecule import Molecule , Bond , Group
4949import rmgpy .molecule
5050from rmgpy .species import Species
5151
52- from rmgpy .scoop_framework .util import get
53-
5452#: This dictionary is used to add multiplicity to species label
5553_multiplicity_labels = {1 :'S' ,2 :'D' ,3 :'T' ,4 :'Q' ,5 :'V' ,}
5654
@@ -250,8 +248,7 @@ def averageThermoData(thermoDataList=None):
250248 """
251249 if thermoDataList is None :
252250 thermoDataList = []
253-
254- import copy
251+
255252 numValues = len (thermoDataList )
256253
257254 if numValues == 0 :
@@ -260,10 +257,10 @@ def averageThermoData(thermoDataList=None):
260257 logging .debug ('Averaging thermo data over {0} value(s).' .format (numValues ))
261258
262259 if numValues == 1 :
263- return copy . deepcopy (thermoDataList [0 ])
260+ return deepcopy (thermoDataList [0 ])
264261
265262 else :
266- averagedThermoData = copy . deepcopy (thermoDataList [0 ])
263+ averagedThermoData = deepcopy (thermoDataList [0 ])
267264 for thermoData in thermoDataList [1 :]:
268265 averagedThermoData = addThermoData (averagedThermoData , thermoData )
269266
@@ -337,7 +334,6 @@ def convertRingToSubMolecule(ring):
337334 This function takes a ring structure (can either be monoring or polyring) to create a new
338335 submolecule with newly deep copied atoms
339336 """
340- from rmgpy .molecule .molecule import Molecule , Bond
341337
342338 atomsMapping = {}
343339 for atom in ring :
@@ -359,8 +355,6 @@ def combineTwoRingsIntoSubMolecule(ring1, ring2):
359355 submolecule with newly deep copied atoms
360356 """
361357
362- from rmgpy .molecule .molecule import Molecule , Bond
363-
364358 assert len (commonAtoms (ring1 , ring2 ))> 0 , "The two input rings don't have common atoms."
365359
366360 atomsMapping = {}
@@ -680,7 +674,7 @@ def removeGroup(self, groupToRemove):
680674 parentR = groupToRemove .parent
681675
682676 #look for other pointers that point toward entry
683- for entryName , entry in self .entries .iteritems ():
677+ for entry in self .entries .itervalues ():
684678 if isinstance (entry .data , basestring ):
685679 if entry .data == groupToRemove .label :
686680 #if the entryToRemove.data is also a pointer, then copy
@@ -1051,7 +1045,7 @@ def getThermoData(self, species, trainingSet=None):
10511045
10521046 try :
10531047 quantumMechanics = getInput ('quantumMechanics' )
1054- except Exception , e :
1048+ except Exception :
10551049 logging .debug ('Quantum Mechanics DB could not be found.' )
10561050 quantumMechanics = None
10571051
@@ -1239,12 +1233,12 @@ def getThermoDataFromDepository(self, species):
12391233 Returns: a list of tuples (thermoData, depository, entry) without any Cp0 or CpInf data.
12401234 """
12411235 items = []
1242- for label , entry in self .depository ['stable' ].entries .iteritems ():
1236+ for entry in self .depository ['stable' ].entries .itervalues ():
12431237 for molecule in species .molecule :
12441238 if molecule .isIsomorphic (entry .item ):
12451239 items .append ((deepcopy (entry .data ), self .depository ['stable' ], entry ))
12461240 break
1247- for label , entry in self .depository ['radical' ].entries .iteritems ():
1241+ for entry in self .depository ['radical' ].entries .itervalues ():
12481242 for molecule in species .molecule :
12491243 if molecule .isIsomorphic (entry .item ):
12501244 items .append ((deepcopy (entry .data ), self .depository ['radical' ], entry ))
@@ -1263,7 +1257,7 @@ def getThermoDataFromLibrary(self, species, library):
12631257 Returns a tuple: (ThermoData, library, entry) or None.
12641258 """
12651259 match = None
1266- for label , entry in library .entries .iteritems ():
1260+ for entry in library .entries .itervalues ():
12671261 for molecule in species .molecule :
12681262 if molecule .isIsomorphic (entry .item ) and entry .data is not None :
12691263 thermoData = deepcopy (entry .data )
@@ -1685,8 +1679,7 @@ def __addRingCorrectionThermoDataFromTree(self, thermoData, ring_database, molec
16851679 if thermoData is None :
16861680 return data , node , isPartialMatch
16871681 else :
1688- return addThermoData (thermoData , data , groupAdditivity = True , verbose = True ), node , isPartialMatch
1689- return addThermoData (thermoData , data , groupAdditivity = True , verbose = True ), node
1682+ return addThermoData (thermoData , data , groupAdditivity = True , verbose = True ), node , isPartialMatch
16901683 # By setting verbose=True, we turn on the comments of ring correction to pass the unittest.
16911684 # Typically this comment is very short and also very helpful to check if the ring correction is calculated correctly.
16921685
0 commit comments