From eabc79cba81204375ea41998157af5d13323623a Mon Sep 17 00:00:00 2001 From: Lilachn91 Date: Wed, 25 Oct 2023 17:52:20 +0300 Subject: [PATCH 1/3] Added solvation methods to Orca adapter, works with Orca version 5 with parallelization --- arc/job/adapters/orca.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/arc/job/adapters/orca.py b/arc/job/adapters/orca.py index dbe893b157..8c0c5db2f2 100644 --- a/arc/job/adapters/orca.py +++ b/arc/job/adapters/orca.py @@ -1,5 +1,5 @@ """ -An adapter for executing Orca jobs +An adapter for executing Orca 5 jobs https://orcaforum.kofo.mpg.de/app.php/portal """ @@ -47,7 +47,6 @@ # method_class: 'HF' for wavefunction methods (hf, mp, cc, dlpno ...). 'KS' for DFT methods. # options: additional keywords to control job (e.g., TightSCF, NormalPNO ...) input_template = """!${restricted}${method_class} ${method} ${basis} ${auxiliary_basis} ${keywords} -! NRSCF # using Newton–Raphson SCF algorithm !${job_type_1} ${job_type_2} %%maxcore ${memory} @@ -55,8 +54,6 @@ nprocs ${cpus} end %%scf # recommended SCF settings -NRMaxIt 400 -NRStart 0.00005 MaxIter 500 end${scan} ${block} @@ -312,6 +309,20 @@ def write_input_file(self) -> None: input_dict['scan'] += f'\nD {torsion} = {dihedral:.1f}, {dihedral - self.scan_res:.1f}, {self.scan_res:.1f}\n' input_dict['scan'] += '\nend\nend' if len(self.torsions) > 1 else '\nend' + if self.level.solvation_method: + if self.level.solvation_method.lower() == 'smd': + self.add_to_args(val=f""" +%cpcm SMD true + SMDsolvent "{self.level.solvent}" +end + """, + key1='block') + elif self.level.solvation_method.lower() in ['pcm', 'cpcm']: + self.add_to_args(val=f""" +!CPCM({self.level.solvent}) + """, + key1='block') + input_dict = update_input_dict_with_args(args=self.args, input_dict=input_dict) with open(os.path.join(self.local_path, input_filenames[self.job_adapter]), 'w') as f: From d565c8c5300b4e11de8c6255230988939180c194 Mon Sep 17 00:00:00 2001 From: Lilachn91 Date: Wed, 25 Oct 2023 18:16:35 +0300 Subject: [PATCH 2/3] Added tests for solvation methods with Orca 5, works with parallelization --- arc/job/adapters/orca_test.py | 111 +++++++++++++++++++++++++++++++--- 1 file changed, 101 insertions(+), 10 deletions(-) diff --git a/arc/job/adapters/orca_test.py b/arc/job/adapters/orca_test.py index eb95b3944b..d3aa891ec0 100644 --- a/arc/job/adapters/orca_test.py +++ b/arc/job/adapters/orca_test.py @@ -3,6 +3,7 @@ """ This module contains unit tests of the arc.job.adapters.orca module +Compatible with Orca version 5 """ import math @@ -40,36 +41,59 @@ def setUpClass(cls): H -0.53338088 -0.77135867 -0.54806440""")], testing=True, ) - + cls.job_2 = OrcaAdapter(execution_type='queue', + job_type='sp', + level=Level(method='DLPNO-CCSD(T)', basis='def2-tzvp', auxiliary_basis='def2-tzvp/c', + solvation_method='SMD', solvent='DMSO'), + project='test', + project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_OrcaAdapter'), + species=[ARCSpecies(label='CH3O', + xyz="""C 0.03807240 0.00035621 -0.00484242 + O 1.35198769 0.01264937 -0.17195885 + H -0.33965241 -0.14992727 1.02079480 + H -0.51702680 0.90828035 -0.29592912 + H -0.53338088 -0.77135867 -0.54806440""")], + testing=True, + ) + cls.job_3 = OrcaAdapter(execution_type='queue', + job_type='sp', + level=Level(method='DLPNO-CCSD(T)', basis='def2-tzvp', auxiliary_basis='def2-tzvp/c', + solvation_method='cpcm', solvent='water'), + project='test', + project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_OrcaAdapter'), + species=[ARCSpecies(label='CH3O', + xyz="""C 0.03807240 0.00035621 -0.00484242 + O 1.35198769 0.01264937 -0.17195885 + H -0.33965241 -0.14992727 1.02079480 + H -0.51702680 0.90828035 -0.29592912 + H -0.53338088 -0.77135867 -0.54806440""")], + testing=True, + ) def test_set_cpu_and_mem(self): """Test assigning number of cpu's and memory""" - self.job_1.cpu_cores = 48 self.job_1.input_file_memory = None self.job_1.submit_script_memory = None self.job_1.set_cpu_and_mem() - self.assertEqual(self.job_1.cpu_cores, 48) + self.assertEqual(self.job_1.cpu_cores, 8) def test_set_input_file_memory(self): """Test setting the input_file_memory argument""" - expected_memory = math.ceil(14 * 1024 / 48) + expected_memory = math.ceil(14 * 1024 / 8) self.assertEqual(self.job_1.input_file_memory, expected_memory) def test_write_input_file(self): - """Test writing Gaussian input files""" + """Test writing Orca input files""" self.job_1.write_input_file() with open(os.path.join(self.job_1.local_path, input_filenames[self.job_1.job_adapter]), 'r') as f: content_1 = f.read() job_1_expected_input_file = """!uHF dlpno-ccsd(t) def2-tzvp def2-tzvp/c tightscf normalpno -! NRSCF # using Newton–Raphson SCF algorithm !sp -%maxcore 299 +%maxcore 1792 %pal # job parallelization settings -nprocs 48 +nprocs 8 end %scf # recommended SCF settings -NRMaxIt 400 -NRStart 0.00005 MaxIter 500 end @@ -84,6 +108,73 @@ def test_write_input_file(self): """ self.assertEqual(content_1, job_1_expected_input_file) + def test_write_input_file_with_SMD_solvation(self): + """Test writing ORCA input files with SMD solvation""" + self.job_2.write_input_file() + with open(os.path.join(self.job_2.local_path, input_filenames[self.job_2.job_adapter]), 'r') as f: + content_2 = f.read() + job_2_expected_input_file = """!uHF dlpno-ccsd(t) def2-tzvp def2-tzvp/c tightscf normalpno +!sp + +%maxcore 1792 +%pal # job parallelization settings +nprocs 8 +end +%scf # recommended SCF settings +MaxIter 500 +end + + + +%cpcm SMD true + SMDsolvent "dmso" +end + + + +* xyz 0 2 +C 0.03807240 0.00035621 -0.00484242 +O 1.35198769 0.01264937 -0.17195885 +H -0.33965241 -0.14992727 1.02079480 +H -0.51702680 0.90828035 -0.29592912 +H -0.53338088 -0.77135867 -0.54806440 +* +""" + self.assertEqual(content_2, job_2_expected_input_file) + + + def test_write_input_file_with_CPCM_solvation(self): + """Test writing ORCA input files with CPCM solvation""" + self.job_3.write_input_file() + with open(os.path.join(self.job_3.local_path, input_filenames[self.job_3.job_adapter]), 'r') as f: + content_3 = f.read() + job_3_expected_input_file = """!uHF dlpno-ccsd(t) def2-tzvp def2-tzvp/c tightscf normalpno +!sp + +%maxcore 1792 +%pal # job parallelization settings +nprocs 8 +end +%scf # recommended SCF settings +MaxIter 500 +end + + + +!CPCM(water) + + + +* xyz 0 2 +C 0.03807240 0.00035621 -0.00484242 +O 1.35198769 0.01264937 -0.17195885 +H -0.33965241 -0.14992727 1.02079480 +H -0.51702680 0.90828035 -0.29592912 +H -0.53338088 -0.77135867 -0.54806440 +* +""" + self.assertEqual(content_3, job_3_expected_input_file) + def test_set_files(self): """Test setting files""" job_1_files_to_upload = [{'file_name': 'submit.sub', From b895514db4f46ae07aedad773decf4400b7c17fa Mon Sep 17 00:00:00 2001 From: Lilachn91 Date: Wed, 25 Oct 2023 15:14:11 +0300 Subject: [PATCH 3/3] Fixed error message for rate calculation when sp file is missing --- arc/statmech/arkane.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arc/statmech/arkane.py b/arc/statmech/arkane.py index 6cf04dee26..26c1e2aa1a 100644 --- a/arc/statmech/arkane.py +++ b/arc/statmech/arkane.py @@ -540,7 +540,7 @@ def generate_arkane_species_file(self, if not os.path.isfile(freq_path): return_none_text = f'the freq file in path {freq_path}' if not os.path.isfile(sp_path): - return_none_text = f'the freq file in path {sp_path}' + return_none_text = f'the sp file in path {sp_path}' if return_none_text is not None: logger.error(f'Could not find {return_none_text} for species {species.label}. Not calculating properties.') return None