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

This commit is contained in:
sjplimp
2010-01-19 20:04:41 +00:00
parent fae7fd7621
commit 60908cc6c5
8 changed files with 188 additions and 164 deletions

View File

@ -84,25 +84,27 @@ file names or user-chosen ID strings.
</P>
<P>Here is how each line in the input script is parsed by LAMMPS:
</P>
<P>(1) If the line ends with a "&" character (the "and" character which
is shift-7 on most keyboards) with no trailing whitespace (and no
surrounding quotes), the command is assumed to continue on the next
line. The next line is concatenated to the previous line by removing
the "&" character ("and" character) and newline. This allows long
commands to be continued across two or more lines.
<P>(1) If the last printable character on the line is a "&" character
(with no surrounding quotes), the command is assumed to continue on
the next line. The next line is concatenated to the previous line by
removing the "&" character and newline. This allows long commands to
be continued across two or more lines.
</P>
<P>(2) All characters from the first "#" character onward are treated as
comment and discarded.
comment and discarded. See an exception in (6). Note that a
comment after a trailing "&" character will prevent the command from
continuing on the next line. Also note that for multi-line commands a
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. 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 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
scripts.
<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.
</P>
<P>(4) The line is broken into "words" separated by whitespace (tabs,
spaces). Note that words can thus contain letters, digits,
@ -111,11 +113,12 @@ underscores, or punctuation characters.
<P>(5) The first word is the command name. All successive words in the
line are arguments.
</P>
<P>(6) Text with spaces can be enclosed in double quotes so it will be
treated as a single argument. See the <A HREF = "dump_modify.html">dump modify</A>
or <A HREF = "fix_print.html">fix print</A> commands for examples. A '#' or '$'
character that is in text between double quotes will not be treated as
a comment or substituted for as a variable.
<P>(6) If you want text with spaces to be treated as a single argument,
it can be enclosed in double quotes. The quotes are removed when the
single argument is stored in its final form. 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 double quotes will not be treated as
a comment indicator in (2) or substituted for as a variable in (3).
</P>
<HR>

View File

