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

This commit is contained in:
sjplimp 2009-12-31 21:08:23 +00:00
parent daf95056d8
commit 98222b27f4
4 changed files with 90 additions and 8 deletions

View File

@ -15,7 +15,7 @@
</H3>
<P><B>Syntax:</B>
</P>
<PRE>compute ID group-ID style arg mode input1 input2 ...
<PRE>compute ID group-ID style arg mode input1 input2 ... keyword args ...
</PRE>
<UL><LI>ID, group-ID are documented in <A HREF = "compute.html">compute</A> command
@ -38,13 +38,22 @@
f_ID[I] = Ith column of array calculated by a fix with ID
v_name = per-atom vector calculated by an atom-style variable with name
</PRE>
<LI>zero or more keyword/args pairs may be appended
<LI>keyword = <I>replace</I>
<PRE> <I>replace</I> args = vec1 vec2
vec1 = reduced value from this input vector will be replaced
vec2 = replace it with vec1[N] where N is index of max/min value from vec2
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>compute 1 all reduce sum c_force
compute 1 all reduce/region subbox sum c_force
compute 2 all reduce min c_press<B>2</B> f_ave v_myKE
compute 2 all reduce min c_press<B>2</B> f_ave v_myKE
compute 3 fluid reduce max c_index<B>1</B> c_index<B>2</B> c_dist replace 1 3 replace 2 3
</PRE>
<P><B>Description:</B>
</P>
@ -110,6 +119,36 @@ invoke other computes, fixes, or variables when they are evaluated, so
this is a very general means of generating per-atom quantities to
reduce.
</P>
<HR>
<P>If the <I>replace</I> keyword is used, two indices <I>vec1</I> and <I>vec2</I> are
specified, where each index ranges from 1 to the # of input values.
The replace keyword can only be used if the <I>mode</I> is <I>min</I> or <I>max</I>.
It works as follows. A min/max is computed as usual on the <I>vec2</I>
input vector. The index N of that value within <I>vec2</I> is also stored.
Then, instead of performing a min/max on the <I>vec1</I> input vector, the
stored index is used to select the Nth element of the <I>vec1</I> vector.
</P>
<P>Thus, for example, if you wish to use this compute to find the bond
with maximum stretch, you can do it as follows:
</P>
<PRE>compute 1 all property/local batom1 batom2
compute 2 all bond/local dist
compute 3 all reduce max c_1[1] c_1[2] c_2 replace 1 3 replace 2 3
thermo_style custom step temp c_3[1] c_3[2] c_3[3]
</PRE>
<P>The first two input values in the compute reduce command are vectors
with the IDs of the 2 atoms in each bond, using the <A HREF = "compute_property_local.html">compute
property/local</A> command. The last input
value is bond distance, using the <A HREF = "compute_bond_local.html">compute
bond/local</A> command. Instead of taking the
max of the two atom ID vectors, which does not yield useful
information in this context, the <I>replace</I> keywords will extract the
atom IDs for the two atoms in the bond of maximum stretch. These atom
IDs and the bond stretch will be printed with thermodynamic output.
</P>
<HR>
<P>If a single input is specified this compute produces a global scalar
value. If multiple inputs are specified, this compute produces a
vector of global values, the length of which is equal to the number of

View File

@ -11,7 +11,7 @@ compute reduce/region command :h3
[Syntax:]
compute ID group-ID style arg mode input1 input2 ... :pre
compute ID group-ID style arg mode input1 input2 ... keyword args ... :pre
ID, group-ID are documented in "compute"_compute.html command :ulb,l
style = {reduce} or {reduce/region} :l
@ -27,13 +27,20 @@ input = x, y, z, vx, vy, vz, fx, fy, fz, c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_nam
f_ID = vector calculated by a fix with ID
f_ID\[I\] = Ith column of array calculated by a fix with ID
v_name = per-atom vector calculated by an atom-style variable with name :pre
zero or more keyword/args pairs may be appended :l
keyword = {replace} :l
{replace} args = vec1 vec2
vec1 = reduced value from this input vector will be replaced
vec2 = replace it with vec1\[N\] where N is index of max/min value from vec2 :pre
:ule
[Examples:]
compute 1 all reduce sum c_force
compute 1 all reduce/region subbox sum c_force
compute 2 all reduce min c_press[2] f_ave v_myKE :pre
compute 2 all reduce min c_press[2] f_ave v_myKE
compute 3 fluid reduce max c_index[1] c_index[2] c_dist replace 1 3 replace 2 3 :pre
[Description:]
@ -99,6 +106,36 @@ invoke other computes, fixes, or variables when they are evaluated, so
this is a very general means of generating per-atom quantities to
reduce.
:line
If the {replace} keyword is used, two indices {vec1} and {vec2} are
specified, where each index ranges from 1 to the # of input values.
The replace keyword can only be used if the {mode} is {min} or {max}.
It works as follows. A min/max is computed as usual on the {vec2}
input vector. The index N of that value within {vec2} is also stored.
Then, instead of performing a min/max on the {vec1} input vector, the
stored index is used to select the Nth element of the {vec1} vector.
Thus, for example, if you wish to use this compute to find the bond
with maximum stretch, you can do it as follows:
compute 1 all property/local batom1 batom2
compute 2 all bond/local dist
compute 3 all reduce max c_1\[1\] c_1\[2\] c_2 replace 1 3 replace 2 3
thermo_style custom step temp c_3\[1\] c_3\[2\] c_3\[3\] :pre
The first two input values in the compute reduce command are vectors
with the IDs of the 2 atoms in each bond, using the "compute
property/local"_compute_property_local.html command. The last input
value is bond distance, using the "compute
bond/local"_compute_bond_local.html command. Instead of taking the
max of the two atom ID vectors, which does not yield useful
information in this context, the {replace} keywords will extract the
atom IDs for the two atoms in the bond of maximum stretch. These atom
IDs and the bond stretch will be printed with thermodynamic output.
:line
If a single input is specified this compute produces a global scalar
value. If multiple inputs are specified, this compute produces a
vector of global values, the length of which is equal to the number of

View File

@ -17,7 +17,7 @@
</PRE>
<UL><LI>ID = user-assigned name for the region
<LI>style = <I>block</I> or <I>cone</I> or <I>cylinder</I> or <I>prism</I> or <I>sphere</I> or <I>union</I> or <I>intersect</I>
<LI>style = <I>block</I> or <I>cone</I> or <I>cylinder</I> or <I>plane</I> or <I>prism</I> or <I>sphere</I> or <I>union</I> or <I>intersect</I>
<PRE> <I>block</I> args = xlo xhi ylo yhi zlo zhi
xlo,xhi,ylo,yhi,zlo,zhi = bounds of block in all dimensions (distance units)
@ -31,6 +31,9 @@
c1,c2 = coords of cylinder axis in other 2 dimensions (distance units)
radius = cylinder radius (distance units)
lo,hi = bounds of cylinder in dim (distance units)
<I>plane</I> args = px py pz nx ny nz
px,py,pz = point on the plane
nx,ny,nz = direction normal to plane (distance units)
<I>prism</I> args = xlo xhi ylo yhi zlo zhi xy xz yz
xlo,xhi,ylo,yhi,zlo,zhi = bounds of untilted prism (distance units)
xy = distance to tilt y in x direction (distance units)
@ -88,7 +91,7 @@ parameter cannot be used.
</P>
<P>For style <I>cone</I>, an axis-aligned cone is defined which is like a
<I>cylinder</I> except that two different radii (one at each end) can be
defined.
defined. Either of the radii can be 0.0.
</P>
<P>For style <I>cone</I> and <I>cylinder</I>, the c1,c2 params are coordinates in
the 2 other dimensions besides the cylinder axis dimension. For dim =

View File

@ -13,7 +13,7 @@ region command :h3
region ID style args keyword value ... :pre
ID = user-assigned name for the region :ulb,l
style = {block} or {cone} or {cylinder} or {prism} or {sphere} or {union} or {intersect} :l
style = {block} or {cone} or {cylinder} or {plane} or {prism} or {sphere} or {union} or {intersect} :l
{block} args = xlo xhi ylo yhi zlo zhi
xlo,xhi,ylo,yhi,zlo,zhi = bounds of block in all dimensions (distance units)
{cone} args = dim c1 c2 radlo radhi lo hi
@ -26,6 +26,9 @@ style = {block} or {cone} or {cylinder} or {prism} or {sphere} or {union} or {in
c1,c2 = coords of cylinder axis in other 2 dimensions (distance units)
radius = cylinder radius (distance units)
lo,hi = bounds of cylinder in dim (distance units)
{plane} args = px py pz nx ny nz
px,py,pz = point on the plane
nx,ny,nz = direction normal to plane (distance units)
{prism} args = xlo xhi ylo yhi zlo zhi xy xz yz
xlo,xhi,ylo,yhi,zlo,zhi = bounds of untilted prism (distance units)
xy = distance to tilt y in x direction (distance units)
@ -79,7 +82,7 @@ parameter cannot be used.
For style {cone}, an axis-aligned cone is defined which is like a
{cylinder} except that two different radii (one at each end) can be
defined.
defined. Either of the radii can be 0.0.
For style {cone} and {cylinder}, the c1,c2 params are coordinates in
the 2 other dimensions besides the cylinder axis dimension. For dim =