-
Notifications
You must be signed in to change notification settings - Fork 24
Improves restart and TS guess handling #823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
9ea2bef
7ca8799
bbc9e9f
baa4c5d
15c4941
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -325,6 +325,8 @@ def __init__(self, | |||||||
| self.orbitals_level = orbitals_level | ||||||||
| self.unique_species_labels = list() | ||||||||
| self.save_restart = False | ||||||||
| if self.restart_dict is not None: | ||||||||
| self._sanitize_restart_output() | ||||||||
|
|
||||||||
| if len(self.rxn_list): | ||||||||
| rxn_info_path = self.make_reaction_labels_info_file() | ||||||||
|
|
@@ -2619,7 +2621,14 @@ def switch_ts(self, label: str): | |||||||
| logger.info(f'Switching a TS guess for {label}...') | ||||||||
| self.determine_most_likely_ts_conformer(label=label) # Look for a different TS guess. | ||||||||
| self.delete_all_species_jobs(label=label) # Delete other currently running jobs for this TS. | ||||||||
| self.output[label]['geo'] = self.output[label]['freq'] = self.output[label]['sp'] = self.output[label]['composite'] = '' | ||||||||
| if label in self.output: | ||||||||
| self.output[label]['convergence'] = False | ||||||||
| for key in ['opt', 'freq', 'sp', 'composite', 'fine']: | ||||||||
| if key in self.output[label]['job_types']: | ||||||||
| self.output[label]['job_types'][key] = False | ||||||||
| if 'paths' in self.output[label]: | ||||||||
| for key in self.output[label]['paths']: | ||||||||
| self.output[label]['paths'][key] = '' if key != 'irc' else list() | ||||||||
| freq_path = os.path.join(self.project_directory, 'output', 'rxns', label, 'geometry', 'freq.out') | ||||||||
| if os.path.isfile(freq_path): | ||||||||
| os.remove(freq_path) | ||||||||
|
|
@@ -3044,6 +3053,9 @@ def check_all_done(self, label: str): | |||||||
| logger.debug(f'Species {label} did not converge.') | ||||||||
| all_converged = False | ||||||||
| break | ||||||||
| if all_converged and self._missing_required_paths(label): | ||||||||
| logger.debug(f'Species {label} did not converge due to missing output paths.') | ||||||||
| all_converged = False | ||||||||
| if label in self.output and all_converged: | ||||||||
| self.output[label]['convergence'] = True | ||||||||
| if self.species_dict[label].is_ts: | ||||||||
|
|
@@ -3084,6 +3096,64 @@ def check_all_done(self, label: str): | |||||||
| # Update restart dictionary and save the yaml restart file: | ||||||||
| self.save_restart_dict() | ||||||||
|
|
||||||||
| def _missing_required_paths(self, label: str) -> bool: | ||||||||
| """ | ||||||||
| Check whether required output paths are missing for a species/TS. | ||||||||
|
|
||||||||
| Args: | ||||||||
| label (str): The species label. | ||||||||
|
|
||||||||
| Returns: | ||||||||
| bool: Whether required output paths are missing. | ||||||||
| """ | ||||||||
| if label not in self.output or 'paths' not in self.output[label]: | ||||||||
| return False | ||||||||
| path_map = { | ||||||||
| 'opt': 'geo', | ||||||||
| 'freq': 'freq', | ||||||||
| 'sp': 'sp', | ||||||||
| 'composite': 'composite', | ||||||||
| } | ||||||||
| for job_type, path_key in path_map.items(): | ||||||||
| if job_type == 'composite': | ||||||||
| required = self.composite_method is not None | ||||||||
| else: | ||||||||
| required = self.job_types.get(job_type, False) | ||||||||
| if not required: | ||||||||
| continue | ||||||||
| if self.species_dict[label].number_of_atoms == 1 and job_type in ['opt', 'freq']: | ||||||||
| continue | ||||||||
| if self.output[label]['job_types'].get(job_type, False) and not self.output[label]['paths'].get(path_key, ''): | ||||||||
| return True | ||||||||
| return False | ||||||||
|
|
||||||||
| def _sanitize_restart_output(self) -> None: | ||||||||
| """ | ||||||||
| Ensure restart output state is internally consistent (e.g., convergence without paths). | ||||||||
| """ | ||||||||
| path_map = { | ||||||||
| 'opt': 'geo', | ||||||||
| 'freq': 'freq', | ||||||||
| 'sp': 'sp', | ||||||||
| 'composite': 'composite', | ||||||||
| } | ||||||||
| for label in list(self.output.keys()): | ||||||||
| if label not in self.species_dict: | ||||||||
| continue | ||||||||
| if self.output[label].get('convergence') and self._missing_required_paths(label): | ||||||||
| self.output[label]['convergence'] = False | ||||||||
| for job_type, path_key in path_map.items(): | ||||||||
| if job_type == 'composite': | ||||||||
| required = self.composite_method is not None | ||||||||
| else: | ||||||||
| required = self.job_types.get(job_type, False) | ||||||||
| if not required: | ||||||||
| continue | ||||||||
| if self.species_dict[label].number_of_atoms == 1 and job_type in ['opt', 'freq']: | ||||||||
| continue | ||||||||
| if not self.output[label]['paths'].get(path_key, ''): | ||||||||
| self.output[label]['job_types'][job_type] = False | ||||||||
|
||||||||
| self.output[label]['job_types'][job_type] = False | |
| if 'job_types' in self.output[label]: | |
| self.output[label]['job_types'][job_type] = False |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1536,12 +1536,12 @@ def make_ts_report(self): | |||||
| self.ts_report += ':\n' | ||||||
| if self.successful_methods: | ||||||
| self.ts_report += 'Methods that successfully generated a TS guess:\n' | ||||||
| for successful_method in self.successful_methods: | ||||||
| self.ts_report += successful_method + ',' | ||||||
| unique_successful_methods = list(dict.fromkeys(self.successful_methods)) | ||||||
| self.ts_report += ','.join(unique_successful_methods) | ||||||
| if self.unsuccessful_methods: | ||||||
| self.ts_report += '\nMethods that were unsuccessfully in generating a TS guess:\n' | ||||||
|
||||||
| self.ts_report += '\nMethods that were unsuccessfully in generating a TS guess:\n' | |
| self.ts_report += '\nMethods that were unsuccessful in generating a TS guess:\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see this minor comment
Copilot
AI
Jan 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deduplication of TS methods in the report will cause an existing test to fail. The test in arc/species/species_test.py at line 1202-1206 expects the ts_report to contain duplicates (e.g., 'autotst,autotst,autotst,autotst,gcn,gcn,...'), but after this change, the report will show 'autotst,gcn,kinbot' instead. The test should be updated to match the new expected behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is duplicated logic for resetting output between switch_ts (lines 2624-2631) and delete_all_species_jobs (lines 3620-3626). Both methods reset convergence, job_types, and paths in nearly identical ways. Since switch_ts calls delete_all_species_jobs at line 2623, consider removing the duplicate resetting logic from switch_ts and relying solely on delete_all_species_jobs to handle the output reset. This would improve maintainability and reduce the risk of the two implementations diverging.