LAMMPS Users,
I have some questions about the variable command. I am trying to build
a crystal structure of alternating layers of two atom types and having
trouble implementing the current value of a variable (v_) in my input
script with a filename of "in.superlattice". Below is the section of
script causing the problems. I keep getting "ERROR: Using variable
equal keyword before initial run" when LAMMPS tries to evaluate "$s".
It seems that the code does not like to evaluate my variables unless
runs are embedded within the loop. Is there a work around or another
way of evaluating a variable without doing an initial run? The last
part of the documentation on variable seems to imply it is possible.
Also when using "v_" does the variable name have to be a single
character? Or can one use something like "v_{variablename}"? I just
haven't had much luck with it, but the errors described above might be
the real problem. In other words, can I use something like "layer" and
"v_layer" instead of "x" and "v_x" in the script below?
Thank you,
Rob
variable x loop $p
#These will not be redefined each loop.
variable s equal add(4.0,mult(sub(v_x,1),add($m,$n))) #start of first
atom type layer
variable t equal add(3.99,add(mult(sub(v_x,1),add($m,$n)),$m))#end of
1st atom type layer
variable u equal add(4.0,add(mult(sub(v_x,1),add($m,$n)),$m)) #start of
2nd atom type layer
variable v equal add(3.99, mult(v_x,add($m,$n))) #end of 1st atom type
layer
label periodloop
region S$x block 0.0 $w 0.0 $w $s $t
region G$x block 0.0 $w 0.0 $w $u $v
create_atoms 1 region S$x
create_atoms 1 region G$x
next x #iterate to next x
jump in.superlattice periodloop