def failsSpeciesConstraints(species): """ Pass in either a `Species` or `Molecule` object and checks whether it passes the speciesConstraints set by the user. If not, returns `True` for failing speciesConstraints. """ from rmgpy.rmg.input import getInput try: speciesConstraints = getInput('speciesConstraints') except Exception, e: logging.debug('Species constraints could not be found.') speciesConstraints = {}
def failsSpeciesConstraints(species): """ Pass in either a `Species` or `Molecule` object and checks whether it passes the speciesConstraints set by the user. If not, returns `True` for failing speciesConstraints. """ from rmgpy.rmg.input import getInput try: speciesConstraints = getInput('speciesConstraints') except Exception, e: logging.debug('Species constraints could not be found.') speciesConstraints = {}
def generateThermoData(spc, thermoClass=NASA, solventName=''): """ Generates thermo data, first checking Libraries, then using either QM or Database. The database generates the thermo data for each structure (resonance isomer), picks that with lowest H298 value. It then calls :meth:`processThermoData`, to convert (via Wilhoit) to NASA and set the E0. Result stored in `spc.thermo` and returned. """ try: thermodb = getDB('thermo') if not thermodb: raise Exception except Exception: logging.debug( 'Could not obtain the thermo database. Not generating thermo...') return None thermo0 = thermodb.getThermoData(spc) # 1. maybe only submit cyclic core # 2. to help radical prediction, HBI should also # look up centrailThermoDB for its saturated version # currently it only looks up libraries or estimates via GAV from rmgpy.rmg.input import getInput try: thermoCentralDatabase = getInput('thermoCentralDatabase') except Exception: logging.debug('thermoCentralDatabase could not be found.') thermoCentralDatabase = None if thermoCentralDatabase and thermoCentralDatabase.client \ and thermoCentralDatabase.satisfyRegistrationRequirements(spc, thermo0, thermodb): thermoCentralDatabase.registerInCentralThermoDB(spc) return processThermoData(spc, thermo0, thermoClass, solventName)
def generateThermoData(spc, thermoClass=NASA, solventName=''): """ Generates thermo data, first checking Libraries, then using either QM or Database. The database generates the thermo data for each structure (resonance isomer), picks that with lowest H298 value. It then calls :meth:`processThermoData`, to convert (via Wilhoit) to NASA and set the E0. Result stored in `spc.thermo` and returned. """ try: thermodb = getDB('thermo') if not thermodb: raise Exception except Exception: logging.debug('Could not obtain the thermo database. Not generating thermo...') return None thermo0 = thermodb.getThermoData(spc) # 1. maybe only submit cyclic core # 2. to help radical prediction, HBI should also # look up centrailThermoDB for its saturated version # currently it only looks up libraries or estimates via GAV from rmgpy.rmg.input import getInput try: thermoCentralDatabase = getInput('thermoCentralDatabase') except Exception: logging.debug('thermoCentralDatabase could not be found.') thermoCentralDatabase = None if thermoCentralDatabase and thermoCentralDatabase.client \ and thermoCentralDatabase.satisfyRegistrationRequirements(spc, thermo0, thermodb): thermoCentralDatabase.registerInCentralThermoDB(spc) return processThermoData(spc, thermo0, thermoClass, solventName)
if not thermodb: raise Exception except Exception, e: logging.debug( 'Could not obtain the thermo database. Not generating thermo...') return None thermo0 = thermodb.getThermoData(spc) # 1. maybe only submit cyclic core # 2. to help radical prediction, HBI should also # look up centrailThermoDB for its saturated version # currently it only looks up libraries or estimates via GAV from rmgpy.rmg.input import getInput try: thermoCentralDatabase = getInput('thermoCentralDatabase') except Exception, e: logging.debug('thermoCentralDatabase could not be found.') thermoCentralDatabase = None if thermoCentralDatabase and thermoCentralDatabase.client \ and thermoCentralDatabase.satisfyRegistrationRequirements(spc, thermo0, thermodb): thermoCentralDatabase.registerInCentralThermoDB(spc) return processThermoData(spc, thermo0, thermoClass) def evaluator(spc): """ Module-level function passed to workers.
def failsSpeciesConstraints(species): """ Pass in either a `Species` or `Molecule` object and checks whether it passes the speciesConstraints set by the user. If not, returns `True` for failing speciesConstraints. """ from rmgpy.rmg.input import getInput try: speciesConstraints = getInput('speciesConstraints') except Exception: logging.debug('Species constraints could not be found.') speciesConstraints = {} if isinstance(species, Species): struct = species.molecule[0] else: # expects a molecule here struct = species explicitlyAllowedMolecules = speciesConstraints.get( 'explicitlyAllowedMolecules', []) for molecule in explicitlyAllowedMolecules: if struct.isIsomorphic(molecule): return False maxCarbonAtoms = speciesConstraints.get('maximumCarbonAtoms', -1) if maxCarbonAtoms != -1: if struct.getNumAtoms('C') > maxCarbonAtoms: return True maxOxygenAtoms = speciesConstraints.get('maximumOxygenAtoms', -1) if maxOxygenAtoms != -1: if struct.getNumAtoms('O') > maxOxygenAtoms: return True maxNitrogenAtoms = speciesConstraints.get('maximumNitrogenAtoms', -1) if maxNitrogenAtoms != -1: if struct.getNumAtoms('N') > maxNitrogenAtoms: return True maxSiliconAtoms = speciesConstraints.get('maximumSiliconAtoms', -1) if maxSiliconAtoms != -1: if struct.getNumAtoms('Si') > maxSiliconAtoms: return True maxSulfurAtoms = speciesConstraints.get('maximumSulfurAtoms', -1) if maxSulfurAtoms != -1: if struct.getNumAtoms('S') > maxSulfurAtoms: return True maxHeavyAtoms = speciesConstraints.get('maximumHeavyAtoms', -1) if maxHeavyAtoms != -1: if struct.getNumAtoms() - struct.getNumAtoms('H') > maxHeavyAtoms: return True maxRadicals = speciesConstraints.get('maximumRadicalElectrons', -1) if maxRadicals != -1: if (struct.getRadicalCount() > maxRadicals): return True maxCarbenes = speciesConstraints.get('maximumSingletCarbenes', 1) if maxRadicals != -1: if struct.getSingletCarbeneCount() > maxCarbenes: return True maxCarbeneRadicals = speciesConstraints.get('maximumCarbeneRadicals', 0) if maxCarbeneRadicals != -1: if struct.getSingletCarbeneCount() > 0 and struct.getRadicalCount( ) > maxCarbeneRadicals: return True return False
def failsSpeciesConstraints(species): """ Pass in either a `Species` or `Molecule` object and checks whether it passes the speciesConstraints set by the user. If not, returns `True` for failing speciesConstraints. """ from rmgpy.rmg.input import getInput try: speciesConstraints = getInput('speciesConstraints') except Exception: logging.debug('Species constraints could not be found.') speciesConstraints = {} if isinstance(species, Species): struct = species.molecule[0] else: # expects a molecule here struct = species explicitlyAllowedMolecules = speciesConstraints.get('explicitlyAllowedMolecules', []) for molecule in explicitlyAllowedMolecules: if struct.isIsomorphic(molecule): return False maxCarbonAtoms = speciesConstraints.get('maximumCarbonAtoms', -1) if maxCarbonAtoms != -1: if struct.getNumAtoms('C') > maxCarbonAtoms: return True maxOxygenAtoms = speciesConstraints.get('maximumOxygenAtoms', -1) if maxOxygenAtoms != -1: if struct.getNumAtoms('O') > maxOxygenAtoms: return True maxNitrogenAtoms = speciesConstraints.get('maximumNitrogenAtoms', -1) if maxNitrogenAtoms != -1: if struct.getNumAtoms('N') > maxNitrogenAtoms: return True maxSiliconAtoms = speciesConstraints.get('maximumSiliconAtoms', -1) if maxSiliconAtoms != -1: if struct.getNumAtoms('Si') > maxSiliconAtoms: return True maxSulfurAtoms = speciesConstraints.get('maximumSulfurAtoms', -1) if maxSulfurAtoms != -1: if struct.getNumAtoms('S') > maxSulfurAtoms: return True maxHeavyAtoms = speciesConstraints.get('maximumHeavyAtoms', -1) if maxHeavyAtoms != -1: if struct.getNumAtoms() - struct.getNumAtoms('H') > maxHeavyAtoms: return True maxRadicals = speciesConstraints.get('maximumRadicalElectrons', -1) if maxRadicals != -1: if (struct.getRadicalCount() > maxRadicals): return True maxCarbenes = speciesConstraints.get('maximumSingletCarbenes', 1) if maxRadicals != -1: if struct.getSingletCarbeneCount() > maxCarbenes: return True maxCarbeneRadicals = speciesConstraints.get('maximumCarbeneRadicals', 0) if maxCarbeneRadicals != -1: if struct.getSingletCarbeneCount() > 0 and struct.getRadicalCount() > maxCarbeneRadicals: return True maxIsotopes = speciesConstraints.get('maximumIsotopicAtoms', -1) if maxIsotopes != -1: counter = 0 for atom in struct.atoms: if not isclose(atom.mass, getElement(atom.symbol).mass, atol=1e-04): counter += 1 if counter > maxIsotopes: return True return False
thermodb = getDB('thermo') if not thermodb: raise Exception except Exception, e: logging.debug('Could not obtain the thermo database. Not generating thermo...') return None thermo0 = thermodb.getThermoData(spc) # 1. maybe only submit cyclic core # 2. to help radical prediction, HBI should also # look up centrailThermoDB for its saturated version # currently it only looks up libraries or estimates via GAV from rmgpy.rmg.input import getInput try: thermoCentralDatabase = getInput('thermoCentralDatabase') except Exception, e: logging.debug('thermoCentralDatabase could not be found.') thermoCentralDatabase = None if thermoCentralDatabase and thermoCentralDatabase.client \ and thermoCentralDatabase.satisfyRegistrationRequirements(spc, thermo0, thermodb): thermoCentralDatabase.registerInCentralThermoDB(spc) return processThermoData(spc, thermo0, thermoClass, solventName) def evaluator(spc, solventName = ''): """ Module-level function passed to workers.