From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri Jul 08 2011 - 11:20:11 CDT

On Fri, Jul 8, 2011 at 10:56 AM, maria goranovic
<mariagoranovic_at_gmail.com> wrote:
> Hi Axel
> Thank you for the help. However, I am not much of an expert in tcl or vmd
> scripting and am learning. Hopefully I can please get some help?

i can try.

> One difference between your setup and mine seems to be that in your setup
> all the data over frames which you are trying to import is lying in one
> file, and you read the file one at a time?

i read the data up front and store it away in an array that is indexed
by the frame number, since that is faster.
for the example of a dipole, there is not much data to store.

> So, here: each line is being read from zundel.dip and assigned to the
> dipdata($i) array.

exactly.

> for {set i 0} {$i < $n} {incr i} {
> # advance selection to the current frame and update.
> $sel frame $n
> $sel update
> set dipdata($i) [list [center_of_mass $sel] [gets $dip]]
> }
> close $dip

> However, the data I need to read in each frame is not one line, but an
> entire file.

that doesn't make a difference. you can just do a per frame
open/close and read in the file. however, you can also stick
to the reading a file. the latter is just taking more time.

> Secondly, I did not really understand what seems to be the key command:
> trace variable vmd_frame(0) w do_dipdraw

> This means that the command do_dipdraw will be executed if vmd_frame(0) is
> executed? what is the w for? what is vmd_frame(0) ?

not executed but written to. vmd_frame is an array that records the
current frame number of each molecule. thus $vmd_frame(0) will give
you the current frame number for molecule 0. this array/variable will
be updated by VMD whenever a new frame becomes current, and
then the "trace" will be triggered and do_dipdraw is launched.

HTH,
   axel.

> Thank you again,
> Maria
> On Fri, Jul 8, 2011 at 3:31 PM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>
>> On Fri, Jul 8, 2011 at 8:59 AM, maria goranovic
>> <mariagoranovic_at_gmail.com> wrote:
>> > Hi
>> > I have a trajectory, and I want to source in a different draw-command
>> > containing file on each frame. The files to be sourced in contain
>> > several
>> > draw commands as below:
>> > ...
>> > draw point {   67.340   84.391   32.398}
>> > draw point {   67.340   84.391   32.340}
>> > draw point {   67.340   84.410   32.284}
>> > draw point {   67.340   84.446   32.238}
>> > draw point {   67.340   84.495   32.206}
>> > draw point {   67.340   84.552   32.192}
>> > draw point {   67.340   84.611   32.196}
>> > draw point {   67.340   84.664   32.220}
>> > draw point {   67.340   84.707   32.260}
>> > draw point {   67.340   84.735   32.311}
>> > draw point {   67.353   84.567   32.605}
>> > ...
>> >
>> > the idea is to view the trajectory and draw a new set of points each
>> > frame.
>> > Can someone please suggest how to accomplish this?
>> > I tried something like the following to load 5 frames from a 125-frame
>> > trajectory. The files temp_$j.vmd_plot contain data like the above. The
>> > script below works, except that only the last set of points i.e.
>> > outputhole_5.vmd_plot are displayed, and no others. When I look back
>> > into
>> > the trajectory, VMD has lost information of previous temp_$j.vmd_plot
>> > files.
>> > How do I keep the data in the display?
>>
>> that is not how this will work.
>>
>> have a look at item 5.2 in this document.
>>
>>
>> http://sites.google.com/site/akohlmey/redirect/cpmd-vmd.pdf?attredirects=0&d=1
>>
>> cheers,
>>    axel.
>>
>>
>> > ====================
>> > mol load gro protein-aligned-50ns.gro
>> > # Load trajectory
>> > for {set j 0} {$j < 5 } {incr j} {
>> > # i goes like 1, 26, 51 ...
>> > set i [expr ($j*25)+1]
>> > # k goes like 25, 50, 75 ...
>> > set k [expr ($j+1)*25]
>> > mol addfile {protein-aligned.xtc} type {xtc} first $i last $k step 25
>> > waitfor 1 0
>> > # this file contains the draw statements
>> > source temp_$j.vmd_plot
>> > }
>> > ========================
>> >
>> > --
>> > Maria G.
>> > Technical University of Denmark
>> > Copenhagen
>> >
>>
>>
>>
>> --
>> Dr. Axel Kohlmeyer
>> akohlmey_at_gmail.com  http://goo.gl/1wk0
>>
>> Institute for Computational Molecular Science
>> Temple University, Philadelphia PA, USA.
>
>
>
> --
> Maria G.
> Technical University of Denmark
> Copenhagen
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.