Forcing update to be called only once.
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
PlumedMainsuch assize_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