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

This commit is contained in:
sjplimp 2013-07-24 20:47:56 +00:00
parent b8208f582c
commit 6755d5b44f
4 changed files with 184 additions and 82 deletions

View File

@ -43,10 +43,12 @@ then all must be of the same variable style: <I>index</I>, <I>loop</I>, <I>file<
<I>uloop</I>-style variables can be mixed in the same <I>next</I> command.
</P>
<P>All the variables specified with the next command are incremented by
one value from their respective list of values. A <I>file</I>-style variable
reads the next line from its associated file. <I>String-</I> or <I>atom</I>- or
<I>equal</I>- or <I>world</I>-style variables cannot be used with the the next
command, since they only store a single value.
one value from their respective list of values. A <I>file</I>-style
variable reads the next line from its associated file. An
<I>atomfile</I>-style variable reads the next set of lines (one per atom)
from its associated file. <I>String-</I> or <I>atom</I>- or <I>equal</I>- or
<I>world</I>-style variables cannot be used with the the next command,
since they only store a single value.
</P>
<P>When any of the variables in the next command has no more values, a
flag is set that causes the input script to skip the next
@ -54,19 +56,24 @@ flag is set that causes the input script to skip the next
a next command to exit. As explained in the <A HREF = "variable.html">variable</A>
command, the variable that has exhausted its values is also deleted.
This allows it to be used and re-defined later in the input script.
<I>File</I>-style variables are exhausted when the end-of-file is reached.
<I>File</I>-style and <I>atomfile</I>-style variables are exhausted when the
end-of-file is reached.
</P>
<P>When the next command is used with <I>index</I>- or <I>loop</I>-style or
<I>file</I>-style variables, the next value is assigned to the variable for
all processors. When the next command is used with <I>universe</I>- or
<I>uloop</I>-style variables, the next value is assigned to whichever
processor partition executes the command first. All processors in the
partition are assigned the same value. Running LAMMPS on multiple
partitions of processors via the "-partition" command-line switch is
described in <A HREF = "Section_start.html#start_7">this section</A> of the manual.
<I>Universe</I>- and <I>uloop</I>-style variables are incremented using the
files "tmp.lammps.variable" and "tmp.lammps.variable.lock" which you
will see in your directory during such a LAMMPS run.
<P>When the next command is used with <I>index</I>- or <I>loop</I>-style variables,
the next value is assigned to the variable for all processors. When
the next command is used with <I>file</I>-style variables, the next line is
read from its file and the string assigned to the variable. When the
next command is used with <I>atomfile</I>-style variables, the next set of
per-atom values is read from its file and assigned to the variable.
When the next command is used with <I>universe</I>- or <I>uloop</I>-style
variables, the next value is assigned to whichever processor partition
executes the command first. All processors in the partition are
assigned the same value. Running LAMMPS on multiple partitions of
processors via the "-partition" command-line switch is described in
<A HREF = "Section_start.html#start_7">this section</A> of the manual. <I>Universe</I>-
and <I>uloop</I>-style variables are incremented using the files
"tmp.lammps.variable" and "tmp.lammps.variable.lock" which you will
see in your directory during such a LAMMPS run.
</P>
<P>Here is an example of running a series of simulations using the next
command with an <I>index</I>-style variable. If this input script is named

View File

@ -40,10 +40,12 @@ then all must be of the same variable style: {index}, {loop}, {file},
{uloop}-style variables can be mixed in the same {next} command.
All the variables specified with the next command are incremented by
one value from their respective list of values. A {file}-style variable
reads the next line from its associated file. {String-} or {atom}- or
{equal}- or {world}-style variables cannot be used with the the next
command, since they only store a single value.
one value from their respective list of values. A {file}-style
variable reads the next line from its associated file. An
{atomfile}-style variable reads the next set of lines (one per atom)
from its associated file. {String-} or {atom}- or {equal}- or
{world}-style variables cannot be used with the the next command,
since they only store a single value.
When any of the variables in the next command has no more values, a
flag is set that causes the input script to skip the next
@ -51,19 +53,24 @@ flag is set that causes the input script to skip the next
a next command to exit. As explained in the "variable"_variable.html
command, the variable that has exhausted its values is also deleted.
This allows it to be used and re-defined later in the input script.
{File}-style variables are exhausted when the end-of-file is reached.
{File}-style and {atomfile}-style variables are exhausted when the
end-of-file is reached.
When the next command is used with {index}- or {loop}-style or
{file}-style variables, the next value is assigned to the variable for
all processors. When the next command is used with {universe}- or
{uloop}-style variables, the next value is assigned to whichever
processor partition executes the command first. All processors in the
partition are assigned the same value. Running LAMMPS on multiple
partitions of processors via the "-partition" command-line switch is
described in "this section"_Section_start.html#start_7 of the manual.
{Universe}- and {uloop}-style variables are incremented using the
files "tmp.lammps.variable" and "tmp.lammps.variable.lock" which you
will see in your directory during such a LAMMPS run.
When the next command is used with {index}- or {loop}-style variables,
the next value is assigned to the variable for all processors. When
the next command is used with {file}-style variables, the next line is
read from its file and the string assigned to the variable. When the
next command is used with {atomfile}-style variables, the next set of
per-atom values is read from its file and assigned to the variable.
When the next command is used with {universe}- or {uloop}-style
variables, the next value is assigned to whichever processor partition
executes the command first. All processors in the partition are
assigned the same value. Running LAMMPS on multiple partitions of
processors via the "-partition" command-line switch is described in
"this section"_Section_start.html#start_7 of the manual. {Universe}-
and {uloop}-style variables are incremented using the files
"tmp.lammps.variable" and "tmp.lammps.variable.lock" which you will
see in your directory during such a LAMMPS run.
Here is an example of running a series of simulations using the next
command with an {index}-style variable. If this input script is named

