def loadEntry(self, index, label, molecule, thermo, reference=None, referenceType='', shortDesc='', longDesc='', ): molecule = Molecule().fromAdjacencyList(molecule) # Internal checks for adding entry to the thermo library if label in self.entries.keys(): raise DatabaseError('Found a duplicate molecule with label {0} in the thermo library. Please correct your library.'.format(label)) for entry in self.entries.values(): if molecule.isIsomorphic(entry.item): if molecule.multiplicity == entry.item.multiplicity: raise DatabaseError('Adjacency list and multiplicity of {0} matches that of existing molecule {1} in thermo library. Please correct your library.'.format(label, entry.label)) self.entries[label] = Entry( index = index, label = label, item = molecule, data = thermo, reference = reference, referenceType = referenceType, shortDesc = shortDesc, longDesc = longDesc.strip(), )
def loadEntry(self, index, label, molecule, thermo, reference=None, referenceType='', shortDesc='', longDesc='', ): molecule = Molecule().fromAdjacencyList(molecule) # Internal checks for adding entry to the thermo library if label in self.entries.keys(): raise DatabaseError('Found a duplicate molecule with label {0} in the thermo library. Please correct your library.'.format(label)) for entry in self.entries.values(): if molecule.isIsomorphic(entry.item): raise DatabaseError('Adjacency list of {0} matches that of existing molecule {1} in thermo library. Please correct your library.'.format(label, entry.label)) self.entries[label] = Entry( index = index, label = label, item = molecule, data = thermo, reference = reference, referenceType = referenceType, shortDesc = shortDesc, longDesc = longDesc.strip(), )
def getThermoDataFromDepository(self, species): """ Return all possible sets of thermodynamic parameters for a given :class:`Species` object `species` from the depository. If no depository is loaded, a :class:`DatabaseError` is raised. Returns: a list of tuples (thermoData, depository, entry) without any Cp0 or CpInf data. """ items = [] for label, entry in self.depository['stable'].entries.iteritems(): for molecule in species.molecule: if molecule.isIsomorphic(entry.item): items.append((deepcopy(entry.data), self.depository['stable'], entry)) break for label, entry in self.depository['radical'].entries.iteritems(): for molecule in species.molecule: if molecule.isIsomorphic(entry.item): items.append((deepcopy(entry.data), self.depository['radical'], entry)) break return items
def getThermoDataFromDepository(self, species): """ Return all possible sets of thermodynamic parameters for a given :class:`Species` object `species` from the depository. If no depository is loaded, a :class:`DatabaseError` is raised. Returns: a list of tuples (thermoData, depository, entry) without any Cp0 or CpInf data. """ items = [] for label, entry in self.depository['stable'].entries.iteritems(): for molecule in species.molecule: if molecule.isIsomorphic(entry.item): items.append((deepcopy(entry.data), self.depository['stable'], entry)) break for label, entry in self.depository['radical'].entries.iteritems(): for molecule in species.molecule: if molecule.isIsomorphic(entry.item): items.append((deepcopy(entry.data), self.depository['radical'], entry)) break return items
def getThermoDataFromLibrary(self, species, library): """ Return the set of thermodynamic parameters corresponding to a given :class:`Species` object `species` from the specified thermodynamics `library`. If `library` is a string, the list of libraries is searched for a library with that name. If no match is found in that library, ``None`` is returned. If no corresponding library is found, a :class:`DatabaseError` is raised. Returns a tuple: (ThermoData, library, entry) or None. """ for label, entry in library.entries.iteritems(): for molecule in species.molecule: if molecule.isIsomorphic(entry.item) and entry.data is not None: thermoData = deepcopy(entry.data) self.findCp0andCpInf(species, thermoData) return (thermoData, library, entry) return None
def getThermoDataFromLibrary(self, species, library): """ Return the set of thermodynamic parameters corresponding to a given :class:`Species` object `species` from the specified thermodynamics `library`. If `library` is a string, the list of libraries is searched for a library with that name. If no match is found in that library, ``None`` is returned. If no corresponding library is found, a :class:`DatabaseError` is raised. Returns a tuple: (ThermoData, library, entry) or None. """ for label, entry in library.entries.iteritems(): for molecule in species.molecule: if molecule.isIsomorphic(entry.item) and entry.data is not None: thermoData = deepcopy(entry.data) self.findCp0andCpInf(species, thermoData) return (thermoData, library, entry) return None