git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5257 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -114,11 +114,23 @@ underscores, or punctuation characters.
|
|||||||
line are arguments.
|
line are arguments.
|
||||||
</P>
|
</P>
|
||||||
<P>(6) If you want text with spaces to be treated as a single argument,
|
<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
|
it can be enclosed in either double or single quotes. E.g.
|
||||||
single argument is stored in its final form. See the <A HREF = "dump_modify.html">dump modify
|
</P>
|
||||||
format</A> or <A HREF = "if.html">if</A> commands for examples. A "#"
|
<PRE>print "Volume = $v"
|
||||||
or "$" character that is between double quotes will not be treated as
|
print 'Volume = $v'
|
||||||
a comment indicator in (2) or substituted for as a variable in (3).
|
</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).
|
||||||
|
</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
|
||||||
|
<A HREF = "if.html">if</A> or <A HREF = "run.html">run every</A> command), then the double and
|
||||||
|
single quotes can be nested in the usual manner. See the doc pages
|
||||||
|
for those commands for examples. Only one of level of nesting is
|
||||||
|
allowed, but that should be sufficient for most use cases.
|
||||||
</P>
|
</P>
|
||||||
<HR>
|
<HR>
|
||||||
|
|
||||||
|
|||||||
@ -111,11 +111,23 @@ underscores, or punctuation characters.
|
|||||||
line are arguments.
|
line are arguments.
|
||||||
|
|
||||||
(6) If you want text with spaces to be treated as a single argument,
|
(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
|
it can be enclosed in either double or single quotes. E.g.
|
||||||
single argument is stored in its final form. See the "dump modify
|
|
||||||
format"_dump_modify.html or "if"_if.html commands for examples. A "#"
|
print "Volume = $v"
|
||||||
or "$" character that is between double quotes will not be treated as
|
print 'Volume = $v' :pre
|
||||||
a comment indicator in (2) or substituted for as a variable in (3).
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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
|
||||||
|
"if"_if.html or "run every"_run.html command), then the double and
|
||||||
|
single quotes can be nested in the usual manner. See the doc pages
|
||||||
|
for those commands for examples. Only one of level of nesting is
|
||||||
|
allowed, but that should be sufficient for most use cases.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
<PRE>angle_style class2
|
<PRE>angle_style class2
|
||||||
angle_coeff * 75.0
|
angle_coeff * 75.0
|
||||||
angle_coeff 1 bb 10.5872 1.0119 1.5228
|
angle_coeff 1 bb 10.5872 1.0119 1.5228
|
||||||
|
angle_coeff * ba 3.6551 24.895 1.0119 1.5228
|
||||||
</PRE>
|
</PRE>
|
||||||
<P><B>Description:</B>
|
<P><B>Description:</B>
|
||||||
</P>
|
</P>
|
||||||
|
|||||||
@ -16,7 +16,8 @@ angle_style class2 :pre
|
|||||||
|
|
||||||
angle_style class2
|
angle_style class2
|
||||||
angle_coeff * 75.0
|
angle_coeff * 75.0
|
||||||
angle_coeff 1 bb 10.5872 1.0119 1.5228 :pre
|
angle_coeff 1 bb 10.5872 1.0119 1.5228
|
||||||
|
angle_coeff * ba 3.6551 24.895 1.0119 1.5228 :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,11 @@
|
|||||||
</P>
|
</P>
|
||||||
<PRE>dihedral_style class2
|
<PRE>dihedral_style class2
|
||||||
dihedral_coeff 1 100 75 100 70 80 60
|
dihedral_coeff 1 100 75 100 70 80 60
|
||||||
|
dihedral_coeff * mbt 3.5945 0.1704 -0.5490 1.5228
|
||||||
|
dihedral_coeff * ebt 0.3417 0.3264 -0.9036 0.1368 0.0 -0.8080 1.0119 1.1010
|
||||||
|
dihedral_coeff 2 at 0.0 -0.1850 -0.7963 -2.0220 0.0 -0.3991 110.2453 105.1270
|
||||||
|
dihedral_coeff * aat -13.5271 110.2453 105.1270
|
||||||
|
dihedral_coeff * bb13 0.0 1.0119 1.1010
|
||||||
</PRE>
|
</PRE>
|
||||||
<P><B>Description:</B>
|
<P><B>Description:</B>
|
||||||
</P>
|
</P>
|
||||||
|
|||||||
@ -15,7 +15,12 @@ dihedral_style class2 :pre
|
|||||||
[Examples:]
|
[Examples:]
|
||||||
|
|
||||||
dihedral_style class2
|
dihedral_style class2
|
||||||
dihedral_coeff 1 100 75 100 70 80 60 :pre
|
dihedral_coeff 1 100 75 100 70 80 60
|
||||||
|
dihedral_coeff * mbt 3.5945 0.1704 -0.5490 1.5228
|
||||||
|
dihedral_coeff * ebt 0.3417 0.3264 -0.9036 0.1368 0.0 -0.8080 1.0119 1.1010
|
||||||
|
dihedral_coeff 2 at 0.0 -0.1850 -0.7963 -2.0220 0.0 -0.3991 110.2453 105.1270
|
||||||
|
dihedral_coeff * aat -13.5271 110.2453 105.1270
|
||||||
|
dihedral_coeff * bb13 0.0 1.0119 1.1010 :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
|
|||||||
135
doc/if.html
135
doc/if.html
@ -13,64 +13,81 @@
|
|||||||
</H3>
|
</H3>
|
||||||
<P><B>Syntax:</B>
|
<P><B>Syntax:</B>
|
||||||
</P>
|
</P>
|
||||||
<PRE>if value1 operator value2 then t1 t2 ... else e1 e2 ...
|
<PRE>if boolean then t1 t2 ... elif boolean f1 f2 ... elif boolean f1 f2 ... else e1 e2 ...
|
||||||
</PRE>
|
</PRE>
|
||||||
<UL><LI>value1 = 1st value
|
<UL><LI>boolean = a Boolean expression evaluated as TRUE or FALSE (see below)
|
||||||
<LI>operator = "<" or "<=" or ">" or ">=" or "==" or "!="
|
|
||||||
<LI>value2 = 2nd value
|
|
||||||
<LI>then = required word
|
<LI>then = required word
|
||||||
<LI>t1,t2,...,tN = one or more LAMMPS commands to execute if condition is met, each enclosed in quotes
|
<LI>t1,t2,...,tN = one or more LAMMPS commands to execute if condition is met, each enclosed in quotes
|
||||||
|
<LI>elif = optional word, can appear multiple times
|
||||||
|
<LI>f1,f2,...,fN = one or more LAMMPS commands to execute if elif condition is met, each enclosed in quotes (optional arguments)
|
||||||
<LI>else = optional argument
|
<LI>else = optional argument
|
||||||
<LI>e1,e2,...,eN = one or more LAMMPS commands to execute if condition is not met, each enclosed in quotes (optional arguments)
|
<LI>e1,e2,...,eN = one or more LAMMPS commands to execute if no condition is met, each enclosed in quotes (optional arguments)
|
||||||
</UL>
|
</UL>
|
||||||
<P><B>Examples:</B>
|
<P><B>Examples:</B>
|
||||||
</P>
|
</P>
|
||||||
<PRE>if ${steps} > 1000 then exit
|
<PRE>if "${steps} > 1000" then exit
|
||||||
if $x <= $y then "print X is smaller = $x" else "print Y is smaller = $y"
|
if "$x <= $y" then "print X is smaller = $x" else "print Y is smaller = $y"
|
||||||
if ${eng} > 0.0 then "timestep 0.005"
|
if "(${eng} > 0.0) || ($n < 1000)" then &
|
||||||
if ${eng} > ${eng_previous} then "jump file1" else "jump file2"
|
"timestep 0.005" &
|
||||||
|
elif $n<10000 &
|
||||||
|
"timestep 0.01" &
|
||||||
|
else &
|
||||||
|
"timestep 0.02" &
|
||||||
|
"print 'Max step reached'"
|
||||||
|
if "${eng} > ${eng_previous}" then "jump file1" else "jump file2"
|
||||||
</PRE>
|
</PRE>
|
||||||
<P><B>Description:</B>
|
<P><B>Description:</B>
|
||||||
</P>
|
</P>
|
||||||
<P>This command provides an in-then-else 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
|
script. A Boolean expression is evaluted and the result is TRUE or
|
||||||
result is TRUE or FALSE. Note that as in the examples above, either
|
FALSE. Note that as in the examples above, the expression can contain
|
||||||
of the two values can be variables, as defined by the
|
variables, as defined by the <A HREF = "variable.html">variable</A> command, which
|
||||||
<A HREF = "variable.html">variable</A> command, so that when the if command is
|
will be evaluated as part of the expression. Thus a user-defined
|
||||||
executed, the variable(s) will be evaluated, which could calculate a
|
formula that reflects the current state of the simulation can be used
|
||||||
user-defined formula that reflects the current state of the
|
to issue one or more new commands.
|
||||||
simulation.
|
|
||||||
</P>
|
</P>
|
||||||
<P>If the result of the if test is TRUE, then one or more commands (t1,
|
<P>If the result of the Boolean expression is TRUE, then one or more
|
||||||
t2, ..., tN) are executed. If the result of the if test is FALSE and
|
commands (t1, t2, ..., tN) are executed. If it is FALSE, then Boolean
|
||||||
no optional "else" argument is included, then the if command does
|
expressions associated with successive elif keywords are evaluated
|
||||||
nothing. If the result of the if test is FALSE and the optional
|
until one is found to be true, in which case its commands (f1, f2,
|
||||||
"else" argument is included, then one or more commands (e1,
|
..., fN) are executed. If no Boolean expression is TRUE, then the
|
||||||
e2, ..., eN) are executed.
|
commands associated witht the else keyword, namely (e1, e2, ..., eN),
|
||||||
|
are executed. The elif and else keywords and their associated
|
||||||
|
commands are optional. If they aren't specified and the initial
|
||||||
|
Boolean expression is FALSE, then no commands are executed.
|
||||||
</P>
|
</P>
|
||||||
<P>Each then or else command (t1, e1, etc) can be any valid LAMMPS input
|
<P>The allowed syntax for each Boolean expression is described below.
|
||||||
script command. Each command should be enclosed in quotes, so it will
|
</P>
|
||||||
be treated as a single argument, as in the examples above.
|
<P>Each command (t1, f1, e1, etc) can be any valid LAMMPS input script
|
||||||
|
command. If the command is more than one word, it must enclosed in
|
||||||
|
quotes, so it will be treated as a single argument, as in the examples
|
||||||
|
above.
|
||||||
|
</P>
|
||||||
|
<P>IMPORTANT NOTE: If a command itself requires a quoted argument (e.g. a
|
||||||
|
<A HREF = "print.html">print</A> command), then double and single quotes can be used
|
||||||
|
and nested in the usual manner, as in the examples above and below.
|
||||||
|
See <A HREF = "Section_commands.html#3_2">this section</A> of the manual for more
|
||||||
|
details on using quotes in arguments. Only one of level of nesting is
|
||||||
|
allowed, but that should be sufficient for most use cases.
|
||||||
</P>
|
</P>
|
||||||
<P>Note that by using the line continuation character "&", the if command
|
<P>Note that by using the line continuation character "&", the if command
|
||||||
can be spread across many lines, though it is still a single
|
can be spread across many lines, though it is still a single command:
|
||||||
command:
|
|
||||||
</P>
|
</P>
|
||||||
<PRE>if $a < $b then &
|
<PRE>if "$a < $b" then &
|
||||||
"print Minimum value = $a" &
|
"print 'Minimum value = $a'" &
|
||||||
"run 1000" &
|
"run 1000" &
|
||||||
else &
|
else &
|
||||||
"print Minimum value = $b" &
|
'print "Minimum value = $b"' &
|
||||||
"minimize 0.001 0.001 1000 10000"
|
"minimize 0.001 0.001 1000 10000"
|
||||||
</PRE>
|
</PRE>
|
||||||
<P>Note that if any executed comand is a bogus LAMMPS command, such as
|
<P>Note that if one of the commands to execute is an invalid LAMMPS
|
||||||
"exit" in the first example above, then executing the command will
|
command, such as "exit" in the first example above, then executing the
|
||||||
cause LAMMPS to halt.
|
command will cause LAMMPS to halt.
|
||||||
</P>
|
</P>
|
||||||
<P>Note that by jumping to a label in the same input script, the if
|
<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
|
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
|
delete</A> command for info on how to delete the associated
|
||||||
variable, so that it can be re-used later in the input script.
|
loop variable, so that it can be re-used later in the input script.
|
||||||
</P>
|
</P>
|
||||||
<P>Here is an example of a double loop which uses the if and
|
<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
|
<A HREF = "jump.html">jump</A> commands to break out of the inner loop when a
|
||||||
@ -82,7 +99,7 @@ variable a loop 5
|
|||||||
variable b loop 5
|
variable b loop 5
|
||||||
print "A,B = $a,$b"
|
print "A,B = $a,$b"
|
||||||
run 10000
|
run 10000
|
||||||
if $b > 2 then "jump in.script break"
|
if '$b > 2' then "print 'Jumping to another script'" "jump in.script break"
|
||||||
next b
|
next b
|
||||||
jump in.script loopb
|
jump in.script loopb
|
||||||
label break
|
label break
|
||||||
@ -91,6 +108,52 @@ variable b delete
|
|||||||
<PRE>next a
|
<PRE>next a
|
||||||
jump in.script loopa
|
jump in.script loopa
|
||||||
</PRE>
|
</PRE>
|
||||||
|
<HR>
|
||||||
|
|
||||||
|
<P>The Boolean expressions for the if and elif keywords have a C-like
|
||||||
|
syntax. Note that each expression is a single argument within the if
|
||||||
|
command. Thus if you want to include spaces in the expression for
|
||||||
|
clarity, you must enclose the entire expression in quotes.
|
||||||
|
</P>
|
||||||
|
<P>An expression is built out of numbers
|
||||||
|
</P>
|
||||||
|
<PRE>0.2, 100, 1.0e20, -15.4, etc
|
||||||
|
</PRE>
|
||||||
|
<P>and Boolean operators:
|
||||||
|
</P>
|
||||||
|
<PRE>A == B
|
||||||
|
A != B
|
||||||
|
A < B
|
||||||
|
A <= B
|
||||||
|
A > B
|
||||||
|
A >= B
|
||||||
|
A && B
|
||||||
|
A || B
|
||||||
|
</PRE>
|
||||||
|
<P>Each A and B is a number or a variable reference like $a or ${abc},
|
||||||
|
or another Boolean expression.
|
||||||
|
</P>
|
||||||
|
<P>If a variable is used it must produce a number when evaluated and
|
||||||
|
substituted for in the expression.
|
||||||
|
</P>
|
||||||
|
<P>Expressions are evaluated left to right and have the usual C-style
|
||||||
|
precedence: the 4 relational operators "<", "<=", ">", and ">=" have
|
||||||
|
the highest precedence; those 4 relational operators before the
|
||||||
|
remaining two relational operators "==" and "!="; those two relational
|
||||||
|
operators before the logical AND operator "&&"; and the AND operator
|
||||||
|
"&&" before the logical OR operator "||". Parenthesis can be used to
|
||||||
|
group one or more portions of an expression and/or enforce a different
|
||||||
|
order of evaluation than what would occur with the default precedence.
|
||||||
|
</P>
|
||||||
|
<P>The 6 relational operators return either a 1.0 or 0.0 depending on
|
||||||
|
whether the relationship between x and y is true or false. The
|
||||||
|
logical AND operator will return 1.0 of both its arguments are
|
||||||
|
non-zero, else return a 0.0. The logical OR operator will return 1.0
|
||||||
|
of either of its arguments is non-zero, else return a 0.0.
|
||||||
|
</P>
|
||||||
|
<P>The overall Boolean expression produces a TRUE result if the result is
|
||||||
|
non-zero. If the result is zero, the expression result is FALSE.
|
||||||
|
</P>
|
||||||
<P><B>Restrictions:</B> none
|
<P><B>Restrictions:</B> none
|
||||||
</P>
|
</P>
|
||||||
<P><B>Related commands:</B>
|
<P><B>Related commands:</B>
|
||||||
|
|||||||
135
doc/if.txt
135
doc/if.txt
@ -10,64 +10,81 @@ if command :h3
|
|||||||
|
|
||||||
[Syntax:]
|
[Syntax:]
|
||||||
|
|
||||||
if value1 operator value2 then t1 t2 ... else e1 e2 ... :pre
|
if boolean then t1 t2 ... elif boolean f1 f2 ... elif boolean f1 f2 ... else e1 e2 ... :pre
|
||||||
|
|
||||||
value1 = 1st value
|
boolean = a Boolean expression evaluated as TRUE or FALSE (see below)
|
||||||
operator = "<" or "<=" or ">" or ">=" or "==" or "!="
|
|
||||||
value2 = 2nd value
|
|
||||||
then = required word
|
then = required word
|
||||||
t1,t2,...,tN = one or more LAMMPS commands to execute if condition is met, each enclosed in quotes
|
t1,t2,...,tN = one or more LAMMPS commands to execute if condition is met, each enclosed in quotes
|
||||||
|
elif = optional word, can appear multiple times
|
||||||
|
f1,f2,...,fN = one or more LAMMPS commands to execute if elif condition is met, each enclosed in quotes (optional arguments)
|
||||||
else = optional argument
|
else = optional argument
|
||||||
e1,e2,...,eN = one or more LAMMPS commands to execute if condition is not met, each enclosed in quotes (optional arguments) :ul
|
e1,e2,...,eN = one or more LAMMPS commands to execute if no condition is met, each enclosed in quotes (optional arguments) :ul
|
||||||
|
|
||||||
[Examples:]
|
[Examples:]
|
||||||
|
|
||||||
if $\{steps\} > 1000 then exit
|
if "$\{steps\} > 1000" then exit
|
||||||
if $x <= $y then "print X is smaller = $x" else "print Y is smaller = $y"
|
if "$x <= $y" then "print X is smaller = $x" else "print Y is smaller = $y"
|
||||||
if $\{eng\} > 0.0 then "timestep 0.005"
|
if "($\{eng\} > 0.0) || ($n < 1000)" then &
|
||||||
if $\{eng\} > $\{eng_previous\} then "jump file1" else "jump file2" :pre
|
"timestep 0.005" &
|
||||||
|
elif $n<10000 &
|
||||||
|
"timestep 0.01" &
|
||||||
|
else &
|
||||||
|
"timestep 0.02" &
|
||||||
|
"print 'Max step reached'"
|
||||||
|
if "$\{eng\} > $\{eng_previous\}" then "jump file1" else "jump file2" :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
This command provides an in-then-else 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
|
script. A Boolean expression is evaluted and the result is TRUE or
|
||||||
result is TRUE or FALSE. Note that as in the examples above, either
|
FALSE. Note that as in the examples above, the expression can contain
|
||||||
of the two values can be variables, as defined by the
|
variables, as defined by the "variable"_variable.html command, which
|
||||||
"variable"_variable.html command, so that when the if command is
|
will be evaluated as part of the expression. Thus a user-defined
|
||||||
executed, the variable(s) will be evaluated, which could calculate a
|
formula that reflects the current state of the simulation can be used
|
||||||
user-defined formula that reflects the current state of the
|
to issue one or more new commands.
|
||||||
simulation.
|
|
||||||
|
|
||||||
If the result of the if test is TRUE, then one or more commands (t1,
|
If the result of the Boolean expression is TRUE, then one or more
|
||||||
t2, ..., tN) are executed. If the result of the if test is FALSE and
|
commands (t1, t2, ..., tN) are executed. If it is FALSE, then Boolean
|
||||||
no optional "else" argument is included, then the if command does
|
expressions associated with successive elif keywords are evaluated
|
||||||
nothing. If the result of the if test is FALSE and the optional
|
until one is found to be true, in which case its commands (f1, f2,
|
||||||
"else" argument is included, then one or more commands (e1,
|
..., fN) are executed. If no Boolean expression is TRUE, then the
|
||||||
e2, ..., eN) are executed.
|
commands associated witht the else keyword, namely (e1, e2, ..., eN),
|
||||||
|
are executed. The elif and else keywords and their associated
|
||||||
|
commands are optional. If they aren't specified and the initial
|
||||||
|
Boolean expression is FALSE, then no commands are executed.
|
||||||
|
|
||||||
Each then or else command (t1, e1, etc) can be any valid LAMMPS input
|
The syntax for Boolean expressions is described below.
|
||||||
script command. Each command should be enclosed in quotes, so it will
|
|
||||||
be treated as a single argument, as in the examples above.
|
Each command (t1, f1, e1, etc) can be any valid LAMMPS input script
|
||||||
|
command. If the command is more than one word, it must enclosed in
|
||||||
|
quotes, so it will be treated as a single argument, as in the examples
|
||||||
|
above.
|
||||||
|
|
||||||
|
IMPORTANT NOTE: If a command itself requires a quoted argument (e.g. a
|
||||||
|
"print"_print.html command), then double and single quotes can be used
|
||||||
|
and nested in the usual manner, as in the examples above and below.
|
||||||
|
See "this section"_Section_commands.html#3_2 of the manual for more
|
||||||
|
details on using quotes in arguments. Only one of level of nesting is
|
||||||
|
allowed, but that should be sufficient for most use cases.
|
||||||
|
|
||||||
Note that by using the line continuation character "&", the if command
|
Note that by using the line continuation character "&", the if command
|
||||||
can be spread across many lines, though it is still a single
|
can be spread across many lines, though it is still a single command:
|
||||||
command:
|
|
||||||
|
|
||||||
if $a < $b then &
|
if "$a < $b" then &
|
||||||
"print Minimum value = $a" &
|
"print 'Minimum value = $a'" &
|
||||||
"run 1000" &
|
"run 1000" &
|
||||||
else &
|
else &
|
||||||
"print Minimum value = $b" &
|
'print "Minimum value = $b"' &
|
||||||
"minimize 0.001 0.001 1000 10000" :pre
|
"minimize 0.001 0.001 1000 10000" :pre
|
||||||
|
|
||||||
Note that if any executed comand is a bogus LAMMPS command, such as
|
Note that if one of the commands to execute is an invalid LAMMPS
|
||||||
"exit" in the first example above, then executing the command will
|
command, such as "exit" in the first example above, then executing the
|
||||||
cause LAMMPS to halt.
|
command will cause LAMMPS to halt.
|
||||||
|
|
||||||
Note that by jumping to a label in the same input script, the if
|
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
|
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
|
delete"_variable.html command for info on how to delete the associated
|
||||||
variable, so that it can be re-used later in the input script.
|
loop variable, so that it can be re-used later in the input script.
|
||||||
|
|
||||||
Here is an example of a double loop which uses the if and
|
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
|
"jump"_jump.html commands to break out of the inner loop when a
|
||||||
@ -79,7 +96,7 @@ variable a loop 5
|
|||||||
variable b loop 5
|
variable b loop 5
|
||||||
print "A,B = $a,$b"
|
print "A,B = $a,$b"
|
||||||
run 10000
|
run 10000
|
||||||
if $b > 2 then "jump in.script break"
|
if '$b > 2' then "print 'Jumping to another script'" "jump in.script break"
|
||||||
next b
|
next b
|
||||||
jump in.script loopb
|
jump in.script loopb
|
||||||
label break
|
label break
|
||||||
@ -87,6 +104,52 @@ variable b delete :pre
|
|||||||
next a
|
next a
|
||||||
jump in.script loopa :pre
|
jump in.script loopa :pre
|
||||||
|
|
||||||
|
:line
|
||||||
|
|
||||||
|
The Boolean expressions for the if and elif keywords have a C-like
|
||||||
|
syntax. Note that each expression is a single argument within the if
|
||||||
|
command. Thus if you want to include spaces in the expression for
|
||||||
|
clarity, you must enclose the entire expression in quotes.
|
||||||
|
|
||||||
|
An expression is built out of numbers
|
||||||
|
|
||||||
|
0.2, 100, 1.0e20, -15.4, etc :pre
|
||||||
|
|
||||||
|
and Boolean operators:
|
||||||
|
|
||||||
|
A == B
|
||||||
|
A != B
|
||||||
|
A < B
|
||||||
|
A <= B
|
||||||
|
A > B
|
||||||
|
A >= B
|
||||||
|
A && B
|
||||||
|
A || B :pre
|
||||||
|
|
||||||
|
Each A and B is a number or a variable reference like $a or $\{abc\},
|
||||||
|
or another Boolean expression.
|
||||||
|
|
||||||
|
If a variable is used it must produce a number when evaluated and
|
||||||
|
substituted for in the expression.
|
||||||
|
|
||||||
|
Expressions are evaluated left to right and have the usual C-style
|
||||||
|
precedence: the 4 relational operators "<", "<=", ">", and ">=" have
|
||||||
|
the highest precedence; those 4 relational operators before the
|
||||||
|
remaining two relational operators "==" and "!="; those two relational
|
||||||
|
operators before the logical AND operator "&&"; and the AND operator
|
||||||
|
"&&" before the logical OR operator "||". Parenthesis can be used to
|
||||||
|
group one or more portions of an expression and/or enforce a different
|
||||||
|
order of evaluation than what would occur with the default precedence.
|
||||||
|
|
||||||
|
The 6 relational operators return either a 1.0 or 0.0 depending on
|
||||||
|
whether the relationship between x and y is true or false. The
|
||||||
|
logical AND operator will return 1.0 if both its arguments are
|
||||||
|
non-zero, else return a 0.0. The logical OR operator will return 1.0
|
||||||
|
if either of its arguments is non-zero, else return a 0.0.
|
||||||
|
|
||||||
|
The overall Boolean expression produces a TRUE result if the result is
|
||||||
|
non-zero. If the result is zero, the expression result is FALSE.
|
||||||
|
|
||||||
[Restrictions:] none
|
[Restrictions:] none
|
||||||
|
|
||||||
[Related commands:]
|
[Related commands:]
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
</P>
|
</P>
|
||||||
<PRE>improper_style class2
|
<PRE>improper_style class2
|
||||||
improper_coeff 1 100.0 0
|
improper_coeff 1 100.0 0
|
||||||
|
improper_coeff * aa 0.0 0.0 0.0 115.06 130.01 115.06
|
||||||
</PRE>
|
</PRE>
|
||||||
<P><B>Description:</B>
|
<P><B>Description:</B>
|
||||||
</P>
|
</P>
|
||||||
|
|||||||
@ -15,7 +15,8 @@ improper_style class2 :pre
|
|||||||
[Examples:]
|
[Examples:]
|
||||||
|
|
||||||
improper_style class2
|
improper_style class2
|
||||||
improper_coeff 1 100.0 0 :pre
|
improper_coeff 1 100.0 0
|
||||||
|
improper_coeff * aa 0.0 0.0 0.0 115.06 130.01 115.06 :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
|
|||||||
@ -13,23 +13,23 @@
|
|||||||
</H3>
|
</H3>
|
||||||
<P><B>Syntax:</B>
|
<P><B>Syntax:</B>
|
||||||
</P>
|
</P>
|
||||||
<PRE>print str1 str2 ...
|
<PRE>print str
|
||||||
</PRE>
|
</PRE>
|
||||||
<UL><LI>str1,str2,...,strN = one or more text strings to print, which may contain variables
|
<UL><LI>str1 = text string to print, which may contain variables
|
||||||
</UL>
|
</UL>
|
||||||
<P><B>Examples:</B>
|
<P><B>Examples:</B>
|
||||||
</P>
|
</P>
|
||||||
<PRE>print Done with equilibration
|
<PRE>print "Done with equilibration"
|
||||||
print The system volume is now $v
|
print Vol=$v
|
||||||
print "The system volume is now $v"
|
print "The system volume is now $v"
|
||||||
</PRE>
|
</PRE>
|
||||||
<P><B>Description:</B>
|
<P><B>Description:</B>
|
||||||
</P>
|
</P>
|
||||||
<P>Print one or more text strings to the screen and logfile. The
|
<P>Print a text string to the screen and logfile. One line of output is
|
||||||
individual text strings are effectively concatenated into a single
|
generated. If the string has white space in it (spaces, tabs, etc),
|
||||||
string, and one line of output is generated. Thus the 2nd and 3rd
|
then you must enclose it in single or double quotes so that it is
|
||||||
examples above are equivalent. If variables are included in any of
|
treated as a single argument. If variables are included in the
|
||||||
the strings, they will be evaluated and their current values printed.
|
string, they will be evaluated and their current values printed.
|
||||||
</P>
|
</P>
|
||||||
<P>If you want the print command to be executed multiple times (with
|
<P>If you want the print command to be executed multiple times (with
|
||||||
changing variable values), there are 3 options. First, consider using
|
changing variable values), there are 3 options. First, consider using
|
||||||
|
|||||||
@ -10,23 +10,23 @@ print command :h3
|
|||||||
|
|
||||||
[Syntax:]
|
[Syntax:]
|
||||||
|
|
||||||
print str1 str2 ... :pre
|
print str :pre
|
||||||
|
|
||||||
str1,str2,...,strN = one or more text strings to print, which may contain variables :ul
|
str1 = text string to print, which may contain variables :ul
|
||||||
|
|
||||||
[Examples:]
|
[Examples:]
|
||||||
|
|
||||||
print Done with equilibration
|
print "Done with equilibration"
|
||||||
print The system volume is now $v
|
print Vol=$v
|
||||||
print "The system volume is now $v" :pre
|
print "The system volume is now $v" :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
Print one or more text strings to the screen and logfile. The
|
Print a text string to the screen and logfile. One line of output is
|
||||||
individual text strings are effectively concatenated into a single
|
generated. If the string has white space in it (spaces, tabs, etc),
|
||||||
string, and one line of output is generated. Thus the 2nd and 3rd
|
then you must enclose it in single or double quotes so that it is
|
||||||
examples above are equivalent. If variables are included in any of
|
treated as a single argument. If variables are included in the
|
||||||
the strings, they will be evaluated and their current values printed.
|
string, they will be evaluated and their current values printed.
|
||||||
|
|
||||||
If you want the print command to be executed multiple times (with
|
If you want the print command to be executed multiple times (with
|
||||||
changing variable values), there are 3 options. First, consider using
|
changing variable values), there are 3 options. First, consider using
|
||||||
|
|||||||
15
doc/run.html
15
doc/run.html
@ -41,7 +41,7 @@
|
|||||||
run 1000000 upto
|
run 1000000 upto
|
||||||
run 100 start 0 stop 1000
|
run 100 start 0 stop 1000
|
||||||
run 1000 pre no post yes
|
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
|
run 100000 every 1000 NULL
|
||||||
</PRE>
|
</PRE>
|
||||||
<P><B>Description:</B>
|
<P><B>Description:</B>
|
||||||
@ -120,7 +120,10 @@ number of arguments. Each of the trailing arguments is a single
|
|||||||
LAMMPS command, and each command should be enclosed in quotes, so that
|
LAMMPS command, and each command should be enclosed in quotes, so that
|
||||||
the entire command will be treated as a single argument. This will
|
the entire command will be treated as a single argument. This will
|
||||||
also prevent any variables in the command from being evaluated until
|
also prevent any variables in the command from being evaluated until
|
||||||
it is executed multiple times during the run.
|
it is executed multiple times during the run. Note that if a command
|
||||||
|
itself needs one of its arguments quoted (e.g. the <A HREF = "print.html">print</A>
|
||||||
|
command), then you can use a combination of single and double quotes,
|
||||||
|
as in the example above.
|
||||||
</P>
|
</P>
|
||||||
<P>The <I>every</I> keyword is a means to avoid listing a long series of runs
|
<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
|
and interleaving commands in your input script. For example, a
|
||||||
@ -161,10 +164,10 @@ command can be spread across many lines, though it is still a single
|
|||||||
command:
|
command:
|
||||||
</P>
|
</P>
|
||||||
<PRE>run 100000 every 1000 &
|
<PRE>run 100000 every 1000 &
|
||||||
"print Minimum value = $a" &
|
"print 'Minimum value = $a'" &
|
||||||
"print Maximum value = $b" &
|
"print 'Maximum value = $b'" &
|
||||||
"print Temp = $c" &
|
"print 'Temp = $c'" &
|
||||||
"print Press = $d"
|
"print 'Press = $d'"
|
||||||
</PRE>
|
</PRE>
|
||||||
<P>If the <I>pre</I> and <I>post</I> options are set to "no" when used with the
|
<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
|
<I>every</I> keyword, then the 1st run will do the full setup and the last
|
||||||
|
|||||||
15
doc/run.txt
15
doc/run.txt
@ -34,7 +34,7 @@ run 10000
|
|||||||
run 1000000 upto
|
run 1000000 upto
|
||||||
run 100 start 0 stop 1000
|
run 100 start 0 stop 1000
|
||||||
run 1000 pre no post yes
|
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
|
run 100000 every 1000 NULL :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
@ -113,7 +113,10 @@ number of arguments. Each of the trailing arguments is a single
|
|||||||
LAMMPS command, and each command should be enclosed in quotes, so that
|
LAMMPS command, and each command should be enclosed in quotes, so that
|
||||||
the entire command will be treated as a single argument. This will
|
the entire command will be treated as a single argument. This will
|
||||||
also prevent any variables in the command from being evaluated until
|
also prevent any variables in the command from being evaluated until
|
||||||
it is executed multiple times during the run.
|
it is executed multiple times during the run. Note that if a command
|
||||||
|
itself needs one of its arguments quoted (e.g. the "print"_print.html
|
||||||
|
command), then you can use a combination of single and double quotes,
|
||||||
|
as in the example above.
|
||||||
|
|
||||||
The {every} keyword is a means to avoid listing a long series of runs
|
The {every} keyword is a means to avoid listing a long series of runs
|
||||||
and interleaving commands in your input script. For example, a
|
and interleaving commands in your input script. For example, a
|
||||||
@ -154,10 +157,10 @@ command can be spread across many lines, though it is still a single
|
|||||||
command:
|
command:
|
||||||
|
|
||||||
run 100000 every 1000 &
|
run 100000 every 1000 &
|
||||||
"print Minimum value = $a" &
|
"print 'Minimum value = $a'" &
|
||||||
"print Maximum value = $b" &
|
"print 'Maximum value = $b'" &
|
||||||
"print Temp = $c" &
|
"print 'Temp = $c'" &
|
||||||
"print Press = $d" :pre
|
"print 'Press = $d'" :pre
|
||||||
|
|
||||||
If the {pre} and {post} options are set to "no" when used with the
|
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
|
{every} keyword, then the 1st run will do the full setup and the last
|
||||||
|
|||||||
@ -332,9 +332,9 @@ relational operators "<", "<=", ">", and ">="; those 4 relational
|
|||||||
operators before the remaining two relational operators "==" and "!=";
|
operators before the remaining two relational operators "==" and "!=";
|
||||||
those two relational operators before the logical AND operator "&&";
|
those two relational operators before the logical AND operator "&&";
|
||||||
and the AND operator "&&" before the logical OR operator "||".
|
and the AND operator "&&" before the logical OR operator "||".
|
||||||
Parenthesis can be used to group one or more portions of a formula and
|
Parenthesis can be used to group one or more portions of a formula
|
||||||
enforce a different order of evaluation than what would occur with the
|
and/or enforce a different order of evaluation than what would occur
|
||||||
default precedence.
|
with the default precedence.
|
||||||
</P>
|
</P>
|
||||||
<P>The 6 relational operators return either a 1.0 or 0.0 depending on
|
<P>The 6 relational operators return either a 1.0 or 0.0 depending on
|
||||||
whether the relationship between x and y is true or false. For
|
whether the relationship between x and y is true or false. For
|
||||||
|
|||||||
@ -331,17 +331,17 @@ relational operators "<", "<=", ">", and ">="; those 4 relational
|
|||||||
operators before the remaining two relational operators "==" and "!=";
|
operators before the remaining two relational operators "==" and "!=";
|
||||||
those two relational operators before the logical AND operator "&&";
|
those two relational operators before the logical AND operator "&&";
|
||||||
and the AND operator "&&" before the logical OR operator "||".
|
and the AND operator "&&" before the logical OR operator "||".
|
||||||
Parenthesis can be used to group one or more portions of a formula and
|
Parenthesis can be used to group one or more portions of a formula
|
||||||
enforce a different order of evaluation than what would occur with the
|
and/or enforce a different order of evaluation than what would occur
|
||||||
default precedence.
|
with the default precedence.
|
||||||
|
|
||||||
The 6 relational operators return either a 1.0 or 0.0 depending on
|
The 6 relational operators return either a 1.0 or 0.0 depending on
|
||||||
whether the relationship between x and y is true or false. For
|
whether the relationship between x and y is true or false. For
|
||||||
example the expression x<10.0 in an atom-style variable formula will
|
example the expression x<10.0 in an atom-style variable formula will
|
||||||
return 1.0 for all atoms whose x-coordinate is less than 10.0, and 0.0
|
return 1.0 for all atoms whose x-coordinate is less than 10.0, and 0.0
|
||||||
for the others. The logical AND operator will return 1.0 of both its
|
for the others. The logical AND operator will return 1.0 if both its
|
||||||
arguments are non-zero, else return a 0.0. The logical OR operator
|
arguments are non-zero, else return a 0.0. The logical OR operator
|
||||||
will return 1.0 of either of its arguments is non-zero, else return a
|
will return 1.0 if either of its arguments is non-zero, else return a
|
||||||
0.0. These relational and logical operators can be used as a masking
|
0.0. These relational and logical operators can be used as a masking
|
||||||
or selection operation in a formula. For example, the number of atoms
|
or selection operation in a formula. For example, the number of atoms
|
||||||
whose properties satifsy one or more criteria could be calculated by
|
whose properties satifsy one or more criteria could be calculated by
|
||||||
|
|||||||
Reference in New Issue
Block a user