plumed2 icon indicating copy to clipboard operation
plumed2 copied to clipboard

Forcing update to be called only once.

Open GiovanniBussi opened this issue 6 years ago • 0 comments

As suggested by @valsson in #510 :

When testing these things I noticed that it possible to call update() multiple times within the same step which most likely will lead to incorrect results. I don't think anyone would do something like that, but anyway I add a warning for this function.

Something that could be easily done is:

  • add a variable in PlumedMain such as size_t last_update_step
  • in PlumedMain::update(), check that the step is different and update it.

Should this trigger an error (plumed_assert) or just write a WARNING in the output?

If we assume people might want to do it legitimately, perhaps a WARNING would be extremely noisy (one per step!). Should we then maybe only write it with a pace, or even just once?

If we assume this is not legitimate, then I think we should have an assert. The problem is that we do not have MD-plumed interfaces under control, and that there might be codes that start failing if we implement this as an assertion.

Giovanni

GiovanniBussi avatar Aug 02 '19 08:08 GiovanniBussi