def load(self): """ Load the contents of the input file into a PressureDependenceJob object. """ from arkane.pdep import PressureDependenceJob from arkane.input import load_input_file # Seed with a PdepJob object if self.pdep is None: self.pdep = PressureDependenceJob(network=None) if self.inputFileExists(): job_list = load_input_file(self.getInputFilename())[0] assert len(job_list) == 1 job = job_list[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 test_load_input_file(self): """Test loading an Arkane input file""" path = os.path.join(os.path.dirname(os.path.dirname(rmgpy.__file__)), 'examples', 'arkane', 'networks', 'acetyl+O2', 'input.py') job_list, reaction_dict, species_dict, transition_state_dict, network_dict, model_chemistry \ = load_input_file(path) self.assertEqual(len(job_list), 1) self.assertEqual(len(reaction_dict), 5) self.assertTrue('entrance1' in reaction_dict) self.assertTrue('exit2' in reaction_dict) self.assertEqual(len(species_dict), 9) self.assertTrue('acetyl' in species_dict) self.assertTrue('hydroperoxyl' in species_dict) self.assertEqual(len(transition_state_dict), 5) self.assertTrue('entrance1' in transition_state_dict) self.assertTrue('isom1' in transition_state_dict) self.assertEqual(len(network_dict), 1) self.assertTrue('acetyl + O2' in network_dict) self.assertIsNone(model_chemistry)
def load_input_file(self, input_file): """ Load a set of jobs from the given `input_file` on disk. Returns the loaded set of jobs as a list. """ self.input_file = input_file self.job_list, self.reaction_dict, self.species_dict, self.transition_state_dict, self.network_dict, \ self.model_chemistry = load_input_file(self.input_file) logging.info('') return self.job_list