Skip to content

Commit 40b8f45

Browse files
committed
Added get_mock_xyz() to the mockter adapter
1 parent 827a08e commit 40b8f45

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

arc/job/adapters/mockter.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def __init__(self,
122122
self.command = 'mockter'
123123
self.url = ''
124124

125-
if species is None:
126-
raise ValueError('Cannot execute Mockter without an ARCSpecies object.')
125+
if species is None and reactions is None:
126+
raise ValueError('Cannot execute Mockter without an ARCSpecies or an ARCReaction object.')
127127

128128
_initialize_adapter(obj=self,
129129
is_ts=False,
@@ -178,7 +178,7 @@ def write_input_file(self) -> None:
178178
input_dict['memory'] = self.input_file_memory
179179
input_dict['method'] = self.level.method
180180
input_dict['multiplicity'] = self.multiplicity
181-
input_dict['xyz'] = xyz_to_str(self.xyz)
181+
input_dict['xyz'] = xyz_to_str(self.get_mock_xyz())
182182
input_dict['job_type'] = self.job_type
183183
input_dict['memory'] = self.input_file_memory
184184

@@ -238,7 +238,22 @@ def set_input_file_memory(self) -> None:
238238
Set the input_file_memory attribute.
239239
"""
240240
self.input_file_memory = self.job_memory_gb
241-
241+
242+
def get_mock_xyz(self) -> Optional[dict]:
243+
"""
244+
Get the xyz coordinates for the mock job.
245+
"""
246+
if self.xyz is not None:
247+
return self.xyz
248+
if self.species is not None and len(self.species):
249+
return self.species[0].get_xyz()
250+
if self.reactions is not None and len(self.reactions):
251+
ts_xyz_str = ''
252+
for r in self.reactions[0].r_species:
253+
ts_xyz_str += xyz_to_str(r.get_xyz()) + '\n'
254+
return str_to_xyz(ts_xyz_str)
255+
return None
256+
242257
def execute_incore(self):
243258
"""
244259
Execute a job incore.
@@ -250,7 +265,7 @@ def execute_incore(self):
250265
if self.species[0].is_ts:
251266
freqs[0] = -500
252267
output = {'adapter': 'mockter',
253-
'xyz': input['xyz'],
268+
'xyz': xyz,
254269
'sp': e_elect,
255270
'T1': 0.0002,
256271
'freqs': freqs,

0 commit comments

Comments
 (0)