Skip to content

Commit

Permalink
print detailed information on outcar reading failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Han Wang committed Jan 21, 2024
1 parent af40337 commit 2e0a182
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")

Check warning on line 146 in dpdata/vasp/outcar.py

View check run for this annotation

Codecov / codecov/patch

dpdata/vasp/outcar.py#L146

Added line #L146 was not covered by tests
if len(coord) == 0:
raise ValueError("cannot find coordinates in OUTCAR block")

Check warning on line 148 in dpdata/vasp/outcar.py

View check run for this annotation

Codecov / codecov/patch

dpdata/vasp/outcar.py#L148

Added line #L148 was not covered by tests
if len(cell) == 0:
raise ValueError("cannot find cell in OUTCAR block")

Check warning on line 150 in dpdata/vasp/outcar.py

View check run for this annotation

Codecov / codecov/patch

dpdata/vasp/outcar.py#L150

Added line #L150 was not covered by tests
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 2e0a182

Please sign in to comment.