Skip to content

Shortcut: PCAVARS

Module mapping
Description Usage
Projection on principal component eigenvectors or other high dimensional linear subspace used in 2 tutorialsused in 1 eggs

Details and examples

Projection on principal component eigenvectors or other high dimensional linear subspace

As discussed in the documenation for RMSD and the refdist module there are various different ways of calculating the distance between the instantaneous structure adopted by the system and some high-dimensional, reference configuration. The problem with all these methods, as one gets further and further from the reference configuration, the distance from it becomes a progressively poorer and poorer collective variable. This happens because the ``number" of structures at a distance from a reference configuration is proportional to in an dimensional space. Consequently, when is small the distance from the reference configuration may well be a good collective variable. However, when is large it is unlikely that the distance from the reference structure is a good CV. When the distance is large there will almost certainly be markedly different configurations that have the same CV value and hence barriers in transverse degrees of freedom.

For these reasons dimensionality reduction is often employed so a projection of a high-dimensional configuration in a lower dimensionality space is found using a function:

where here we have introduced some high-dimensional reference configuration . By far the simplest way to do this is to use some linear operator for . That is to say we find a low-dimensional projection by rotating the basis vectors using some linear algebra:

Here is the displacement from the refernece configuration in the high dimenisonal space, which you can calculate using the RMSD action or by simply calculating difference between the instaneous values for a collection of variables and the values of the variables for a particular reference configuration. is then a by matrix where is the dimensionality of the high dimensional space and is the dimensionality of the lower dimensional subspace. This matrix, , can be found by various means including principal component analysis (PCA) and normal mode analysis. In both these methods the rows of would be the principle eigenvectors of a square matrix. For PCA the covariance while for normal modes the Hessian.

Examples

The following input calculates a projection on a linear subspace where the displacements from the reference configuration are calculated using RMSD and TYPE=OPTIMAL. Consequently, both translation of the center of mass of the atoms and rotation of the reference frame are removed from the displacements that appear in the equatiosn above. The matrix and the reference configuration are specified in the pdb input file reference.pdb and the value of all projections (and the residual) are output to a file called colvar2.

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=regtest/mapping/rt-pca/reference.pdb
pca2: PCAVARSProjection on principal component eigenvectors or other high dimensional linear subspace This action is a shortcut. More details REFERENCEa pdb file containing the set of reference configurations=
regtest/mapping/rt-pca/reference.pdb
Click here to see an extract from this file.
×

FILE: regtest/mapping/rt-pca/reference.pdb

ATOM      2  CH3 ACE     1      12.932 -14.718  -6.016  1.00  1.00
ATOM      5  C   ACE     1      21.312  -9.928  -5.946  1.00  1.00
ATOM      9  CA  ALA     2      19.462 -11.088  -8.986  1.00  1.00
ATOM     13  HB2 ALA     2      21.112 -10.688 -12.476  1.00  1.00
ATOM     15  C   ALA     2      19.422   7.978 -14.536  1.00  1.00
ATOM     20 HH31 NME     3      20.122  -9.928 -17.746  1.00  1.00
ATOM     21 HH32 NME     3      18.572 -13.148 -16.346  1.00  1.00
END
REMARK TYPE=DIRECTION
ATOM      2  CH3 ACE     1      0.1414  0.3334 -0.0302  1.00  0.00
ATOM      5  C   ACE     1      0.0893 -0.1095 -0.1434  1.00  0.00
ATOM      9  CA  ALA     2      0.0207 -0.321   0.0321  1.00  0.00
ATOM     13  HB2 ALA     2      0.0317 -0.6085  0.0783  1.00  0.00
ATOM     15  C   ALA     2      0.1282 -0.4792  0.0797  1.00  0.00
ATOM     20 HH31 NME     3      0.0053 -0.465   0.0309  1.00  0.00
ATOM     21 HH32 NME     3     -0.1019 -0.4261 -0.0082  1.00  0.00
END
REMARK TYPE=DIRECTION
ATOM      2  CH3 ACE     1     -0.0380 -0.2736 -0.0003  1.00  0.00
ATOM      5  C   ACE     1     -0.0656 -0.2138  0.0075  1.00  0.00
ATOM      9  CA  ALA     2     -0.0286 -0.2116 -0.0579  1.00  0.00
ATOM     13  HB2 ALA     2     -0.0235 -0.2794 -0.0388  1.00  0.00
ATOM     15  C   ALA     2     -0.0512 -0.3078 -0.0076  1.00  0.00
ATOM     20 HH31 NME     3      0.0798 -0.2642 -0.1300  1.00  0.00
ATOM     21 HH32 NME     3      0.1136 -0.0846 -0.1385  1.00  0.00
END
TYPE the manner in which distances are calculated=OPTIMAL
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=pca2.* FILEthe name of the file on which to output these quantities=colvar2

