def load(self): """ Load the contents of the input file into a PressureDependenceJob object. """ from rmgpy.cantherm.pdep import PressureDependenceJob from rmgpy.cantherm.input import loadInputFile # Seed with a PdepJob object if self.pdep is None: self.pdep = PressureDependenceJob(network=None) if self.inputFileExists(): jobList = loadInputFile(self.getInputFilename()) assert len(jobList) == 1 job = jobList[0] if isinstance(job, PressureDependenceJob) is False: raise Exception('Input file given did not provide a pressure dependence network.') self.pdep = job self.pdep.initialize() if self.pdep.network is not None: self.title = self.pdep.network.label self.save() return self.pdep.network
def load(self): """ Load the contents of the input file into a PressureDependenceJob object. """ from rmgpy.cantherm.pdep import PressureDependenceJob from rmgpy.cantherm.input import loadInputFile # Seed with a PdepJob object if self.pdep is None: self.pdep = PressureDependenceJob(network=None) if self.inputFileExists(): jobList = loadInputFile(self.getInputFilename()) assert len(jobList) == 1 job = jobList[0] if isinstance(job, PressureDependenceJob) is False: raise Exception( 'Input file given did not provide a pressure dependence network.' ) self.pdep = job self.pdep.initialize() if self.pdep.network is not None: self.title = self.pdep.network.label self.save() return self.pdep.network
def execute(self): """ Execute, in order, the jobs found in input file specified by the `inputFile` attribute. """ # Initialize the logging system (both to the console and to a file in the # output directory) self.initializeLog(self.verbose, os.path.join(self.outputDirectory, "cantherm.log")) # Print some information to the beginning of the log self.logHeader() # Load the input file for the job self.jobList = loadInputFile(self.inputFile) logging.info("") # Initialize (and clear!) the output file for the job outputFile = os.path.join(self.outputDirectory, "output.py") with open(outputFile, "w") as f: pass # Run the jobs for job in self.jobList: job.execute(outputFile=outputFile) # Print some information to the end of the log self.logFooter()
def loadInputFile(self, inputFile): """ Load a set of jobs from the given `inputFile` on disk. Returns the loaded set of jobs as a list. """ self.inputFile = inputFile self.jobList = loadInputFile(self.inputFile) logging.info('') return self.jobList