How to use loops while using "rerun" command

Hello, all. I need to define groups of different atoms at different timesteps, so I used the “rerun” command and “variable loop” command to define different groups. However, I found that under the “rerun” command, loops cannot be performed, and the loop values remain unchanged throughout the entire rerun time. I don’t know how to solve this problem?

It may be that your rerun eats all the frames in the trajectory, and the loop variable never has the chance to go beyond its first value. Try to limit the frames read with the first and last keywords. Or share a small trajectory and input file to reproduce this behaviour.