As you can see from the example above, the reference configurations are specified using a pdb file. The first configuration that you provide is the reference configuration, which is referred to in the above expressions as . Subsequent configurations give the directions of row vectors that are contained in the matrix above. These directions are specified by giving a second configuration that describes the components of explicitly.

When you use an input like the one in the example above PLUMED assumes that the atoms for which RMSD displacements are being computed together form a molecule. A procedure akin to that in WHOLEMOLECULES is thus performed to ensure that any bonds that are broken by the periodic boundary conditions are reformed. If you would like to turn this feature off for any reason you add the NOPBC flag to the input line as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=regtest/mapping/rt-pca/reference.pdb
pca2: PCAVARSProjection on principal component eigenvectors or other high dimensional linear subspace This action is a shortcut. More details REFERENCEa pdb file containing the set of reference configurations=
regtest/mapping/rt-pca/reference.pdb
Click here to see an extract from this file.
×

FILE: regtest/mapping/rt-pca/reference.pdb

ATOM      2  CH3 ACE     1      12.932 -14.718  -6.016  1.00  1.00
ATOM      5  C   ACE     1      21.312  -9.928  -5.946  1.00  1.00
ATOM      9  CA  ALA     2      19.462 -11.088  -8.986  1.00  1.00
ATOM     13  HB2 ALA     2      21.112 -10.688 -12.476  1.00  1.00
ATOM     15  C   ALA     2      19.422   7.978 -14.536  1.00  1.00
ATOM     20 HH31 NME     3      20.122  -9.928 -17.746  1.00  1.00
ATOM     21 HH32 NME     3      18.572 -13.148 -16.346  1.00  1.00
END
REMARK TYPE=DIRECTION
ATOM      2  CH3 ACE     1      0.1414  0.3334 -0.0302  1.00  0.00
ATOM      5  C   ACE     1      0.0893 -0.1095 -0.1434  1.00  0.00
ATOM      9  CA  ALA     2      0.0207 -0.321   0.0321  1.00  0.00
ATOM     13  HB2 ALA     2      0.0317 -0.6085  0.0783  1.00  0.00
ATOM     15  C   ALA     2      0.1282 -0.4792  0.0797  1.00  0.00
ATOM     20 HH31 NME     3      0.0053 -0.465   0.0309  1.00  0.00
ATOM     21 HH32 NME     3     -0.1019 -0.4261 -0.0082  1.00  0.00
END
REMARK TYPE=DIRECTION
ATOM      2  CH3 ACE     1     -0.0380 -0.2736 -0.0003  1.00  0.00
ATOM      5  C   ACE     1     -0.0656 -0.2138  0.0075  1.00  0.00
ATOM      9  CA  ALA     2     -0.0286 -0.2116 -0.0579  1.00  0.00
ATOM     13  HB2 ALA     2     -0.0235 -0.2794 -0.0388  1.00  0.00
ATOM     15  C   ALA     2     -0.0512 -0.3078 -0.0076  1.00  0.00
ATOM     20 HH31 NME     3      0.0798 -0.2642 -0.1300  1.00  0.00
ATOM     21 HH32 NME     3      0.1136 -0.0846 -0.1385  1.00  0.00
END
NOPBC do not use periodic boundary conditions when computing this quantity TYPE the manner in which distances are calculated=OPTIMAL
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=pca2.* FILEthe name of the file on which to output these quantities=colvar2

