Shortcut: DIFFERENCE

Module refdist
Description Usage
Calculate the differences between two scalars or vectors used in 1 tutorialsused in 0 eggs
output value type
a function that measures the difference scalar/vector

Input

The arguments that serve as the input for this action are specified using one or more of the keywords in the following table.

Keyword Type Description
ARG scalar/vector/matrix the values input to this function

Further details and examples

Calculate the differences between two scalars or vectors

This action can be used to calculate the difference between two values. For example, if we want to calculate the difference between the distances between atoms 1 and 2 and 3 and 4 we can use an input like the one shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
d2: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=3,4
diff: DIFFERENCECalculate the differences between two scalars or vectors More details ARGthe values input to this function=d1,d2
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=diff FILEthe name of the file on which to output these quantities=colvar

At first sight this action appears pointless as you can achieve the same result with the following input:

Click on the labels of the actions for more information on what each action computes
tested on2.11
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
d2: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=3,4
diff: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=d1,d2 FUNCthe function you wish to evaluate=x-y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=diff FILEthe name of the file on which to output these quantities=colvar

However, this second example will not give an equivalent result to the following input:

Click on the labels of the actions for more information on what each action computes
tested on2.11
t1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
t2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=5,6,7,8
diff: DIFFERENCECalculate the differences between two scalars or vectors More details ARGthe values input to this function=t1,t2
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=diff FILEthe name of the file on which to output these quantities=colvar

as the CUSTOM command cannot caclulate differences between periodic input variables. In this case you have to use DIFFERENCE to ensure that the periodic boundary conditions are applied when the final difference is calculated.

Difference from reference value/s

The DIFFERENCE command is frequently used to determine the difference between the instantaneous value of a quantity and a reference value as illustrated in the example below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
ref_psi: CONSTANTCreate a constant value that can be passed to actions This action has hidden defaults. More details VALUESthe numbers that are in your constant value=2.25029540
t: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
diff: DIFFERENCECalculate the differences between two scalars or vectors More details ARGthe values input to this function=t,ref_psi
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=diff FILEthe name of the file on which to output these quantities=colvar

You can also use this action to calculate the difference between the instaneous values of a vector of quantities and a reference vector as illustrated in the example below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
ref: CONSTANTCreate a constant value that can be passed to actions This action has hidden defaults. More details VALUESthe numbers that are in your constant value=1.387980,1.126120,1.269380,1.321120,1.212420
d: DISTANCESCalculate the distances between multiple piars of atoms This action is a shortcut. More details ATOMS1the pairs of atoms that you would like to calculate the angles for=1,2 ATOMS2the pairs of atoms that you would like to calculate the angles for=3,4 ATOMS3the pairs of atoms that you would like to calculate the angles for=5,6 ATOMS4the pairs of atoms that you would like to calculate the angles for=7,8 ATOMS5the pairs of atoms that you would like to calculate the angles for=9,10
diff: DIFFERENCECalculate the differences between two scalars or vectors More details ARGthe values input to this function=d,ref
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=diff FILEthe name of the file on which to output these quantities=colvar

The output in this case is a five dimensional vector. Each element of this vector contains the difference between the corresponding elements of the two input vectors.

Notice that you cannot use a mixture of scalars and vectors in the input for this action. Only two values can be input to this action and these two input values must have the same rank and the same number of elements.

Syntax

The following table describes the keywords and options that can be used with this action

Keyword Type Default Description
ARG input none the values input to this function