Unfortunately, fix_store_state only stores per_atom values, not values of a variable which I calculate elsewhere.
please be aware that when you refer to a variable as "x" in the
context of MD simulations, the implication is that this would refer to
atom positions
As I said, I feed the value into fix_move, which requires a global scalar.
that is not correct. fix move also accepts atom style variables, thus
making the assumption of x being per-atom data plausible.
to stash away a global value, you could execute a piece of LAMMPS
script as argument to the every flag of the run command.
just use immediate expansion (var\), so something along the lines of :
every 1 "variable equal oldval {val}"
of course, this is not going to be the most efficient way...
it may also be possible to (ab)use fix ave/time for this purpose.
I don’t think variables will work for this purpose,
since an atom-style variable (unlike an equal style
variable) cannot store any per-atom “state”, e.g. the value
of all the positions and hold onto it for future
timesteps. You could do that for the initial
volume of the system (a scalar, with an equal-style
var), but not for a per-atom quantity.
Fix store/state can do that, which means you
could write an (inefficient) loop something like:
variable dx atom x-f_1[1]
variable dy …
variable dz
fix move all move NULL NULL NULL v_dx v_dy v_dz
loop:
fix 1 all store/state f_2[1] f_2[2] f_2[3]
fix 2 all store/state x y z
run 1
jump SELF loop
With some additional initialization (pre-loop),
I think this will work (untested) b/c
each time thru the loop the store/state fixes
will be redefined, which will store the previous
step (held by fix 2) in fix 1, then store the current
step in fix 2.
Then in the 1-step simulation, the positions
will be updated, using fix move variables which
reference the previous positions in fix 1.
But if you really want to do this every step,
then you are better off writing a compute or
fix which stores the state internally (using
fix STORE, not fix store/state).