writing potential and forces from previous steps

Hello,

I recently wrote my own potential in LAMMPS. What I want to do is the following.
I want to store the forces from the previous 9 steps and I want to set my new force be the average of the forces from the previous 9 steps and the current step. How can I get the forces from previous time steps ?

Regards,
Ahmed

Hello,

I recently wrote my own potential in LAMMPS. What I want to do is the
following.
I want to store the forces from the previous 9 steps and I want to set my
new force be the average of the forces from the previous 9 steps and the
current step. How can I get the forces from previous time steps ?

you would have to write a custom fix style for that. you can probably
use either fix respa or fix store as a starting point.

axel.

Hi Axel,

Thanks for the reply. just out of curiosity would fix ave/chunk do it

Hi Axel,

Thanks for the reply. just out of curiosity would fix ave/chunk do it

no. chunks are just ways to partition the system. you want to keep n
copies of "old" data around for each atom, fix respa does that (it is
used under the hood for run_style respa to manage to keep copies of
the computed forces at different respa levels around). the difference
between what you want and what respa does is, that you want to keep a
window of the last n forces while fix respa provides copies of forces
from different respa levels. however, those are also computed at
different times. only, when that is done is very different. in fact,
keeping a window of the last n steps is easier to do.

axel.

Hi Axel,

I have a quick question. If I implement the something similar to fix_store to be able to compute the forces per atom from the previous 10 steps, How can I ensure that these forces will be used in the stress calculations in LAMMPS.

Regards,
Ahmed

Hi Axel,

I have a quick question. If I implement the something similar to fix_store
to be able to compute the forces per atom from the previous 10 steps, How
can I ensure that these forces will be used in the stress calculations in
LAMMPS.

you cannot. this is not how LAMMPS computes stress. if you change
forces after the fact, you cannot expect the stress suddenly will be
consistent with that.
thus if you post-process the forces, you will need to do
post-processing of the stress in a compatible fashion as well. you
would have to derive how to compute that on your own.

axel.