maybe it is a "if" bug

Hi Steve,
When the command “if” is used at the end of the input script like the following(ended by quotes and &), it will not be excuted.

if “$i==0” then &
“run 10” &

Yours,
Cun

The following is part of the input script:

[email protected]…33…2088…:test$ lmp
LAMMPS (28 Mar 2012)

[email protected]…2088…:test$ cat in.crack

2d LJ crack simulation

zoom 1.6 adiam 1.5

#dump_modify 1 pad 4

if "i==0" then & "run 5000" & "run 5" [email protected]:test

If I put these lines at the end of bench/in.lj,
it runs an extra 105 steps.

Steve

variable i equal 0

if "$i==0" then &
"run 100" &
"run 5"

Sorry, I give you wrong input file.
But What will be if you add a quote after “run 5” ? My test is that it won’t run.

The following is OK (“run 5” & isn’t at the end of the file):

Sorry, I give you wrong input file.
But What will be if you add a quote after "run 5" ? My test is that it won't
run.

The following is OK ("run 5" & isn't at the end of the file):

variable i equal 0

if "$i==0" then &
"run 100" &
"run 5" &

run 5

But the following will not run ( "run 5" & at the end of the file):

variable i equal 0

if "$i==0" then &
"run 100" &
"run 5" &

so why *should* that work? you tell lammps
that there would be more to come and then
there isn't.

sorry but this is a case of PEBCAC,
     axel.

You will have the same problem with any LAMMPS command
which is the last line in the file and ends with a "&", so it
has nothing to do with the if command.

If you added an extra blank line at the end of your script
it would be fine.

When LAMMPS sees the trailing "&" it tries to read another line.
If there is not another line, it triggers LAMMPS to exit, whether
it was in the middle of a multiline command or not.

Steve

Thank you for your help! I will take care of it.

Yours,
Cun