From c9d88affb207f1846fa27f18b14a6d3c7d0f3538 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Mon, 17 Mar 2025 14:40:07 +0200 Subject: [PATCH] Added the trsh_rotors arg --- arc/main.py | 11 +++++++++++ arc/scheduler.py | 12 ++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/arc/main.py b/arc/main.py index e40dd6840d..967ec69f55 100644 --- a/arc/main.py +++ b/arc/main.py @@ -152,6 +152,7 @@ class ARC(object): format (``True``, default) or classical two-parameter Arrhenius equation format (``False``). trsh_ess_jobs (bool, optional): Whether to attempt troubleshooting failed ESS jobs. Default is ``True``. + trsh_rotors (bool, optional): Whether to attempt troubleshooting failed rotor scan jobs. Default is ``True``. output (dict, optional): Output dictionary with status and final QM file paths for all species. Only used for restarting. output_multi_spc (dict, optional): Output dictionary with status and final QM file paths for the multi species. @@ -227,6 +228,7 @@ class ARC(object): three_params (bool): Compute rate coefficients using the modified three-parameter Arrhenius equation format (``True``) or classical two-parameter Arrhenius equation format (``False``). trsh_ess_jobs (bool): Whether to attempt troubleshooting failed ESS jobs. Default is ``True``. + trsh_rotors (bool): Whether to attempt troubleshooting failed rotor scan jobs. Default is ``True``. ts_adapters (list): Entries represent different TS adapters. report_e_elect (bool): Whether to report electronic energy. skip_nmd (bool): Whether to skip normal mode displacement check. @@ -279,6 +281,7 @@ def __init__(self, thermo_adapter: str = 'Arkane', three_params: bool = True, trsh_ess_jobs: bool = True, + trsh_rotors: bool = True, ts_adapters: List[str] = None, ts_guess_level: Optional[Union[str, dict, Level]] = None, verbose=logging.INFO, @@ -317,6 +320,7 @@ def __init__(self, self.compute_rates = compute_rates self.three_params = three_params self.trsh_ess_jobs = trsh_ess_jobs + self.trsh_rotors = trsh_rotors self.compute_transport = compute_transport self.thermo_adapter = StatmechEnum(thermo_adapter.lower()).value self.kinetics_adapter = StatmechEnum(kinetics_adapter.lower()).value @@ -440,6 +444,10 @@ def __init__(self, logger.info('\n') logger.warning('Not troubleshooting ESS jobs!') logger.info('\n') + elif not self.trsh_rotors: + logger.info('\n') + logger.warning('Not troubleshooting rotor scan jobs!') + logger.info('\n') self.scheduler = None self.restart_dict = self.as_dict() @@ -544,6 +552,8 @@ def as_dict(self) -> dict: restart_dict['three_params'] = self.three_params if not self.trsh_ess_jobs: restart_dict['trsh_ess_jobs'] = self.trsh_ess_jobs + if not self.trsh_rotors: + restart_dict['trsh_rotors'] = self.trsh_rotors if self.ts_guess_level is not None and str(self.ts_guess_level).split()[0] != default_levels_of_theory['ts_guesses']: restart_dict['ts_guess_level'] = self.ts_guess_level.as_dict() \ if not isinstance(self.ts_guess_level, (dict, str)) else self.ts_guess_level @@ -617,6 +627,7 @@ def execute(self) -> dict: e_confs=self.e_confs, dont_gen_confs=self.dont_gen_confs, trsh_ess_jobs=self.trsh_ess_jobs, + trsh_rotors=self.trsh_rotors, fine_only=self.fine_only, ts_adapters=self.ts_adapters, report_e_elect=self.report_e_elect, diff --git a/arc/scheduler.py b/arc/scheduler.py index 379c12dc8f..3ca1b0dd1c 100644 --- a/arc/scheduler.py +++ b/arc/scheduler.py @@ -162,6 +162,7 @@ class Scheduler(object): kinetics_adapter (str, optional): The statmech software to use for kinetic rate coefficient calculations. freq_scale_factor (float, optional): The harmonic frequencies scaling factor. trsh_ess_jobs (bool, optional): Whether to attempt troubleshooting failed ESS jobs. Default is ``True``. + trsh_rotors (bool, optional): Whether to attempt troubleshooting failed rotor scan jobs. Default is ``True``. ts_adapters (list, optional): Entries represent different TS adapters. report_e_elect (bool, optional): Whether to report electronic energy. Default is ``False``. skip_nmd (bool, optional): Whether to skip normal mode displacement check. Default is ``False``. @@ -219,6 +220,7 @@ class Scheduler(object): kinetics_adapter (str): The statmech software to use for kinetic rate coefficient calculations. freq_scale_factor (float): The harmonic frequencies scaling factor. trsh_ess_jobs (bool): Whether to attempt troubleshooting failed ESS jobs. Default is ``True``. + trsh_rotors (bool): Whether to attempt troubleshooting failed rotor scan jobs. Default is ``True``. ts_adapters (list): Entries represent different TS adapters. report_e_elect (bool): Whether to report electronic energy. skip_nmd (bool): Whether to skip normal mode displacement check. @@ -253,6 +255,7 @@ def __init__(self, e_confs: Optional[float] = 5, fine_only: Optional[bool] = False, trsh_ess_jobs: Optional[bool] = True, + trsh_rotors: Optional[bool] = True, kinetics_adapter: str = 'arkane', freq_scale_factor: float = 1.0, ts_adapters: List[str] = None, @@ -284,6 +287,7 @@ def __init__(self, self.job_types = job_types if job_types is not None else default_job_types self.fine_only = fine_only self.trsh_ess_jobs = trsh_ess_jobs + self.trsh_rotors = trsh_rotors self.kinetics_adapter = kinetics_adapter self.freq_scale_factor = freq_scale_factor self.ts_adapters = ts_adapters if ts_adapters is not None else default_ts_adapters @@ -2888,7 +2892,7 @@ def check_scan_job(self, if len(list(actions.keys())) \ and 'pivTS' not in self.species_dict[label].rotors_dict[job.rotor_index]['invalidation_reason'] \ - and self.trsh_ess_jobs: + and self.trsh_ess_jobs and self.trsh_rotors: # The rotor scan is problematic (and does not block a TS reaction zone), troubleshooting is required. logger.info(f'Trying to troubleshoot rotor ' f'{self.species_dict[label].rotors_dict[job.rotor_index]["pivots"]} ' @@ -3219,9 +3223,9 @@ def troubleshoot_scan_job(self, - ``True`` if the troubleshooting is valid. - The actions are applied in the troubleshooting. """ - if not self.trsh_ess_jobs: + if not self.trsh_ess_jobs or not self.trsh_rotors: logger.warning(f'Not troubleshooting failed scan job {job.job_name}. To enable troubleshooting, ' - f'set the "trsh_ess_jobs" to "True".') + f'set the "trsh_ess_jobs" and the "trsh_rotors" arguments to "True".') return False, dict() label = job.species_label @@ -3413,7 +3417,7 @@ def troubleshoot_ess(self, level_of_theory (Level, dict, str): The level of theory to use. conformer (int, optional): The conformer index. """ - if not self.trsh_ess_jobs: + if not self.trsh_ess_jobs or not self.trsh_rotors and job.job_type == 'scan': logger.warning(f'Not troubleshooting failed {label} job {job.job_name}. ' f'To enable troubleshooting, set the "trsh_ess_jobs" argument to "True".') return None