@@ -604,7 +604,10 @@ def getThermoData(self, species):
604604 """
605605 # Check the libraries in order first; return the first successful match
606606 thermoData = self .getThermoDataFromLibraries (species )
607- if thermoData is None :
607+ if thermoData is not None :
608+ assert len (thermoData )== 3 , "thermoData should be a tuple at this point, eg. (thermoData, library, entry)"
609+ thermoData = thermoData [0 ]
610+ else :
608611 # Thermo not found in any loaded libraries, so estimate
609612 thermoData = self .getThermoDataFromGroups (species )
610613
@@ -631,7 +634,8 @@ def getThermoDataFromLibraries(self, species):
631634 for label in self .libraryOrder :
632635 thermoData = self .getThermoDataFromLibrary (species , self .libraries [label ])
633636 if thermoData is not None :
634- thermoData .comment = label
637+ assert len (thermoData ) == 3 , "thermoData should be a tuple at this point"
638+ thermoData [0 ].comment += label
635639 return thermoData
636640 return None
637641
@@ -657,7 +661,8 @@ def getAllThermoData(self, species):
657661 first, then the libraries (in order), and then the group additivity
658662 estimate. This method is useful for a generic search job.
659663
660- Returns: a list of ThermoData
664+ Returns: a list of tuples (ThermoData, source, entry)
665+ (Source is a library or depository, or None)
661666 """
662667 thermoDataList = []
663668 # Data from depository comes first
@@ -666,10 +671,13 @@ def getAllThermoData(self, species):
666671 for label in self .libraryOrder :
667672 data = self .getThermoDataFromLibrary (species , self .libraries [label ])
668673 if data :
669- data .comment = label
674+ assert len (data ) == 3 , "thermoData should be a tuple at this point"
675+ data [0 ].comment += label
670676 thermoDataList .append (data )
671677 # Last entry is always the estimate from group additivity
672- thermoDataList .append (self .getThermoDataFromGroups (species ))
678+ # Make it a tuple
679+ data = (self .getThermoDataFromGroups (species ), None , None )
680+ thermoDataList .append (data )
673681
674682 # Return all of the resulting thermo parameters
675683 return thermoDataList
@@ -704,14 +712,14 @@ def getThermoDataFromLibrary(self, species, library):
704712 ``None`` is returned. If no corresponding library is found, a
705713 :class:`DatabaseError` is raised.
706714
707- Returns: ThermoData
715+ Returns a tuple: ( ThermoData, library, entry) or None.
708716 """
709717 for label , entry in library .entries .iteritems ():
710718 for molecule in species .molecule :
711719 if molecule .isIsomorphic (entry .item ) and entry .data is not None :
712720 thermoData = deepcopy (entry .data )
713721 self .findCp0andCpInf (species , thermoData )
714- return thermoData
722+ return ( thermoData , library , entry )
715723 return None
716724
717725 def getThermoDataFromGroups (self , species ):
@@ -721,6 +729,9 @@ def getThermoDataFromGroups(self, species):
721729 additivity values. If no group additivity values are loaded, a
722730 :class:`DatabaseError` is raised.
723731
732+ The resonance isomer (molecule) with the lowest H298 is used, and as a side-effect
733+ the resonance isomers (items in `species.molecule` list) are sorted in ascending order.
734+
724735 Returns: ThermoData
725736 """
726737 thermo = []
0 commit comments