From: Joshua D. Moore (
Date: Thu Sep 20 2012 - 13:44:04 CDT


I want to assign a variable in VMD running in Linux from the command line.

I can do something like

animate goto start
set startframe [molinfo top get frame]
echo $startframe

And VMD will return the frame number of the start

But if I want to get a value out of a file using awk, such as the
following I get a blank return.

vmd > set frame 5
vmd > echo $frame
vmd > set time [awk NR==$frame time.txt]
vmd > echo $time
(returns a blank and should return 0.006)

In a bash shell I would do the following.

bash> time=$(awk 'NR==5' time.txt)
bash> echo $time

But I can't get VMD to store the variable. Can VMD return a variable
using unix commands from within VMD (a Linux version of VMD of

What I want to do is to display some text that shows "time =
something" in VMD to render a movie. My frames need to be spaced at
uneven times, so I want to read the times from a file in a loop within

Thanks in advance if you can help.