colvars icon indicating copy to clipboard operation
colvars copied to clipboard

Use MD engine's default frequency to empty the Colvars traj buffer

Open giacomofiorin opened this issue 1 year ago • 2 comments

The sizes of Linux write buffers have increased in many scenario over the years, partly due to higher memory capacity.

Not seeing output written for the first few lines of the .colvars.traj can be inconvenient in many cases. I have just finished a day-long NAMD test job where the DCD file (3.4 GB in size) was written frame by frame, but the .colvars.traj file (61 MB) was written all at the end in a single chunk.

The .colvars.traj file is already flushed every time a restart is written, but this cannot always be relied upon.

It would be useful to also record when the MD engine is writing trajectory frames, and use that frequency to empty the buffer in addition to the restart frequency.

Additionally, I would propose removing the hard-coded default value of 100 for colvarsTrajFrequency: thoughts on this?

giacomofiorin avatar Oct 27 '24 19:10 giacomofiorin

It would be useful to also record when the MD engine is writing trajectory frames, and use that frequency to empty the buffer in addition to the restart frequency.

Agreed, but would take some work and add an item to the proxy interface, for a moderately useful piece of information. Low-tech, low-effort solution: define a reasonable default flush frequency and an option to override it.

Additionally, I would propose removing the hard-coded default value of 100 for colvarsTrajFrequency: thoughts on this?

Would that make the parameter mandatory, or would the trajectory not be written at all if the keyword is absent? I think writing the trajectory is a sane default, but then we need a default frequency - would you use the back-end traj frequency to sync the output? Giving an option to disable it makes sense too, perhaps with a frequency of -1?

jhenin avatar Nov 06 '24 11:11 jhenin

The .colvars.traj file is already flushed every time a restart is written, but this cannot always be relied upon.

Is it possible to implement a flush frequency? PLUMED has the FLUSH action which is useful in your case but Colvars has not.

HanatoK avatar Nov 06 '24 15:11 HanatoK