## VMD-L Mailing List

**From:** *poker_at_physics.usyd.edu.au*

**Date:** Wed Oct 21 2009 - 03:26:59 CDT

**Next message:**Axel Kohlmeyer: "Re: Atom sorting according to resid"**Previous message:**poker_at_physics.usyd.edu.au: "Direct manipulation of the camera"**In reply to:**poker_at_physics.usyd.edu.au: "Direct manipulation of the camera"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]

Don't worry about it too much; I have the solution now.

thanks,

P.

= = = (the script) = = =puts "This proc will rotate your molecule in the

viewer via the coordinate axis and not camera axis. Note that visual axes are

not rotated by direct mainpulations."

puts "Usage: coord_rot \$axis \$deg. Axis is either 0,1,2 or x,y,z. Deg is the

rotation in degrees, conventionally clockwise."

puts "Usage: coord_rot \$axis \$deg \$step. Rotates the molecule over \$deg by

steps of \$step degs. NB: this is similar to \"rotate z by 360 1\", although

you cannot interact with the tcl interface."

proc coord_rot {axis deg {step 0}} {

if { $axis=="x"} { set axis 0}

if { $axis=="y"} { set axis 1}

if { $axis=="z"} { set axis 2}

if { [expr $deg*$step] < 0 } {

puts "Steps and Degrees opposing. Will exit due to infinite loop!"

return

}

#Obtains the rotation matrix of the camera relative to the coordinate axes.

#this matrix represents the vectors of the coordinate axes in the camera fram.

set R [expr [molinfo top get rotate_matrix]]

#Grab the axis of interest.

set e3 [lrange [lindex [transtranspose $R] $axis] 0 2]

if { $step==0 } {

#Set the rotation about said axis, and apply back to the rotational matrix.

set M [trans axis $e3 $deg deg]

set R [transmult $M $R]

molinfo top set rotate_matrix [list $R]

} else {

#similar version looping over each step.

set i $step

while { abs($i) < abs($deg)} {

set M [trans axis $e3 $step deg]

set R [transmult $M $R]

molinfo top set rotate_matrix [list $R]

display update ui

set i [expr $i + $step]

}

}

}

Quoting poker_at_physics.usyd.edu.au:

*> I would like to make an animation with the camera rotating around the
*

*> molecule's
*

*> z-axis (and not its own axis).
*

*>
*

*> I've just checked the two camera navigation plugins and have a few
*

*> questions:
*

*>
*

*> ====
*

*> # R G M iG -> rotates around the REAL Z axis going through origin
*

*>
*

*> # puts "C = [lindex [molinfo top get center_matrix] 0]"
*

*> # puts "R = [lindex [molinfo top get rotate_matrix] 0]"
*

*> # puts "S = [lindex [molinfo top get scale_matrix ] 0]"
*

*> # puts "T = [lindex [molinfo top get global_matrix ] 0]"
*

*> ====
*

*> > R G M iG ...this line sounds like what I want to do, is it a series of
*

*> matrix
*

*> multiplications, with G as the global_matrix ???
*

*>
*

*> What is the global_matrix in this, exactly?
*

*> Can I check that:
*

*> - rotate_matrix is rotation around coordinates defined by center_matrix.
*

*> - scale matrix is zoom... but what do the relevant numbers mean?
*

*>
*

*> Camera axis: Can I directly obtain the relationship of its axis with the
*

*> molecule axis? E.g. a translation/rotation matrix?
*

*>
*

*> thanks,
*

*> P.
*

*>
*

**Next message:**Axel Kohlmeyer: "Re: Atom sorting according to resid"**Previous message:**poker_at_physics.usyd.edu.au: "Direct manipulation of the camera"**In reply to:**poker_at_physics.usyd.edu.au: "Direct manipulation of the camera"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]