Fix nonaffine/displacement but at end_of_step

Fix nonaffine/displacement is currently implemented at post_force(int). But at that instant the 2nd part of the velocity verlet is not carried out and also the box is not deformed. If I want to calculate D2min after the full integration is done, can I just change post_force(int) to end_of_step(). I tried that and the code compiles and runs. But is there any logical error I am missing?

I would imagine that most output quantities calculated at end of step (dumps, computes …) will start depending on whether they are defined before or after that fix. I am also not sure if there will be any problems with the domain decomposition since all communications are usually finished long before.

You may want to look at fix mvv/dpd which somehow uses the velocity at the end of the step rather than mid-step for the DPD … stuff. I don’t fully understand it myself, but maybe it’ll make sense to you.

Maybe I’m misunderstanding, but I don’t think this is an issue.

With the D2min option, the calculation only depends on the position which is only updated in initial_integrate(). With the integrated option, it’s intended to mirror the position integration so it should be updated before the 2nd velocity update in final_integrate().

Where calculations are performed relative to box changes also seems arbitrary. You could say currently D2min is calculated after the prior box deformation. Furthermore, deformations, if anything, affinely shift particle positions which don’t really contribute to D2min (details such as particles moving out of range etc. aside).

Lastly, you have to be careful moving calculations to end_of_step() because whether they are performed before or after the box is deformed (e.g. by fix deform) then depends on the order of fixes in your input script - which is never a good thing.