Functions

When performing biased dynamics or analyzing a trajectory you may wish to analyze/bias the value of some function of a set of collective variables rather than the values of the collective variables directly. You can do this with PLUMED by using any one of the following list of functions.

Notice that in many functions you should explicitly say to PLUMED whether the result is a periodic variable or not using the keyword PERIODIC. This is crucial to allow a variable to be properly based. To know if a function is periodic of not you should answer to the following question:

  • Can my function change with a discontinuity when I move my atoms in a continuous manner?

In case the answer is no, than you should use PERIODIC=NO. In case the answer is yes, then you should consider the following question:

  • Are the values of the function at the discontinuity always the same or do they change?

In case the answer is that they are the same, you should use PERIODIC=A,B where A is the smallest value and B is the largest value. In case the answer is that the values at the discontinuity are not always the same, then you cannot construct a variable that can be biased with PLUMED. Consider the following examples:

Click on the labels of the actions for more information on what each action computes
tested on master




BESSEL Calculate the value of a Bessel function.
BESSEL_SCALAR Calculate the value of a Bessel function.
BESSEL_VECTOR Calculate the bessel function for all the elements in a vector
BETWEEN Use a switching function to determine how many of the input variables are within a certain range.
BETWEEN_VECTOR Use a switching function to determine how many of the input components are within a certain range
COMBINE Calculate a polynomial combination of a set of other variables.
COMBINE_SCALAR Calculate a polynomial combination of a set of other variables.
COMBINE_VECTOR Add together the elements of a set of vectors elementwise
CUSTOM Calculate a combination of variables using a custom expression.
CUSTOM_SCALAR Calculate a function of a set of input scalars
CUSTOM_VECTOR Calculate a function of a set of input vectors elementwise
DIFFERENCE Calculate the differences between two scalars
DIFFERENCE_SCALAR Calculate the differences between two scalars
DIFFERENCE_VECTOR Calculate the differences between the elements of two vectors
ENSEMBLE Calculates the replica averaging of a collective variable over multiple replicas.
FLATTEN Convert a matrix into a vector
FUNCPATHGENERAL This function calculates path collective variables (PCVs) using an arbitrary combination of collective variables.
FUNCPATHMSD This function calculates path collective variables.
FUNCSUMHILLS This function is intended to be called by the command line tool sum_hills. It is meant to integrate a HILLS file or an HILLS file interpreted as a histogram in a variety of ways. It is, therefore, not expected that you use this during your dynamics (it will crash!)
HIGHEST This function can be used to find the highest colvar by magnitude in a set.
KERNEL Use a switching function to determine how many of the input variables are less than a certain cutoff.
LESS_THAN Use a switching function to determine how many of the input variables are less than a certain cutoff.
LESS_THAN_VECTOR Use a switching function to determine how many components of the vector are less than a certain cutoff.
LOCALENSEMBLE Calculates the average over multiple arguments.
LOWEST This function can be used to find the lowest colvar by magnitude in a set.
MAHALANOBIS_DISTANCE Calculate the mahalanobis distance between two points in CV space
MATHEVAL An alias to the CUSTOM function that can also be used to calaculate combinations of variables using a custom expression.
MATHEVAL_SCALAR Calculate a function of a set of input scalars
MATHEVAL_VECTOR Calculate a function of a set of input vectors elementwise
MATRIX_PRODUCT_DIAGONAL Calculate the product of two matrices and return a vector that contains the diagonal elements of the ouptut vector
MOMENTS Calculate the moments of the distribution of input quantities
MOMENTS_SCALAR Calculate the moments of the distribution of input quantities
MOMENTS_VECTOR Calculate the moments of the distribution of input vectors
MORE_THAN Use a switching function to determine how many of the input variables are more than a certain cutoff.
MORE_THAN_VECTOR Use a switching function to determine how many of elements in the input vector are more than a certain cutoff.
NORMALIZED_EUCLIDEAN_DISTANCE Calculate the normalised euclidean distance between two points in CV space
PIECEWISE Compute a piece wise straight line through its arguments that passes through a set of ordered control points.
PIECEWISE_SCALAR Compute a piece wise straight line through its arguments that passes through a set of ordered control points.
PRODUCT Calculate the product of the input quantities
PYTHONFUNCTION Define collective variables in the Python language.
SORT This function can be used to sort colvars according to their magnitudes.
SORT_SCALAR Sort the input scalars in a vector according to their magnitudes
SORT_VECTOR Sort the elements in a vector according to their magnitudes
STATS Calculates statistical properties of a set of collective variables with respect to a set of reference values.

In addition to the keywords above, by enabling optional modules you can access to the following keywords:

PYTORCH_MODEL (from PYTORCH module) Load a PyTorch model compiled with TorchScript.
SELECT (from PLUMED-ISDB module) Selects an argument based on the value of a SELECTOR.