Skip to content

Commit

Permalink
Define output dict for multi species in main.py (#735)
Browse files Browse the repository at this point in the history
We have problem when we launch `restart.yml` saying unexpected keyword
argument 'output_multi_spc'. It turns out previously we defined
`Scheduler.output_multi_spc` parallel to `Scheduler.output` in
`Scheduler` `__init__`, however, we forgot to define it in the `ARC`
class in `main.py`. So now we add the relevant terms in `main.py`.
  • Loading branch information
JintaoWu98 committed Apr 17, 2024
2 parents be1f6c8 + 5ca8ae1 commit dfe93dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions arc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class ARC(object):
trsh_ess_jobs (bool, optional): Whether to attempt troubleshooting failed ESS 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.
Only used for restarting.
running_jobs (dict, optional): A dictionary of jobs submitted in a precious ARC instance, used for restarting.
ts_adapters (list, optional): Entries represent different TS adapters.
report_e_elect (bool, optional): Whether to report electronic energy. Default is ``False``.
Expand All @@ -180,6 +182,8 @@ class ARC(object):
Job types not defined in adaptive levels will have non-adaptive (regular) levels.
output (dict): Output dictionary with status and final QM file paths for all species. Only used for restarting,
the actual object used is in the Scheduler class.
output_multi_spc (dict): Output dictionary with status and final QM file paths for the multi species.
Only used for restarting, the actual object used is in the Scheduler class.
bac_type (str): The bond additivity correction type. 'p' for Petersson- or 'm' for Melius-type BAC.
``None`` to not use BAC.
arkane_level_of_theory (Level): The Arkane level of theory to use for AEC and BAC.
Expand Down Expand Up @@ -258,6 +262,7 @@ def __init__(self,
opt_level: Optional[Union[str, dict, Level]] = None,
orbitals_level: Optional[Union[str, dict, Level]] = None,
output: Optional[dict] = None,
output_multi_spc: Optional[dict] = None,
project: Optional[str] = None,
project_directory: Optional[str] = None,
reactions: Optional[List[Union[ARCReaction, Reaction]]] = None,
Expand Down Expand Up @@ -291,6 +296,7 @@ def __init__(self,
if not os.path.exists(self.project_directory):
os.makedirs(self.project_directory)
self.output = output
self.output_multi_spc = output_multi_spc
self.standardize_output_paths() # depends on self.project_directory
self.running_jobs = running_jobs or dict()
for jobs in self.running_jobs.values():
Expand Down Expand Up @@ -515,6 +521,7 @@ def as_dict(self) -> dict:
restart_dict['orbitals_level'] = self.orbitals_level.as_dict() \
if not isinstance(self.orbitals_level, (dict, str)) else self.orbitals_level
restart_dict['output'] = self.output
restart_dict['output_multi_spc'] = self.output_multi_spc if self.output_multi_spc else dict()
restart_dict['project'] = self.project
restart_dict['reactions'] = [rxn.as_dict() for rxn in self.reactions]
restart_dict['running_jobs'] = self.running_jobs
Expand Down
1 change: 1 addition & 0 deletions arc/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def test_as_dict(self):
'method_type': 'dft',
'software': 'gaussian'},
'output': {},
'output_multi_spc': {},
'project': 'arc_test',
'reactions': [],
'running_jobs': {},
Expand Down
6 changes: 5 additions & 1 deletion arc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,18 +1183,22 @@ def run_opt_job(self, label: str, fine: bool = False):
or self.species_dict[label].get_xyz(generate=False)
if self.species_dict[label].initial_xyz is None:
raise SpeciesError(f'Cannot execute opt job for {label} without xyz (got None for Species.initial_xyz)')
label_single_spc = None
key = None
if self.species_dict[label].multi_species:
key = 'fine' if fine else 'opt'
if self.output_multi_spc[self.species_dict[label].multi_species].get(key, False):
return
self.output_multi_spc[self.species_dict[label].multi_species][key] = True
label_single_spc = label
label = [species.label for species in self.species_list
if species.multi_species == self.species_dict[label].multi_species]
self.run_job(label=label,
xyz=self.species_dict[label].initial_xyz if isinstance(label, str) else None,
level_of_theory=self.opt_level,
job_type='opt',
fine=fine)
if label_single_spc is not None and key is not None:
self.output_multi_spc[self.species_dict[label_single_spc].multi_species][key] = True

def run_composite_job(self, label: str):
"""
Expand Down

0 comments on commit dfe93dd

Please sign in to comment.