illegal if command

Hello All,

I’m attempting this loop:

label loop
variable t index 400.0 300.0
velocity all create $t 123 rot yes dist gaussian
fix 2 all nvt temp $t $t 100.0
if “$t != 300.0” then &
“run 100000” &
else &
“run 10000”
next t
jump PolyBLA.in loop

However I get an illegal if command error:

label loop
variable t index 400.0 300.0
velocity all create $t 123 rot yes dist gaussian
velocity all create 400.0 123 rot yes dist gaussian
fix 2 all nvt temp $t $t 100.0
fix 2 all nvt temp 400.0 $t 100.0
fix 2 all nvt temp 400.0 400.0 100.0
if “$t != 300.0” then “run 100000” else “run 10000”
ERROR: Illegal if command

Not really sure why because it’s substituting ‘t’ for the velocity and fix but it won’t for the if-statement.

Thanks for your help.

Hello All,

I'm attempting this loop:

label loop
variable t index 400.0 300.0
        velocity all create $t 123 rot yes dist gaussian
        fix 2 all nvt temp $t $t 100.0
        if "$t != 300.0" then &
        "run 100000" &
        else &
        "run 10000"
next t
jump PolyBLA.in loop

However I get an illegal if command error:

label loop
variable t index 400.0 300.0
        velocity all create $t 123 rot yes dist gaussian
        velocity all create 400.0 123 rot yes dist gaussian
        fix 2 all nvt temp $t $t 100.0
        fix 2 all nvt temp 400.0 $t 100.0
        fix 2 all nvt temp 400.0 400.0 100.0
        if "$t != 300.0" then "run 100000" else "run 10000"
ERROR: Illegal if command

Not really sure why because it's substituting 't' for the velocity and
fix but it won't for the if-statement.

it works for me using the current version of lammps.

two possible explanations: a) you use an older version of lammps
that has incompatible changes to the if syntax
b) you have some non-ASCII characters in the line assembled to
become the if statement. this tends to happen a lot when people
write input files on windows or use native language support.

cheers,
   axel.

The cluster I’m running on was using a 2010 version of LAMMPS. Now using a 2011 version and if-command is running smoothly.