Illegal Variable Substitution

Hello,

I am attempting to do the following:

variable x2_temp equal x[5]
variable y2_temp equal y[5]
variable z2_temp equal z[5]

variable x2 equal {x2_temp} variable y2 equal {y2_temp}
variable z2 equal ${z2_temp}

#variable x2_temp delete
#variable y2_temp delete
#variable z2_temp delete

fix hold_C2 C2 spring tether 1000 ({x2}-1.0) {y2} {z2} 0.0

And I’m getting the error: ERROR on proc 0: Substitution for illegal variable (input.cpp:399)

This section (http://lammps.sandia.gov/doc/Section_commands.html#cmd_2) of the parsing rules seems to say that I can do that. Obviously I’m doing something wrong. Any help would be great. Thanks

Please always state which version of lammps you are using.

You need to use: \(v\_x2\-1\.0\) Because immediate variable expansion disables expansion.

Axel.

Axel is correct - nesting is not allowed. I added an explanation
of this to section 3.2 on input script parsing.

Steve