Skip to content

Commit efb42c0

Browse files
kfir4444alongd
authored andcommitted
Tests: Molpro MRCI implementation
1 parent 0f67285 commit efb42c0

File tree

1 file changed

+117
-7
lines changed

1 file changed

+117
-7
lines changed

arc/job/adapters/molpro_test.py

Lines changed: 117 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ def setUpClass(cls):
4343
species=[ARCSpecies(label='spc1', xyz=['O 0 0 1'])],
4444
testing=True,
4545
)
46+
cls.job_3 = MolproAdapter(execution_type='queue',
47+
job_type='sp',
48+
level=Level(method='MRCI', basis='aug-cc-pvtz-f12'),
49+
project='test',
50+
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_3'),
51+
species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000
52+
O 1.01258 -0.17285 0.00000
53+
H -0.93116 -0.20169 0.00000"""])],
54+
testing=True,
55+
)
56+
cls.job_4 = MolproAdapter(execution_type='queue',
57+
job_type='sp',
58+
level=Level(method='MRCI-F12', basis='aug-cc-pvtz-f12'),
59+
project='test',
60+
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_4'),
61+
species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000
62+
O 1.01258 -0.17285 0.00000
63+
H -0.93116 -0.20169 0.00000"""])],
64+
testing=True,
65+
)
4666

4767
def test_set_cpu_and_mem(self):
4868
"""Test assigning number of cpu's and memory"""
@@ -57,26 +77,26 @@ def test_set_input_file_memory(self):
5777
self.job_1.input_file_memory = None
5878
self.job_1.cpu_cores = 48
5979
self.job_1.set_input_file_memory()
60-
self.assertEqual(self.job_1.input_file_memory, 40)
80+
self.assertEqual(self.job_1.input_file_memory, 438)
6181

6282
self.job_1.cpu_cores = 8
6383
self.job_1.set_input_file_memory()
64-
self.assertEqual(self.job_1.input_file_memory, 235)
84+
self.assertEqual(self.job_1.input_file_memory, 438)
6585

6686
self.job_1.input_file_memory = None
6787
self.job_1.cpu_cores = 1
6888
self.job_1.set_input_file_memory()
69-
self.assertEqual(self.job_1.input_file_memory, 1880)
89+
self.assertEqual(self.job_1.input_file_memory, 438)
7090

7191
def test_write_input_file(self):
72-
"""Test writing Gaussian input files"""
92+
"""Test writing Molpro input files"""
7393
self.job_1.cpu_cores = 48
7494
self.job_1.set_input_file_memory()
7595
self.job_1.write_input_file()
7696
with open(os.path.join(self.job_1.local_path, input_filenames[self.job_1.job_adapter]), 'r') as f:
7797
content_1 = f.read()
7898
job_1_expected_input_file = """***,spc1
79-
memory,40,m;
99+
memory,Total=438,m;
80100
81101
geometry={angstrom;
82102
O 0.00000000 0.00000000 1.00000000}
@@ -105,7 +125,7 @@ def test_write_input_file(self):
105125
with open(os.path.join(self.job_2.local_path, input_filenames[self.job_2.job_adapter]), 'r') as f:
106126
content_2 = f.read()
107127
job_2_expected_input_file = """***,spc1
108-
memory,40,m;
128+
memory,Total=438,m;
109129
110130
geometry={angstrom;
111131
O 0.00000000 0.00000000 1.00000000}
@@ -128,6 +148,96 @@ def test_write_input_file(self):
128148
"""
129149
self.assertEqual(content_2, job_2_expected_input_file)
130150

151+
def test_write_mrci_input_file(self):
152+
"""Test writing MRCI Molpro input files"""
153+
self.job_3.cpu_cores = 48
154+
self.job_3.set_input_file_memory()
155+
self.job_3.write_input_file()
156+
with open(os.path.join(self.job_3.local_path, input_filenames[self.job_3.job_adapter]), 'r') as f:
157+
content_3 = f.read()
158+
job_3_expected_input_file = """***,HNO_t
159+
memory,Total=438,m;
160+
161+
geometry={angstrom;
162+
N -0.08142000 0.37454000 0.00000000
163+
O 1.01258000 -0.17285000 0.00000000
164+
H -0.93116000 -0.20169000 0.00000000}
165+
166+
gprint,orbitals;
167+
168+
basis=aug-cc-pvtz-f12
169+
170+
171+
172+
int;
173+
{hf;
174+
maxit,1000;
175+
wf,spin=0,charge=0;}
176+
177+
{casscf;
178+
maxit,999;
179+
wf,spin=0,charge=0;}
180+
181+
{mrci;
182+
maxit,999;
183+
wf,spin=0,charge=0;};
184+
185+
186+
187+
188+
E_mrci=energy;
189+
E_mrci_Davidson=energd;
190+
191+
table,E_mrci,E_mrci_Davidson;
192+
---;
193+
194+
"""
195+
self.assertEqual(content_3, job_3_expected_input_file)
196+
197+
self.job_4.cpu_cores = 48
198+
self.job_4.set_input_file_memory()
199+
self.job_4.write_input_file()
200+
with open(os.path.join(self.job_4.local_path, input_filenames[self.job_4.job_adapter]), 'r') as f:
201+
content_4 = f.read()
202+
job_4_expected_input_file = """***,HNO_t
203+
memory,Total=438,m;
204+
205+
geometry={angstrom;
206+
N -0.08142000 0.37454000 0.00000000
207+
O 1.01258000 -0.17285000 0.00000000
208+
H -0.93116000 -0.20169000 0.00000000}
209+
210+
gprint,orbitals;
211+
212+
basis=aug-cc-pvtz-f12
213+
214+
215+
216+
int;
217+
{hf;
218+
maxit,1000;
219+
wf,spin=0,charge=0;}
220+
221+
{casscf;
222+
maxit,999;
223+
wf,spin=0,charge=0;}
224+
225+
{mrci-f12;
226+
maxit,999;
227+
wf,spin=0,charge=0;};
228+
229+
230+
231+
232+
E_mrci=energy;
233+
E_mrci_Davidson=energd;
234+
235+
table,E_mrci,E_mrci_Davidson;
236+
---;
237+
238+
"""
239+
self.assertEqual(content_4, job_4_expected_input_file)
240+
131241
def test_set_files(self):
132242
"""Test setting files"""
133243
job_1_files_to_upload = [{'file_name': 'submit.sub',
@@ -155,7 +265,7 @@ def tearDownClass(cls):
155265
A function that is run ONCE after all unit tests in this class.
156266
Delete all project directories created during these unit tests
157267
"""
158-
for folder in ['test_MolproAdapter_1', 'test_MolproAdapter_2']:
268+
for folder in ['test_MolproAdapter_1', 'test_MolproAdapter_2', 'test_MolproAdapter_3', 'test_MolproAdapter_4']:
159269
shutil.rmtree(os.path.join(ARC_PATH, 'arc', 'testing', folder), ignore_errors=True)
160270

161271

0 commit comments

Comments
 (0)