From: Z.Y.Qiu (luoyuan126_at_gmail.com)
Date: Mon Dec 03 2012 - 22:53:30 CST

Hi,everyone! In order to how many atoms in some radial distance certred at
some atom in whole frame, I write a script
to calculate it. The following is my script:
proc getnum {totalframe} {
 set a 0
 set b 0
 set c 0
 set d 0
 for { set i 0} { $i<=$totalframe} { incr i 1} {
   atomselect 0 "type 2 and within 2.2 of index 2985" frame $i
    set num [atomselect$i num]
    set list [atomselect$i list]
    if {$num==0} {
      incr a 1
    } elseif {$num==1} {
      incr b 1
    } elseif {$num==2} {
      incr c 1
    } elseif {$num>2} {
      incr d 1
    }
  puts "frame $i $num $list\n"
  }
  puts " No.of 0=$a\n"
  puts " No.of 1=$b\n"
  puts " No.of 2=$c\n"
  puts " No.of more than 2=$d\n"
}

But I met a question. Sometimes I can run the script successfully. However,
it can't be run for second time with an err that
"invalid command name "atomselect0" or "invalid command name "atomselect1"
and so on.I can't find where the problem
is.Additional,how can I ouput the result to some file I specify??
Thank you and appreciating any comment.
yours sincerely
Z.Y.Yau
12-03-2012