View File

@ -17,7 +17,7 @@
</PRE>
<UL><LI>name = name of variable to define
<LI>style = <I>delete</I> or <I>index</I> or <I>loop</I> or <I>world</I> or <I>universe</I> or <I>uloop</I> or <I>string</I> or <I>file</I> or <I>equal</I> or <I>atom</I>
<LI>style = <I>delete</I> or <I>index</I> or <I>loop</I> or <I>world</I> or <I>universe</I> or <I>uloop</I> or <I>string</I> or <I>file</I> or <I>atomfile</I> or <I>equal</I> or <I>atom</I>
<PRE> <I>delete</I> = no args
<I>index</I> args = one or more strings
@ -40,6 +40,7 @@
pad = all values will be same length, e.g. 001, 002, ..., 100
<I>string</I> arg = one string
<I>file</I> arg = filename
<I>atomfile</I> arg = filename
<I>equal</I> or <I>atom</I> args = one formula containing numbers, thermo keywords, math operations, group functions, atom values and vectors, compute/fix/variable references
numbers = 0.0, 100, -5.4, 2.8e-4, etc
constants = PI
@ -106,7 +107,9 @@ a formula which when evaluated produces one numeric value per atom
which can be output to a dump file (see the <A HREF = "dump.html">dump custom</A>
command) or used as input to an averaging fix (see the <A HREF = "fix_ave_spatial.html">fix
ave/spatial</A> and <A HREF = "fix_ave_atom.html">fix ave/atom</A>
commands).
commands). Variables of style <I>atomfile</I> can be used similar to
atom-style variables, except they get their per-atom values from a
file rather than from a formula.
</P>
<P>In the discussion that follows, the "name" of the variable is the
arbitrary string that is the 1st argument in the variable command.
@ -245,7 +248,7 @@ read again in a loop.
</P>
<P>For the <I>file</I> style, a filename is provided which contains a list of
strings to assign to the variable, one per line. The strings can be
numeric values if desired; see the discussion of the next() function
numeric values if desired. See the discussion of the next() function
below for equal-style variables, which will convert the string of a
file-style variable into a numeric value in a formula.
</P>
@ -263,6 +266,36 @@ character is stripped. Blank lines are skipped. The first "word" of
a non-blank line, delimited by white space, is the "string" assigned
to the variable.
</P>
<P>For the <I>atomfile</I> style, a filename is provided which contains one or
more sets of values, to assign on a per-atom basis to the variable.
The format of the file is described below.
</P>
<P>When an atomfile-style variable is defined, the file is opened and the
first set of per-atom values are read and stored with the variable.
This means the variable can then be evaluated as many times as desired
and will return those values. There are two ways to cause the next
set of per-atom values from the file to be read: use the
<A HREF = "next.html">next</A> command or the next() function in an atom-style
variable, as discussed below.
</P>
<P>The rules for formatting the file are as follows. Each time a set of
per-atom values is read, a non-blank line is searched for in the file.
A comment character "#" can be used anywhere on a line; text starting
with the comment character is stripped. Blank lines are skipped. The
first "word" of a non-blank line, delimited by white space, is read as
the count N of per-atom lines to immediately follow. N can be be the
total number of atoms in the system, or only a subset. The next N
lines have the following format
</P>
<PRE>ID value
</PRE>
<P>where ID is an atom ID and value is the per-atom numeric value that
will be assigned to that atom. IDs can be listed in any order.
</P>
<P>IMPORTANT NOTE: Every time a set of per-atom lines is read, the value
for all atoms is first set to 0.0. Thus values for atoms whose ID
does not appear in the set, will remain 0.0.
</P>
<HR>
<P>For the <I>equal</I> and <I>atom</I> styles, a single string is specified which
@ -589,18 +622,29 @@ variables. It returns a 1 for atoms that are in both the group and
region, and a 0 for atoms that are not in both.
</P>
<P>The next(x) function takes 1 argument which is a variable ID (not
"v_foo", just "foo"). It must be for a file-style variable. Each
time the next() function is invoked (i.e. each time the equal-style or
atom-style variable is evaluated), the current string value stored by
the file-style variable is converted to a numeric value returned by
the function, and the next value from the file is read and stored.
Note that if the line previously read from the file was not a numeric
string, then it will typically evaluate to 0.0, which is likely not
what you want. Since the file-style variable reads and stores the
first line of the file when it is defined in the input script, this is
the value that will be returned the first time the next() function is
invoked. If next() is invoked more times than there are lines in the
file, the value for the last line is repeatedly returned.
"v_foo", just "foo"). It must be for a file-style or atomfile-style
variable. Each time the next() function is invoked (i.e. each time
the equal-style or atom-style variable is evaluated), the following
steps occur.
</P>
<P>For file-style variables, the current string value stored by the
file-style variable is converted to a numeric value and returned by
the function. And the next string value in the file is read and
stored. Note that if the line previously read from the file was not a
numeric string, then it will typically evaluate to 0.0, which is
likely not what you want.
</P>
<P>For atomfile-style variables, the current per-atom values stored by
the atomfile-style variable are returned by the function. And the
next set of per-atom values in the file is read and stored.
</P>
<P>Since file-style and atomfile-style variables read and store the first
line of the file or first set of per-atoms values when they are
defined in the input script, these are the value(s) that will be
returned the first time the next() function is invoked. If next() is
invoked more times than there are lines or sets of lines in the file,
the variable is deleted, similar to how the <A HREF = "next.html">next</A> command
operates.
</P>
<HR>
@ -698,16 +742,16 @@ in the reference should be replaced by the name of a variable defined
elsewhere in the input script.
</P>
<P>As discussed on this doc page, equal-style variables generate a global
scalar numeric value; atom-style variables generate a per-atom vector
of numeric values; all other variables store a string. The formula
for an equal-style variable can use any style of variable except an
atom-style (unless only a single value from the atom-style variable is
accessed via a subscript). If a string-storing variable is used,
the string is converted to a numeric value. Note that this
will typically produce a 0.0 if the string is not a numeric string,
which is likely not what you want. The formula for an atom-style
variable can use any style of variable, including other atom-style
variables.
scalar numeric value; atom-style and atomfile-style variables generate
a per-atom vector of numeric values; all other variables store a
string. The formula for an equal-style variable can use any style of
variable except an atom-style or atomfile-style (unless only a single
value from the variable is accessed via a subscript). If a
string-storing variable is used, the string is converted to a numeric
value. Note that this will typically produce a 0.0 if the string is
not a numeric string, which is likely not what you want. The formula
for an atom-style variable can use any style of variable, including
other atom-style or atomfile-style variables.
</P>
<P>Examples of different kinds of variable references are as follows.
There is no ambiguity as to what a reference means, since variables

