Hello all
I have a question regarding runing double loop in input script. Using the format in the way:
variable i loop 20
label loopi
variable j loop 10
label loopj
{#content}
next j
jump SELF loopj
nrxt i
jump SELF loopi
It works only once for outermost ‘i’ loop.
Any suggestion about the trouble will be very helpful.
Thankyou
Andri
Hello all
I have a question regarding runing double loop in input script. Using the format in the way:
variable i loop 20
label loopi
variable j loop 10
label loopj
{#content}
next j
jump SELF loopj
nrxt i
jump SELF loopi
It works only once for outermost 'i' loop.
Any suggestion about the trouble will be very helpful.
there is a typo in your script example. the following works for me:
$ cat in.loop ; ~/compile/lammps/build/lmp -in in.loop
variable i loop 4
label loopi
variable j loop 4
label loopj
print "value $i / $j"
next j
jump SELF loopj
next i
jump SELF loopi
LAMMPS (8 Feb 2019)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread.
(src/comm.cpp:87)
using 1 OpenMP thread(s) per MPI task
value 1 / 1
value 1 / 2
value 1 / 3
value 1 / 4
value 2 / 1
value 2 / 2
value 2 / 3
value 2 / 4
value 3 / 1
value 3 / 2
value 3 / 3
value 3 / 4
value 4 / 1
value 4 / 2
value 4 / 3
value 4 / 4
Total wall time: 0:00:00
Thankyou Axel for highlighting the problem.
Thankyou
Hello all
The double loop works well in a simple run or display,but in case of conditional check during the run of inner loop the outer loop doesnot continue after 1 run.
for eq: In the below example the loop for n doesnot continue.
variable n loop 5
label loopn
variable r equal floor(random(50,850000,182))
#temperature in reduced units
variable temp equal 1.2
#number of obstacles to add
variable npart equal 0
#set up basic simulation stuff
dimension 2
units lj
atom_style full
boundary p p p
#neighbor settings
neighbor 2.0 bin
neigh_modify every 1 delay 0 check yes
#read input configuraiton
read_data equilibrated1.data
#all particles has mass 1
mass * 1