Shortcut: NORMALIZED_EUCLIDEAN_DISTANCE

Module refdist
Description Usage
Calculate the normalised euclidean distance between two points in CV space used in 0 tutorialsused in 0 eggs
output value type
the normalized euclidean distances between the input vectors scalar/vector

Further details and examples

Calculate the normalised euclidean distance between two points in CV space

If we have two n-dimensional vectors u and v and an n dimensional vector of inverse covariance values, a, we can calculate the normalised Euclidean distance between the two points as

d=ni=1ai(uivi)2

which can be expressed in matrix form as:

d2=(uv)Ta(uv)

where here is used to indicate the Hadamard product of the two vectors.

The inputs below shows an example where this is used to calculate the Normalized Euclidean distance between the instaneous values of some torsional angles and some reference values for these torsion. The inverse covriance values are provided in the constant value with label m. In this first example the input values are vectors:

Click on the labels of the actions for more information on what each action computes
tested on2.11
m: 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=0.1,0.2,0.3
c: 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,2,3
d: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMS1the pair of atom that we are calculating the distance between=1,2 ATOMS2the pair of atom that we are calculating the distance between=3,4 ATOMS3the pair of atom that we are calculating the distance between=5,6
dd: NORMALIZED_EUCLIDEAN_DISTANCECalculate the normalised euclidean distance between two points in CV space This action is a shortcut. More details ARG1The poin that we are calculating the distance from=c ARG2The point that we are calculating the distance to=d METRICThe inverse covariance matrix that should be used when calculating the distance=m
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=dd FILEthe name of the file on which to output these quantities=colvar

while this second example does the same thing but uses scalars in input.

Click on the labels of the actions for more information on what each action computes
tested on2.11
m: 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=0.1,0.2,0.3
c1: CONSTANTCreate a constant value that can be passed to actions This action has hidden defaults. More details VALUEthe single number that you would like to store=1
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
c2: CONSTANTCreate a constant value that can be passed to actions This action has hidden defaults. More details VALUEthe single number that you would like to store=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
c3: CONSTANTCreate a constant value that can be passed to actions This action has hidden defaults. More details VALUEthe single number that you would like to store=3
d3: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=5,6
dd: NORMALIZED_EUCLIDEAN_DISTANCECalculate the normalised euclidean distance between two points in CV space This action is a shortcut. More details ARG1The poin that we are calculating the distance from=c1,c2,c3 ARG2The point that we are calculating the distance to=d1,d2,d3 METRICThe inverse covariance matrix that should be used when calculating the distance=m
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=dd FILEthe name of the file on which to output these quantities=colvar

Calculating multiple distances

Suppose that we now have m reference configurations we can define the following m distances from these reference configurations:

d2j=(uvj)Ta(uvj)

Lets suppose that we put the m, n-dimensional (uvj) vectors in this expression into a n×m matrix, A, by using the DISPLACEMENT command. It is then straightforward to show that the d2j values in the above expression are the diagonal elements of the matrix product ATKA, where K is an n×mmatrixthatcontainsmcopiesoftheinversecovariancematrixa$ in its columns.

We can use this idea to calculate multiple NORMALIZED_EUCLIDEAN_DISTANCE values in the following inputs. This first example calculates the three distances between the instaneoues values of two torsions and three reference configurations.

Click on the labels of the actions for more information on what each action computes
tested on2.11
m: 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=0.1,0.2
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.25,1.3,-1.5
ref_phi: 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.91,-0.6,2.4

psi: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4 phi: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=13,14,15,16 dd: NORMALIZED_EUCLIDEAN_DISTANCECalculate the normalised euclidean distance between two points in CV space This action is a shortcut. More details ARG1The poin that we are calculating the distance from=psi,phi ARG2The point that we are calculating the distance to=ref_psi,ref_phi METRICThe inverse covariance matrix that should be used when calculating the distance=m PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=dd FILEthe name of the file on which to output these quantities=colvar

This section example calculates the three distances between a single reference value for the two torsions and three instances of this pair of torsions.

Click on the labels of the actions for more information on what each action computes
tested on2.11
m: 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=0.1,0.2
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.25
ref_phi: 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.91

psi: TORSIONCalculate one or multiple torsional angles. More details ATOMS1the four atoms involved in the torsional angle=1,2,3,4 ATOMS2the four atoms involved in the torsional angle=5,6,7,8 ATOMS3the four atoms involved in the torsional angle=9,10,11,12 phi: TORSIONCalculate one or multiple torsional angles. More details ATOMS1the four atoms involved in the torsional angle=13,14,15,16 ATOMS2the four atoms involved in the torsional angle=17,18,19,20 ATOMS3the four atoms involved in the torsional angle=21,22,23,24 dd: NORMALIZED_EUCLIDEAN_DISTANCECalculate the normalised euclidean distance between two points in CV space This action is a shortcut. More details ARG1The poin that we are calculating the distance from=psi,phi ARG2The point that we are calculating the distance to=ref_psi,ref_phi METRICThe inverse covariance matrix that should be used when calculating the distance=m PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=dd FILEthe name of the file on which to output these quantities=colvar

This final example then computes three distances between three pairs of torsional angles and threee reference values for these three values.

Click on the labels of the actions for more information on what each action computes
tested on2.11
m: 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=0.1,0.2
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.25,1.3,-1.5
ref_phi: 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.91,-0.6,2.4

psi: TORSIONCalculate one or multiple torsional angles. More details ATOMS1the four atoms involved in the torsional angle=1,2,3,4 ATOMS2the four atoms involved in the torsional angle=5,6,7,8 ATOMS3the four atoms involved in the torsional angle=9,10,11,12 phi: TORSIONCalculate one or multiple torsional angles. More details ATOMS1the four atoms involved in the torsional angle=13,14,15,16 ATOMS2the four atoms involved in the torsional angle=17,18,19,20 ATOMS3the four atoms involved in the torsional angle=21,22,23,24 dd: NORMALIZED_EUCLIDEAN_DISTANCECalculate the normalised euclidean distance between two points in CV space This action is a shortcut. More details ARG1The poin that we are calculating the distance from=psi,phi ARG2The point that we are calculating the distance to=ref_psi,ref_phi METRICThe inverse covariance matrix that should be used when calculating the distance=m PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=dd FILEthe name of the file on which to output these quantities=colvar

Syntax

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

Keyword Type Default Description
ARG1 compulsory none The poin that we are calculating the distance from
ARG2 compulsory none The point that we are calculating the distance to
METRIC compulsory none The inverse covariance matrix that should be used when calculating the distance
SQUARED optional false The squared distance should be calculated