git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2157 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -40,7 +40,7 @@
|
||||
vx[], vy[], vz[], fx[], fy[], fz[]
|
||||
compute references = c_ID, c_ID[2], c_ID[N], c_ID[N][2], c_ID[], c_ID[][2]
|
||||
fix references = f_ID, f_ID[2], f_ID[N], f_ID[N][2], f_ID[], f_ID[][2]
|
||||
other variables = v_abc, v_abc[N], v_abc[]
|
||||
variable references = v_abc, v_abc[N], v_abc[]
|
||||
</PRE>
|
||||
|
||||
</UL>
|
||||
@ -97,15 +97,14 @@ script (with 2 exceptions, read further). This is to allow an input
|
||||
script to be processed multiple times without resetting the variables;
|
||||
see the <A HREF = "jump.html">jump</A> or <A HREF = "include.html">include</A> commands. It also
|
||||
means that using the <A HREF = "Section_start.html#2_6">command-line switch</A> -var
|
||||
will override a corresponding variable setting in the input script.
|
||||
will override a corresponding index variable setting in the input
|
||||
script.
|
||||
</P>
|
||||
<P>There are two exceptions to this rule. First, variables of style
|
||||
<I>equal</I> and <I>atom</I> ARE redefined each time the command is encountered.
|
||||
This allows them to be reset, when their formulas contain a
|
||||
substitution for another variable, e.g. $x. This can be useful in a
|
||||
loop. This also means an <I>equal</I>-style variable will re-define a
|
||||
command-line switch -var setting, so an <I>index</I>-style variable should
|
||||
be used for such settings instead, as in bench/in.lj.
|
||||
loop.
|
||||
</P>
|
||||
<P>Second, as described below, if a variable is iterated on to the end of
|
||||
its list of strings via the <A HREF = "next.html">next</A> command, it is removed
|
||||
@ -298,13 +297,13 @@ compute. N is a global atom ID (positive integer).
|
||||
</TD></TR></TABLE></DIV>
|
||||
|
||||
<P>Fix references access one or more quantities calculated by a
|
||||
<A HREF = "fix.html">fix</A>. The ID in the reference should be replaced by
|
||||
the actual ID of the fix defined elsewhere in the input script.
|
||||
See the doc pages for individual computes to see which ones calculate
|
||||
global versus per-atom quantities. If the compute reference contains
|
||||
empty brackets, then per-atom values calculated by the compute are
|
||||
accessed. Otherwise a single value (global or per-atom) calculated by
|
||||
the compute is accessed.
|
||||
<A HREF = "fix.html">fix</A>. The ID in the reference should be replaced by the
|
||||
actual ID of the fix defined elsewhere in the input script. See the
|
||||
doc pages for individual computes to see which ones calculate global
|
||||
versus per-atom quantities. If the fix reference contains empty
|
||||
brackets, then per-atom values calculated by the fix are accessed.
|
||||
Otherwise a single value (global or per-atom) calculated by the
|
||||
fix is accessed.
|
||||
</P>
|
||||
<P>Note that some fixes only generate quantities on certain timesteps.
|
||||
If a variable attempts to access the fix on non-allowed timesteps, an
|
||||
@ -338,27 +337,30 @@ print $a
|
||||
</PRE>
|
||||
<P>then LAMMPS will run for a while when the print statement is invoked!
|
||||
</P>
|
||||
<P>Another way to reference a variable in a formula is using the $x form
|
||||
instead of v_x. There is a subtle difference between the two
|
||||
references that has to do with when the evaluation of the included
|
||||
variable is done.
|
||||
<HR>
|
||||
|
||||
<P>It is useful to understand the distinction between referencing a
|
||||
variable in a formula using the $x form instead of v_x. There is a
|
||||
subtle difference between the two references that has to do with when
|
||||
the evaluation of the included variable is done.
|
||||
</P>
|
||||
<P>Using a $x, the value of the include variable is substituted for
|
||||
immediately when the line is read from the input script, just as it
|
||||
would be in other input script command. This could be the desired
|
||||
behavior if a static value is desired. Or it could be the desired
|
||||
behavior for an equal-style variable if the variable command appears
|
||||
in a loop (see the <A HREF = "jump.html">jump</A> and <A HREF = "next.html">next</A> commands),
|
||||
since the substitution will be performed anew each time thru the loop
|
||||
as the command is re-read. Note that if the variable formula is
|
||||
enclosed in double quotes, this prevents variable substitution and
|
||||
thus an error will be generated when the variable formula is
|
||||
evaluated.
|
||||
<P>Referencing the variable as $x, the value of the include variable is
|
||||
substituted for immediately when the line is read from the input
|
||||
script, just as it would be in other input script command.
|
||||
</P>
|
||||
<P>Using a v_x, the value of the included variable will not be accessed
|
||||
until the variable formula is evaluated. Thus the value may change
|
||||
each time the evaluation is performed. This may also be desired
|
||||
behavior.
|
||||
<P>This could be the desired behavior if a static value is desired. Or
|
||||
it could be the desired behavior for an equal-style variable if the
|
||||
variable command appears in a loop (see the <A HREF = "jump.html">jump</A> and
|
||||
<A HREF = "next.html">next</A> commands), since the substitution will be performed
|
||||
anew each time thru the loop as the command is re-read. Note that if
|
||||
the variable formula is enclosed in double quotes, this prevents
|
||||
variable substitution and thus an error will be generated when the
|
||||
variable formula is evaluated.
|
||||
</P>
|
||||
<P>Referencing the variable as v_x, the value of the included variable
|
||||
will not be accessed until the variable formula is evaluated. Thus
|
||||
the value may change each time the evaluation is performed. This may
|
||||
also be desired behavior.
|
||||
</P>
|
||||
<P>As an example, if the current simulation box volume is 1000.0, then
|
||||
these lines:
|
||||
|
||||
Reference in New Issue
Block a user