[lammps-users] Can "fix halt" command use for two or more condition

Hi lammps users,

Is there any way to quit “run” when satisfied some condition. For example, I would like quit “run” when satisfied the condition for variable: “step > 2000” and “bondLength > 8”, So I guess we can implement something like :

if “({step} > 2000) && ({bondLength}> 8)” then “quit”

run 10000

Unfortunately , the above “if” command is only executed once at first time, and do not run again.

The other method to quit run could be using “fix halt” command like:

fix 1 all halt 100 v_step >2000

run 10000

As you can see, the “fix halt” command only allows one condition, however, I have two variable conditions. So is there anyway to quit “run” when both two conditions are satisfied?

Thank you in advance.

Jiang Xiao

Hi lammps users,

Is there any way to quit “run” when satisfied some condition. For example, I would like quit “run” when satisfied the condition for variable: “step > 2000” and “bondLength > 8”, So I guess we can implement something like :

if “({step} > 2000) && ({bondLength}> 8)” then “quit”

run 10000

no.

Unfortunately , the above “if” command is only executed once at first time, and do not run again.

that is how LAMMPS inputs work. each line is always acted upon immediately.

anything else only makes sense to a human, not a computer.

The other method to quit run could be using “fix halt” command like:

fix 1 all halt 100 v_step >2000

run 10000

As you can see, the “fix halt” command only allows one condition, however, I have two variable conditions. So is there anyway to quit “run” when both two conditions are satisfied?

you can use conditions inside an equal style variable.

variable stop equal “(v_step > 2000) && (v_bondLength > 8)”

and then

fix 1 all halt 100 v_stop>0

axel.