From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Nov 02 2011 - 15:49:19 CDT

On Wed, Nov 2, 2011 at 3:41 PM, ban arn <ban.arn_at_gmail.com> wrote:

> Dear VMD users
>
> I would like to calculate radius of gyration for trajectory and i'm using
> script like this
>
> set mol [molinfo top]
> set out [open test04.txt w]
> set sel [atomselect top "resid 101 93 80 49 39"]
> set frames [molinfo $mol get numframes]
> for {set i 0} {$i < $frames} {incr i} {
> $sel frame $i
> $sel update
> lappend a [measure rgyr $sel]
> puts $out "$i $a"
> }
> $sel delete
>
> It produces huge ouput and i'm puzzling whether i'm doing calculating
> correctly or not.
>
> I expect one value for each trajectory & i'm getting output as like matrix.
>

that is because of the lappend. you don't need it.
just use:

   puts $out "$i [measure rgyr $sel]"

the $sel update is also not needed with your selection.
$sel update is only required, if the selected atoms would
change from frame to frame, e.g. from using "within"
keyword or a selection by coordinate. that should make
the script much faster.

cheers,
    axel.

> Kindly advice.
>
> Many Thanks
> Balaji
>
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.