From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Sat Jun 29 2013 - 09:59:54 CDT

On Sat, Jun 29, 2013 at 4:57 PM, Solen <solen_at_brandeis.edu> wrote:
> 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")

this is not a VMD, but a Tcl question. check out:

http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

axel.

>
> ************************
> #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

--
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
International Centre for Theoretical Physics, Trieste. Italy.