Action: QUATERNION_BOND_PRODUCT_MATRIX
| Module | crystdistrib |
|---|---|
| Description | Usage |
| Calculate the product between a matrix of quaternions and the bonds connecting molecules |
Details and examples
Calculate the product between a matrix of quaternions and the bonds connecting molecules
Calculate the product of a quaternion, times a vector, times the conjugate of the quaternion. Geometrically, this is the given vector projected onto the coordinate system defined by the quaternion. For context, the QUATERNION action defines an orthogonal coordinate frame given 3 atoms (i.e. one can define a coordinate system based on the structure of a given molecule). This action can then project a vector from the given molecular frame, toward another molecule, essentially pointing toward molecule 2, from the perspective of molecule 1. See QUATERNION for information about the molecular coordinate frame. Given a quaternion centered on molecule 1 , and the vector connecting molecule 1, and some other molecule 2, , the following calculation is performed:
where the overline denotes the quaternion conjugate. Internally, the vector is treated as a quaternion with zero real part. Such a multiplication will always yield another quaternion with zero real part, and the results can be interpreted as an ordinary vector in Nevertheless, this action has four components, the first of which, w, will always be entirely zeros. Finally, the resulting vector is normalized within the action, and the real length can be returned by multiplying each component by the norm of the vector given to the action. The quaternion should be a vector, and the distances a matrix.
In this example, 3 quaternion frames are calculated, and multiplied element-wise onto a distance matrix, yielding 9 vectors overall.
#calculate the quaternion frames for 3 molecules quat: QUATERNIONCalculate unit quaternions for molecules. More details ATOMS1the three atom that we are using to calculate the quaternion=1,2,3 ATOMS2the three atom that we are using to calculate the quaternion=4,5,6 ATOMS3the three atom that we are using to calculate the quaternion=7,8,9 #also find the distance between the 3 origins of the molecule frames c1: DISTANCE_MATRIXCalculate a matrix of distances between atoms. This action has hidden defaults. More details GROUPthe atoms for which you would like to calculate the adjacency matrix=1,4,7 CUTOFF ignore distances that have a value larger than this cutoff=100.0 COMPONENTS also calculate the components of the vector connecting the atoms in the contact matrix qp: QUATERNION_BOND_PRODUCT_MATRIXCalculate the product between a matrix of quaternions and the bonds connecting molecules More details ARGthis action takes 8 arguments=quat.*,c1.* #this is now a matrix showing how each molecule is oriented in 3D space #relative to eachother's origins #now use in a simple collective variable ops: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=qp.* VARthe names to give each of the arguments in the function=w,i,j,k FUNCthe function you wish to evaluate=w+i+j+k PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO #w could have been ignored because it is always zero.
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 | this action takes 8 arguments |
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 |
|---|---|---|
| w | matrix | the real component of quaternion |
| i | matrix | the i component of the quaternion |
| j | matrix | the j component of the quaternion |
| k | matrix | the k component of the quaternion |
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 | this action takes 8 arguments |
| SERIAL | optional | false | do the calculation in serial. Further information about this flag can be found here. |
| USEGPU | optional | false | run this calculation on the GPU. Further information about this flag can be found here. |