added XOR operator to variable command
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<!-- HTML_ONLY -->
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="29 Sep 2016 version">
|
||||
<META NAME="docnumber" CONTENT="30 Sep 2016 version">
|
||||
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
|
||||
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
|
||||
</HEAD>
|
||||
@ -21,7 +21,7 @@
|
||||
<H1></H1>
|
||||
|
||||
LAMMPS Documentation :c,h3
|
||||
29 Sep 2016 version :c,h4
|
||||
30 Sep 2016 version :c,h4
|
||||
|
||||
Version info: :h4
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ InP, myString, a123, ab_23_cd, etc :pre
|
||||
|
||||
and Boolean operators:
|
||||
|
||||
A == B, A != B, A < B, A <= B, A > B, A >= B, A && B, A || B, !A :pre
|
||||
A == B, A != B, A < B, A <= B, A > B, A >= B, A && B, A || B, A |^ B, !A :pre
|
||||
|
||||
Each A and B is a number or string or a variable reference like $a or
|
||||
$\{abc\}, or A or B can be another Boolean expression.
|
||||
@ -155,9 +155,10 @@ precedence: the unary logical NOT operator "!" has the highest
|
||||
precedence, the 4 relational operators "<", "<=", ">", and ">=" are
|
||||
next; the two remaining relational operators "==" and "!=" are next;
|
||||
then the logical AND operator "&&"; and finally the logical OR
|
||||
operator "||" has the lowest precedence. 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.
|
||||
operator "||" and logical XOR (exclusive or) operator "|^" have the
|
||||
lowest precedence. 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.
|
||||
|
||||
When the 6 relational operators (first 6 in list above) compare 2
|
||||
numbers, they return either a 1.0 or 0.0 depending on whether the
|
||||
@ -171,9 +172,11 @@ relationship between A and B is TRUE or FALSE (or just A). The
|
||||
logical AND operator will return 1.0 if both its arguments are
|
||||
non-zero, else it returns 0.0. The logical OR operator will return
|
||||
1.0 if either of its arguments is non-zero, else it returns 0.0. The
|
||||
logical NOT operator returns 1.0 if its argument is 0.0, else it
|
||||
returns 0.0. The 3 logical operators can only be used to operate on
|
||||
numbers, not on strings.
|
||||
logical XOR operator will return 1.0 if one of its arguments is zero
|
||||
and the other non-zero, else it returns 0.0. The logical NOT operator
|
||||
returns 1.0 if its argument is 0.0, else it returns 0.0. The 3
|
||||
logical operators can only be used to operate on numbers, not on
|
||||
strings.
|
||||
|
||||
The overall Boolean expression produces a TRUE result if the result is
|
||||
non-zero. If the result is zero, the expression result is FALSE.
|
||||
|
||||
@ -47,7 +47,7 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st
|
||||
constants = PI, version, on, off, true, false, yes, no
|
||||
thermo keywords = vol, ke, press, etc from "thermo_style"_thermo_style.html
|
||||
math operators = (), -x, x+y, x-y, x*y, x/y, x^y, x%y,
|
||||
x == y, x != y, x < y, x <= y, x > y, x >= y, x && y, x || y, !x
|
||||
x == y, x != y, x < y, x <= y, x > y, x >= y, x && y, x || y, x |^ y, !x
|
||||
math functions = sqrt(x), exp(x), ln(x), log(x), abs(x),
|
||||
sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), atan2(y,x),
|
||||
random(x,y,z), normal(x,y,z), ceil(x), floor(x), round(x)
|
||||
@ -450,7 +450,7 @@ Number: 0.2, 100, 1.0e20, -15.4, etc
|
||||
Constant: PI, version, on, off, true, false, yes, no
|
||||
Thermo keywords: vol, pe, ebond, etc
|
||||
Math operators: (), -x, x+y, x-y, x*y, x/y, x^y, x%y, \
|
||||
x == y, x != y, x < y, x <= y, x > y, x >= y, x && y, x || y, !x
|
||||
x == y, x != y, x < y, x <= y, x > y, x >= y, x && y, x || y, x |^ y, !x
|
||||
Math functions: sqrt(x), exp(x), ln(x), log(x), abs(x), \
|
||||
sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), atan2(y,x), \
|
||||
random(x,y,z), normal(x,y,z), ceil(x), floor(x), round(x), \
|
||||
@ -551,9 +551,10 @@ division and the modulo operator "%" are next; addition and
|
||||
subtraction are next; the 4 relational operators "<", "<=", ">", and
|
||||
">=" are next; the two remaining relational operators "==" and "!="
|
||||
are next; then the logical AND operator "&&"; and finally the logical
|
||||
OR operator "||" has the lowest precedence. Parenthesis can be used
|
||||
to group one or more portions of a formula and/or enforce a different
|
||||
order of evaluation than what would occur with the default precedence.
|
||||
OR operator "||" and logical XOR (exclusive or) operator "|^" have the
|
||||
lowest precedence. Parenthesis can be used to group one or more
|
||||
portions of a formula and/or enforce a different order of evaluation
|
||||
than what would occur with the default precedence.
|
||||
|
||||
NOTE: Because a unary minus is higher precedence than exponentiation,
|
||||
the formula "-2^2" will evaluate to 4, not -4. This convention is
|
||||
@ -568,8 +569,10 @@ 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 if both its
|
||||
arguments are non-zero, else it returns 0.0. The logical OR operator
|
||||
will return 1.0 if either of its arguments is non-zero, else it
|
||||
returns 0.0. The logical NOT operator returns 1.0 if its argument is
|
||||
0.0, else it returns 0.0.
|
||||
returns 0.0. The logical XOR operator will return 1.0 if one of its
|
||||
arguments is zero and the other non-zero, else it returns 0.0. The
|
||||
logical NOT operator returns 1.0 if its argument is 0.0, else it
|
||||
returns 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
|
||||
|
||||
Reference in New Issue
Block a user