From: JC Gumbart (gumbart_at_ks.uiuc.edu)
Date: Fri Mar 11 2011 - 20:47:02 CST

After "$sel frame $i", you also need "$sel update".

On Mar 12, 2011, at 7:16 AM, <emiliawu_at_dicp.ac.cn> <emiliawu_at_dicp.ac.cn> wrote:

> Hi All,
>
> I have a question about using tcl script to count the number of ions in my system from different frames in my dcd files.
> here is the script:
> --------------------
>
> package require psfgen
>
> topology top_all27pl36.rtf
>
> mol new sheet_namd.psf
> mol addfile sheet-equil.1.dcd step 99 waitfor all
> mol addfile sheet-equil.2.dcd step 99 waitfor all
>
> set outfile1 [open cla_5.dat w];
> set nf [molinfo top get numframes]
> set sel [atomselect top {segname CLA and within 5 of {segname "PEP.*"}}]
> for {set i 0 } {$i < $nf } { incr i } {
> $sel frame $i
> puts $outfile1 [$sel num ]
> }
> close $outfile1
>
> --------------------
>
> the result I got is same number for different frames, I do not know what's wrong with my script, did I not set the frame part correctly? thanks a lot for any help!
>
>
> Emilia
>
>
>
> ___________________________________
> DICP WebMail, http://webmail.dicp.ac.cn
>