def loadKinetics(self, path, reactionLibraries=None, seedMechanisms=None, kineticsFamilies=None, kineticsDepositories=None): """ Load the RMG kinetics database from the given `path` on disk, where `path` points to the top-level folder of the RMG kinetics database. """ kineticsLibraries = [] libraryOrder = [] if seedMechanisms is None and reactionLibraries is None: kineticsLibraries = None if seedMechanisms is not None: for library in seedMechanisms: kineticsLibraries.append(library) libraryOrder.append((library, 'Seed')) if reactionLibraries is not None: for library in reactionLibraries: kineticsLibraries.append(library) libraryOrder.append((library, 'Reaction Library')) self.kinetics = KineticsDatabase() self.kinetics.libraryOrder = libraryOrder self.kinetics.load(path, families=kineticsFamilies, libraries=kineticsLibraries, depositories=kineticsDepositories) broadcast(self.kinetics, 'kinetics')
def loadKinetics(self, path, reactionLibraries=None, seedMechanisms=None, kineticsFamilies=None, kineticsDepositories=None ): """ Load the RMG kinetics database from the given `path` on disk, where `path` points to the top-level folder of the RMG kinetics database. """ kineticsLibraries = [] libraryOrder = [] if seedMechanisms is None and reactionLibraries is None: kineticsLibraries = None if seedMechanisms is not None: for library in seedMechanisms: kineticsLibraries.append(library) libraryOrder.append((library,'Seed')) if reactionLibraries is not None: for library in reactionLibraries: kineticsLibraries.append(library) libraryOrder.append((library,'Reaction Library')) self.kinetics = KineticsDatabase() self.kinetics.libraryOrder = libraryOrder self.kinetics.load(path, families=kineticsFamilies, libraries=kineticsLibraries, depositories=kineticsDepositories ) broadcast(self.kinetics, 'kinetics')
def loadSolvation(self, path): """ Load the RMG solvation database from the given `path` on disk, where `path` points to the top-level folder of the RMG solvation database. """ self.solvation = SolvationDatabase() self.solvation.load(path) broadcast(self.solvation, 'solvation')
def loadStatmech(self, path, statmechLibraries=None, depository=True): """ Load the RMG statmech database from the given `path` on disk, where `path` points to the top-level folder of the RMG statmech database. """ self.statmech = StatmechDatabase() self.statmech.load(path, statmechLibraries, depository) broadcast(self.statmech, 'statmech')
def loadThermo(self, path, thermoLibraries=None, depository=True): """ Load the RMG thermo database from the given `path` on disk, where `path` points to the top-level folder of the RMG thermo database. """ self.thermo = ThermoDatabase() self.thermo.load(path, thermoLibraries, depository) broadcast(self.thermo, 'thermo')
def loadTransport(self, path, transportLibraries=None): """ Load the RMG transport database from the given 'path' on disk, where 'path' points to the top-level folder of the RMG transport database. """ self.transport = TransportDatabase() self.transport.load(path, transportLibraries) broadcast(self.transport, 'transport')
def loadForbiddenStructures(self, path): """ Load the RMG forbidden structures from the given `path` on disk, where `path` points to the forbidden structures file. """ self.forbiddenStructures = ForbiddenStructures() self.forbiddenStructures.load(path) broadcast(self.forbiddenStructures, 'forbidden')
def initialize(wd, rxns): global working_dir, reactions working_dir = wd assert os.path.isdir(working_dir) #set global variable here such that functions executed in the root worker have access to it. reactions = [ReductionReaction(rxn) for rxn in rxns] broadcast(reactions, 'reactions')
def readThermoInputFile(path, rmg0): """ Read an thermo estimation input file at `path` on disk into the :class:`RMG` object `rmg`. """ global rmg, speciesDict full_path = os.path.abspath(os.path.expandvars(path)) try: f = open(full_path) except IOError: logging.error('The input file "{0}" could not be opened.'.format(full_path)) logging.info('Check that the file exists and that you have read access.') raise logging.info('Reading input file "{0}"...'.format(full_path)) rmg = rmg0 rmg.reactionModel = CoreEdgeReactionModel() rmg.initialSpecies = [] rmg.reactionSystems = [] speciesDict = {} global_context = { '__builtins__': None } local_context = { '__builtins__': None, 'True': True, 'False': False, 'database': database, 'catalystProperties': catalystProperties, 'species': species, 'SMARTS': SMARTS, 'SMILES': SMILES, 'InChI': InChI, 'solvation': solvation, 'adjacencyList': adjacencyList, 'quantumMechanics': quantumMechanics, 'mlEstimator': mlEstimator, } try: exec f in global_context, local_context except (NameError, TypeError, SyntaxError) as e: logging.error('The input file "{0}" was invalid:'.format(full_path)) logging.exception(e) raise finally: f.close() if rmg.quantumMechanics: rmg.quantumMechanics.setDefaultOutputDirectory(rmg.outputDirectory) rmg.quantumMechanics.initialize() broadcast(rmg.quantumMechanics, 'quantumMechanics') logging.info('')
def loadForbiddenStructures(self, path=None): """ Load the RMG forbidden structures from the given `path` on disk, where `path` points to the forbidden structures file. If no path is given, a blank forbidden structures object is created. """ self.forbiddenStructures = ForbiddenStructures() if path is not None: self.forbiddenStructures.load(path) broadcast(self.forbiddenStructures, 'forbidden')
def loadForbiddenStructures(self, path = None): """ Load the RMG forbidden structures from the given `path` on disk, where `path` points to the forbidden structures file. If no path is given, a blank forbidden structures object is created. """ self.forbiddenStructures = ForbiddenStructures() if path is not None: self.forbiddenStructures.load(path) broadcast(self.forbiddenStructures, 'forbidden')
'pressureDependence': pressureDependence, 'options': options, 'generatedSpeciesConstraints': generatedSpeciesConstraints, } try: exec f in global_context, local_context except (NameError, TypeError, SyntaxError), e: logging.error('The input file "{0}" was invalid:'.format(full_path)) logging.exception(e) raise finally: f.close() rmg.speciesConstraints['explicitlyAllowedMolecules'] = [] broadcast(rmg.speciesConstraints, 'speciesConstraints') # convert keys from species names into species objects. for reactionSystem in rmg.reactionSystems: reactionSystem.convertInitialKeysToSpeciesObjects(speciesDict) logging.info('') ################################################################################ def readThermoInputFile(path, rmg0): """ Read an thermo estimation input file at `path` on disk into the :class:`RMG` object `rmg`. """
'pressureDependence': pressureDependence, 'options': options, 'generatedSpeciesConstraints': generatedSpeciesConstraints, } try: exec f in global_context, local_context except (NameError, TypeError, SyntaxError), e: logging.error('The input file "{0}" was invalid:'.format(full_path)) logging.exception(e) raise finally: f.close() rmg.speciesConstraints['explicitlyAllowedMolecules'] = [] broadcast(rmg.speciesConstraints, 'speciesConstraints') # convert keys from species names into species objects. for reactionSystem in rmg.reactionSystems: reactionSystem.convertInitialKeysToSpeciesObjects(speciesDict) logging.info('') ################################################################################ def readThermoInputFile(path, rmg0): """ Read an thermo estimation input file at `path` on disk into the :class:`RMG` object `rmg`.
"pressureDependence": pressureDependence, "options": options, "generatedSpeciesConstraints": generatedSpeciesConstraints, } try: exec f in global_context, local_context except (NameError, TypeError, SyntaxError), e: logging.error('The input file "{0}" was invalid:'.format(full_path)) logging.exception(e) raise finally: f.close() rmg.speciesConstraints["explicitlyAllowedMolecules"] = [] broadcast(rmg.speciesConstraints, "speciesConstraints") # convert keys from species names into species objects. for reactionSystem in rmg.reactionSystems: reactionSystem.convertInitialKeysToSpeciesObjects(speciesDict) logging.info("") ################################################################################ def readThermoInputFile(path, rmg0): """ Read an thermo estimation input file at `path` on disk into the :class:`RMG` object `rmg`.
'pressureDependence': pressureDependence, 'options': options, 'generatedSpeciesConstraints': generatedSpeciesConstraints, } try: exec f in global_context, local_context except (NameError, TypeError, SyntaxError), e: logging.error('The input file "{0}" was invalid:'.format(full_path)) logging.exception(e) raise finally: f.close() rmg.speciesConstraints['explicitlyAllowedMolecules'] = [] broadcast(rmg.speciesConstraints, 'speciesConstraints') # convert keys from species names into species objects. for reactionSystem in rmg.reactionSystems: reactionSystem.convertInitialKeysToSpeciesObjects(speciesDict) if rmg.quantumMechanics: rmg.quantumMechanics.setDefaultOutputDirectory(rmg.outputDirectory) rmg.quantumMechanics.initialize() broadcast(rmg.quantumMechanics, 'quantumMechanics') logging.info('') ################################################################################ def readThermoInputFile(path, rmg0):
def readInputFile(path, rmg0): """ Read an RMG input file at `path` on disk into the :class:`RMG` object `rmg`. """ global rmg, speciesDict full_path = os.path.abspath(os.path.expandvars(path)) try: f = open(full_path) except IOError: logging.error('The input file "{0}" could not be opened.'.format(full_path)) logging.info('Check that the file exists and that you have read access.') raise logging.info('Reading input file "{0}"...'.format(full_path)) logging.info(f.read()) f.seek(0)# return to beginning of file setGlobalRMG(rmg0) rmg.reactionModel = CoreEdgeReactionModel() rmg.initialSpecies = [] rmg.reactionSystems = [] speciesDict = {} global_context = { '__builtins__': None } local_context = { '__builtins__': None, 'True': True, 'False': False, 'database': database, 'catalystProperties': catalystProperties, 'species': species, 'SMARTS': SMARTS, 'SMILES': SMILES, 'InChI': InChI, 'adjacencyList': adjacencyList, 'simpleReactor': simpleReactor, 'liquidReactor': liquidReactor, 'surfaceReactor': surfaceReactor, 'simulator': simulator, 'solvation': solvation, 'model': model, 'quantumMechanics': quantumMechanics, 'mlEstimator': mlEstimator, 'pressureDependence': pressureDependence, 'options': options, 'generatedSpeciesConstraints': generatedSpeciesConstraints, 'thermoCentralDatabase': thermoCentralDatabase } try: exec f in global_context, local_context except (NameError, TypeError, SyntaxError) as e: logging.error('The input file "{0}" was invalid:'.format(full_path)) logging.exception(e) raise finally: f.close() rmg.speciesConstraints['explicitlyAllowedMolecules'] = [] broadcast(rmg.speciesConstraints, 'speciesConstraints') # convert keys from species names into species objects. for reactionSystem in rmg.reactionSystems: reactionSystem.convertInitialKeysToSpeciesObjects(speciesDict) if rmg.quantumMechanics: rmg.quantumMechanics.setDefaultOutputDirectory(rmg.outputDirectory) rmg.quantumMechanics.initialize() broadcast(rmg.quantumMechanics, 'quantumMechanics') logging.info('')