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

This commit is contained in:
sjplimp 2013-02-18 17:23:22 +00:00
parent f24bd36fe5
commit c3091aeaac
6 changed files with 97 additions and 39 deletions

View File

@ -100,13 +100,34 @@ single leading "#" will comment out the entire command.
</P>
<P>(3) The line is searched repeatedly for $ characters, which indicate
variables that are replaced with a text string. See an exception in
(6). If the $ is followed by curly brackets, then the variable name
is the text inside the curly brackets. If no curly brackets follow
the $, then the variable name is the single character immediately
following the $. Thus ${myTemp} and $x refer to variable names
"myTemp" and "x". See the <A HREF = "variable.html">variable</A> command for
details of how strings are assigned to variables and how they are
substituted for in input script commands.
(6).
</P>
<P>If the $ is followed by curly brackets, then the variable name is the
text inside the curly brackets. If no curly brackets follow the $,
then the variable name is the single character immediately following
the $. Thus ${myTemp} and $x refer to variable names "myTemp" and
"x".
</P>
<P>If the $ is followed by parenthesis, then the text inside the
parenthesis is treated as an "immediate" variable and evaluated as an
<A HREF = "variable.html">equal-style variable</A>. This is a way to use numeric
formulas in an input script without having to assign them to variable
names. For example, these 3 input script lines:
</P>
<PRE>variable X equal (xlo+xhi)/2+sqrt(v_area)
region 1 block $X 2 INF INF EDGE EDGE
variable X delete
</PRE>
<P>can be replaced by
</P>
<PRE>region 1 block $((xlo+xhi)/2+sqrt(v_area)) 2 INF INF EDGE EDGE
</PRE>
<P>The latter produces an identical result, without having to define and
discard a temporary variable X.
</P>
<P>See the <A HREF = "variable.html">variable</A> command for more details of how
strings are assigned to variables and evaluated, and how they can be
used in input script commands.
</P>
<P>(4) The line is broken into "words" separated by whitespace (tabs,
spaces). Note that words can thus contain letters, digits,
@ -120,12 +141,13 @@ it can be enclosed in either double or single quotes. E.g.
</P>
<PRE>print "Volume = $v"
print 'Volume = $v'
if "$<I>steps</I> > 1000" then quit
</PRE>
<P>The quotes are removed when the single argument is stored internally.
See the <A HREF = "dump_modify.html">dump modify format</A> or <A HREF = "if.html">if</A> commands
for examples. A "#" or "$" character that is between quotes will not
be treated as a comment indicator in (2) or substituted for as a
variable in (3).
See the <A HREF = "dump_modify.html">dump modify format</A> or <A HREF = "print.html">print</A> or
<A HREF = "if.html">if</A> commands for examples. A "#" or "$" character that is
between quotes will not be treated as a comment indicator in (2) or
substituted for as a variable in (3).
</P>
<P>IMPORTANT NOTE: If the argument is itself a command that requires a
quoted argument (e.g. using a <A HREF = "print.html">print</A> command as part of an

View File

@ -96,13 +96,34 @@ single leading "#" will comment out the entire command.
(3) The line is searched repeatedly for $ characters, which indicate
variables that are replaced with a text string. See an exception in
(6). If the $ is followed by curly brackets, then the variable name
is the text inside the curly brackets. If no curly brackets follow
the $, then the variable name is the single character immediately
following the $. Thus $\{myTemp\} and $x refer to variable names
"myTemp" and "x". See the "variable"_variable.html command for
details of how strings are assigned to variables and how they are
substituted for in input script commands.
(6).
If the $ is followed by curly brackets, then the variable name is the
text inside the curly brackets. If no curly brackets follow the $,
then the variable name is the single character immediately following
the $. Thus $\{myTemp\} and $x refer to variable names "myTemp" and
"x".
If the $ is followed by parenthesis, then the text inside the
parenthesis is treated as an "immediate" variable and evaluated as an
"equal-style variable"_variable.html. This is a way to use numeric
formulas in an input script without having to assign them to variable
names. For example, these 3 input script lines:
variable X equal (xlo+xhi)/2+sqrt(v_area)
region 1 block $X 2 INF INF EDGE EDGE
variable X delete :pre
can be replaced by
region 1 block $((xlo+xhi)/2+sqrt(v_area)) 2 INF INF EDGE EDGE :pre
The latter produces an identical result, without having to define and
discard a temporary variable X.
See the "variable"_variable.html command for more details of how
strings are assigned to variables and evaluated, and how they can be
used in input script commands.
(4) The line is broken into "words" separated by whitespace (tabs,
spaces). Note that words can thus contain letters, digits,
@ -115,13 +136,14 @@ line are arguments.
it can be enclosed in either double or single quotes. E.g.
print "Volume = $v"
print 'Volume = $v' :pre
print 'Volume = $v'
if "${steps} > 1000" then quit :pre
The quotes are removed when the single argument is stored internally.
See the "dump modify format"_dump_modify.html or "if"_if.html commands
for examples. A "#" or "$" character that is between quotes will not
be treated as a comment indicator in (2) or substituted for as a
variable in (3).
See the "dump modify format"_dump_modify.html or "print"_print.html or
"if"_if.html commands for examples. A "#" or "$" character that is
between quotes will not be treated as a comment indicator in (2) or
substituted for as a variable in (3).
IMPORTANT NOTE: If the argument is itself a command that requires a
quoted argument (e.g. using a "print"_print.html command as part of an

View File

@ -74,8 +74,8 @@ header line(s) and section(s) that it reads from the data file.
spacing between words and numbers) is not important except that header
and section keywords (e.g. atoms, xlo xhi, Masses, Bond Coeffs) must
be capitalized as shown and can't have extra white space between their
words - e.g. two spaces or a tab between "Bond" and "Coeffs" is not
valid.
words - e.g. two spaces or a tab between the 2 words in "xlo xhi" or
the 2 words in "Bond Coeffs", is not valid.
</P>
<HR>

View File

@ -68,8 +68,8 @@ The formatting of individual lines in the data file (indentation,
spacing between words and numbers) is not important except that header
and section keywords (e.g. atoms, xlo xhi, Masses, Bond Coeffs) must
be capitalized as shown and can't have extra white space between their
words - e.g. two spaces or a tab between "Bond" and "Coeffs" is not
valid.
words - e.g. two spaces or a tab between the 2 words in "xlo xhi" or
the 2 words in "Bond Coeffs", is not valid.
:line

View File

@ -119,8 +119,8 @@ evaluation of the string. Note that the same string can generate
different values when it is evaluated at different times during a
simulation.
</P>
<P>IMPORTANT NOTE: When the input script line that defines a variable of
style <I>equal</I> or <I>atom</I> that contain a formula is encountered, the
<P>IMPORTANT NOTE: When the input script line is encountered that defines
a variable of style <I>equal</I> or <I>atom</I> that contains a formula, the
formula is NOT immediately evaluated and the result stored. See the
discussion below about "Immediate Evaluation of Variables" if you want
to do this.
@ -724,10 +724,17 @@ produce only a global scalar or a per-atom vector, never both.
</P>
<P>There is a difference between referencing a variable with a leading $
sign (e.g. $x or ${abc}) versus with a leading "v_" (e.g. v_x or
v_abc). The former can be used in any command, including a variable
command, to force the immediate evaluation of the referenced variable
and the substitution of its value into the command. The latter is a
required kind of argument to some commands (e.g. the <A HREF = "fix_ave_spatial.html">fix
v_abc). The former can be used in any input script command, including
a variable command. The input script parser evaluates the reference
variable immediately and substitutes its value into the command. As
explained in <A HREF = "Section_commands.html#3_2">Section commands 3.2</A> for
"Parsing rules", you can also use un-named "immediate" variables for
this purpose. An variable reference such as
$((xlo+xhi)/2+sqrt(v_area)) evaluates the string between the
parenthesis as an equal-style variable.
</P>
<P>Referencing a variable with a leading "v_" is an optional or required
kind of argument for some commands (e.g. the <A HREF = "fix_ave_spatial.html">fix
ave/spatial</A> or <A HREF = "dump.html">dump custom</A> or
<A HREF = "thermo_style.html">thermo_style</A> commands) if you wish it to evaluate
a variable periodically during a run. It can also be used in a

View File

@ -113,8 +113,8 @@ evaluation of the string. Note that the same string can generate
different values when it is evaluated at different times during a
simulation.
IMPORTANT NOTE: When the input script line that defines a variable of
style {equal} or {atom} that contain a formula is encountered, the
IMPORTANT NOTE: When the input script line is encountered that defines
a variable of style {equal} or {atom} that contains a formula, the
formula is NOT immediately evaluated and the result stored. See the
discussion below about "Immediate Evaluation of Variables" if you want
to do this.
@ -718,10 +718,17 @@ v_name\[I\]: atom I's value in per-atom vector :tb(s=:)
There is a difference between referencing a variable with a leading $
sign (e.g. $x or $\{abc\}) versus with a leading "v_" (e.g. v_x or
v_abc). The former can be used in any command, including a variable
command, to force the immediate evaluation of the referenced variable
and the substitution of its value into the command. The latter is a
required kind of argument to some commands (e.g. the "fix
v_abc). The former can be used in any input script command, including
a variable command. The input script parser evaluates the reference
variable immediately and substitutes its value into the command. As
explained in "Section commands 3.2"_Section_commands.html#3_2 for
"Parsing rules", you can also use un-named "immediate" variables for
this purpose. An variable reference such as
$((xlo+xhi)/2+sqrt(v_area)) evaluates the string between the
parenthesis as an equal-style variable.
Referencing a variable with a leading "v_" is an optional or required
kind of argument for some commands (e.g. the "fix
ave/spatial"_fix_ave_spatial.html or "dump custom"_dump.html or
"thermo_style"_thermo_style.html commands) if you wish it to evaluate
a variable periodically during a run. It can also be used in a