[lammps-users] fix msd data not being written

Hi. I recently did a run with many different msd fixes (applied to different groups of atoms with different reference times). The run aborted due to wall clock time running out, and no data was written to any of the MSD files, so the run was useless. I am surprised that no data was written to the MSD files, because:

  1. Many restart files were written during the run

  2. The run was paused, fixes were added, and the run restarted at many points (with a new “run” command, see the attched input script). I would think that all relevant data would be written “up to date” during such pauses.

  3. No error messages were output. There were some “WARNING: More than one fix msd”'s, but those are usually no problem - I have run with multiple msd fixes before, though not so many as for this run.

In general, this may illustrate a problem that I have seen a number of times with LAMMPS but I believe is not specific to LAMMPS. Data is not written to files immediately. For example, sometimes hours pass between writes to the logfile. Is this due to a problem with MPI, or Unix/Linux, or what? I would guess that the OS holds data in a buffer before actually writing it to the file, but that’s just an uneducated guess. Does anyone know more about this problem, and if so how to fix it, i. e. how to force data to be written to files in real time (or at least frequently?)

Thanks,
Rob

relaxscript (6.02 KB)

Try adding this line as the last line of fix_msd::end_of_step()

if (me == 0) fflush(fp);

and see if it fixes the problem. The thermo and dump commands
have a flush option that adds this.

Steve