From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri Jan 14 2011 - 12:49:50 CST

On Fri, Jan 14, 2011 at 1:26 PM, Fahimeh Baftizadeh
<fahimeh.baftizadeh_at_googlemail.com> wrote:
> Thank you very much Alex,
> Finally ;-)  with a littel bit of coding I managed to generate the correct
> format for "cube" file and then read them sequentially with your script with
> very small modification that I did.

the technique used in the script is in no way specific to cube files.
_any_ volumetric data file format that VMD understands would have done.
this is a key point in understanding how VMD works: it doesn't matter
where data is coming from, it only matters what data is taken from the
input and how you can access it in VMD.

> Now I like to add some representaion, like VolumeSlice, and look at it
> during the trajectory, but I think there is something worng going on , It
> update the isosurface representation correctly but not the VolumeSlice
> representation!

the line in the script using the lreplace command is the one that is specific
to the Isosurface representation. it basically replaces the index of the data
set the representation is using. if you want to update both, Isosurface and
VolumeSlice, you have to duplicate those parts of the code that keep
the relevant information around and modify variable names accordingly.

> Can you help me to find out the problem ?! I am sorry but I am very new in
> tcl programming :-(

then first teach yourself some more tcl! e.g. from the tutorial at www.tcl.tk.
what you are doing is a bit more complex and i don't have the time to
provide a shrinkwrapped solution.

> He
>
> # $Id: au-iso.vmd,v 1.2 2004/05/21 15:50:29 akohlmey Exp $
> # Display settings
> display projection   Orthographic
> display nearclip set 0.000000
> display farclip  set 10.000000
> display depthcue   off
> # store the molecule id for later use
> set step 188
> set start 11
> set updmol [mol new {out_10.cube} type cube waitfor all]
> for { set i  $start} {$i < $step } { incr i } {
> mol addfile out_${i}.cube type cube waitfor all
> }
>
> mol delrep 0 top
> mol representation Isosurface 0.04 0.0 0.0 0.0
> mol color ColorID 15
> mol selection {all}
> mol addrep top
> mol representation VolumeSlice
> #mol color ColorID 5
> mol selection {all}
>
> # store name of the isosurface representation (id=3) for later use
> mol addrep top

> set updrep [mol repname top 0]
> set updrep [mol repname top 1]

this part _cannot_ work. the second step will override the first.
you need two different variable names here.

> #mol rename top {Golden Shot}
>
> rotate z by -90
> rotate x by -90
> rotate x by 2
> rotate y by 3
> rotate x by 2
>
> # use the volumetric data set for the isosurface corresponding to the frame.
> # $updmol contains the id of the molecule and $updrep the (unique) name of
> # the isosurface representation
> #
> proc update_iso {args} {
>     global updmol
>     global updrep

and from here, the code needs to be replicated as well
so that it works on both representations. the good news
is that in both Isosurface and VolumeSlice, the third data
element is the index of the volumetric data set, so that
the lreplace statement only needs the variables updated
for the second representation, not the indices.

cheers,
   axel.

>
>     # get representation id and return if invalid
>     set repid [mol repindex $updmol $updrep]
>     if {$repid < 0} { return }
>
>     # update representation but replace the data set
>     # id with the current frame number.
>     set frame [molinfo $updmol get frame]
>     lassign [molinfo $updmol get "{rep $repid}"] rep
>     mol representation [lreplace $rep 2 2 $frame]
>     mol modrep $repid $updmol
> }
>
> trace variable vmd_frame($updmol) w update_iso
> animate goto 0
>
>
>
> On Tue, Jan 11, 2011 at 12:29 AM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>
>> On Mon, Jan 10, 2011 at 4:29 PM, Fahimeh Baftizadeh
>> <fahimeh.baftizadeh_at_googlemail.com> wrote:
>>
>> fahimeh,
>>
>> > thanks John for your reply.
>> > Let me make my question more clear.
>> > I have a grid of point which they have intensity as a function of time,
>> > they
>> > are fixed in the space, What I would like to see is
>> > 1- their intensity change with time (like changing the colors).
>> > 2- then I would like to apply also the volume slice to have more visual
>> > information.
>>
>> what you describe is a visualization problem, that is usually
>> handled by tools like ParaView (http://paraview.org)
>> or OpenDX (http://www.opendx.org), and others most of which
>> are commercial applications. they allow you much more flexible
>> reading and processing of data compared to VMD.
>>
>> > I was thinking of generating a file.dx ... but maybe i need a little bit
>> > of
>> > tcl scripting in order to generate a movie, not a single frame.
>>
>> yes. you can load multiple volumetric data sets and then show
>> only one of them. here is an old script of mine that does this
>>
>> http://klein-group.icms.temple.edu/cpmd-vmd/files/au-iso.vmd
>>
>> with "cube" files (which are grids that also include atoms) you
>> can use this with .dx files just as well. the multi-molanim GUI
>> that john mentioned more-or-less does the same thing, but with
>> whole "molecules" (which in VMD-speak can also refer to a
>> single graphics visualization without any atoms).
>>
>>
>> cheers,
>>    axel.
>>
>>
>>
>>
>> > Thanks in advance
>> > Fahimeh
>> >
>>
>>
>> --
>> Dr. Axel Kohlmeyer
>> akohlmey_at_gmail.com  http://goo.gl/1wk0
>>
>> Institute for Computational Molecular Science
>> Temple University, Philadelphia PA, USA.
>
>
>
> --
> --------------------------------------------------------------------------------------------------------------
> Fahimeh Baftizadeh
> SISSA, via Bonomea, 265
> 34136 Trieste, ITALY
> email : fbafti_at_sissa.it
>            fahimeh.baftizadeh_at_gmail.com
>
> phone : +39-040-3787-302
>
>

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