git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2157 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2008-10-06 23:07:25 +00:00
parent c21e7ac926
commit a598c31acc
4 changed files with 80 additions and 74 deletions

View File

@ -579,12 +579,13 @@ the input script is read. "Name" is the variable name which can be a
single character (referenced as $x in the input script) or a full single character (referenced as $x in the input script) or a full
string (referenced as ${abc}). The value can be any string. Using string (referenced as ${abc}). The value can be any string. Using
this command-line option is equivalent to putting the line "variable this command-line option is equivalent to putting the line "variable
name index value" at the beginning of the input script. Defining a name index value" at the beginning of the input script. Defining an
variable as a command-line argument overrides any setting for the same index variable as a command-line argument overrides any setting for
variable in the input script, since variables cannot be re-defined. the same index variable in the input script, since index variables
See the <A HREF = "variable.html">variable</A> command for more info on defining cannot be re-defined. See the <A HREF = "variable.html">variable</A> command for
variables and <A HREF = "Section_commands.html#3_2">this section</A> for more info more info on defining index and other kinds of variables and <A HREF = "Section_commands.html#3_2">this
on using variables in input scripts. section</A> for more info on using variables in
input scripts.
</P> </P>
<HR> <HR>

View File

@ -572,12 +572,13 @@ the input script is read. "Name" is the variable name which can be a
single character (referenced as $x in the input script) or a full single character (referenced as $x in the input script) or a full
string (referenced as $\{abc\}). The value can be any string. Using string (referenced as $\{abc\}). The value can be any string. Using
this command-line option is equivalent to putting the line "variable this command-line option is equivalent to putting the line "variable
name index value" at the beginning of the input script. Defining a name index value" at the beginning of the input script. Defining an
variable as a command-line argument overrides any setting for the same index variable as a command-line argument overrides any setting for
variable in the input script, since variables cannot be re-defined. the same index variable in the input script, since index variables
See the "variable"_variable.html command for more info on defining cannot be re-defined. See the "variable"_variable.html command for
variables and "this section"_Section_commands.html#3_2 for more info more info on defining index and other kinds of variables and "this
on using variables in input scripts. section"_Section_commands.html#3_2 for more info on using variables in
input scripts.
:line :line

View File

