Skip to content

Commit 827a08e

Browse files
authored
Don't gen xyz when checking if a species is monoatomic (#785)
To avoid inf. recursions (is_monoatomic → get_xyz → get_cheap_conformer → is_monoatomic), don't generate a cheap xyz when checking if a species is monoatomic
2 parents 552bcb3 + 1967e9d commit 827a08e

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

arc/job/trsh.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def determine_ess_status(output_path: str,
8383
return 'errored', ['NoOutput'], 'Log file could not be read', ''
8484
forward_lines = tuple(lines)
8585
reverse_lines = tuple(lines[::-1])
86+
len_reversed_lines, len_forward_lines = len(reverse_lines), len(forward_lines)
8687

8788
if software == 'gaussian':
8889
for line in forward_lines[-1:-20:-1]:
@@ -93,7 +94,7 @@ def determine_ess_status(output_path: str,
9394
if 'l9999.exe' in line or 'link 9999' in line:
9495
cycle_issue = False
9596
neg_eigenvalues = False
96-
for j in range(i,len(reverse_lines)):
97+
for j in range(i, len_reversed_lines):
9798
if 'Number of steps exceeded' in reverse_lines[j]:
9899
keywords = ['MaxOptCycles', 'GL9999']
99100
error = 'Maximum optimization cycles reached.'
@@ -132,7 +133,7 @@ def determine_ess_status(output_path: str,
132133
# Check if Inaccurate quadrature in CalDSu
133134
inacc_quad = False
134135
for j in range(i + 300, i, -1):
135-
if 'Inaccurate quadrature in CalDSu' in reverse_lines[j]:
136+
if j < len_reversed_lines and 'Inaccurate quadrature in CalDSu' in reverse_lines[j]:
136137
inacc_quad = True
137138
keywords = ['InaccurateQuadrature', 'GL502']
138139
error = 'Inaccurate quadrature in CalDSu'
@@ -158,7 +159,7 @@ def determine_ess_status(output_path: str,
158159
elif 'l123.exe' in line:
159160
delta_x = False
160161
gs2_opt = False
161-
for j in range(i + 1, len(reverse_lines)):
162+
for j in range(i + 1, len_reversed_lines):
162163
if 'Delta-x Convergence NOT Met' in reverse_lines[j]:
163164
delta_x = True
164165
keywords = ['DeltaX', 'GL123']
@@ -172,16 +173,16 @@ def determine_ess_status(output_path: str,
172173
line = 'GS2 Optimization Failure'
173174
break
174175
if any([keyword in ['GL301', 'GL401'] for keyword in keywords]):
175-
additional_info = forward_lines[len(forward_lines) - i - 2]
176+
additional_info = forward_lines[len_forward_lines - i - 2]
176177
if 'No data on chk file' in additional_info \
177178
or 'Basis set data is not on the checkpoint file' in additional_info \
178179
or 'Error in GetGes' in additional_info:
179180
keywords = ['CheckFile']
180181
error = additional_info.strip()
181182
elif 'GL301' in keywords:
182-
if 'Atomic number out of range for' in forward_lines[len(forward_lines) - i - 2]:
183+
if 'Atomic number out of range for' in forward_lines[len_forward_lines - i - 2]:
183184
keywords.append('BasisSet')
184-
error = f'The basis set {forward_lines[len(forward_lines) - i - 2].split()[6]} ' \
185+
error = f'The basis set {forward_lines[len_forward_lines - i - 2].split()[6]} ' \
185186
f'is not appropriate for the this chemistry.'
186187
else:
187188
keywords.append('InputError')

arc/species/species.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,9 @@ def is_monoatomic(self) -> Optional[bool]:
10351035
"""
10361036
if self.mol is not None and len(self.mol.atoms):
10371037
return len(self.mol.atoms) == 1
1038-
xyz = self.get_xyz()
1038+
if self.mol_list is not None and len(self.mol_list):
1039+
return len(self.mol_list[0].atoms) == 1
1040+
xyz = self.get_xyz(generate=False)
10391041
if xyz is not None:
10401042
return len(xyz['symbols']) == 1
10411043
return None

0 commit comments

Comments
 (0)