Notice that the PCAVARS command is a shortcut. If you look at how the shortcut in the above input is expanded you should be able to see how the command works by calculating the RMSD displacement between the instantaneous and reference configuration and how those displacements are then projected on the eigenvector that was specified in the second frame of the pdb input above. Understanding the expanded version of this shortcut command allows you to recognise that you can project the displacement vector on any arbitrary vector. For example in the input below two reference structures are provided in the pdb file. PLUMED calculates the RMSD distance between these two reference configurations during setup and sets up a unit vector called eig that points along the director connecting the two RMSD structure. During the calculation the vector connecting the instantaneous configuration and the first of the two reference configurations in computed. This vector is then projected on the unit vector connecting the two initial structures:

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=regtest/mapping/rt-pca-two-frames/two-frames.pdb

# Read in two reference configuratioms from PDB file ref1: PDB2CONSTANTCreate a constant value from a PDB input file This action is a shortcut. More details REFERENCEa file in pdb format containing the reference structure=
regtest/mapping/rt-pca-two-frames/two-frames.pdb
Click here to see an extract from this file.
×

FILE: regtest/mapping/rt-pca-two-frames/two-frames.pdb

ATOM      5  CLP ALA     1      -1.819  -0.143   1.679  1.00  1.00
ATOM      6  OL  ALA     1      -1.177  -0.889   2.401  1.00  1.00
ATOM      7  NL  ALA     1      -1.313   0.341   0.529  1.00  1.00
ATOM      8  HL  ALA     1      -1.845   0.961  -0.011  1.00  1.00
ATOM      9  CA  ALA     1      -0.003  -0.019   0.021  1.00  1.00
ATOM     10  HA  ALA     1       0.205  -1.051   0.259  1.00  1.00
ATOM     11  CB  ALA     1       0.009   0.135  -1.509  1.00  1.00
ATOM     15  CRP ALA     1       1.121   0.799   0.663  1.00  1.00
ATOM     16  OR  ALA     1       1.723   1.669   0.043  1.00  1.00
ATOM     17  NR  ALA     1       1.423   0.519   1.941  1.00  1.00
ATOM     18  HR  ALA     1       0.873  -0.161   2.413  1.00  1.00
ATOM     19  CR  ALA     1       2.477   1.187   2.675  1.00  1.00
END
ATOM      5  CLP ALA     1      -1.941   1.459   0.447  1.00  1.00
ATOM      6  OL  ALA     1      -1.481   2.369  -0.223  1.00  1.00
ATOM      7  NL  ALA     1      -1.303   0.291   0.647  1.00  1.00
ATOM      8  HL  ALA     1      -1.743  -0.379   1.229  1.00  1.00
ATOM      9  CA  ALA     1      -0.011  -0.077   0.099  1.00  1.00
ATOM     10  HA  ALA     1       0.155  -1.099   0.417  1.00  1.00
ATOM     11  CB  ALA     1       0.001  -0.097  -1.439  1.00  1.00
ATOM     15  CRP ALA     1       1.191   0.673   0.683  1.00  1.00
ATOM     16  OR  ALA     1       2.015   0.103   1.375  1.00  1.00
ATOM     17  NR  ALA     1       1.303   1.983   0.393  1.00  1.00
ATOM     18  HR  ALA     1       0.553   2.411  -0.109  1.00  1.00
ATOM     19  CR  ALA     1       2.395   2.811   0.843  1.00  1.00
END
NUMBER if there are multiple structures in the pdb file you can specify that you want the RMSD from a specific structure by specifying its place in the file here=1
ref1T: TRANSPOSECalculate the transpose of a matrix More details ARGthe label of the vector or matrix that should be transposed=ref1 ref2: PDB2CONSTANTCreate a constant value from a PDB input file This action is a shortcut. More details REFERENCEa file in pdb format containing the reference structure=
regtest/mapping/rt-pca-two-frames/two-frames.pdb
Click here to see an extract from this file.
×

FILE: regtest/mapping/rt-pca-two-frames/two-frames.pdb

