Skip to content

Commit f22e66d

Browse files
wanghan-iapcmHan Wangpre-commit-ci[bot]
authored
print detailed information on outcar reading failure (#596)
Co-authored-by: Han Wang <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent af40337 commit f22e66d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dpdata/vasp/outcar.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ def analyze_block(lines, ntot, nelm, ml=False):
142142
is_converge = False
143143
elif energy_token[ml_index] in ii:
144144
energy = float(ii.split()[energy_index[ml_index]])
145-
assert (force is not None) and len(coord) > 0 and len(cell) > 0
145+
if len(force) == 0:
146+
raise ValueError("cannot find forces in OUTCAR block")
147+
if len(coord) == 0:
148+
raise ValueError("cannot find coordinates in OUTCAR block")
149+
if len(cell) == 0:
150+
raise ValueError("cannot find cell in OUTCAR block")
146151
return coord, cell, energy, force, virial, is_converge
147152
elif cell_token[ml_index] in ii:
148153
for dd in range(3):

0 commit comments

Comments
 (0)