next up previous contents index
Next: Molecular Analysis Up: Vectors and Matrices Previous: Multiplying vectors and matrices   Contents   Index

Misc. functions and values

Several other terms are added to the vectors package. The first is the variable M_PI, which contains the value of pi.

Examples:
vmd > set M_PI
3.14159265358979323846
vmd > expr 90 * ($M_PI / 180)
1.5708

The functions trans_from_rot, trans_to_rot, trans_from_offset, and trans_to_offset are used to get or set a transformation matrix from either a 3x3 rotation matrix or offset vector. As currently designed, these assume there is no scaling in the matrix. The trans_from_offset is identical to transoffset and is present for completeness.

The last is find_rotation_value varname, which takes a variable name and extracts from the beginning of it those terms which describe an amount of rotation. The rest of the data in the variable remains, and the amount of rotation, in radians, is returned. This is used by those functions which need a rotation. The valid values are: a number, followed by one of rad, radian, or radians for a value in radians, the word pi to give the rotation in factors of pi, or one of deg, degree, or degrees for a value in degrees. If no units are given, the value is assumed to be in degrees.

Examples:

vmd > set a "180 deg north"
180 deg north
vmd > find_rotation_value a
3.14159
vmd > set a
north
vmd > set a "1 pi to eat"
1 pi to eat
vmd > find_rotation_value a
3.14159
vmd > set a
to eat
vmd > set a 45 
45
vmd > find_rotation_value a
0.785398
vmd > expr $M_PI * 3.0 / 2.0
4.71239
vmd > set a "4.71238 radians"
4.71238 radians
vmd > find_rotation_value a
4.71238


next up previous contents index
Next: Molecular Analysis Up: Vectors and Matrices Previous: Multiplying vectors and matrices   Contents   Index
vmd@ks.uiuc.edu