From: Sun Yicheng (sunyicheng001_at_hotmail.com)
Date: Thu Oct 01 2009 - 10:28:39 CDT

Dear VMD user,

                    i have two files : dump.pdb and user.data.
dump.pdb is a regular PDB file and user.data stores the values which i want to color atoms in dump.pdb.
format of user.data :
1.02
2.04
4.04
5.02
4.23
.
.
i extract these values by awk command, one line contains a value.
i have gone though the mail list for some suggestions, but my script does't work well, color is not changed per frame. it must be some error in it that i can not find. i want to know how to load the user.data file to "user" field correctly.
i got this script from mail list, what does " set line "" " means in the script?

-------The script:------------

set file dump.pdb
mol new $file
set numframes [molinfo top get numframes]
set numatoms [molinfo top get numatoms]
set sel [atomselect top "all"]
set fp [open "user.data" r]
set line ""
for {set i 0} {$i<$numframes} {incr i} {
gets $fp line
$sel frame $i
puts "setting user data for frame [$sel frame].."
for {set j 0} {$j<$numatoms} {incr j} {
animate goto $i
$sel set user $line
}
}
$sel delete
 

2009-10-01

Sun Yicheng