Skip to content

Commit

Permalink
Merge pull request #414 from ReactionMechanismGenerator/unconverged_s…
Browse files Browse the repository at this point in the history
…pecies

If a species gets invalidated, delete its jobs and don't spawn new ones
  • Loading branch information
alongd committed Aug 1, 2020
2 parents e37fea2 + c17a260 commit 39c9669
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
10 changes: 8 additions & 2 deletions arc/job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,10 @@ def write_input_file(self):
if up_file['source'] == 'path':
source_path = up_file['local']
destination_path = os.path.join(self.local_path, up_file['name'])
shutil.copyfile(source_path, destination_path)
try:
shutil.copyfile(source_path, destination_path)
except shutil.SameFileError:
pass
elif up_file['source'] == 'input_files':
with open(os.path.join(self.local_path, up_file['name']), 'w') as f:
f.write(input_files[up_file['local']])
Expand Down Expand Up @@ -1211,7 +1214,10 @@ def _upload_check_file(self, local_check_file_path=None):
else:
# running locally, just copy the check file to the job folder
new_check_file_path = os.path.join(self.local_path, 'check.chk')
shutil.copyfile(local_check_file_path, new_check_file_path)
try:
shutil.copyfile(local_check_file_path, new_check_file_path)
except shutil.SameFileError:
pass

def _download_output_file(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion arc/job/trsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def trsh_negative_freq(label: str,
'cannot troubleshoot geometry using dihedral modifications.')
output_warnings.append('rotors = False; ')
logger.error('Invalidating species.')
output_errors.append('Error: Encountered negative frequencies too many times; ')
output_errors.append('Error: Encountered negative frequencies too many times; Invalidating species; ')
else:
neg_freqs_idx = list() # store indices w.r.t. vibfreqs
largest_neg_freq_idx = 0 # index in vibfreqs
Expand Down
11 changes: 9 additions & 2 deletions arc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Scheduler(object):
},
'conformers': <comments>,
'isomorphism': <comments>,
'convergence': <status>, # boolean
'convergence': <status>, # Optional[bool]
'restart': <comments>,
'info': <comments>,
'warnings': <comments>,
Expand Down Expand Up @@ -469,6 +469,9 @@ def schedule_jobs(self):
self.timer = True
job_list = list()
for label in self.unique_species_labels:
if self.output[label]['convergence'] is False:
# skip unconverged species
continue
# look for completed jobs and decide what jobs to run next
self.get_servers_jobs_ids() # updates `self.servers_jobs_ids`
try:
Expand Down Expand Up @@ -2720,6 +2723,10 @@ def troubleshoot_negative_freq(self, label, job):
self.species_dict[label].neg_freqs_trshed.extend(current_neg_freqs_trshed)
for output_error in output_errors:
self.output[label]['errors'] += output_error
if 'Invalidating species' in output_error:
logger.info(f'Deleting all currently running jobs for species {label}...')
self.delete_all_species_jobs(label)
self.output[label]['convergence'] = False
for output_warning in output_warnings:
self.output[label]['warnings'] += output_warning
if len(confs):
Expand Down Expand Up @@ -3196,7 +3203,7 @@ def initialize_output_dict(self, label: Optional[str] = None):
for key in keys:
if key not in self.output[species.label]:
if key == 'convergence':
self.output[species.label][key] = False
self.output[species.label][key] = None
else:
self.output[species.label][key] = ''

Expand Down
4 changes: 2 additions & 2 deletions arc/schedulerTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_initialize_output_dict(self):
self.sched1.initialize_output_dict()
self.assertFalse(self.sched1._does_output_dict_contain_info())
empty_species_dict = {'conformers': '',
'convergence': False,
'convergence': None,
'errors': '',
'info': '',
'isomorphism': '',
Expand All @@ -235,7 +235,7 @@ def test_initialize_output_dict(self):
'sp': ''},
'restart': '',
'warnings': ''}
initialized_output_dict = {'C2H6':empty_species_dict,
initialized_output_dict = {'C2H6': empty_species_dict,
'CtripCO': empty_species_dict,
'methylamine': empty_species_dict,
}
Expand Down

0 comments on commit 39c9669

Please sign in to comment.