예제 #1
0
 def test_arkane_two_parameter_arrhenius_fit(self):
     test_path = os.path.join(self.test_base_path,
                              'two_parameter_arrhenius_fit')
     file_to_remove = [
         'output.py', 'chem.inp', 'supporting_information.csv'
     ]
     for file in file_to_remove:
         if os.path.exists(os.path.join(test_path, file)):
             os.remove(os.path.join(test_path, file))
     arkane = Arkane(input_file=os.path.join(test_path, 'input.py'),
                     output_directory=test_path)
     arkane.plot = False
     arkane.save_rmg_libraries = False
     arkane.execute()
     with open(os.path.join(test_path, 'output.py'), 'r') as f:
         output = f.readlines()
     reverse_output = output[::-1]
     for i, line in enumerate(reverse_output):
         if 'kinetics fitted using' in line:
             msg_output = line.rstrip()
             n_output = reverse_output[i - 5].split('=')[1].strip().replace(
                 ',', '')
             break
     msg_expected = '# kinetics fitted using the two-parameter Arrhenius equation k = A * exp(-Ea/RT)'
     self.assertEqual(msg_output, msg_expected)
     n_expected = '0'
     self.assertEqual(n_output, n_expected)
예제 #2
0
 def test_arkane_examples(self):
     for example_type in self.example_types:
         example_type_path = os.path.join(self.base_path, example_type)
         for example in sorted(os.listdir(example_type_path)):
             path = os.path.join(example_type_path, example)
             arkane = Arkane(inputFile=os.path.join(path, 'input.py'), outputDirectory=path)
             arkane.plot = True
             logging.info("running {}".format(example))
             arkane.execute()
             with open(os.path.join(path, 'arkane.log'), 'r') as f:
                 log = f.readlines()
             for line in log[::-1]:
                 if 'execution terminated' in line:
                     break
             else:
                 self.failed.append([example_type, example])
     error_message = 'Arkane example(s) failed: '
     for example_type, example_name in self.failed:
         error_message += '{1} in {0}; '.format(example_name, example_type)
     self.assertFalse(self.failed, error_message)
예제 #3
0
 def test_arkane_examples(self):
     for example_type in self.example_types:
         example_type_path = os.path.join(self.base_path, example_type)
         for example in os.listdir(example_type_path):
             path = os.path.join(example_type_path, example)
             arkane = Arkane(inputFile=os.path.join(path, 'input.py'),
                             outputDirectory=path)
             arkane.plot = True
             arkane.execute()
             with open(os.path.join(path, 'arkane.log'), 'r') as f:
                 log = f.readlines()
             for line in log[::-1]:
                 if 'execution terminated' in line:
                     break
             else:
                 self.failed.append([example_type, example])
     error_message = 'Arkane example(s) failed: '
     for example_type, example_name in self.failed:
         error_message += '{1} in {0}; '.format(example_name, example_type)
     self.assertFalse(self.failed, error_message)
예제 #4
0
 def test_arkane_examples(self):
     for example_type in self.example_types:
         example_type_path = os.path.join(self.base_path, example_type)
         for example in sorted(os.listdir(example_type_path)):
             path = os.path.join(example_type_path, example)
             arkane = Arkane(input_file=os.path.join(path, 'input.py'), output_directory=path)
             arkane.plot = example_type != 'bac'  # Don't plot BAC examples because they require a lot of memory
             logging.info("running {}".format(example))
             arkane.execute()
             with open(os.path.join(path, 'arkane.log'), 'r') as f:
                 log = f.readlines()
             for line in log[::-1]:
                 if 'execution terminated' in line:
                     break
             else:
                 self.failed.append([example_type, example])
     error_message = 'Arkane example(s) failed: '
     for example_type, example_name in self.failed:
         error_message += '{1} in {0}; '.format(example_name, example_type)
     self.assertFalse(self.failed, error_message)