|
10 | 10 | # Constants from TOML file |
11 | 11 | REACTANT_XYZ_FILE = config['paths']['reactant'] |
12 | 12 | PRODUCT_XYZ_FILE = config['paths']['product'] |
13 | | -TAG = config['run']['tag'] |
14 | 13 |
|
15 | 14 | # Setup logging |
16 | 15 | logging.basicConfig(level=logging.INFO) |
|
23 | 22 |
|
24 | 23 |
|
25 | 24 | def main(): |
26 | | - try: |
27 | | - # Read reactant and product structures |
28 | | - reactant = read(REACTANT_XYZ_FILE) |
29 | | - product = read(PRODUCT_XYZ_FILE) |
30 | | - logger.info("Successfully read reactant and product structures.") |
31 | | - except Exception as e: |
32 | | - logger.error(f"Error reading reactant and product structures: {e}") |
33 | | - return |
| 25 | + # Read reactant and product structures |
| 26 | + reactant = read(REACTANT_XYZ_FILE) |
| 27 | + product = read(PRODUCT_XYZ_FILE) |
| 28 | + logger.info("Successfully read reactant and product structures.") |
34 | 29 |
|
35 | | - try: |
36 | | - # Create NEB job |
37 | | - job1 = neb_job(reactant, product, calc_kwargs=calc_kwargs1) |
38 | | - job1.update_metadata({"tag": f'neb_{TAG}'}) |
39 | | - logger.info("Created NEB job.") |
40 | | - except Exception as e: |
41 | | - logger.error(f"Error creating NEB job: {e}") |
42 | | - return |
| 30 | + # Create NEB job |
| 31 | + job1 = neb_job(reactant, product, calc_kwargs=calc_kwargs1) |
| 32 | + logger.info("Created NEB job.") |
43 | 33 |
|
44 | | - try: |
45 | | - # Create TS job with custom Hessian |
46 | | - job2 = ts_job(job1.output['neb_results']['highest_e_atoms'], use_custom_hessian=True) |
47 | | - job2.update_metadata({"tag": f'ts_hess_{TAG}'}) |
48 | | - logger.info("Created TS job with custom Hessian.") |
49 | | - except Exception as e: |
50 | | - logger.error(f"Error creating TS job: {e}") |
51 | | - return |
| 34 | + # Create TS job with custom Hessian |
| 35 | + job2 = ts_job(job1.output['neb_results']['highest_e_atoms'], use_custom_hessian=True) |
| 36 | + logger.info("Created TS job with custom Hessian.") |
52 | 37 |
|
53 | | - try: |
54 | | - # Create IRC job in forward direction |
55 | | - job3 = irc_job(job2.output['atoms'], direction='forward', **calc_kwargs1) |
56 | | - job3.update_metadata({"tag": f'ircf_hess_{TAG}'}) |
57 | | - logger.info("Created IRC job in forward direction.") |
58 | | - except Exception as e: |
59 | | - logger.error(f"Error creating IRC job in forward direction: {e}") |
60 | | - return |
| 38 | + # Create IRC job in forward direction |
| 39 | + job3 = irc_job(job2.output['atoms'], direction='forward', **calc_kwargs1) |
| 40 | + logger.info("Created IRC job in forward direction.") |
61 | 41 |
|
62 | | - try: |
63 | | - # Create IRC job in reverse direction |
64 | | - job4 = irc_job(job2.output['atoms'], direction='reverse', **calc_kwargs1) |
65 | | - job4.update_metadata({"tag": f'ircr_hess_{TAG}'}) |
66 | | - logger.info("Created IRC job in reverse direction.") |
67 | | - except Exception as e: |
68 | | - logger.error(f"Error creating IRC job in reverse direction: {e}") |
69 | | - return |
| 42 | + # Create IRC job in reverse direction |
| 43 | + job4 = irc_job(job2.output['atoms'], direction='reverse', **calc_kwargs1) |
| 44 | + logger.info("Created IRC job in reverse direction.") |
70 | 45 |
|
71 | | - try: |
72 | | - # Combine jobs into a flow |
73 | | - jobs = [job1, job2, job3, job4] |
74 | | - flow = jf.Flow(jobs) |
75 | | - logger.info("Jobs combined into a flow.") |
76 | | - except Exception as e: |
77 | | - logger.error(f"Error combining jobs into a flow: {e}") |
78 | | - return |
| 46 | + # Combine jobs into a flow |
| 47 | + jobs = [job1, job2, job3, job4] |
| 48 | + flow = jf.Flow(jobs) |
| 49 | + logger.info("Jobs combined into a flow.") |
79 | 50 |
|
80 | | - try: |
81 | | - # Execute the workflow locally |
82 | | - responses = jf.managers.local.run_locally(flow) |
83 | | - logger.info("Workflow executed successfully.") |
84 | | - logger.info(f"Responses: {responses}") |
85 | | - except Exception as e: |
86 | | - logger.error(f"Error executing workflow: {e}") |
87 | | - return |
| 51 | + # Execute the workflow locally |
| 52 | + responses = jf.managers.local.run_locally(flow) |
| 53 | + logger.info("Workflow executed successfully.") |
| 54 | + logger.info(f"Responses: {responses}") |
88 | 55 |
|
89 | 56 |
|
90 | 57 | if __name__ == "__main__": |
91 | 58 | main() |
| 59 | + |
0 commit comments