ATOM      5  CLP ALA     1      -1.819  -0.143   1.679  1.00  1.00
ATOM      6  OL  ALA     1      -1.177  -0.889   2.401  1.00  1.00
ATOM      7  NL  ALA     1      -1.313   0.341   0.529  1.00  1.00
ATOM      8  HL  ALA     1      -1.845   0.961  -0.011  1.00  1.00
ATOM      9  CA  ALA     1      -0.003  -0.019   0.021  1.00  1.00
ATOM     10  HA  ALA     1       0.205  -1.051   0.259  1.00  1.00
ATOM     11  CB  ALA     1       0.009   0.135  -1.509  1.00  1.00
ATOM     15  CRP ALA     1       1.121   0.799   0.663  1.00  1.00
ATOM     16  OR  ALA     1       1.723   1.669   0.043  1.00  1.00
ATOM     17  NR  ALA     1       1.423   0.519   1.941  1.00  1.00
ATOM     18  HR  ALA     1       0.873  -0.161   2.413  1.00  1.00
ATOM     19  CR  ALA     1       2.477   1.187   2.675  1.00  1.00
END
ATOM      5  CLP ALA     1      -1.941   1.459   0.447  1.00  1.00
ATOM      6  OL  ALA     1      -1.481   2.369  -0.223  1.00  1.00
ATOM      7  NL  ALA     1      -1.303   0.291   0.647  1.00  1.00
ATOM      8  HL  ALA     1      -1.743  -0.379   1.229  1.00  1.00
ATOM      9  CA  ALA     1      -0.011  -0.077   0.099  1.00  1.00
ATOM     10  HA  ALA     1       0.155  -1.099   0.417  1.00  1.00
ATOM     11  CB  ALA     1       0.001  -0.097  -1.439  1.00  1.00
ATOM     15  CRP ALA     1       1.191   0.673   0.683  1.00  1.00
ATOM     16  OR  ALA     1       2.015   0.103   1.375  1.00  1.00
ATOM     17  NR  ALA     1       1.303   1.983   0.393  1.00  1.00
ATOM     18  HR  ALA     1       0.553   2.411  -0.109  1.00  1.00
ATOM     19  CR  ALA     1       2.395   2.811   0.843  1.00  1.00
END
NUMBER if there are multiple structures in the pdb file you can specify that you want the RMSD from a specific structure by specifying its place in the file here=2
# Calculate the displacement vector that takes you from ref1 to ref2 eigu: RMSDCalculate the RMSD with respect to a reference structure. More details ARGinstead of using the REFERENCE option you can use this action to specify the labels of two actions that you are calculating the RMSD between=ref1T,ref2 DISPLACEMENT Calculate the vector of displacements instead of the length of this vector TYPE the manner in which RMSD alignment is performed=OPTIMAL # Normalise the reference vector eigu2: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=eigu.disp FUNCthe function you wish to evaluate=x*x PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO eign2: SUMCalculate the sum of the arguments More details ARGthe vector/matrix/grid whose elements shuld be added together=eigu2 PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO eig: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=eigu.disp,eign2 FUNCthe function you wish to evaluate=x/sqrt(y) PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO eigT: TRANSPOSECalculate the transpose of a matrix More details ARGthe label of the vector or matrix that should be transposed=eig # Everything prior to this point is only done in setup. From here onwards we have the commands that are done during the main calculate loop.
# Calculate the RMSD displacement between the instaneous structure and the first reference structure rmsd: RMSDCalculate the RMSD with respect to a reference structure. This action is a shortcut. More details REFERENCEa file in pdb format containing the reference structure and the atoms involved in the CV=
regtest/mapping/rt-pca-two-frames/two-frames.pdb
Click here to see an extract from this file.
×

FILE: regtest/mapping/rt-pca-two-frames/two-frames.pdb

