From: Rune Thomas Kidmose (rtk_at_mbg.au.dk)
Date: Mon Feb 19 2018 - 01:18:59 CST

Hi,

I have started using VMD more and more for rendering and animations, and I do this using tcl scripts.

Currently when I need to get a specific view I use the molinfo command, e.g. molinfo top get center_matrix

I proceed doing this on the: scale_matrix, rotate_matrix and global_matrix.

I then add the view to my script like this:

mol info set {center_matrix} {{{ {matrix numbers} }}} etc.

and while this approach works, it gets a bit tedious to do every time I change the view slightly. So I was wondering if there is an easier way of obtaining and setting the view via a tcl script?

I have found the view_matrix command, which I though was a one-step solution for obtaining the view, but I am unable to set the view_matrix via my script.

I have seen a couple of plugins which helps with remembering and setting views if working from the GUI, but I have not been able to use them from my scripts.

Currently I made a simpel tcl script which writes the 4 above mentioned matrices out to a file, in a format I can directly insert into my script, while this helps, I just wanted to make sure I am not missing some obvious way of doing this.

In case ppl are interested, the script I made is basically this (showing only for center matrix)

set file [open view_matrices.log w]
set c [molinfo top get center_matrix]
puts $file “molinfo top set {center_matrix}{$c}”
close $file

Cheers

Ruki