handle nsteps=0 in savefile

This commit is contained in:
Ian Jauslin 2023-04-18 00:48:54 -04:00
parent 41945b8e35
commit 063dae642a

View File

@ -180,7 +180,7 @@ int eea(
remove_entry(params, "starting_time");
remove_entry(params, "init");
remove_entry(params, "nsteps");
fprintf(savefile," -p \"%s;starting_time=%lu;nsteps=%lu;init=file:%s\"", params, t+1, nsteps-t-1, savefile_string);
fprintf(savefile," -p \"%s;starting_time=%lu;nsteps=%lu;init=file:%s\"", params, t+1, (nsteps == 0 ? 0 : nsteps-t-1), savefile_string);
free(params);
fprintf(savefile," energy\n");