From: Peter Freddolino (petefred_at_ks.uiuc.edu)
Date: Fri Apr 13 2007 - 21:25:24 CDT

Hi Amit,
The simple way is to wrap your main loop in

for {set i 0} {$i < $nf} {incr i} {
...
}

And then and "frame $i" to each of the selections you create in the loop.

Be sure to delete con (and every other selection you might make) after
every loop iteration.

You can also loop over frames in the inner loop if you prefer, which
would look like

for {set i 0} {$i < $nf} {incr i} {
    $con frame $i
    $con update
    puts $file "$j [$con get resid]"
}

Peter

amit dong wrote:
> Hi,
> I need to calculate contacts for all the residues for a
> full trajectory. I can calculate it for a single frame, but I a not
> able to extend it to whole trajectory. Can anyone shed some light on
> this. I will be grateful.
> Thanks
> Amit
>
> The script for single frame:
>
> set mol 0
> set minA 1
> set maxA 76
> set file [ open output.dat w]
>
> set nf [ molinfo $mol get numframes]
>
> for {set j $minA} {$j <= $maxA} {incr j} {
> set con [atomselect $mol "alpha and (within 8 of resid $j and alpha)"]
> set a [$con get resid]
> puts $file "$j $a"
> }
>
> close $file
>