From c5f9d387d8ff3bf01d50d0549c2eeef3f6426473 Mon Sep 17 00:00:00 2001
From: sjplimp
For example, these commands would change the prefactor coefficient of the pair_style soft potential from 10.0 to 30.0 in a -linear fashion over the course of a 1000-step simulation: +linear fashion over the course of a simulation:
-variable min equal 10.0 -variable max equal 30.0 -variable prefactor equal min+(max-min)*elapsed/1000 +variable prefactor equal ramp(10,30) fix 1 all adapt 1 pair soft a * * prefactorThe atom keyword enables various atom properties to be changed. The diff --git a/doc/fix_adapt.txt b/doc/fix_adapt.txt index cf072e73da..2735c23c63 100644 --- a/doc/fix_adapt.txt +++ b/doc/fix_adapt.txt @@ -103,11 +103,9 @@ details. For example, these commands would change the prefactor coefficient of the "pair_style soft"_pair_soft.html potential from 10.0 to 30.0 in a -linear fashion over the course of a 1000-step simulation: +linear fashion over the course of a simulation: -variable min equal 10.0 -variable max equal 30.0 -variable prefactor equal min+(max-min)*elapsed/1000 +variable prefactor equal ramp(10,30) fix 1 all adapt 1 pair soft a * * prefactor :pre The {atom} keyword enables various atom properties to be changed. The diff --git a/doc/pair_lubricate.html b/doc/pair_lubricate.html index 05ec052dc9..bbbad7c412 100644 --- a/doc/pair_lubricate.html +++ b/doc/pair_lubricate.html @@ -33,7 +33,7 @@ pair_coeff * *
pair_style lubricate 1.0 1 1 1 0 2.3 2.4 1.3 5878598 pair_coeff * * -variable vmu equal 1.0+elapsed/10000 +variable vmu equal ramp(1,2) fix 1 all adapt 1 pair lubricate mu * * vmu
Description: diff --git a/doc/pair_lubricate.txt b/doc/pair_lubricate.txt index 0154a1fc3e..9a541f9217 100644 --- a/doc/pair_lubricate.txt +++ b/doc/pair_lubricate.txt @@ -30,7 +30,7 @@ pair_coeff * * :pre pair_style lubricate 1.0 1 1 1 0 2.3 2.4 1.3 5878598 pair_coeff * * -variable vmu equal 1.0+elapsed/10000 +variable vmu equal ramp(1,2) fix 1 all adapt 1 pair lubricate mu * * vmu :pre [Description:] diff --git a/doc/pair_soft.html b/doc/pair_soft.html index d99219730f..d1c840274f 100644 --- a/doc/pair_soft.html +++ b/doc/pair_soft.html @@ -25,7 +25,7 @@ pair_coeff 1 1 10.0 3.0
pair_style soft 2.5 pair_coeff * * 0.0 -variable prefactor equal 30.0*elapsed/10000 +variable prefactor equal ramp(0,30) fix 1 all adapt 1 pair soft a * * prefactor
Description: @@ -59,9 +59,9 @@ or more pair types over the course of a simulation, in which case pair_coeff settings for A must still be specified, but will be overridden. For example these commands will vary the prefactor A for all pairwise interactions from 0.0 at the beginning to 30.0 at the end -of a 10,000 step run: +of a run:
-variable prefactor equal 30.0*elapsed/10000 +variable prefactor equal ramp(0,30) fix 1 all adapt 1 pair soft a * * prefactorNote that a formula defined by an equal-style variable diff --git a/doc/pair_soft.txt b/doc/pair_soft.txt index 562ee0bdbb..aa6427acad 100644 --- a/doc/pair_soft.txt +++ b/doc/pair_soft.txt @@ -22,7 +22,7 @@ pair_coeff 1 1 10.0 3.0 :pre pair_style soft 2.5 pair_coeff * * 0.0 -variable prefactor equal 30.0*elapsed/10000 +variable prefactor equal ramp(0,30) fix 1 all adapt 1 pair soft a * * prefactor :pre [Description:] @@ -56,9 +56,9 @@ or more pair types over the course of a simulation, in which case pair_coeff settings for A must still be specified, but will be overridden. For example these commands will vary the prefactor A for all pairwise interactions from 0.0 at the beginning to 30.0 at the end -of a 10,000 step run: +of a run: -variable prefactor equal 30.0*elapsed/10000 +variable prefactor equal ramp(0,30) fix 1 all adapt 1 pair soft a * * prefactor :pre Note that a formula defined by an "equal-style variable"_variable.html diff --git a/doc/variable.html b/doc/variable.html index 79e591bf80..73f28858f7 100644 --- a/doc/variable.html +++ b/doc/variable.html @@ -34,7 +34,7 @@ x==y, x!=y, x
y, x>=y, x&&y, x||y math functions = sqrt(x), exp(x), ln(x), log(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), - ceil(x), floor(x), round(x) + ceil(x), floor(x), round(x), ramp(x,y) group functions = count(group), mass(group), charge(group), xcm(group,dim), vcm(group,dim), fcm(group,dim), bound(group,xmin), gyration(group), ke(group), @@ -257,7 +257,7 @@ references to other variables. Number 0.2, 100, 1.0e20, -15.4, etc 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 + Math functions sqrt(x), exp(x), ln(x), log(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), ceil(x), floor(x), round(x) Math functions sqrt(x), exp(x), ln(x), log(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), ceil(x), floor(x), round(x), ramp(x,y) 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) @@ -267,16 +267,18 @@ references to other variables. Atom values mass[i], type[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i] - Other variables v_name, v_name[i] Most of the formula elements generate scalar values. The exceptions -are those that represent a per-atom vector of values. These are the -atom vectors, compute references that represent a per-atom vector, fix -references that represent a per-atom vector, and variables that are -atom-style variables. +
Most of the formula elements produce a scalar value. A few produce a +per-atom vector of values. These are the atom vectors, compute +references that represent a per-atom vector, fix references that +represent a per-atom vector, and variables that are atom-style +variables. Math functions that operate on scalar values produce a +scalar value; math function that operate on per-atom vectors produce a +per-atom vector.
A formula for equal-style variables cannot use any formula element -that generates a per-atom vector. A formula for an atom-style -variable can use formula elements that produce either scalar values or -per-atom vectors. +that produces a per-atom vector. A formula for an atom-style variable +can use formula elements that produce either a scalar value or a +per-atom vector.
The thermo keywords allowed in a formula are those defined by the thermo_style custom command. Thermo keywords that @@ -293,10 +295,15 @@ values accessed by the thermo keyword must be current. See the discussion below about "Variable Accuracy".
Math operators are written in the usual way, where the "x" and "y" in -the examples above can be another section of the formula. 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 +the examples can themselves be arbitrarily complex formulas, as in the +examples above. In this syntax, "x" and "y" can be scalar values or +per-atom vectors. For example, "ke/natoms" is the division of two +scalars, where "y+z" is the sum of two per-atom vectors of y- and +z-coordinates. +
+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 "!="; @@ -319,19 +326,34 @@ whose properties satisy 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.
-Math functions can be specified as keywords followed by a -parenthesized argument, e.g. sqrt(v_ke). Note that ln() is the -natural log; log() is the base 10 log. The ceil(), floor(), and +
Math functions are specified as keywords followed by one or more +parenthesized arguments "x", "y", etc, each of which can themselves be +arbitrarily complex formulas. In this syntax, the arguments can +represent scalar values or per-atom vectors. For example, +"sqrt(natoms)" is the sqrt() of a scalar, where "sqrt(y*z)" is a +per-atom vector with each element being the sqrt() of the product of +two atom coordinates. +
+Most of the math functions perform obvious operations. The ln() is +the natural log; log() is the base 10 log. The ceil(), floor(), and round() operations are those in the C math library. Ceil() is the smallest integer not less than its argument. Floor() if the largest integer not greater than its argument. Round() is the nearest integer to its argument.
-Group functions take one or two arguments in a specific format. The -first argument is the group-ID. The dim argument, if it exists, is -x or y or z. The dir argument, if it exists, is xmin, -xmax, ymin, ymax, zmin, or zmax. The dimdim argument, if it -exists, is xx or yy or zz or xy or yz or xz. +
Ramp(x,y) uses the current timestep to generate a scalar value: +
+value = x + (y-x) * (timestep - startstep) / (stopstep - startstep) ++which is a value that ramps linear over the timesteps of a run between +x and y. The run began on startstep and will end on stopstep. +
+Group functions are specified as keywords followed by one or two +parenthesized arguments. The first argument is the group-ID. The +dim argument, if it exists, is x or y or z. The dir +argument, if it exists, is xmin, xmax, ymin, ymax, zmin, or +zmax. The dimdim argument, if it exists, is xx or yy or zz +or xy or yz or xz.
The group function count() is the number of atoms in the group. The group functions mass() and charge() are the total mass and charge of @@ -347,11 +369,11 @@ one of 6 components of the inertia tensor of the group of atoms around its center of mass. Omega() returns components of the angular velocity of the group of atoms around its center of mass.
-Region functions are exactly the same as group functions except they -take an extra argument which is the region ID. The function is -computed for all atoms that are in both the group and the region. If -the group is "all", then the only criteria for atom inclusion is that -it be in the region. +
Region functions are specified exactly the same way as group functions +except they take an extra argument which is the region ID. The +function is computed for all atoms that are in both the group and the +region. If the group is "all", then the only criteria for atom +inclusion is that it be in the region.
Atom values take a single integer argument I from 1 to N, where I is the an atom-ID, e.g. x[243], which means use the x coordinate of the diff --git a/doc/variable.txt b/doc/variable.txt index 66c8b14256..7c9cbde337 100644 --- a/doc/variable.txt +++ b/doc/variable.txt @@ -29,7 +29,7 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st x==y, x!=y, x
y, x>=y, x&&y, x||y math functions = sqrt(x), exp(x), ln(x), log(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), - ceil(x), floor(x), round(x) + ceil(x), floor(x), round(x), ramp(x,y) group functions = count(group), mass(group), charge(group), xcm(group,dim), vcm(group,dim), fcm(group,dim), bound(group,xmin), gyration(group), ke(group), @@ -250,7 +250,7 @@ references to other variables. Number: 0.2, 100, 1.0e20, -15.4, etc 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 -Math functions: sqrt(x), exp(x), ln(x), log(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), ceil(x), floor(x), round(x) +Math functions: sqrt(x), exp(x), ln(x), log(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), ceil(x), floor(x), round(x), ramp(x,y) 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), \ @@ -266,16 +266,18 @@ Compute references: c_ID, c_ID\[i\], c_ID\[i\]\[j\] Fix references: f_ID, f_ID\[i\], f_ID\[i\]\[j\] Other variables: v_name, v_name\[i\] :tb(s=:) -Most of the formula elements generate scalar values. The exceptions -are those that represent a per-atom vector of values. These are the -atom vectors, compute references that represent a per-atom vector, fix -references that represent a per-atom vector, and variables that are -atom-style variables. +Most of the formula elements produce a scalar value. A few produce a +per-atom vector of values. These are the atom vectors, compute +references that represent a per-atom vector, fix references that +represent a per-atom vector, and variables that are atom-style +variables. Math functions that operate on scalar values produce a +scalar value; math function that operate on per-atom vectors produce a +per-atom vector. A formula for equal-style variables cannot use any formula element -that generates a per-atom vector. A formula for an atom-style -variable can use formula elements that produce either scalar values or -per-atom vectors. +that produces a per-atom vector. A formula for an atom-style variable +can use formula elements that produce either a scalar value or a +per-atom vector. The thermo keywords allowed in a formula are those defined by the "thermo_style custom"_thermo_style.html command. Thermo keywords that @@ -292,10 +294,15 @@ values accessed by the thermo keyword must be current. See the discussion below about "Variable Accuracy". Math operators are written in the usual way, where the "x" and "y" in -the examples above can be another section of the formula. 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 +the examples can themselves be arbitrarily complex formulas, as in the +examples above. In this syntax, "x" and "y" can be scalar values or +per-atom vectors. For example, "ke/natoms" is the division of two +scalars, where "y+z" is the sum of two per-atom vectors of y- and +z-coordinates. + +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 "!="; @@ -318,19 +325,34 @@ whose properties satisy 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. -Math functions can be specified as keywords followed by a -parenthesized argument, e.g. sqrt(v_ke). Note that ln() is the -natural log; log() is the base 10 log. The ceil(), floor(), and +Math functions are specified as keywords followed by one or more +parenthesized arguments "x", "y", etc, each of which can themselves be +arbitrarily complex formulas. In this syntax, the arguments can +represent scalar values or per-atom vectors. For example, +"sqrt(natoms)" is the sqrt() of a scalar, where "sqrt(y*z)" is a +per-atom vector with each element being the sqrt() of the product of +two atom coordinates. + +Most of the math functions perform obvious operations. The ln() is +the natural log; log() is the base 10 log. The ceil(), floor(), and round() operations are those in the C math library. Ceil() is the smallest integer not less than its argument. Floor() if the largest integer not greater than its argument. Round() is the nearest integer to its argument. -Group functions take one or two arguments in a specific format. The -first argument is the group-ID. The {dim} argument, if it exists, is -{x} or {y} or {z}. The {dir} argument, if it exists, is {xmin}, -{xmax}, {ymin}, {ymax}, {zmin}, or {zmax}. The {dimdim} argument, if it -exists, is {xx} or {yy} or {zz} or {xy} or {yz} or {xz}. +Ramp(x,y) uses the current timestep to generate a scalar value: + +value = x + (y-x) * (timestep - startstep) / (stopstep - startstep) :pre + +which is a value that ramps linear over the timesteps of a run between +x and y. The run began on startstep and will end on stopstep. + +Group functions are specified as keywords followed by one or two +parenthesized arguments. The first argument is the group-ID. The +{dim} argument, if it exists, is {x} or {y} or {z}. The {dir} +argument, if it exists, is {xmin}, {xmax}, {ymin}, {ymax}, {zmin}, or +{zmax}. The {dimdim} argument, if it exists, is {xx} or {yy} or {zz} +or {xy} or {yz} or {xz}. The group function count() is the number of atoms in the group. The group functions mass() and charge() are the total mass and charge of @@ -346,11 +368,11 @@ one of 6 components of the inertia tensor of the group of atoms around its center of mass. Omega() returns components of the angular velocity of the group of atoms around its center of mass. -Region functions are exactly the same as group functions except they -take an extra argument which is the region ID. The function is -computed for all atoms that are in both the group and the region. If -the group is "all", then the only criteria for atom inclusion is that -it be in the region. +Region functions are specified exactly the same way as group functions +except they take an extra argument which is the region ID. The +function is computed for all atoms that are in both the group and the +region. If the group is "all", then the only criteria for atom +inclusion is that it be in the region. Atom values take a single integer argument I from 1 to N, where I is the an atom-ID, e.g. x\[243\], which means use the x coordinate of the