diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index e8280d056..0eddac91a 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -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):