A small issue with displace_atoms command

Dear all,

I have encountered a minor bug in a "displace_atoms" command:
If I use a command similar to "displace_atoms test move -\{x\} \-{y} -${z}" and, for example, the "x" variable is negative, the atoms won't be moved in x direction and there won't be any error messages. I'm using the most recent LAMMPS version (25Sep14). A simple script which shows the bug is attached to this message.

Yours faithfully,
Michal Kanski

displace_atoms_bug.in (516 Bytes)

If you are saying you are wanting the input parser to
evaluates --3.0 (with 2 minus signs) as 3.0, then

you’re expecting too much from the LAMMPS input
parser. You also could not say ${x}+2.0 in an input line.
All the parser does is pass the string to the C function
atof(), which does not do math, e.g. evaluate a formula.

You could use an equal-style variable like

variable x equal “-v_myX”

variable x equal “v_myX+2.0”

and then myX could eval to a positive or negative
number and it should work. The variable parser
evaluates a formula, the input parser does not.