ATOM      5  CLP ALA     1      -1.819  -0.143   1.679  1.00  1.00
ATOM      6  OL  ALA     1      -1.177  -0.889   2.401  1.00  1.00
ATOM      7  NL  ALA     1      -1.313   0.341   0.529  1.00  1.00
ATOM      8  HL  ALA     1      -1.845   0.961  -0.011  1.00  1.00
ATOM      9  CA  ALA     1      -0.003  -0.019   0.021  1.00  1.00
ATOM     10  HA  ALA     1       0.205  -1.051   0.259  1.00  1.00
ATOM     11  CB  ALA     1       0.009   0.135  -1.509  1.00  1.00
ATOM     15  CRP ALA     1       1.121   0.799   0.663  1.00  1.00
ATOM     16  OR  ALA     1       1.723   1.669   0.043  1.00  1.00
ATOM     17  NR  ALA     1       1.423   0.519   1.941  1.00  1.00
ATOM     18  HR  ALA     1       0.873  -0.161   2.413  1.00  1.00
ATOM     19  CR  ALA     1       2.477   1.187   2.675  1.00  1.00
END
ATOM      5  CLP ALA     1      -1.941   1.459   0.447  1.00  1.00
ATOM      6  OL  ALA     1      -1.481   2.369  -0.223  1.00  1.00
ATOM      7  NL  ALA     1      -1.303   0.291   0.647  1.00  1.00
ATOM      8  HL  ALA     1      -1.743  -0.379   1.229  1.00  1.00
ATOM      9  CA  ALA     1      -0.011  -0.077   0.099  1.00  1.00
ATOM     10  HA  ALA     1       0.155  -1.099   0.417  1.00  1.00
ATOM     11  CB  ALA     1       0.001  -0.097  -1.439  1.00  1.00
ATOM     15  CRP ALA     1       1.191   0.673   0.683  1.00  1.00
ATOM     16  OR  ALA     1       2.015   0.103   1.375  1.00  1.00
ATOM     17  NR  ALA     1       1.303   1.983   0.393  1.00  1.00
ATOM     18  HR  ALA     1       0.553   2.411  -0.109  1.00  1.00
ATOM     19  CR  ALA     1       2.395   2.811   0.843  1.00  1.00
END
NUMBER if there are multiple structures in the pdb file you can specify that you want the RMSD from a specific structure by specifying its place in the file here=1 TYPE the manner in which RMSD alignment is performed=OPTIMAL DISPLACEMENT Calculate the vector of displacements instead of the length of this vector SQUARED This should be setted if you want MSD instead of RMSD
# Project the displacement computed above on the director of the vector that connects reference structure ref1 to refeference structure ref2 pca: MATRIX_VECTOR_PRODUCTCalculate the product of the matrix and the vector More details ARGthe label for the matrix and the vector/scalar that are being multiplied=eigT,rmsd.disp # Print the final CV to a file PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=pca FILEthe name of the file on which to output these quantities=colvar

You can also project vectors of differences of arguments on reference vectors. For example, the input below can be used to look at the projection of the vector connecting the instantanous configuraiton to a reference point in CV on a reference vector that has been specified in the PDB file.

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=regtest/mapping/rt-pca-args/epath.pdb

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 d3: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=5,6 pca: PCAVARSProjection on principal component eigenvectors or other high dimensional linear subspace This action is a shortcut and it has hidden defaults. More details ARGif there are arguments to be used specify them here=d1,d2,d3 REFERENCEa pdb file containing the set of reference configurations=
regtest/mapping/rt-pca-args/epath.pdb
Click here to see an extract from this file.
×

FILE: regtest/mapping/rt-pca-args/epath.pdb

REMARK d1=0.1221 d2=0.0979 d3=0.1079
END
REMARK d1=0.078811 d2=-0.945732 d3=-0.315244
END
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=pca_eig-1,pca_residual FILEthe name of the file on which to output these quantities=colvar

The first set of argument values in this input file are the reference values for the arguments. The second any subsquent sets of arguments give the coefficients that should be used when constructing linear combinations.

Notice, lastly, that you can also use a combination of argument values and atomic positions when specifying the reference configuration and the reference directions. If you are doing something this complicated, however, you are perhaps better working with the PLUMED input directly rather than this shortcut as you will need to take special measures to ensure that all your CVs are in the same units.

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 if there are arguments to be used specify them here

Output components

This action calculates the values in the following table. These values can be referenced elsewhere in the input by using this Action's label followed by a dot and the name of the value required from the list below.

Name Type Description
eig vector the projections on the eigenvalues
residual scalar the residual distance that is not projected on any of the eigenvalues

Full list of keywords

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

Keyword Type Default Description
ARG input none if there are arguments to be used specify them here
REFERENCE compulsory none a pdb file containing the set of reference configurations
TYPE compulsory OPTIMAL-FAST the manner in which distances are calculated
NOPBC optional false do not use periodic boundary conditions when computing this quantity