From: Lena Simine (lena.simine_at_rice.edu)
Date: Thu Apr 21 2016 - 02:19:24 CDT

Hi!

I am trying to make an animation of a molecule, with monomers colored
according to some input
and an additional transparent "beads" representation on selected atoms
(varying from frame to frame): it is supposed to look
like a transparent bubble of varying size moving around on a
"colorful" backbone.

My semi-working script with details of the problems is below. (I got
the colors right, but got stuck on the "bubble")
Thanks for your help!

Lena
----------------------------------------------------------------------------------------------------------------------------------
set mol 0
set sel [atomselect top all]

####read in data for colors (a number for each atom)
set fp [open "colors.dat" r]
set file_data [read $fp]
close $fp
set color_data [split $file_data "\n"]
####and the selection for the bubble, it comes in the format: serial a
b c d... (where a,b,c,d are integers)
set fp1 [open "bubble.dat" r]
set file_data1 [read $fp]
close $fp1
set bubble_data [split $file_data1 "\n"]

#get number of frames in the trajectory
set n [ molinfo top get numframes ]

#iterate over frames and do the magic
for {set i 0} {$i < $n} {incr i} {
     ###this sets the colors and it works!
     $sel frame $i
     set sel_text [lindex $ex_data $i]

     ###this stores the selection for this frame in sel_text
     set sel_text [lindex $ex_data $i] ### puts $sel_text --> serial
1 2 3 4 5 (or similar)

     mol representation beads 1 68
     mol color ColorID 0

     ### problem1 in the next line: it doesn't want to accept the
value of $sel_text which is supposed to read something like - serial 1
2 3 4 5
     ### I tried with "", '' - nothing works
     mol selection {"$sel_text"}

     mol material Transparent
     mol addrep top

     ###problem2: not sure what to do with all the accumulating
selections..delete them ? keep them?
     ###+ I am not even sure that I am doing the right thing and each
frame will, in fact, get updated.
     set repid$i [expr [molinfo top get numreps]-1]
}