From 03dfe53a210f42717778f974261953f586f52547 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 18 Nov 2010 18:30:31 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5265 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/if.html | 20 +++++++++++--------- doc/if.txt | 20 +++++++++++--------- doc/variable.html | 36 +++++++++++++++++++----------------- doc/variable.txt | 36 +++++++++++++++++++----------------- 4 files changed, 60 insertions(+), 52 deletions(-) diff --git a/doc/if.html b/doc/if.html index a29aa0d10d..bbbbfb5f24 100644 --- a/doc/if.html +++ b/doc/if.html @@ -121,7 +121,7 @@ clarity, you must enclose the entire expression in quotes.

and Boolean operators:

-
A == B, A != B, A < B, A <= B, A > B, A >= B, A && B, A || B 
+
A == B, A != B, A < B, A <= B, A > B, A >= B, A && B, A || B, !A 
 

Each A and B is a number or a variable reference like $a or ${abc}, or another Boolean expression. @@ -130,19 +130,21 @@ or another Boolean expression. substituted for in the expression, else an error will be generated.

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 +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.

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 +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. +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 overall Boolean expression produces a TRUE result if the result is non-zero. If the result is zero, the expression result is FALSE. diff --git a/doc/if.txt b/doc/if.txt index b006a5ebff..7ecf6eb401 100644 --- a/doc/if.txt +++ b/doc/if.txt @@ -117,7 +117,7 @@ An expression is built out of numbers: and Boolean operators: -A == B, A != B, A < B, A <= B, A > B, A >= B, A && B, A || B :pre +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 a variable reference like $a or $\{abc\}, or another Boolean expression. @@ -126,19 +126,21 @@ If a variable is used it must produce a number when evaluated and substituted for in the expression, else an error will be generated. 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 +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. 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 +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. +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 overall Boolean expression produces a TRUE result if the result is non-zero. If the result is zero, the expression result is FALSE. diff --git a/doc/variable.html b/doc/variable.html index 298592f75d..7f913caf8c 100644 --- a/doc/variable.html +++ b/doc/variable.html @@ -44,7 +44,7 @@ constants = PI thermo keywords = vol, ke, press, etc from thermo_style math operators = (), -x, x+y, x-y, x*y, x/y, x^y, - x==y, x!=y, xy, x>=y, x&&y, x||y + x==y, x!=y, xy, x>=y, x&&y, x||y, !x math functions = sqrt(x), exp(x), ln(x), log(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) @@ -272,7 +272,7 @@ references to other variables. Number 0.2, 100, 1.0e20, -15.4, etc Constant PI Thermo keywords vol, pe, ebond, etc -Math operators (), -x, x+y, x-y, x*y, x/y, x^y, x==y, x!=y, xy, x>=y, x&&y, x||y +Math operators (), -x, x+y, x-y, x*y, x/y, x^y, x==y, x!=y, xy, x>=y, x&&y, x||y, !x Math functions sqrt(x), exp(x), ln(x), log(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), ramp(x,y), stagger(x,y), logfreq(x,y,z), vdisplace(x,y), swiggle(x,y,z), cwiggle(x,y,z) Group functions count(ID), mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), fcm(ID,dim), bound(ID,dir), gyration(ID), ke(ID), angmom(ID,dim), inertia(ID,dimdim), omega(ID,dim) Region functions count(ID,IDR), mass(ID,IDR), charge(ID,IDR), xcm(ID,dim,IDR), vcm(ID,dim,IDR), fcm(ID,dim,IDR), bound(ID,dir,IDR), gyration(ID,IDR), ke(ID,IDR), angmom(ID,dim,IDR), inertia(ID,dimdim,IDR), omega(ID,dim,IDR) @@ -325,26 +325,28 @@ scalars, where "vy+vz" is the element-by-element sum of two per-atom vectors of y and z velocities.

Operators are evaluated left to right and have the usual C-style -precedence: unary minus before exponentiation ("^"); exponentiation -before multiplication and division; multiplication and division before -addition and subtraction; addition and subtraction before the 4 -relational operators "<", "<=", ">", and ">="; 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 a formula -and/or enforce a different order of evaluation than what would occur -with the default precedence. +precedence: unary minus and unary logical NOT operator "!" have the +highest precedence, exponentiation "^" is next; multiplication and +division 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.

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 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 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. These relational and logical operators can be used as a masking -or selection operation in a formula. For example, the number of atoms +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. +

+

These relational and logical operators can be used as a masking or +selection operation in a formula. For example, the number of atoms whose properties satifsy one or more criteria could be calculated by taking the returned per-atom vector of ones and zeroes and passing it to the compute reduce command. diff --git a/doc/variable.txt b/doc/variable.txt index d12497b239..ae68785dbe 100644 --- a/doc/variable.txt +++ b/doc/variable.txt @@ -39,7 +39,7 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st constants = PI 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, xy, x>=y, x&&y, x||y + x==y, x!=y, xy, x>=y, x&&y, x||y, !x math functions = sqrt(x), exp(x), ln(x), log(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) @@ -265,7 +265,7 @@ references to other variables. Number: 0.2, 100, 1.0e20, -15.4, etc Constant: PI Thermo keywords: vol, pe, ebond, etc -Math operators: (), -x, x+y, x-y, x*y, x/y, x^y, x==y, x!=y, xy, x>=y, x&&y, x||y +Math operators: (), -x, x+y, x-y, x*y, x/y, x^y, x==y, x!=y, xy, x>=y, x&&y, x||y, !x Math functions: sqrt(x), exp(x), ln(x), log(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), ramp(x,y), stagger(x,y), logfreq(x,y,z), vdisplace(x,y), swiggle(x,y,z), cwiggle(x,y,z) Group functions: count(ID), mass(ID), charge(ID), xcm(ID,dim), \ vcm(ID,dim), fcm(ID,dim), bound(ID,dir), \ @@ -324,26 +324,28 @@ scalars, where "vy+vz" is the element-by-element sum of two per-atom vectors of y and z velocities. Operators are evaluated left to right and have the usual C-style -precedence: unary minus before exponentiation ("^"); exponentiation -before multiplication and division; multiplication and division before -addition and subtraction; addition and subtraction before the 4 -relational operators "<", "<=", ">", and ">="; 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 a formula -and/or enforce a different order of evaluation than what would occur -with the default precedence. +precedence: unary minus and unary logical NOT operator "!" have the +highest precedence, exponentiation "^" is next; multiplication and +division 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. 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 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 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. These relational and logical operators can be used as a masking -or selection operation in a formula. For example, the number of atoms +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. + +These relational and logical operators can be used as a masking or +selection operation in a formula. For example, the number of atoms whose properties satifsy one or more criteria could be calculated by taking the returned per-atom vector of ones and zeroes and passing it to the "compute reduce"_compute_reduce.html command.