@ -40,7 +40,7 @@
vx[], vy[], vz[], fx[], fy[], fz[] 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] 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] 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> </PRE>
</UL> </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; 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 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 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>
<P>There are two exceptions to this rule. First, variables of style <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. <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 This allows them to be reset, when their formulas contain a
substitution for another variable, e.g. $x. This can be useful in 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 loop.
command-line switch -var setting, so an <I>index</I>-style variable should
be used for such settings instead, as in bench/in.lj.
</P> </P>
<P>Second, as described below, if a variable is iterated on to the end of <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 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> </TD></TR></TABLE></DIV>
<P>Fix references access one or more quantities calculated by a <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 <A HREF = "fix.html">fix</A>. The ID in the reference should be replaced by the
the actual ID of the fix defined elsewhere in the input script. actual ID of the fix defined elsewhere in the input script. See the
See the doc pages for individual computes to see which ones calculate doc pages for individual computes to see which ones calculate global
global versus per-atom quantities. If the compute reference contains versus per-atom quantities. If the fix reference contains empty
empty brackets, then per-atom values calculated by the compute are brackets, then per-atom values calculated by the fix are accessed.
accessed. Otherwise a single value (global or per-atom) calculated by Otherwise a single value (global or per-atom) calculated by the
the compute is accessed. fix is accessed.
</P> </P>
<P>Note that some fixes only generate quantities on certain timesteps. <P>Note that some fixes only generate quantities on certain timesteps.
If a variable attempts to access the fix on non-allowed timesteps, an If a variable attempts to access the fix on non-allowed timesteps, an
@ -338,27 +337,30 @@ print $a
</PRE> </PRE>
<P>then LAMMPS will run for a while when the print statement is invoked! <P>then LAMMPS will run for a while when the print statement is invoked!
</P> </P>
<P>Another way to reference a variable in a formula is using the $x form <HR>
instead of v_x. There is a subtle difference between the two
references that has to do with when the evaluation of the included <P>It is useful to understand the distinction between referencing a
variable is done. 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>
<P>Using a $x, the value of the include variable is substituted for <P>Referencing the variable as $x, the value of the include variable is
immediately when the line is read from the input script, just as it substituted for immediately when the line is read from the input
would be in other input script command. This could be the desired script, just as it would be in other input script command.
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>
<P>Using a v_x, the value of the included variable will not be accessed <P>This could be the desired behavior if a static value is desired. Or
until the variable formula is evaluated. Thus the value may change it could be the desired behavior for an equal-style variable if the
each time the evaluation is performed. This may also be desired variable command appears in a loop (see the <A HREF = "jump.html">jump</A> and
behavior. <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>
<P>As an example, if the current simulation box volume is 1000.0, then <P>As an example, if the current simulation box volume is 1000.0, then
these lines: these lines:

View File

@ -35,7 +35,7 @@ style = {index} or {loop} or {world} or {universe} or {uloop} or {equal} or {ato
vx\[\], vy\[\], vz\[\], fx\[\], fy\[\], fz\[\] 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\] 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\] 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\[\] :pre variable references = v_abc, v_abc\[N\], v_abc\[\] :pre
:ule :ule
[Examples:] [Examples:]
@ -91,15 +91,14 @@ script (with 2 exceptions, read further). This is to allow an input
script to be processed multiple times without resetting the variables; script to be processed multiple times without resetting the variables;
see the "jump"_jump.html or "include"_include.html commands. It also see the "jump"_jump.html or "include"_include.html commands. It also
means that using the "command-line switch"_Section_start.html#2_6 -var means that using the "command-line switch"_Section_start.html#2_6 -var
will override a corresponding variable setting in the input script. will override a corresponding index variable setting in the input
script.
There are two exceptions to this rule. First, variables of style There are two exceptions to this rule. First, variables of style
{equal} and {atom} ARE redefined each time the command is encountered. {equal} and {atom} ARE redefined each time the command is encountered.
This allows them to be reset, when their formulas contain a This allows them to be reset, when their formulas contain a
substitution for another variable, e.g. $x. This can be useful in a substitution for another variable, e.g. $x. This can be useful in a
loop. This also means an {equal}-style variable will re-define a loop.
command-line switch -var setting, so an {index}-style variable should
be used for such settings instead, as in bench/in.lj.
Second, as described below, if a variable is iterated on to the end of Second, as described below, if a variable is iterated on to the end of
its list of strings via the "next"_next.html command, it is removed its list of strings via the "next"_next.html command, it is removed
@ -291,13 +290,13 @@ c_ID\[\]: per-atom scalar from a per-atom compute
c_ID\[\]\[M\]: per-atom vector component from a per-atom compute :tb(s=:) c_ID\[\]\[M\]: per-atom vector component from a per-atom compute :tb(s=:)
Fix references access one or more quantities calculated by a Fix references access one or more quantities calculated by a
"fix"_fix.html. The ID in the reference should be replaced by "fix"_fix.html. The ID in the reference should be replaced by the
the actual ID of the fix defined elsewhere in the input script. actual ID of the fix defined elsewhere in the input script. See the
See the doc pages for individual computes to see which ones calculate doc pages for individual computes to see which ones calculate global
global versus per-atom quantities. If the compute reference contains versus per-atom quantities. If the fix reference contains empty
empty brackets, then per-atom values calculated by the compute are brackets, then per-atom values calculated by the fix are accessed.
accessed. Otherwise a single value (global or per-atom) calculated by Otherwise a single value (global or per-atom) calculated by the
the compute is accessed. fix is accessed.
Note that some fixes only generate quantities on certain timesteps. Note that some fixes only generate quantities on certain timesteps.
If a variable attempts to access the fix on non-allowed timesteps, an If a variable attempts to access the fix on non-allowed timesteps, an
@ -329,27 +328,30 @@ print $a :pre
then LAMMPS will run for a while when the print statement is invoked! then LAMMPS will run for a while when the print statement is invoked!
Another way to reference a variable in a formula is using the $x form :line
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.
Using a $x, the value of the include variable is substituted for It is useful to understand the distinction between referencing a
immediately when the line is read from the input script, just as it variable in a formula using the $x form instead of v_x. There is a
would be in other input script command. This could be the desired subtle difference between the two references that has to do with when
behavior if a static value is desired. Or it could be the desired the evaluation of the included variable is done.
behavior for an equal-style variable if the variable command appears
in a loop (see the "jump"_jump.html and "next"_next.html 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.
Using a v_x, the value of the included variable will not be accessed Referencing the variable as $x, the value of the include variable is
until the variable formula is evaluated. Thus the value may change substituted for immediately when the line is read from the input
each time the evaluation is performed. This may also be desired script, just as it would be in other input script command.
behavior.
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 "jump"_jump.html and
"next"_next.html 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.
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.
As an example, if the current simulation box volume is 1000.0, then As an example, if the current simulation box volume is 1000.0, then
these lines: these lines: