diff --git a/doc/variable.html b/doc/variable.html index e01b09478d..37cfc881b3 100644 --- a/doc/variable.html +++ b/doc/variable.html @@ -65,7 +65,7 @@ bound(group,xmin,region), gyration(group,region), ke(group,reigon), angmom(group,dim,region), torque(group,dim,region), inertia(group,dimdim,region), omega(group,dim,region) - special functions = sum(x), min(x), max(x), ave(x), trap(x), gmask(x), rmask(x), grmask(x,y), next(x) + special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i] atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz compute references = c_ID, c_ID[i], c_ID[i][j] @@ -372,7 +372,7 @@ references to other variables. 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), ramp(x,y), stagger(x,y), logfreq(x,y,z), stride(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), torque(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), torque(ID,dim,IDR), inertia(ID,dimdim,IDR), omega(ID,dim,IDR) -Special functions sum(x), min(x), max(x), ave(x), trap(x), gmask(x), rmask(x), grmask(x,y), next(x) +Special functions sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) Atom values id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i] Atom vectors id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz Compute references c_ID, c_ID[i], c_ID[i][j] @@ -615,14 +615,14 @@ inclusion is that it be in the region.

Special functions take specific kinds of arguments, meaning their arguments cannot be formulas themselves.

-

The sum(x), min(x), max(x), ave(x), and trap(x) functions each take 1 -argument which is of the form "c_ID" or "c_ID[N]" or "f_ID" or -"f_ID[N]". The first two are computes and the second two are fixes; -the ID in the reference should be replaced by the ID of a compute or -fix defined elsewhere in the input script. The compute or fix must -produce either a global vector or array. If it produces a global -vector, then the notation without "[N]" should be used. If it -produces a global array, then the notation with "[N]" should be +

The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions +each take 1 argument which is of the form "c_ID" or "c_ID[N]" or +"f_ID" or "f_ID[N]". The first two are computes and the second two +are fixes; the ID in the reference should be replaced by the ID of a +compute or fix defined elsewhere in the input script. The compute or +fix must produce either a global vector or array. If it produces a +global vector, then the notation without "[N]" should be used. If +it produces a global array, then the notation with "[N]" should be used, when N is an integer, to specify which column of the global array is being referenced.

@@ -634,17 +634,24 @@ functions on per-atom and local vectors.

The sum() function calculates the sum of all the vector elements. The min() and max() functions find the minimum and maximum element respectively. The ave() function is the same as sum() except that it -divides the result by the length of the vector. The trap() function -is the same as sum() except the first and last elements are multiplied -by a weighting factor of 1/2 when performing the sum. This -effectively implements an integratiion via the trapezoidal rule on the -global vector of data. I.e. consider a set of points, equally spaced -by 1 in their x coordinate: (1,V1), (2,V2), ..., (N,VN), where the Vi -are the values in the global vector of length N. The integral from 1 -to N of these points is trap(). When appropriately normalized by the -timestep size, this function is useful for calculating integrals of -time-series data, like that generated by the fix -ave/correlate command. +divides the result by the length of the vector. +

+

The trap() function is the same as sum() except the first and last +elements are multiplied by a weighting factor of 1/2 when performing +the sum. This effectively implements an integration via the +trapezoidal rule on the global vector of data. I.e. consider a set of +points, equally spaced by 1 in their x coordinate: (1,V1), (2,V2), +..., (N,VN), where the Vi are the values in the global vector of +length N. The integral from 1 to N of these points is trap(). When +appropriately normalized by the timestep size, this function is useful +for calculating integrals of time-series data, like that generated by +the fix ave/correlate command. +

+

The slope() function uses linear regression to fit a line to the set +of points, equally spaced by 1 in their x coordinate: (1,V1), (2,V2), +..., (N,VN), where the Vi are the values in the global vector of +length N. The returned value is the slope of the line. If the line +has a single point or is vertical, it returns 1.0e20.

The gmask(x) function takes 1 argument which is a group ID. It can only be used in atom-style variables. It returns a 1 for diff --git a/doc/variable.txt b/doc/variable.txt index d7dbf81098..8c6593b751 100644 --- a/doc/variable.txt +++ b/doc/variable.txt @@ -60,7 +60,7 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st bound(group,xmin,region), gyration(group,region), ke(group,reigon), angmom(group,dim,region), torque(group,dim,region), inertia(group,dimdim,region), omega(group,dim,region) - special functions = sum(x), min(x), max(x), ave(x), trap(x), gmask(x), rmask(x), grmask(x,y), next(x) + special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) atom value = id\[i\], mass\[i\], type\[i\], mol\[i\], x\[i\], y\[i\], z\[i\], vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\] atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz compute references = c_ID, c_ID\[i\], c_ID\[i\]\[j\] @@ -372,7 +372,7 @@ Region functions: count(ID,IDR), mass(ID,IDR), charge(ID,IDR), \ bound(ID,dir,IDR), gyration(ID,IDR), ke(ID,IDR), \ angmom(ID,dim,IDR), torque(ID,dim,IDR), \ inertia(ID,dimdim,IDR), omega(ID,dim,IDR) -Special functions: sum(x), min(x), max(x), ave(x), trap(x), gmask(x), rmask(x), grmask(x,y), next(x) +Special functions: sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) Atom values: id\[i\], mass\[i\], type\[i\], mol\[i\], x\[i\], y\[i\], z\[i\], \ vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\] Atom vectors: id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz @@ -615,14 +615,14 @@ Special Functions :h4 Special functions take specific kinds of arguments, meaning their arguments cannot be formulas themselves. -The sum(x), min(x), max(x), ave(x), and trap(x) functions each take 1 -argument which is of the form "c_ID" or "c_ID\[N\]" or "f_ID" or -"f_ID\[N\]". The first two are computes and the second two are fixes; -the ID in the reference should be replaced by the ID of a compute or -fix defined elsewhere in the input script. The compute or fix must -produce either a global vector or array. If it produces a global -vector, then the notation without "\[N\]" should be used. If it -produces a global array, then the notation with "\[N\]" should be +The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions +each take 1 argument which is of the form "c_ID" or "c_ID\[N\]" or +"f_ID" or "f_ID\[N\]". The first two are computes and the second two +are fixes; the ID in the reference should be replaced by the ID of a +compute or fix defined elsewhere in the input script. The compute or +fix must produce either a global vector or array. If it produces a +global vector, then the notation without "\[N\]" should be used. If +it produces a global array, then the notation with "\[N\]" should be used, when N is an integer, to specify which column of the global array is being referenced. @@ -634,17 +634,24 @@ functions on per-atom and local vectors. The sum() function calculates the sum of all the vector elements. The min() and max() functions find the minimum and maximum element respectively. The ave() function is the same as sum() except that it -divides the result by the length of the vector. The trap() function -is the same as sum() except the first and last elements are multiplied -by a weighting factor of 1/2 when performing the sum. This -effectively implements an integratiion via the trapezoidal rule on the -global vector of data. I.e. consider a set of points, equally spaced -by 1 in their x coordinate: (1,V1), (2,V2), ..., (N,VN), where the Vi -are the values in the global vector of length N. The integral from 1 -to N of these points is trap(). When appropriately normalized by the -timestep size, this function is useful for calculating integrals of -time-series data, like that generated by the "fix -ave/correlate"_fix_ave_correlate.html command. +divides the result by the length of the vector. + +The trap() function is the same as sum() except the first and last +elements are multiplied by a weighting factor of 1/2 when performing +the sum. This effectively implements an integration via the +trapezoidal rule on the global vector of data. I.e. consider a set of +points, equally spaced by 1 in their x coordinate: (1,V1), (2,V2), +..., (N,VN), where the Vi are the values in the global vector of +length N. The integral from 1 to N of these points is trap(). When +appropriately normalized by the timestep size, this function is useful +for calculating integrals of time-series data, like that generated by +the "fix ave/correlate"_fix_ave_correlate.html command. + +The slope() function uses linear regression to fit a line to the set +of points, equally spaced by 1 in their x coordinate: (1,V1), (2,V2), +..., (N,VN), where the Vi are the values in the global vector of +length N. The returned value is the slope of the line. If the line +has a single point or is vertical, it returns 1.0e20. The gmask(x) function takes 1 argument which is a group ID. It can only be used in atom-style variables. It returns a 1 for