Skip to content

Commit

Permalink
Check species yml_path in sp/geo/freq checks in Scheduler
Browse files Browse the repository at this point in the history
Assuming that if the Arkane YAML path is not None, the the species has sp/geo/freq
  • Loading branch information
alongd committed Aug 20, 2023
1 parent a9df0fc commit 63df683
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions arc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,8 @@ def check_freq_job(self,
self.output[label]['warnings'] += wrong_freq_message
if job.job_status[1]['status'] != 'done' or (not freq_ok and not self.species_dict[label].is_ts):
self.troubleshoot_ess(label=label, job=job, level_of_theory=job.level)
if job.job_status[1]['status'] == 'done' and freq_ok and not switch_ts and species_has_sp(self.output[label]):
if (job.job_status[1]['status'] == 'done' and freq_ok and not switch_ts
and species_has_sp(self.output[label], self.species_dict[label].yml_path)):
self.check_rxn_e0_by_spc(label)

def check_negative_freq(self,
Expand Down Expand Up @@ -2430,8 +2431,8 @@ def check_rxn_e0_by_spc(self, label: str):
for rxn in self.rxn_list:
labels = rxn.reactants + rxn.products + [rxn.ts_label]
if label in labels and rxn.ts_species.ts_checks['E0'] is None \
and all([(species_has_sp(output_dict) and species_has_freq(output_dict))
or self.species_dict[spc_label].yml_path is not None
and all([(species_has_sp(output_dict, self.species_dict[spc_label].yml_path)
and species_has_freq(output_dict, self.species_dict[spc_label].yml_path))
for spc_label, output_dict in self.output.items() if spc_label in labels]):
check_ts(reaction=rxn,
checks=['energy'],
Expand All @@ -2445,7 +2446,7 @@ def check_rxn_e0_by_spc(self, label: str):
)
if rxn.ts_species.ts_checks['E0'] is False:
logger.info(f'TS {rxn.ts_species.label} of reaction {rxn.label} did not pass the E0 check.\n'
f'Switching TS.\n')
f'Searching for a better TS conformer...\n')
self.switch_ts(rxn.ts_label)

def switch_ts(self, label: str):
Expand Down Expand Up @@ -2549,20 +2550,8 @@ def post_sp_actions(self,
self.output[label]['paths']['sp_no_sol'] = sp_path
self.output[label]['paths']['sp'] = original_sp_path # restore the original path

if self.species_dict[label].is_ts:
for rxn in self.rxn_dict.values():
if rxn.ts_label == label:
if not rxn.ts_species.ts_checks['e_elect']:
check_ts(reaction=rxn, verbose=True, checks=['energy'])
if species_has_freq(self.output[label]) and not rxn.ts_species.ts_checks['E0']:
self.check_rxn_e0_by_spc(label)
if not (rxn.ts_species.ts_checks['E0'] or rxn.ts_species.ts_checks['e_elect']) \
and (self.output[label]['paths']['freq'] or self.species_dict[label].e0):
logger.info(f'TS {label} did not pass the energy check. '
f'Status is:\n{self.species_dict[label].ts_checks}\n'
f'Searching for a better TS conformer...')
self.switch_ts(label=label)
break
if species_has_freq(self.output[label], self.species_dict[label].yml_path):
self.check_rxn_e0_by_spc(label)

# set *at the end* to differentiate between sp jobs when using complex solvation corrections
self.output[label]['job_types']['sp'] = True
Expand Down Expand Up @@ -3625,46 +3614,61 @@ def generate_final_ts_guess_report(self):
save_yaml_file(path=path, content=content)


def species_has_freq(species_output_dict: dict) -> bool:
def species_has_freq(species_output_dict: dict,
yml_path: Optional[str] = None,
) -> bool:
"""
Checks whether a species has valid converged frequencies using it's output dict.
Args:
species_output_dict (dict): The species output dict (i.e., Scheduler.output[label]).
yml_path (str): THe species Arkane YAML file path.
Returns: bool
Whether a species has valid converged frequencies.
"""
if yml_path is not None:
return True
if species_output_dict['paths']['freq'] or species_output_dict['paths']['composite']:
return True
return False


def species_has_geo(species_output_dict: dict) -> bool:
def species_has_geo(species_output_dict: dict,
yml_path: Optional[str] = None,
) -> bool:
"""
Checks whether a species has a valid converged geometry using it's output dict.
Args:
species_output_dict (dict): The species output dict (i.e., Scheduler.output[label]).
yml_path (str): THe species Arkane YAML file path.
Returns: bool
Whether a species has a valid converged geometry.
"""
if yml_path is not None:
return True
if species_output_dict['paths']['geo'] or species_output_dict['paths']['composite']:
return True
return False


def species_has_sp(species_output_dict: dict) -> bool:
def species_has_sp(species_output_dict: dict,
yml_path: Optional[str] = None,
) -> bool:
"""
Checks whether a species has a valid converged single-point energy using it's output dict.
Args:
species_output_dict (dict): The species output dict (i.e., Scheduler.output[label]).
yml_path (str): THe species Arkane YAML file path.
Returns: bool
Whether a species has a valid converged single-point energy.
"""
if yml_path is not None:
return True
if species_output_dict['paths']['sp'] or species_output_dict['paths']['composite']:
return True
return False
Expand Down

0 comments on commit 63df683

Please sign in to comment.