Skip to content

Commit 1621f5d

Browse files
committed
Tests: Molpro MRCI input files
1 parent 48e08b2 commit 1621f5d

File tree

1 file changed

+183
-11
lines changed

1 file changed

+183
-11
lines changed

arc/job/adapters/molpro_test.py

Lines changed: 183 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,36 @@ def setUpClass(cls):
4242
species=[ARCSpecies(label='spc1', xyz=['O 0 0 1'])],
4343
testing=True,
4444
)
45+
cls.job_3 = MolproAdapter(execution_type='queue',
46+
job_type='sp',
47+
level=Level(method='MRCI', basis='aug-cc-pvtz-f12'),
48+
project='test',
49+
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_3'),
50+
species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000
51+
O 1.01258 -0.17285 0.00000
52+
H -0.93116 -0.20169 0.00000"""])],
53+
testing=True,
54+
)
55+
cls.job_4 = MolproAdapter(execution_type='queue',
56+
job_type='sp',
57+
level=Level(method='MRCI-F12', basis='aug-cc-pvtz-f12'),
58+
project='test',
59+
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_4'),
60+
species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000
61+
O 1.01258 -0.17285 0.00000
62+
H -0.93116 -0.20169 0.00000"""])],
63+
testing=True,
64+
)
65+
cls.job_5 = MolproAdapter(execution_type='queue',
66+
job_type='sp',
67+
level=Level(method='MP2_CASSCF_MRCI-F12', basis='aug-cc-pVTZ-F12'),
68+
project='test',
69+
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_MolproAdapter_5'),
70+
species=[ARCSpecies(label='HNO_t', xyz=["""N -0.08142 0.37454 0.00000
71+
O 1.01258 -0.17285 0.00000
72+
H -0.93116 -0.20169 0.00000"""])],
73+
testing=True,
74+
)
4575

4676
def test_set_cpu_and_mem(self):
4777
"""Test assigning number of cpu's and memory"""
@@ -56,26 +86,26 @@ def test_set_input_file_memory(self):
5686
self.job_1.input_file_memory = None
5787
self.job_1.cpu_cores = 48
5888
self.job_1.set_input_file_memory()
59-
self.assertEqual(self.job_1.input_file_memory, 40)
89+
self.assertEqual(self.job_1.input_file_memory, 438)
6090

6191
self.job_1.cpu_cores = 8
6292
self.job_1.set_input_file_memory()
63-
self.assertEqual(self.job_1.input_file_memory, 235)
93+
self.assertEqual(self.job_1.input_file_memory, 438)
6494

6595
self.job_1.input_file_memory = None
6696
self.job_1.cpu_cores = 1
6797
self.job_1.set_input_file_memory()
68-
self.assertEqual(self.job_1.input_file_memory, 1880)
98+
self.assertEqual(self.job_1.input_file_memory, 438)
6999

