Skip to content
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

Allow user to input paths to previous jobs #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions arc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class ARC(object):
compute_rates (bool, optional): Whether to compute rate coefficients for converged reactions.
compute_transport (bool, optional): Whether to compute transport properties for converged species.
statmech_adapter (str, optional): The statmech software to use.
previous_job_paths (dict, optional): A dictionary for paths to previously run files needed for this job

Attributes:
project (str): The project's name. Used for naming the working directory.
Expand Down Expand Up @@ -182,6 +183,7 @@ class ARC(object):
statmech_adapter (str): The statmech software to use.
fine_only (bool): If ``self.job_types['fine'] and not self.job_types['opt']`` ARC will not run optimization
jobs without fine=True
previous_job_paths (dict, optional): A dictionary for paths to previously run files needed for this job
"""

def __init__(self, input_dict=None, project=None, arc_species_list=None, arc_rxn_list=None, level_of_theory='',
Expand All @@ -192,7 +194,7 @@ def __init__(self, input_dict=None, project=None, arc_species_list=None, arc_rxn
job_memory=None, ess_settings=None, bath_gas=None, adaptive_levels=None, freq_scale_factor=None,
calc_freq_factor=True, n_confs=10, e_confs=5, dont_gen_confs=None, keep_checks=False,
solvation=None, compare_to_rmg=True, compute_thermo=True, compute_rates=True, compute_transport=True,
specific_job_type='', statmech_adapter='Arkane'):
specific_job_type='', statmech_adapter='Arkane', previous_job_paths=None):
self.__version__ = VERSION
self.verbose = verbose
self.output = dict()
Expand All @@ -207,6 +209,7 @@ def __init__(self, input_dict=None, project=None, arc_species_list=None, arc_rxn
self.calc_freq_factor = calc_freq_factor
self.keep_checks = keep_checks
self.compare_to_rmg = compare_to_rmg
self.previous_job_paths = previous_job_paths

if input_dict is None:
if project is None:
Expand Down Expand Up @@ -618,7 +621,8 @@ def execute(self) -> dict:
T_count=self.T_count or 50,
lib_long_desc=self.lib_long_desc,
rmg_database=self.rmg_database,
compare_to_rmg=self.compare_to_rmg)
compare_to_rmg=self.compare_to_rmg,
previous_job_paths=self.previous_job_paths)

status_dict = self.summary()
log_footer(execution_time=self.execution_time)
Expand Down
16 changes: 16 additions & 0 deletions arc/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def process_arc_project(statmech_adapter: str,
lib_long_desc: str = '',
rmg_database: Type[RMGDatabase] = None,
compare_to_rmg: bool = True,
previous_job_paths: dict = None,
) -> None:
"""
Process an RMG project, generate thermo and rate coefficients using statistical mechanics (statmech).
Expand All @@ -75,7 +76,22 @@ def process_arc_project(statmech_adapter: str,
rmg_database (RMGDatabase, optional): The RMG database object.
compare_to_rmg (bool, optional): If ``True``, ARC's calculations will be compared against estimations
from RMG's database.
previous_job_paths (dict, optional): A dictionary for paths to previously run files needed for this job
"""
# First, add previous paths to the output dictionary
if previous_job_paths is not None:
print('Checking to see if previous job paths need to be appended')
for spcs_label in species_dict.keys():
if spcs_label in previous_job_paths.keys():
if 'geo' in previous_job_paths[spcs_label].keys():
geo_path = previous_job_paths[spcs_label]['geo']
output_dict[spcs_label]['paths']['geo'] = geo_path
print(f'Geometry path {geo_path} added for species {spcs_label}')
if 'freq' in previous_job_paths[spcs_label].keys():
freq_path = previous_job_paths[spcs_label]['freq']
output_dict[spcs_label]['paths']['freq'] = freq_path
print(f'Frequency path {freq_path} added for species {spcs_label}')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, when shall we use different logs for geo and freq? I used to thought we can use results from freq for both freq and geo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we use freq only for both geo and freqs, but that's done at the adapter level, processor stores all our paths and passes them along.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, it seems like, we don't have to assign geo and freq separately here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just pass freq if you want as long as there is no reason why the user we need to specify a separate geo file (I can't think of any reason) and as long as ARC won't freak out about not having a file for geo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's accept both, but if geo isn't given, override it with freq. Does that sound reasonable?

T_min = T_min or (300, 'K')
T_max = T_max or (3000, 'K')
if isinstance(T_min, (int, float)):
Expand Down