@ -81,25 +81,27 @@ file names or user-chosen ID strings.
Here is how each line in the input script is parsed by LAMMPS:
(1) If the line ends with a "&" character (the "and" character which
is shift-7 on most keyboards) with no trailing whitespace (and no
surrounding quotes), the command is assumed to continue on the next
line. The next line is concatenated to the previous line by removing
the "&" character ("and" character) and newline. This allows long
commands to be continued across two or more lines.
(1) If the last printable character on the line is a "&" character
(with no surrounding quotes), the command is assumed to continue on
the next line. The next line is concatenated to the previous line by
removing the "&" character and newline. This allows long commands to
be continued across two or more lines.
(2) All characters from the first "#" character onward are treated as
comment and discarded.
comment and discarded. See an exception in (6). Note that a
comment after a trailing "&" character will prevent the command from
continuing on the next line. Also note that for multi-line commands a
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. 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 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
scripts.
(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.
(4) The line is broken into "words" separated by whitespace (tabs,
spaces). Note that words can thus contain letters, digits,
@ -108,11 +110,12 @@ underscores, or punctuation characters.
(5) The first word is the command name. All successive words in the
line are arguments.
(6) Text with spaces can be enclosed in double quotes so it will be
treated as a single argument. See the "dump modify"_dump_modify.html
or "fix print"_fix_print.html commands for examples. A '#' or '$'
character that is in text between double quotes will not be treated as
a comment or substituted for as a variable.
(6) If you want text with spaces to be treated as a single argument,
it can be enclosed in double quotes. The quotes are removed when the
single argument is stored in its final form. See the "dump modify
format"_dump_modify.html or "if"_if.html commands for examples. A "#"
or "$" character that is between double quotes will not be treated as
a comment indicator in (2) or substituted for as a variable in (3).
:line

View File

@ -13,15 +13,15 @@
</H3>
<P><B>Syntax:</B>
</P>
<PRE>if value1 operator value2 then command1 else command2
<PRE>if value1 operator value2 then T1 T2 ... else E1 E2 ...
</PRE>
<UL><LI>value1 = 1st value
<LI>operator = "<" or "<=" or ">" or ">=" or "==" or "!="
<LI>value2 = 2nd value
<LI>then = required word
<LI>command1 = command to execute if condition is met
<LI>else = optional word
<LI>command2 = command to execute if condition is not met (optional argument)
<LI>T1,T2,...,TN = one or more commands to execute if condition is met
<LI>else = optional argument
<LI>E1,E2,...,EN = one or more commands to execute if condition is not met (optional arguments)
</UL>
<P><B>Examples:</B>
</P>
@ -32,31 +32,46 @@ if ${eng} > ${eng_previous} then "jump file1" else "jump file2"
</PRE>
<P><B>Description:</B>
</P>
<P>This command provides an in-then-else test capability within an input
<P>This command provides an in-then-else capability within an input
script. Two values are numerically compared to each other and the
result is TRUE or FALSE. Note that as in the examples above, either
of the values can be variables, as defined by the
<A HREF = "variable.html">variable</A> command, so that when they are evaluated when
substituted for in the if command, a user-defined computation will be
performed which can depend on the current state of the simulation.
of the two values can be variables, as defined by the
<A HREF = "variable.html">variable</A> command, so that when the if command is
executed, the variable(s) will be evaluated, which could calculate a
user-defined formula that reflects the current state of the
simulation.
</P>
<P>If the result of the if test is TRUE, then command1 is executed. This
can be any valid LAMMPS input script command. If the command is more
than 1 word, it should be enclosed in double quotes, so that it will
<P>If the result of the if test is TRUE, then one or more commands (T1,
T2, ..., TN) are executed. If the result of the if test is FALSE and
no optional "else" argument is included, then the if command does
nothing. If the result of the if test is FALSE and the optional
"else" argument is included, then one or more commands (E1,
E2, ..., En) are executed.
</P>
<P>Each then or else command (T1,E1,etc) can be any valid LAMMPS input
script command. Each command should be enclosed in quotes, so it will
be treated as a single argument, as in the examples above.
</P>
<P>The if command can contain an optional "else" clause. If it does and
the result of the if test is FALSE, then command2 is executed.
<P>Note that by using the line continuation character "&", the if command
can be spread across many lines, though it is still a single
command:
</P>
<PRE>if $a < $b then &
"print Minimum value = $a"
"run 1000" &
else &
"print Minimum value = $b" &
"minimize 0.001 0.001 1000 10000"
</PRE>
<P>Note that if any executed comand is a bogus LAMMPS command, such as
"exit" in the first example above, then executing the command will
cause LAMMPS to halt.
</P>
<P>Note that by jumping to a label in the same input script, the if
command can be used to break out of a loop. See the <A HREF = "variable.html">variable
delete</A> for info on how to delete the associated loop
variable, so that it can be re-used later in the input script.
</P>
<P>Note that if either command1 or command2 is a bogus LAMMPS command,
such as "exit" in the first example, then executing the command will
cause LAMMPS to halt.
</P>
<P>Here is an example of a double loop which uses the if and
<A HREF = "jump.html">jump</A> commands to break out of the inner loop when a
condition is met, then continues iterating thru the outer loop.
@ -80,7 +95,7 @@ jump in.script loopa
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "variable.html">variable</A>
<P><A HREF = "variable.html">variable</A>, <A HREF = "print.html">print</A>
</P>
<P><B>Default:</B> none
</P>

View File

@ -10,15 +10,15 @@ if command :h3
[Syntax:]
if value1 operator value2 then command1 else command2 :pre
if value1 operator value2 then T1 T2 ... else E1 E2 ... :pre
value1 = 1st value
operator = "<" or "<=" or ">" or ">=" or "==" or "!="
value2 = 2nd value
then = required word
command1 = command to execute if condition is met
else = optional word
command2 = command to execute if condition is not met (optional argument) :ul
T1,T2,...,TN = one or more commands to execute if condition is met
else = optional argument
E1,E2,...,EN = one or more commands to execute if condition is not met (optional arguments) :ul
[Examples:]
@ -29,31 +29,46 @@ if $\{eng\} > $\{eng_previous\} then "jump file1" else "jump file2" :pre
[Description:]
This command provides an in-then-else test capability within an input
This command provides an in-then-else capability within an input
script. Two values are numerically compared to each other and the
result is TRUE or FALSE. Note that as in the examples above, either
of the values can be variables, as defined by the
"variable"_variable.html command, so that when they are evaluated when
substituted for in the if command, a user-defined computation will be
performed which can depend on the current state of the simulation.
of the two values can be variables, as defined by the
"variable"_variable.html command, so that when the if command is
executed, the variable(s) will be evaluated, which could calculate a
user-defined formula that reflects the current state of the
simulation.
If the result of the if test is TRUE, then command1 is executed. This
can be any valid LAMMPS input script command. If the command is more
than 1 word, it should be enclosed in double quotes, so that it will
If the result of the if test is TRUE, then one or more commands (T1,
T2, ..., TN) are executed. If the result of the if test is FALSE and
no optional "else" argument is included, then the if command does
nothing. If the result of the if test is FALSE and the optional
"else" argument is included, then one or more commands (E1,
E2, ..., En) are executed.
Each then or else command (T1,E1,etc) can be any valid LAMMPS input
script command. Each command should be enclosed in quotes, so it will
be treated as a single argument, as in the examples above.
The if command can contain an optional "else" clause. If it does and
the result of the if test is FALSE, then command2 is executed.
Note that by using the line continuation character "&", the if command
can be spread across many lines, though it is still a single
command:
if $a < $b then &
"print Minimum value = $a"
"run 1000" &
else &
"print Minimum value = $b" &
"minimize 0.001 0.001 1000 10000" :pre
Note that if any executed comand is a bogus LAMMPS command, such as
"exit" in the first example above, then executing the command will
cause LAMMPS to halt.
Note that by jumping to a label in the same input script, the if
command can be used to break out of a loop. See the "variable
delete"_variable.html for info on how to delete the associated loop
variable, so that it can be re-used later in the input script.
Note that if either command1 or command2 is a bogus LAMMPS command,
such as "exit" in the first example, then executing the command will
cause LAMMPS to halt.
Here is an example of a double loop which uses the if and
"jump"_jump.html commands to break out of the inner loop when a
condition is met, then continues iterating thru the outer loop.
@ -76,6 +91,6 @@ jump in.script loopa :pre
[Related commands:]
"variable"_variable.html
"variable"_variable.html, "print"_print.html
[Default:] none

View File

@ -13,21 +13,23 @@
</H3>
<P><B>Syntax:</B>
</P>
<PRE>print string
<PRE>print str1 str2 ...
</PRE>
<UL><LI>string = text string to print, which may contain variables
<UL><LI>str1,str2,...,strN = one or more text strings to print, which may contain variables
</UL>
<P><B>Examples:</B>
</P>
<PRE>print "Done with equilibration"
<PRE>print Done with equilibration
print The system volume is now $v
print "The system volume is now $v"
</PRE>
<P><B>Description:</B>
</P>
<P>Print a text string to the screen and logfile. The text string must
be a single argument, so it should be enclosed in double quotes if it
is more than one word. If variables are included in the string, they
will be evaluated and their current values printed.
<P>Print one or more text strings to the screen and logfile. The
individual text strings are effectively concatenated into a single
string, and one line of output is generated. Thus the 2nd and 3rd
examples above are equivalent. If variables are included in any of
the strings, they will be evaluated and their current values printed.
</P>
<P>If you want the print command to be executed multiple times (with
changing variable values), there are 3 options. First, consider using

View File

@ -10,21 +10,23 @@ print command :h3
[Syntax:]
print string :pre
print str1 str2 ... :pre
string = text string to print, which may contain variables :ul
str1,str2,...,strN = one or more text strings to print, which may contain variables :ul
[Examples:]
print "Done with equilibration"
print Done with equilibration
print The system volume is now $v
print "The system volume is now $v" :pre
[Description:]
Print a text string to the screen and logfile. The text string must
be a single argument, so it should be enclosed in double quotes if it
is more than one word. If variables are included in the string, they
will be evaluated and their current values printed.
Print one or more text strings to the screen and logfile. The
individual text strings are effectively concatenated into a single
string, and one line of output is generated. Thus the 2nd and 3rd
examples above are equivalent. If variables are included in any of
the strings, they will be evaluated and their current values printed.
If you want the print command to be executed multiple times (with
changing variable values), there are 3 options. First, consider using

View File

@ -28,10 +28,10 @@
N2 = timestep at which last run will end
<I>pre</I> value = <I>no</I> or <I>yes</I>
<I>post</I> value = <I>no</I> or <I>yes</I>
<I>every</I> values = M command
M = break the run into M-timestep segments and invoke a command between them
command = a single LAMMPS command listed the same as if on a line by itself
NULL means no command will be invoked
<I>every</I> values = M command1 command2 ...
M = break the run into M-timestep segments and invoke one or more commands between each segment
command1,command2,... = a single LAMMPS command, enclosed in quotes
command1 = NULL means no command will be invoked
</PRE>
</UL>
@ -41,7 +41,7 @@
run 1000000 upto
run 100 start 0 stop 1000
run 1000 pre no post yes
run 100000 start 0 stop 1000000 every 1000 print "Protein Rg = $r"
run 100000 start 0 stop 1000000 every 1000 "print Protein Rg = $r"
run 100000 every 1000 NULL
</PRE>
<P><B>Description:</B>
@ -113,14 +113,22 @@ this case.
<P>If <I>post</I> is specified as "no", the full timing summary is skipped;
only a one-line summary timing is printed.
</P>
<P>The <I>every</I> option provides a means of breaking a LAMMPS run into a
series of shorter runs. Optionally a single LAMMPS command can be
executed in between the short runs. This is a means to avoid listing
a long series of runs and commands in your input script. For example,
a <A HREF = "print.html">print</A> command could be invoked or a <A HREF = "fix.html">fix</A>
could be redefined, e.g. to reset a thermostat temperature. Or it
could be useful for invoking a command you have added to LAMMPS that
wraps some other code (e.g. as a library) to perform a computation
<P>The <I>every</I> keyword provides a means of breaking a LAMMPS run into a
series of shorter runs. Optionally, one or more LAMMPS commands will
be executed in between the short runs. If used, the <I>every</I> keyword
must be the last keyword, since it has a variable number of arguments.
Each of the trailing arguments is a single LAMMPS command, and each
command should be enclosed in quotes, so that the entire command will
be treated as a single argument. This will also prevent any variables
in the command from being evaluated until it is executed during the
run.
</P>
<P>The <I>every</I> keyword is a means to avoid listing a long series of runs
and interleaving commands in your input script. For example, a
<A HREF = "print.html">print</A> command could be invoked or a <A HREF = "fix.html">fix</A> could
be redefined, e.g. to reset a thermostat temperature. Or this could
be useful for invoking a command you have added to LAMMPS that wraps
some other code (e.g. as a library) to perform a computation
periodically during a long LAMMPS run. See <A HREF = "Section_modify.html">this
section</A> of the documentation for info about how
to add new commands to LAMMPS. See <A HREF = "Section_howto.html#4_10">this
@ -128,12 +136,12 @@ section</A> of the documentation for ideas about
how to couple LAMMPS to other codes.
</P>
<P>With the <I>every</I> option, N total steps are simulated, in shorter runs
of M steps each. After each M-length run, the command is invoked. If
the command is specified as NULL, no command is invoked. Thus these
lines:
of M steps each. After each M-length run, the specified commands are
invoked. If only a single command is specified as NULL, then no
command is invoked. Thus these lines:
</P>
<PRE>variable q equal x[100]
run 6000 every 2000 print "Coord = $q"
run 6000 every 2000 "print Coord = $q"
</PRE>
<P>are the equivalent of:
</P>
@ -146,24 +154,8 @@ run 2000
print Coord = $q
</PRE>
<P>which does 3 runs of 2000 steps and prints the x-coordinate of a
particular atom between runs. Note that, as in this example, the
command can contain <A HREF = "variable.html">variables</A> which will be evaluated
each time the command is invoked.
</P>
<P>IMPORTANT NOTE: For the <I>every</I> option, the command should be listed
exactly as it would be if it appeared on a line by itself. Thus all
remaining arguments after the M value are considered part of the LAMMPS
command (e.g. print "Protein Rg = $r" as in the example above). This
means that, if specified, the <I>every</I> option must be the last keyword
used.
</P>
<P>IMPORTANT NOTE: For the <I>every</I> option, if the command includes a
variable (e.g. $x or ${abc}), and you want the variable to be
evaluated afresh each time the command is invoked, then you should
enclose that command argument in double quotes, as in the "Protein Rg
= $r" example above. If you don't do this, then the variable will be
substituted for only once initially when the run command is parsed,
just as occurs for any other command containing a variable.
particular atom between runs. Note that the variable "$q" will
be evaluated afresh each time the print command is executed.
</P>
<P>If the <I>pre</I> and <I>post</I> options are set to "no" when used with the
<I>every</I> keyword, then the 1st run will do the full setup and the last

View File

@ -22,10 +22,10 @@ keyword = {upto} or {start} or {stop} or {pre} or {post} or {every} :l
N2 = timestep at which last run will end
{pre} value = {no} or {yes}
{post} value = {no} or {yes}
{every} values = M command
M = break the run into M-timestep segments and invoke a command between them
command = a single LAMMPS command listed the same as if on a line by itself
NULL means no command will be invoked :pre
{every} values = M command1 command2 ...
M = break the run into M-timestep segments and invoke one or more commands between each segment
command1,command2,... = a single LAMMPS command, enclosed in quotes
command1 = NULL means no command will be invoked :pre
:ule
[Examples:]
@ -34,7 +34,7 @@ run 10000
run 1000000 upto
run 100 start 0 stop 1000
run 1000 pre no post yes
run 100000 start 0 stop 1000000 every 1000 print "Protein Rg = $r"
run 100000 start 0 stop 1000000 every 1000 "print Protein Rg = $r"
run 100000 every 1000 NULL :pre
[Description:]
@ -106,14 +106,22 @@ this case.
If {post} is specified as "no", the full timing summary is skipped;
only a one-line summary timing is printed.
The {every} option provides a means of breaking a LAMMPS run into a
series of shorter runs. Optionally a single LAMMPS command can be
executed in between the short runs. This is a means to avoid listing
a long series of runs and commands in your input script. For example,
a "print"_print.html command could be invoked or a "fix"_fix.html
could be redefined, e.g. to reset a thermostat temperature. Or it
could be useful for invoking a command you have added to LAMMPS that
wraps some other code (e.g. as a library) to perform a computation
The {every} keyword provides a means of breaking a LAMMPS run into a
series of shorter runs. Optionally, one or more LAMMPS commands will
be executed in between the short runs. If used, the {every} keyword
must be the last keyword, since it has a variable number of arguments.
Each of the trailing arguments is a single LAMMPS command, and each
command should be enclosed in quotes, so that the entire command will
be treated as a single argument. This will also prevent any variables
in the command from being evaluated until it is executed during the
run.
The {every} keyword is a means to avoid listing a long series of runs
and interleaving commands in your input script. For example, a
"print"_print.html command could be invoked or a "fix"_fix.html could
be redefined, e.g. to reset a thermostat temperature. Or this could
be useful for invoking a command you have added to LAMMPS that wraps
some other code (e.g. as a library) to perform a computation
periodically during a long LAMMPS run. See "this
section"_Section_modify.html of the documentation for info about how
to add new commands to LAMMPS. See "this
@ -121,12 +129,12 @@ section"_Section_howto.html#4_10 of the documentation for ideas about
how to couple LAMMPS to other codes.
With the {every} option, N total steps are simulated, in shorter runs
of M steps each. After each M-length run, the command is invoked. If
the command is specified as NULL, no command is invoked. Thus these
lines:
of M steps each. After each M-length run, the specified commands are
invoked. If only a single command is specified as NULL, then no
command is invoked. Thus these lines:
variable q equal x\[100\]
run 6000 every 2000 print "Coord = $q" :pre
run 6000 every 2000 "print Coord = $q" :pre
are the equivalent of:
@ -139,24 +147,8 @@ run 2000
print Coord = $q :pre
which does 3 runs of 2000 steps and prints the x-coordinate of a
particular atom between runs. Note that, as in this example, the
command can contain "variables"_variable.html which will be evaluated
each time the command is invoked.
IMPORTANT NOTE: For the {every} option, the command should be listed
exactly as it would be if it appeared on a line by itself. Thus all
remaining arguments after the M value are considered part of the LAMMPS
command (e.g. print "Protein Rg = $r" as in the example above). This
means that, if specified, the {every} option must be the last keyword
used.
IMPORTANT NOTE: For the {every} option, if the command includes a
variable (e.g. $x or $\{abc\}), and you want the variable to be
evaluated afresh each time the command is invoked, then you should
enclose that command argument in double quotes, as in the "Protein Rg
= $r" example above. If you don't do this, then the variable will be
substituted for only once initially when the run command is parsed,
just as occurs for any other command containing a variable.
particular atom between runs. Note that the variable "$q" will
be evaluated afresh each time the print command is executed.
If the {pre} and {post} options are set to "no" when used with the
{every} keyword, then the 1st run will do the full setup and the last