Skip to content

Commit

Permalink
Run sp job after conformer job
Browse files Browse the repository at this point in the history
Use the `xyzs` from the conformer job to run `sp` jobs. 

Save the `conformers_after_optimization` using the updated level of theory and energies.
  • Loading branch information
JintaoWu98 committed Sep 15, 2024
1 parent 352631f commit 349e78d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arc/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ def save_conformers_file(project_directory: str,
im_freqs: Optional[List[List[float]]] = None,
log_content: bool = False,
before_optimization: bool = True,
conf_sp: Optional[bool] = False,
):
"""
Save the conformers before or after optimization.
Expand Down Expand Up @@ -936,7 +937,10 @@ def save_conformers_file(project_directory: str,
content += f'Conformers for {label}, computed using a force field:\n\n'
else:
level_of_theory = level_of_theory.simple() if isinstance(level_of_theory, Level) else level_of_theory
content += f'Conformers for {label}, optimized at the {level_of_theory} level:\n\n'
if not conf_sp:
content += f'Conformers for {label}, optimized at the {level_of_theory} level:\n\n'
else:
content += f'Conformers for {label}, sp at the {level_of_theory} level:\n\n'
for i, xyz in enumerate(xyzs):
content += f'conformer {i}:\n'
if xyz is not None:
Expand Down
24 changes: 24 additions & 0 deletions arc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,12 @@ def schedule_jobs(self):
successful_server_termination = self.end_job(job=job, label=label, job_name=job_name)
if successful_server_termination:
troubleshooting_conformer = self.parse_conformer(job=job, label=label, i=i)
if self.conformer_sp_level is not None:
self.run_job(label=label,
xyz=self.species_dict[label].conformers[i],
level_of_theory=self.conformer_sp_level,
job_type='sp',
)
if troubleshooting_conformer:
break
# Just terminated a conformer job.
Expand Down Expand Up @@ -635,6 +641,17 @@ def schedule_jobs(self):
successful_server_termination = self.end_job(job=job, label=label, job_name=job_name)
if successful_server_termination:
self.check_sp_job(label=label, job=job)
plotter.save_conformers_file(project_directory=self.project_directory,
label=label,
xyzs=self.species_dict[label].conformers,
level_of_theory=self.conformer_sp_level,
multiplicity=self.species_dict[label].multiplicity,
charge=self.species_dict[label].charge,
is_ts=False,
energies=self.species_dict[label].conformer_energies,
before_optimization=False,
conf_sp=True
) # after optimization
self.timer = False
break
elif 'composite' in job_name:
Expand Down Expand Up @@ -2663,6 +2680,13 @@ def check_sp_job(self,
# This is a CCSD job ran before MRCI. Spawn MRCI
self.run_sp_job(label)
elif job.job_status[1]['status'] == 'done':
if self.conformer_sp_level is not None:
xyz = parser.parse_geometry(path=job.local_path_to_output_file)
energy = parser.parse_e_elect(path=job.local_path_to_output_file)
for i, conformer in enumerate(self.species_dict[label].conformers):
if conformer == xyz:
self.species_dict[label].conformer_energies[i] = energy
break
self.post_sp_actions(label,
sp_path=os.path.join(job.local_path_to_output_file),
level=job.level,
Expand Down

0 comments on commit 349e78d

Please sign in to comment.