Action: FLATTEN
Module | valtools |
---|---|
Description | Usage |
Convert a matrix into a vector | |
output value | type |
a vector containing all the elements of the input matrix | 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 | matrix | the label for the matrix that you would like to flatten to a vector |
Further details and examples
Convert a matrix into a vector
This action can be used to convert an input matrix to a vector. The input matrix is flattened in row-major order so if the input matrix is N×MtheoutputvectorhasN\times Melements.ThefirstMoftheseelementscontainthefirstrowoftheinputmatrix,thesecondM$ contain the second row of the input matrix and so on.
The following example illustrates how we can convert a 5×5 contact matrix into a vector with 25 elements:
c1CONTACT_MATRIXAdjacency matrix in which two atoms are adjacent if they are within a certain cutoff. More details GROUPspecifies the list of atoms that should be assumed indistinguishable=1,2,3,4,5 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} f : FLATTENConvert a matrix into a vector More details ARGthe label for the matrix that you would like to flatten to a vector=c1 PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=f 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 for the matrix that you would like to flatten to a vector |
NUMERICAL_DERIVATIVES | optional | false | calculate the derivatives for these quantities numerically |