70100
def test_write_input_file(self):
71-
"""Test writing Gaussian input files"""
101+
"""Test writing Molpro input files"""
72102
self.job_1.cpu_cores = 48
73103
self.job_1.set_input_file_memory()
74104
self.job_1.write_input_file()
75105
with open(os.path.join(self.job_1.local_path, input_filenames[self.job_1.job_adapter]), 'r') as f:
76106
content_1 = f.read()
77107
job_1_expected_input_file = """***,spc1
78-
memory,40,m;
108+
memory,Total=438,m;
79109
80110
geometry={angstrom;
81111
O 0.00000000 0.00000000 1.00000000}
@@ -86,8 +116,8 @@ def test_write_input_file(self):
86116
87117
int;
88118
{hf;
89-
maxit,1000;
90-
wf,spin=2,charge=0;}
119+
maxit,999;
120+
wf,spin=2,charge=0;}
91121
92122
uccsd(t)-f12;
93123
@@ -104,7 +134,7 @@ def test_write_input_file(self):
104134
with open(os.path.join(self.job_2.local_path, input_filenames[self.job_2.job_adapter]), 'r') as f:
105135
content_2 = f.read()
106136
job_2_expected_input_file = """***,spc1
107-
memory,40,m;
137+
memory,Total=438,m;
108138
109139
geometry={angstrom;
110140
O 0.00000000 0.00000000 1.00000000}
@@ -115,8 +145,8 @@ def test_write_input_file(self):
115145
116146
int;
117147
{hf;
118-
maxit,1000;
119-
wf,spin=2,charge=0;}
148+
maxit,999;
149+
wf,spin=2,charge=0;}
120150
121151
uccsd(t);
122152
@@ -127,6 +157,147 @@ def test_write_input_file(self):
127157
"""
128158
self.assertEqual(content_2, job_2_expected_input_file)
129159

160+
def test_write_mrci_input_file(self):
161+
"""Test writing MRCI Molpro input files"""
162+
self.job_3.cpu_cores = 48
163+
self.job_3.set_input_file_memory()
164+
self.job_3.write_input_file()
165+
with open(os.path.join(self.job_3.local_path, input_filenames[self.job_3.job_adapter]), 'r') as f:
166+
content_3 = f.read()
167+
job_3_expected_input_file = """***,HNO_t
168+
memory,Total=438,m;
169+
170+
geometry={angstrom;
171+
N -0.08142000 0.37454000 0.00000000
172+
O 1.01258000 -0.17285000 0.00000000
173+
H -0.93116000 -0.20169000 0.00000000}
174+
175+
gprint,orbitals;
176+
177+
basis=aug-cc-pvtz-f12
178+
179+
180+
181+
int;
182+
{hf;
183+
maxit,999;
184+
wf,spin=0,charge=0;}
185+
186+
{casscf;
187+
maxit,999;
188+
wf,spin=0,charge=0;}
189+
190+
{mrci;
191+
maxit,999;
192+
wf,spin=0,charge=0;};
193+
194+
195+
196+
197+
E_mrci=energy;
198+
E_mrci_Davidson=energd;
199+
200+
table,E_mrci,E_mrci_Davidson;
201+
---;
202+
203+
"""
204+
self.assertEqual(content_3, job_3_expected_input_file)
205+
206+
self.job_4.cpu_cores = 48
207+
self.job_4.set_input_file_memory()
208+
self.job_4.write_input_file()
209+
with open(os.path.join(self.job_4.local_path, input_filenames[self.job_4.job_adapter]), 'r') as f:
210+
content_4 = f.read()
211+
job_4_expected_input_file = """***,HNO_t
212+
memory,Total=438,m;
213+
214+
geometry={angstrom;
215+
N -0.08142000 0.37454000 0.00000000
216+
O 1.01258000 -0.17285000 0.00000000
217+
H -0.93116000 -0.20169000 0.00000000}
218+
219+
gprint,orbitals;
220+
221+
basis=aug-cc-pvtz-f12
222+
223+
224+
225+
int;
226+
{hf;
227+
maxit,999;
228+
wf,spin=0,charge=0;}
229+
230+
{casscf;
231+
maxit,999;
232+
wf,spin=0,charge=0;}
233+
234+
{mrci-f12;
235+
maxit,999;
236+
wf,spin=0,charge=0;};
237+
238+
239+
240+
241+
E_mrci=energy;
242+
E_mrci_Davidson=energd;
243+
244+
table,E_mrci,E_mrci_Davidson;
245+
---;
246+
247+
"""
248+
self.assertEqual(content_4, job_4_expected_input_file)
249+
250+
self.job_5.cpu_cores = 48
251+
self.job_5.set_input_file_memory()
252+
self.job_5.write_input_file()
253+
with open(os.path.join(self.job_5.local_path, input_filenames[self.job_5.job_adapter]), 'r') as f:
254+
content_5 = f.read()
255+
job_5_expected_input_file = """***,HNO_t
256+
memory,Total=438,m;
257+
258+
geometry={angstrom;
259+
N -0.08142000 0.37454000 0.00000000
260+
O 1.01258000 -0.17285000 0.00000000
261+
H -0.93116000 -0.20169000 0.00000000}
262+
263+
gprint,orbitals;
264+
265+
basis=aug-cc-pvtz-f12
266+
267+
268+
269+
int;
270+
{hf;
271+
maxit,999;
272+
wf,spin=0,charge=0;}
273+
274+
275+
276+
{mp2;
277+
wf,spin=0,charge=0;}
278+
279+
{casscf;
280+
maxit,999;
281+
wf,spin=0,charge=0;}
282+
283+
{mrci-f12;
284+
maxit,999;
285+
wf,spin=0,charge=0;};
286+
287+
288+
289+
290+
E_mrci=energy;
291+
E_mrci_Davidson=energd;
292+
293+
table,E_mrci,E_mrci_Davidson;
294+
---;
295+
296+
"""
297+
print('*****')
298+
print(content_5)
299+
self.assertEqual(content_5, job_5_expected_input_file)
300+
130301
def test_set_files(self):
131302
"""Test setting files"""
132303
job_1_files_to_upload = [{'file_name': 'submit.sub',
@@ -154,7 +325,8 @@ def tearDownClass(cls):
154325
A function that is run ONCE after all unit tests in this class.
155326
Delete all project directories created during these unit tests
156327
"""
157-
for folder in ['test_MolproAdapter_1', 'test_MolproAdapter_2']:
328+
for folder in ['test_MolproAdapter_1', 'test_MolproAdapter_2', 'test_MolproAdapter_3', 'test_MolproAdapter_4',
329+
'test_MolproAdapter_5']:
158330
shutil.rmtree(os.path.join(ARC_PATH, 'arc', 'testing', folder), ignore_errors=True)
159331

160332

0 commit comments

Comments
 (0)