Skip to content

Commit

Permalink
f! molpro test
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Sep 11, 2024
1 parent 837db38 commit 5c776f5
Showing 1 changed file with 108 additions and 25 deletions.
133 changes: 108 additions & 25 deletions arc/job/adapters/molpro_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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__':
Expand Down

0 comments on commit 5c776f5

Please sign in to comment.