|
16 | 16 | module_dir = os.path.dirname(os.path.abspath(__file__))
|
17 | 17 |
|
18 | 18 |
|
19 |
| -class TestParseOutputQChem(AtomateTest): |
| 19 | +class TestParseOutputQChem_grads(AtomateTest): |
20 | 20 | def setUp(self, lpad=False):
|
21 | 21 | super().setUp(lpad=False)
|
22 | 22 |
|
23 | 23 | def tearDown(self):
|
24 | 24 | pass
|
25 |
| - |
| 25 | + |
26 | 26 | def test_parse_grad_good(self):
|
27 | 27 | my_calc_dir = os.path.join(module_dir, "..", "..", "test_files","parse_grad_good")
|
28 | 28 | ft = QChemToDb(calc_dir=my_calc_dir, parse_grad_file=True)
|
@@ -53,5 +53,33 @@ def test_parse_grad_bad(self):
|
53 | 53 | self.assertEqual(task_doc["warnings"]["grad_file_missing"], True)
|
54 | 54 | os.remove(os.path.join(my_calc_dir, "task.json"))
|
55 | 55 |
|
| 56 | + |
| 57 | +class TestParseOutputQChem_hess(AtomateTest): |
| 58 | + def setUp(self, lpad=False): |
| 59 | + os.makedirs(os.path.join(module_dir, "..", "..", "test_files", "freq_save_hess", "scratch")) |
| 60 | + shutil.copyfile( |
| 61 | + os.path.join(module_dir, "..", "..", "test_files", "freq_save_hess", "BUP_scratch", "132.0"), |
| 62 | + os.path.join(module_dir, "..", "..", "test_files", "freq_save_hess", "scratch", "132.0"), |
| 63 | + ) |
| 64 | + shutil.copyfile( |
| 65 | + os.path.join(module_dir, "..", "..", "test_files", "freq_save_hess", "BUP_scratch", "HESS"), |
| 66 | + os.path.join(module_dir, "..", "..", "test_files", "freq_save_hess", "scratch", "HESS"), |
| 67 | + ) |
| 68 | + super().setUp(lpad=False) |
| 69 | + |
| 70 | + def test_parse_hess(self): |
| 71 | + my_calc_dir = os.path.join(module_dir, "..", "..", "test_files","freq_save_hess") |
| 72 | + ft = QChemToDb(calc_dir=my_calc_dir, parse_hess_file=True) |
| 73 | + ft.run_task({}) |
| 74 | + task_doc = loadfn(os.path.join(my_calc_dir,"task.json")) |
| 75 | + self.assertEqual(task_doc["output"]["final_energy"], -151.3244603665) |
| 76 | + self.assertEqual(task_doc["output"]["hess_data"]["scratch/132.0"][0],0.12636293260949633) |
| 77 | + self.assertEqual(task_doc["output"]["hess_data"]["scratch/132.0"][-2],-0.2025032138024329) |
| 78 | + self.assertEqual(task_doc["output"]["hess_data"]["scratch/HESS"][-2], ' -0.175476533300377 -0.202503213802433 0.205623571433770 \n') |
| 79 | + os.remove(os.path.join(my_calc_dir, "task.json")) |
| 80 | + |
| 81 | + def tearDown(self): |
| 82 | + pass |
| 83 | + |
56 | 84 | if __name__ == "__main__":
|
57 | 85 | unittest.main()
|
0 commit comments