Skip to content

Commit

Permalink
fix thermo_lines not being reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Leimeroth committed Dec 16, 2024
1 parent 73c0b8a commit 9c3488a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pyiron_atomistics/lammps/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,27 +325,25 @@ def _collect_output_log(
with open(file_name, "r") as f:
dfs = []
read_thermo = False
thermo_lines = ""
for l in f:
l = l.lstrip()

if l.startswith("Step"):
thermo_lines = ""
read_thermo = True

if read_thermo:
if l.startswith("Loop") or l.startswith("ERROR"):
read_thermo = False
dfs.append(
pd.read_csv(StringIO(thermo_lines), sep="\s+", engine="c")
)
continue

elif l.startswith("WARNING:"):
logger.warning(f"A warning was found in the log:\n{l}")
continue

thermo_lines += l

if l.startswith("Step"):
read_thermo = True
thermo_lines += l
else:
thermo_lines += l

h5_dict = {
"Step": "steps",
Expand All @@ -361,7 +359,7 @@ def _collect_output_log(
for i in range(len(dfs)):
df = dfs[i]
df["LogStep"] = np.ones(len(df)) * i
df = pd.concat(dfs)
df = pd.concat(dfs, ignore_index=True)

for key in df.columns[df.columns.str.startswith("f_mean")]:
h5_dict[key] = key.replace("f_", "")
Expand Down

0 comments on commit 9c3488a

Please sign in to comment.