Unverified Commit 33c846cd authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

guard converting thermo output from other output to the screen and do not crash

fixes #1844
parent a53202ba
Loading
Loading
Loading
Loading
+11 −2
Changes for python/lammps.py: 11 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -1029,10 +1029,19 @@ def get_thermo_data(output):
            r = {'thermo' : thermo_data }
            runs.append(namedtuple('Run', list(r.keys()))(*list(r.values())))
        elif in_run and len(columns) > 0:
            values = [float(x) for x in line.split()]

            items = line.split()
            # Convert thermo output and store it.
            # It must have the same number of columns and
            # all of them must be convertable to floats.
            # Otherwise we ignore the line
            if len(items) == len(columns):
                try:
                    values = [float(x) for x in items]
                    for i, col in enumerate(columns):
                        current_run[col].append(values[i])
                except ValueError:
                  pass

    return runs

class PyLammps(object):