Every keyword in fix addforce

In my simulation, I used the fix addforce to add forces to atoms, but the process of obtaining these forces is quite complex, involving numerous computes and variables, which is time-consuming. I noticed that fix addforce includes an ‘every’ keyword. Does this ‘every’ mean that the force is added to the system every ‘Nevery’ steps (like every 50 steps) without adding force in between those steps; or does it mean that the force added is updated every 50 steps, with the additional force added remaining constant during the 50 steps and then updated again once 50 steps are completed?Does that mean that if I use every 50 , then no force will be added to the atoms during the intervening 49 steps? Or is a constant force, the same as at step 1, added, just not updated?

Why ask this kind of question when the answer is available in the documentation?

Thank you very much for your response. I read the manual, but I cannot determine whether the force added in the intervening 49 steps is 0 or we are using the addforce obtained from the previous steps.

In my opinion, the statement in the manual is very clear and allows only one interpretation.

If the every keyword is used, the Nevery setting determines how often the forces are applied.

There is no mention of updating the forces.

Okay, if we need to update the variables every 20, do we need to modify the fix addforce command?

No, you can use fix ave/time 20 1 20 to obtain the updated variable value every 20 steps and then apply fix addforce with the cached value from the fix in every step. Really straightforward.


When I tried to use fix ave/atom , this error occurred. However, when I commented out the line fix fBdn Bdn addforce v_vffBdnx v_vffBdny v_vffBdnz , the error disappeared. How can I resolve this issue?
image

Thanks, “fix store/state” works fine.