diff --git a/arc/job/adapters/molpro_test.py b/arc/job/adapters/molpro_test.py index a69b036c62..a7dc828353 100644 --- a/arc/job/adapters/molpro_test.py +++ b/arc/job/adapters/molpro_test.py @@ -42,6 +42,56 @@ def setUpClass(cls): species=[ARCSpecies(label='spc1', xyz=['O 0 0 1'])], testing=True, ) + cls.job_3 = MolproAdapter(execution_type='queue', + job_type='sp', + level=Level(method='MRCI', basis='aug-cc-pvtz-f12'), + project='test', + project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_3'), + species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000 + O 1.01258 -0.17285 0.00000 + H -0.93116 -0.20169 0.00000"""])], + testing=True, + ) + cls.job_4 = MolproAdapter(execution_type='queue', + job_type='sp', + level=Level(method='MRCI-F12', basis='aug-cc-pvtz-f12'), + project='test', + project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_4'), + species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000 + O 1.01258 -0.17285 0.00000 + H -0.93116 -0.20169 0.00000"""])], + testing=True, + ) + cls.job_5 = MolproAdapter(execution_type='queue', + job_type='sp', + level=Level(method='MP2_CASSCF_MRCI-F12', basis='aug-cc-pVTZ-F12'), + project='test', + project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_5'), + species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000 + O 1.01258 -0.17285 0.00000 + H -0.93116 -0.20169 0.00000"""])], + testing=True, + ) + cls.job_6 = MolproAdapter(execution_type='queue', + job_type='sp', + level=Level(method='MP2_CASSCF_RS2C', basis='aug-cc-pVTZ'), # CASPT2 + project='test', + project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_6'), + species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000 + O 1.01258 -0.17285 0.00000 + H -0.93116 -0.20169 0.00000"""])], + testing=True, + ) + cls.job_7 = MolproAdapter(execution_type='queue', + job_type='sp', + level=Level(method='MP2_CASSCF_RS2C', basis='aug-cc-pVTZ'), # CASPT2 + project='test', + project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_7'), + species=[ARCSpecies(label='N', xyz=["""N 0.0 0.0 0.0"""], + active={'occ': [3, 1, 1, 0, 1, 0, 0, 0], + 'closed': [1, 0, 0, 0, 0, 0, 0, 0]})], + testing=True, + ) def test_set_cpu_and_mem(self): """Test assigning number of cpu's and memory""" @@ -56,38 +106,42 @@ def test_set_input_file_memory(self): self.job_1.input_file_memory = None self.job_1.cpu_cores = 48 self.job_1.set_input_file_memory() - self.assertEqual(self.job_1.input_file_memory, 40) + self.assertEqual(self.job_1.input_file_memory, 438) self.job_1.cpu_cores = 8 self.job_1.set_input_file_memory() - self.assertEqual(self.job_1.input_file_memory, 235) + self.assertEqual(self.job_1.input_file_memory, 438) self.job_1.input_file_memory = None self.job_1.cpu_cores = 1 self.job_1.set_input_file_memory() - self.assertEqual(self.job_1.input_file_memory, 1880) + self.assertEqual(self.job_1.input_file_memory, 438) def test_write_input_file(self): - """Test writing Gaussian input files""" + """Test writing Molpro input files""" self.job_1.cpu_cores = 48 self.job_1.set_input_file_memory() 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 = """***,spc1 -memory,40,m; +memory,Total=438,m; geometry={angstrom; O 0.00000000 0.00000000 1.00000000} +gprint,orbitals; + basis=cc-pvtz-f12 int; + {hf; -maxit,1000; -wf,spin=2,charge=0;} + maxit,999; + wf,spin=2,charge=0; +} uccsd(t)-f12; @@ -104,19 +158,23 @@ def test_write_input_file(self): 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 = """***,spc1 -memory,40,m; +memory,Total=438,m; geometry={angstrom; O 0.00000000 0.00000000 1.00000000} +gprint,orbitals; + basis=cc-pvqz int; + {hf; -maxit,1000; -wf,spin=2,charge=0;} + maxit,999; + wf,spin=2,charge=0; +} uccsd(t); @@ -127,6 +185,257 @@ def test_write_input_file(self): """ self.assertEqual(content_2, job_2_expected_input_file) + def test_write_mrci_input_file(self): + """Test writing MRCI Molpro input files""" + self.job_3.cpu_cores = 48 + self.job_3.set_input_file_memory() + 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 = """***,HNO_t +memory,Total=438,m; + +geometry={angstrom; +N -0.08142000 0.37454000 0.00000000 +O 1.01258000 -0.17285000 0.00000000 +H -0.93116000 -0.20169000 0.00000000} + +gprint,orbitals; + +basis=aug-cc-pvtz-f12 + + + +int; + +{hf; + maxit,999; + wf,spin=0,charge=0; +} + +{casscf; + maxit,999; + wf,spin=0,charge=0; +} + +{mrci; + maxit,999; + wf,spin=0,charge=0; +} + + + + +E_mrci=energy; +E_mrci_Davidson=energd; + +table,E_mrci,E_mrci_Davidson; +---; + +""" + self.assertEqual(content_3, job_3_expected_input_file) + + self.job_4.cpu_cores = 48 + self.job_4.set_input_file_memory() + self.job_4.write_input_file() + with open(os.path.join(self.job_4.local_path, input_filenames[self.job_4.job_adapter]), 'r') as f: + content_4 = f.read() + job_4_expected_input_file = """***,HNO_t +memory,Total=438,m; + +geometry={angstrom; +N -0.08142000 0.37454000 0.00000000 +O 1.01258000 -0.17285000 0.00000000 +H -0.93116000 -0.20169000 0.00000000} + +gprint,orbitals; + +basis=aug-cc-pvtz-f12 + + + +int; + +{hf; + maxit,999; + wf,spin=0,charge=0; +} + +{casscf; + maxit,999; + wf,spin=0,charge=0; +} + +{mrci-f12; + maxit,999; + wf,spin=0,charge=0; +} + + + + +E_mrci=energy; +E_mrci_Davidson=energd; + +table,E_mrci,E_mrci_Davidson; +---; + +""" + self.assertEqual(content_4, job_4_expected_input_file) + + self.job_5.cpu_cores = 48 + self.job_5.set_input_file_memory() + self.job_5.write_input_file() + with open(os.path.join(self.job_5.local_path, input_filenames[self.job_5.job_adapter]), 'r') as f: + content_5 = f.read() + job_5_expected_input_file = """***,HNO_t +memory,Total=438,m; + +geometry={angstrom; +N -0.08142000 0.37454000 0.00000000 +O 1.01258000 -0.17285000 0.00000000 +H -0.93116000 -0.20169000 0.00000000} + +gprint,orbitals; + +basis=aug-cc-pvtz-f12 + + + +int; + +{hf; + maxit,999; + wf,spin=0,charge=0; +} + + +{mp2; + wf,spin=0,charge=0; +} + +{casscf; + maxit,999; + wf,spin=0,charge=0; +} + +{mrci-f12; + maxit,999; + wf,spin=0,charge=0; +} + + + + + +E_mrci=energy; +E_mrci_Davidson=energd; + +table,E_mrci,E_mrci_Davidson; +---; + +""" + self.assertEqual(content_5, job_5_expected_input_file) + + self.job_6.cpu_cores = 48 + self.job_6.set_input_file_memory() + self.job_6.write_input_file() + with open(os.path.join(self.job_6.local_path, input_filenames[self.job_6.job_adapter]), 'r') as f: + content_6 = f.read() + job_6_expected_input_file = """***,HNO_t +memory,Total=438,m; + +geometry={angstrom; +N -0.08142000 0.37454000 0.00000000 +O 1.01258000 -0.17285000 0.00000000 +H -0.93116000 -0.20169000 0.00000000} + +gprint,orbitals; + +basis=aug-cc-pvtz + + + +int; + +{hf; + maxit,999; + wf,spin=0,charge=0; +} + + +{mp2; + wf,spin=0,charge=0; +} + +{casscf; + maxit,999; + wf,spin=0,charge=0; +} + +{rs2c; + maxit,999; + wf,spin=0,charge=0; +} + + + + +---; + +""" + self.assertEqual(content_6, job_6_expected_input_file) + + self.job_7.cpu_cores = 48 + self.job_7.set_input_file_memory() + self.job_7.write_input_file() + with open(os.path.join(self.job_7.local_path, input_filenames[self.job_7.job_adapter]), 'r') as f: + content_7 = f.read() + job_7_expected_input_file = """***,N +memory,Total=438,m; + +geometry={angstrom; +N 0.00000000 0.00000000 0.00000000} + +gprint,orbitals; + +basis=aug-cc-pvtz + + + +int; + +{hf; + maxit,999; + wf,spin=3,charge=0; +} + + +{mp2; + wf,spin=3,charge=0; +} + +{casscf; + maxit,999; + wf,spin=3,charge=0; + occ,3,1,1,0,1,0,0,0; + closed,1,0,0,0,0,0,0,0; + state,1; +} + +{rs2c; + maxit,999; + wf,spin=3,charge=0; +} + + + + +---; + +""" + self.assertEqual(content_7, job_7_expected_input_file) + def test_set_files(self): """Test setting files""" job_1_files_to_upload = [{'file_name': 'submit.sub', @@ -154,8 +463,8 @@ def tearDownClass(cls): A function that is run ONCE after all unit tests in this class. Delete all project directories created during these unit tests """ - for folder in ['test_MolproAdapter_1', 'test_MolproAdapter_2']: - shutil.rmtree(os.path.join(ARC_PATH, 'arc', 'testing', folder), ignore_errors=True) + for i in range(10): + shutil.rmtree(os.path.join(ARC_PATH, 'arc', 'testing', f'test_MolproAdapter_{i}'), ignore_errors=True) if __name__ == '__main__':