[lammps-users] how to use math operations in variable command

Hello,

I would like to change some parameters during my simulation, therefore I need to use rariable command in my input script.

variable sig index 2.5 3 3.5 4 4.5 5 5.5 6.0
label index
variable flag equal 2*v_sig
print "flag = " ${flag}
next sig
jump in.gel index

This always give me flag = 2

variable sig index 2.5 3 3.5 4 4.5 5 5.5 6.0
label index
variable flag equal 2.5*v_sig
print "flag = " ${flag}
next sig
jump in.gel index

This always give me flag = 2.5

variable sig index 2.5 3 3.5 4 4.5 5 5.5 6.0
label index
variable flag equal v_sig
print "flag = " ${flag}
next sig
jump in.gel index

This gives me different value of flag as supposed to do.

For the first two cases, they seem to ignore the math operation. Could anyone tell me how to use math operation inside the variable command? Thanks!

Dongsheng

Hello,

I would like to change some parameters during my simulation, therefore I need to use rariable command in my input script.

variable sig index 2.5 3 3.5 4 4.5 5 5.5 6.0
label index
variable flag equal 2*v_sig
print "flag = " ${flag}
next sig
jump in.gel index

This always give me flag = 2

variable sig index 2.5 3 3.5 4 4.5 5 5.5 6.0
label index
variable flag equal 2.5*v_sig
print "flag = " ${flag}
next sig
jump in.gel index

This always give me flag = 2.5

variable sig index 2.5 3 3.5 4 4.5 5 5.5 6.0
label index
variable flag equal v_sig
print "flag = " ${flag}
next sig
jump in.gel index

This gives me different value of flag as supposed to do.

For the first two cases, they seem to ignore the math operation. Could anyone tell me how to use math operation inside the variable command? Thanks!

Dongsheng

Hello, Steve,

It seems I can’t sent an email to the mailing list after I changed my email address. However, I can receive emails. Could you please tell me what I can do?

The following is the question I would like to ask you. Could you please take a look? Thanks!

Dongsheng