Hi,
When I want to create a particle at a desired location, an error is encountered.
create_atoms 1 single ${x1} ${y1} ${z1} units box, where x1, y1 and z1 are variables.
ERROR: Variable for set command is invalid style
create_atoms 1 single v_x1 v_y1 v_z1 units box
ERROR: Expected floating point parameter in input script or data file.
I also check the value of the variables by print.
print "The x1 is ${x1}"
The x1 is -0.0035
print "The y1 is ${y1}"
The y1 is 0
print "The z1 is ${z1}"
The z1 is 0.0099999999
Can anyone help me solve this problem?
Many thanks in advance,
Su
robin | Fri, 01/22/2016 - 10:00
Different ways of passing variables
Hi,
As you tested it, you have various ways of passing variables. I suppose you define your variable with something like: variable myVar equal 12.0 .
Often (for example when you call a fix), the syntax v_myVar fails, you have to use the ${myVar} syntax.
If it fails, you can use the immediate variable syntax:
variable myVar equal 12
create_atoms 1 single 0 0 $(v_myVar)
Cheers