Skip to content

Commit

Permalink
print detailed information on outcar reading failure (#596)
Browse files Browse the repository at this point in the history
Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 22, 2024
1 parent af40337 commit f22e66d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dpdata/vasp/outcar.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ def analyze_block(lines, ntot, nelm, ml=False):
is_converge = False
elif energy_token[ml_index] in ii:
energy = float(ii.split()[energy_index[ml_index]])
assert (force is not None) and len(coord) > 0 and len(cell) > 0
if len(force) == 0:
raise ValueError("cannot find forces in OUTCAR block")
if len(coord) == 0:
raise ValueError("cannot find coordinates in OUTCAR block")
if len(cell) == 0:
raise ValueError("cannot find cell in OUTCAR block")
return coord, cell, energy, force, virial, is_converge
elif cell_token[ml_index] in ii:
for dd in range(3):
Expand Down

0 comments on commit f22e66d

Please sign in to comment.