[lammps-users] using variable

Hello, LAMMPS users,

I checked my simulation. It looked some atoms were overlapped. However, the vdw interaction looked fine. Therefore, I would like to explicitly check the vdw interaction between one pair of atoms. In my input script, I defined several variable. It seemed I can’t do calculation such as sub (I can output the coordinates of those two particles). Could you please help me find where I have a mistake. The relevant part of my script is as following:

group 1 id 265 305

variable stepi equal step
variable x1 equal x[265]
variable x2 equal x[305]
variable y1 equal y[265]
variable y2 equal y[305]
variable dx equal sub({x1}, {x2})
variable dy equal sub({y1}, {y2})
variable distance equal sqrt(add(mult(sub(x[305], x[265]), sub(x[305], x[265])), mult(sub(y[305], y[265]), sub(y[305], y[265]))))
variable LJ_pair equal evdwl

compute 2 1 variable LJ_pair
compute 3 1 variable distance

fix 4 1 print 100 “checkDistance {stepi} {x1} {x2} {y1} {y2} {distance} {dx} {dy}”

Thank you for help!

Dongsheng

No spaces allowed in variable definitions. The final argument must
be one word (no spaces).

Steve