Is there a way to compute a variable depending on its previous value (on the previous time step)?
Something like V_i=a*V_{i-1}+b ...
I found that the store/state fix could possibly work, but it seems it will write at each time step in a file and not keep the variable into the memory.
In general, no. Because variables are not even
evaluated unless they are needed on a specific timestep.
You could write a fix to do this and store whatever
you want from previous timesteps. That's not really
what fix store/state is designed for.
You could use a second variable to store the current
value of the first variable. If you used a loop (via the
jump command), it would be possible to have the
2nd variable store the value of the 1st variable on the
previous loop iteration, simply by assigning them at
the right point in the loop.
# init previous step variable to 0
variable Uprev atom 0
# loop
variable a loop 10
label loop
# create variable from random and last time step
variable Ux atom normal(0,1,1)+v_Uprev
# evaluate the constant variable that will be used during the run (via addforce)
variable Uxconst atom ${Ux}
run 1000
next a #save previous step variable
variable Uprev atom ${Uxconst}
jump in.flume loop
However, immediate evaluation of variable "${}" seems not to work with atom_type variable. Is it the case ?