Action: TRANSPOSE

Module matrixtools
Description Usage
Calculate the transpose of a matrix used in 1 tutorialsused in 2 eggs
output value type
the transpose of the input matrix vector/matrix

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 vector/matrix the label of the vector or matrix that should be transposed

Further details and examples

Calculate the transpose of a matrix

This action takes a matrix in input and calculates the input matrix's tranpose. The following example shows how you can use this to calculate coordination numbers of species A with species B and vice versa.

Click on the labels of the actions for more information on what each action computes
tested on2.11
# Calculate the contact matrix between the two groups
c1: CONTACT_MATRIXAdjacency matrix in which two atoms are adjacent if they are within a certain cutoff. More details GROUPAwhen you are calculating the adjacency matrix between two sets of atoms this keyword is used to specify the atoms along with the keyword GROUPB=1-10 GROUPBwhen you are calculating the adjacency matrix between two sets of atoms this keyword is used to specify the atoms along with the keyword GROUPA=11-30 SWITCHthe input for the switching function that acts upon the distance between each pair of atoms. Options for this keyword are explained in the documentation for LESS_THAN.={RATIONAL R_0=0.1}
# Calculate the cooordination numbers for the atoms in group A by multiplying by a vector of ones
onesB: ONESCreate a constant vector with all elements equal to one This action is a shortcut. More details SIZEthe number of ones that you would like to create=20
coordA: 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=c1,onesB
# Transpose the contact matrix
c1T: TRANSPOSECalculate the transpose of a matrix More details ARGthe label of the vector or matrix that should be transposed=c1
# Calculate the coordination number for the atoms in group B by multiplying the transpose by a vector of ones
onesA: ONESCreate a constant vector with all elements equal to one This action is a shortcut. More details SIZEthe number of ones that you would like to create=10
coordB: 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=c1T,onesA
# Output the two vectors of coordination numbers to a file
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=coordA,coordB FILEthe name of the file on which to output these quantities=colvar

Another useful example where the transpose can be used is shown below. In this input the DISTANCE command is used to calculate the orientation of a collection of molecules. We then can then use the VSTACK, TRANSPOSE and the MATRIX_PRODUCT commands to calculate the dot products between all these vectors

Click on the labels of the actions for more information on what each action computes
tested on2.11
# Calculate the vectors connecting these three pairs of atoms
d: DISTANCECalculate the distance/s between pairs of atoms. More details COMPONENTS calculate the x, y and z components of the distance separately and store them as label 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
# Construct a matrix that contains all the components of the vectors calculated
v: VSTACKCreate a matrix by stacking vectors together More details ARGthe values that you would like to stack together to construct the output matrix=d.x,d.y,d.z
# Transpose v
vT: TRANSPOSECalculate the transpose of a matrix More details ARGthe label of the vector or matrix that should be transposed=v
# And now calculate the 3x3 matrix of dot products
m: MATRIX_PRODUCTCalculate the product of two matrices More details ARGthe label of the two matrices from which the product is calculated=v,vT
# And output the matrix product to a file
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=m 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
ARG input none the label of the vector or matrix that should be transposed
MATRIX optional not used the input matrix (can use ARG instead)