help with global iteration, thank you

Dear LAMMPS community,

May I ask if anyone has the experience with GLOBAL interation please?

For example, I have a fix_move every time step, but the displacement or velocity themselves are calculated from a loop. I’m using “run 1000 every 1 “jump SELF glbLoop”” in the following example.

I don't know what you are trying to do. But
you can dump positions and velocities of your
atom every step, and check yourself whether
the values are what you expect. Running
a complex input script is like debugging compute
code. Do it a step at a time and check your


Dear Steve and all,

Sorry for the confusion. To put it simply, I’m trying to update the input parameter for a fix command for each time step during the run. For example, I need to update the x displacement in a fix move: “fix 1 anAtom move variable v_A NULL NULL NULL NULL NULL units box”.

What I’ve tried is to use “run every 1” plus “jump SELF”, I’m wondering if there is a better way.

Thanks again for your attention,

Your fix and run commands are outside the loop, so I don't
see how the loop on the variable is going to affect the run.

You can read the variable doc page about immediate vs
static variables (at the bottom). The variable in the fix
move command can be time-dependent, so I suggest you
try and write a variable that changes in time the way you
want. Then you shouldn't need the loop.


Dear Steve,

Thanks again for your explanation, but really I need a loop to generate such input for the fix, instead of solely time-dependent. My current problem is wave packet boundary condition, where I need the boundary-atom oscillations to be superposition of linear waves, which per se are time dependent.

Thank you for your patience and help, I really appreciate it.


Then I suggest you put some print statements in
your loop and debug what your script is doing. The
explanations on the variable doc page should help.


That’s true, and I did some preliminary tests. The problem is that LAMMPS seems to initialize the running if I use “run every 1”, which made me wonder if there is a better way.

My problem is really simple: update the fix input every time step (pretty like fix_modify for each iteration). However, the problem is also nontrivial, because the input should be calculated from a loop, instead of a simple “compute” or “variable equal”.

Thanks again.