View File

@ -13,7 +13,7 @@ variable command :h3
variable name style args ... :pre
name = name of variable to define :ulb,l
style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {string} or {file} or {equal} or {atom} :l
style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {string} or {file} or {atomfile} or {equal} or {atom} :l
{delete} = no args
{index} args = one or more strings
{loop} args = N
@ -35,6 +35,7 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st
pad = all values will be same length, e.g. 001, 002, ..., 100
{string} arg = one string
{file} arg = filename
{atomfile} arg = filename
{equal} or {atom} args = one formula containing numbers, thermo keywords, math operations, group functions, atom values and vectors, compute/fix/variable references
numbers = 0.0, 100, -5.4, 2.8e-4, etc
constants = PI
@ -100,7 +101,9 @@ a formula which when evaluated produces one numeric value per atom
which can be output to a dump file (see the "dump custom"_dump.html
command) or used as input to an averaging fix (see the "fix
ave/spatial"_fix_ave_spatial.html and "fix ave/atom"_fix_ave_atom.html
commands).
commands). Variables of style {atomfile} can be used similar to
atom-style variables, except they get their per-atom values from a
file rather than from a formula.
In the discussion that follows, the "name" of the variable is the
arbitrary string that is the 1st argument in the variable command.
@ -239,7 +242,7 @@ read again in a loop.
For the {file} style, a filename is provided which contains a list of
strings to assign to the variable, one per line. The strings can be
numeric values if desired; see the discussion of the next() function
numeric values if desired. See the discussion of the next() function
below for equal-style variables, which will convert the string of a
file-style variable into a numeric value in a formula.
@ -257,6 +260,36 @@ character is stripped. Blank lines are skipped. The first "word" of
a non-blank line, delimited by white space, is the "string" assigned
to the variable.
For the {atomfile} style, a filename is provided which contains one or
more sets of values, to assign on a per-atom basis to the variable.
The format of the file is described below.
When an atomfile-style variable is defined, the file is opened and the
first set of per-atom values are read and stored with the variable.
This means the variable can then be evaluated as many times as desired
and will return those values. There are two ways to cause the next
set of per-atom values from the file to be read: use the
"next"_next.html command or the next() function in an atom-style
variable, as discussed below.
The rules for formatting the file are as follows. Each time a set of
per-atom values is read, a non-blank line is searched for in the file.
A comment character "#" can be used anywhere on a line; text starting
with the comment character is stripped. Blank lines are skipped. The
first "word" of a non-blank line, delimited by white space, is read as
the count N of per-atom lines to immediately follow. N can be be the
total number of atoms in the system, or only a subset. The next N
lines have the following format
ID value :pre
where ID is an atom ID and value is the per-atom numeric value that
will be assigned to that atom. IDs can be listed in any order.
IMPORTANT NOTE: Every time a set of per-atom lines is read, the value
for all atoms is first set to 0.0. Thus values for atoms whose ID
does not appear in the set, will remain 0.0.
:line
For the {equal} and {atom} styles, a single string is specified which
@ -589,18 +622,29 @@ variables. It returns a 1 for atoms that are in both the group and
region, and a 0 for atoms that are not in both.
The next(x) function takes 1 argument which is a variable ID (not
"v_foo", just "foo"). It must be for a file-style variable. Each
time the next() function is invoked (i.e. each time the equal-style or
atom-style variable is evaluated), the current string value stored by
the file-style variable is converted to a numeric value returned by
the function, and the next value from the file is read and stored.
Note that if the line previously read from the file was not a numeric
string, then it will typically evaluate to 0.0, which is likely not
what you want. Since the file-style variable reads and stores the
first line of the file when it is defined in the input script, this is
the value that will be returned the first time the next() function is
invoked. If next() is invoked more times than there are lines in the
file, the value for the last line is repeatedly returned.
"v_foo", just "foo"). It must be for a file-style or atomfile-style
variable. Each time the next() function is invoked (i.e. each time
the equal-style or atom-style variable is evaluated), the following
steps occur.
For file-style variables, the current string value stored by the
file-style variable is converted to a numeric value and returned by
the function. And the next string value in the file is read and
stored. Note that if the line previously read from the file was not a
numeric string, then it will typically evaluate to 0.0, which is
likely not what you want.
For atomfile-style variables, the current per-atom values stored by
the atomfile-style variable are returned by the function. And the
next set of per-atom values in the file is read and stored.
Since file-style and atomfile-style variables read and store the first
line of the file or first set of per-atoms values when they are
defined in the input script, these are the value(s) that will be
returned the first time the next() function is invoked. If next() is
invoked more times than there are lines or sets of lines in the file,
the variable is deleted, similar to how the "next"_next.html command
operates.
:line
@ -694,16 +738,16 @@ in the reference should be replaced by the name of a variable defined
elsewhere in the input script.
As discussed on this doc page, equal-style variables generate a global
scalar numeric value; atom-style variables generate a per-atom vector
of numeric values; all other variables store a string. The formula
for an equal-style variable can use any style of variable except an
atom-style (unless only a single value from the atom-style variable is
accessed via a subscript). If a string-storing variable is used,
the string is converted to a numeric value. Note that this
will typically produce a 0.0 if the string is not a numeric string,
which is likely not what you want. The formula for an atom-style
variable can use any style of variable, including other atom-style
variables.
scalar numeric value; atom-style and atomfile-style variables generate
a per-atom vector of numeric values; all other variables store a
string. The formula for an equal-style variable can use any style of
variable except an atom-style or atomfile-style (unless only a single
value from the variable is accessed via a subscript). If a
string-storing variable is used, the string is converted to a numeric
value. Note that this will typically produce a 0.0 if the string is
not a numeric string, which is likely not what you want. The formula
for an atom-style variable can use any style of variable, including
other atom-style or atomfile-style variables.
Examples of different kinds of variable references are as follows.
There is no ambiguity as to what a reference means, since variables