From: Solen (solen_at_brandeis.edu)
Date: Sat Jun 29 2013 - 09:57:20 CDT

Hello again,

I finally got a chance to work with what you had suggested and got it
working the way I would like it. I will be using this on multiple
structures so I want to make things a bit easier.
How would I make the following into a procedure that takes in molid
value and file name as arguements? (to run it by a command like
"dynamic_radius 0 file.d")

************************
#set molid 0
#set fl "file.d"
set n [molinfo $molid get numframes]
set fp [open $fl r]
for {set i 0} {$i < $n} {incr i} {
     set chrg($i) [gets $fp]
}
close $fp

# procedure to change the charge field from the data in $chrg
proc do_charge {args} {
    global chrg molid
    set a [molinfo $molid get numatoms]
    set f [molinfo $molid get frame]
    for {set i 0} {$i < $a} {incr i} {
        set s [atomselect $molid "index $i"]
         if { [lindex $chrg($f) $i] > 0 } {
        $s set radius [lindex $chrg($f) $i]
    }
}
}

trace variable vmd_frame($molid) w do_charge
animate goto start
do_charge

*************

Thanks again
Solen