switchingfunction

Functions that measure whether values are less than a certain quantity. Functions that measure whether values are less than a certain quantity.

Switching functions \(s(r)\) take a minimum of one input parameter \(d_0\). For \(r \le d_0 \quad s(r)=1.0\) while for \(r > d_0\) the function decays smoothly to 0. The various switching functions available in plumed differ in terms of how this decay is performed.

Where there is an accepted convention in the literature (e.g. COORDINATION) on the form of the switching function we use the convention as the default. However, the flexibility to use different switching functions is always present generally through a single keyword. This keyword generally takes an input with the following form:

KEYWORD={TYPE <list of parameters>}

The following table contains a list of the various switching functions that are available in plumed 2 together with an example input.

TYPE FUNCTION EXAMPLE INPUT DEFAULT PARAMETERS
RATIONAL \( s(r)=\frac{ 1 - \left(\frac{ r - d_0 }{ r_0 }\right)^{n} }{ 1 - \left(\frac{ r - d_0 }{ r_0 }\right)^{m} } \) {RATIONAL R_0= \(r_0\) D_0= \(d_0\) NN= \(n\) MM= \(m\)} \(d_0=0.0\), \(n=6\), \(m=12\)
EXP \( s(r)=\exp\left(-\frac{ r - d_0 }{ r_0 }\right) \) {EXP R_0= \(r_0\) D_0= \(d_0\)} \(d_0=0.0\)
GAUSSIAN \( s(r)=\exp\left(-\frac{ (r - d_0)^2 }{ 2r_0^2 }\right) \) {GAUSSIAN R_0= \(r_0\) D_0= \(d_0\)} \(d_0=0.0\)
SMAP \( s(r) = \left[ 1 + ( 2^{a/b} -1 )\left( \frac{r-d_0}{r_0} \right)^a \right]^{-b/a} \) {SMAP R_0= \(r_0\) D_0= \(d_0\) A= \(a\) B= \(b\)} \(d_0=0.0\)
CUBIC \( s(r) = (y-1)^2(1+2y) \qquad \textrm{where} \quad y = \frac{r - r_1}{r_0-r_1} \) {CUBIC D_0= \(r_1\) D_MAX= \(r_0\)}
TANH \( s(r) = 1 - \tanh\left( \frac{ r - d_0 }{ r_0 } \right) \) {TANH R_0= \(r_0\) D_0= \(d_0\)}

For all the switching functions in the above table one can also specify a further (optional) parameter using the parameter keyword D_MAX to assert that for \(r>d_{\textrm{max}}\) the switching function can be assumed equal to zero. In this case the function is brought smoothly to zero by stretching and shifting it.

KEYWORD={RATIONAL R_0=1 D_MAX=3}

the resulting switching function will be \( s(r) = \frac{s'(r)-s'(d_{max})}{s'(0)-s'(d_{max})} \) where \( s'(r)=\frac{1-r^6}{1-r^{12}} \) Since PLUMED 2.2 this is the default. The old behavior (no stretching) can be obtained with the NOSTRETCH flag. The NOSTRETCH keyword is only provided for backward compatibility and might be removed in the future. Similarly, the STRETCH keyword is still allowed but has no effect.

Notice that switching functions defined with the simplified syntax are never stretched for backward compatibility. This might change in the future.