From 5c776f5a0908c6fbbbde9b02e35b6b7f69724660 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sun, 8 Sep 2024 09:28:38 +0300 Subject: [PATCH] f! molpro test --- arc/job/adapters/molpro_test.py | 133 ++++++++++++++++++++++++++------ 1 file changed, 108 insertions(+), 25 deletions(-) diff --git a/arc/job/adapters/molpro_test.py b/arc/job/adapters/molpro_test.py index ddcff0903d..a7dc828353 100644 --- a/arc/job/adapters/molpro_test.py +++ b/arc/job/adapters/molpro_test.py @@ -82,6 +82,16 @@ def setUpClass(cls): 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""" @@ -120,14 +130,18 @@ def test_write_input_file(self): geometry={angstrom; O 0.00000000 0.00000000 1.00000000} +gprint,orbitals; + basis=cc-pvtz-f12 int; + {hf; maxit,999; - wf,spin=2,charge=0;} + wf,spin=2,charge=0; +} uccsd(t)-f12; @@ -149,14 +163,18 @@ def test_write_input_file(self): geometry={angstrom; O 0.00000000 0.00000000 1.00000000} +gprint,orbitals; + basis=cc-pvqz int; + {hf; maxit,999; - wf,spin=2,charge=0;} + wf,spin=2,charge=0; +} uccsd(t); @@ -189,17 +207,21 @@ def test_write_mrci_input_file(self): int; + {hf; maxit,999; - wf,spin=0,charge=0;} + wf,spin=0,charge=0; +} {casscf; maxit,999; - wf,spin=0,charge=0;} - + wf,spin=0,charge=0; +} + {mrci; maxit,999; - wf,spin=0,charge=0;}; + wf,spin=0,charge=0; +} @@ -233,17 +255,21 @@ def test_write_mrci_input_file(self): int; + {hf; maxit,999; - wf,spin=0,charge=0;} + wf,spin=0,charge=0; +} {casscf; maxit,999; - wf,spin=0,charge=0;} - + wf,spin=0,charge=0; +} + {mrci-f12; maxit,999; - wf,spin=0,charge=0;}; + wf,spin=0,charge=0; +} @@ -277,22 +303,27 @@ def test_write_mrci_input_file(self): int; + {hf; maxit,999; - wf,spin=0,charge=0;} - + wf,spin=0,charge=0; +} {mp2; - wf,spin=0,charge=0;} + wf,spin=0,charge=0; +} {casscf; maxit,999; - wf,spin=0,charge=0;} + wf,spin=0,charge=0; +} {mrci-f12; maxit,999; - wf,spin=0,charge=0;}; + wf,spin=0,charge=0; +} + @@ -326,32 +357,85 @@ def test_write_mrci_input_file(self): int; + {hf; maxit,999; - wf,spin=0,charge=0;} - + wf,spin=0,charge=0; +} {mp2; - wf,spin=0,charge=0;} + wf,spin=0,charge=0; +} {casscf; maxit,999; - wf,spin=0,charge=0;} + wf,spin=0,charge=0; +} {rs2c; maxit,999; - wf,spin=0,charge=0;}; + wf,spin=0,charge=0; +} + ---; """ - print('*****') - print(content_6) 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', @@ -379,9 +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', 'test_MolproAdapter_3', 'test_MolproAdapter_4', - 'test_MolproAdapter_5', 'test_MolproAdapter_6']: - 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__':