storing variables in loop at intermediate steps

Submitted by deepakpawar.2310 on Mon, 10/12/2020 - 03:25

Hi

it's regarding storing the variables at particular timestep,
Then need to use those variables in the next loop

The script is like this

#####################################################
start of the program
>> Scripts intitiates
>> define varaibles
>> variables are changing at every timestep

>> ran for ten timestep
run 10
unfix the all the fixes
>> save the varables at 10

<<<<<<<<<<<<>>>>

likewise

variables should save at following timestep rahter than at every timestep
10
20
30
40
so that they can be use on
step
11
21
31
41 likewise

>> If totally if it ran for 100 timestep

run 100

(Plz see the attached text file in detail)
Any suggestion would be very helpful

AttachmentSize
Plain text icon storing_variables.txt628 bytes

mschramm | Sun, 10/18/2020 - 20:00

Hello,
You will want to first initialize your variables.
Next you will need to set a "label" at the beginning of the loop.
I would then set a conditional on a variable that tells you when to exit the loop.
Do your run.
Update variables and reset fixes.
Now jump back up to the start of the loop.
Set your label for the end of the loop.

See below for an example.

variable k equal 0
label start_loop
if "$k > 10" then "jump in.liggghts end_loop"
# Do run stuff here...

# Update your variables
variable k equal $k+1
print "k = $k"
jump in.liggghts start_loop
label end_loop