These two scripts help greatly in making and handling movies. I need scripts instead of the GUI because most of my data is on machines on the other coast and it gets rather cumbersome to pull a gigantic trajectory file just to see a quick snapshot of the system. I could make PDB (or better dcd) files of parts of trajectory I am interested in, but I will need to make movies at some point.
view_change_render.tcl
trajectory_movie.tcl
http://www.myofilament.org/documents/howto/modeling/VMD_Tcl.htm
PyMol uses get_view and "set view" commands to save and retrieve views of molecules. VMD handles things a little differently. It needs 4 parameters per view. They are [rotate/center/scale/global]_matrix. Saving and retrieving are done by processes below. They have been taken from view_change_render.tcl
I added the last part get_vp to see what the view point actually looks like (similar to get_view in PyMol).
proc save_vp {view_num} { global viewpoints if [info exists viewpoints($view_num)] {unset viewpoints($view_num)} # get the current matricies foreach mol [molinfo list] { set viewpoints($view_num,$mol,0) [molinfo $mol get rotate_matrix] set viewpoints($view_num,$mol,1) [molinfo $mol get center_matrix] set viewpoints($view_num,$mol,2) [molinfo $mol get scale_matrix] set viewpoints($view_num,$mol,3) [molinfo $mol get global_matrix] } }
proc retrieve_vp {view_num} { global viewpoints foreach mol [molinfo list] { if [info exists viewpoints($view_num,$mol,0)] { molinfo $mol set rotate_matrix $viewpoints($view_num,$mol,0) molinfo $mol set center_matrix $viewpoints($view_num,$mol,1) molinfo $mol set scale_matrix $viewpoints($view_num,$mol,2) molinfo $mol set global_matrix $viewpoints($view_num,$mol,3) } else { puts "View $view_num was not saved"} } }
proc get_vp {view_num} { global viewpoints foreach mol [molinfo list] { if [info exists viewpoints($view_num,$mol,0)] { puts "global viewpoints" puts "molinfo $mol set rotate_matrix \"$viewpoints($view_num,$mol,0)\"" puts "molinfo $mol set center_matrix \"$viewpoints($view_num,$mol,1)\"" puts "molinfo $mol set scale_matrix \"$viewpoints($view_num,$mol,2)\"" puts "molinfo $mol set global_matrix \"$viewpoints($view_num,$mol,3)\"" } else { puts "View $view_num was not saved"} } }
Once you save this output (as a text file) it becomes very easy to retrieve the view even
after closing down VMD. Simply copy and paste the output of get_vp.
No comments:
Post a Comment