From: A D (boltzmanndist_at_yahoo.com)
Date: Sun Jan 11 2009 - 12:14:08 CST

I was wondering if it was possible to put a set of atom selections in a list. I tried the following:
-------------------------------------------------------------------
set list1 [list]
for { set resi 20 } { $resi <= 60 } { incr resi } {
  set sel [atomselect 0 "protein and (resid $resi)"]
  lappend list1 $sel
}
--------------------------------------------------------------------
But when I try to access the selection to calculate the center of mass:
-------------------------------------------------------------------
for { set i 0 } { $i <= 40 } { incr i } {
  set sel [lindex $list1 $i]
  set cm [measure center $sel weight mass]
  puts "cm"
}
--------------------------------------------------------------------
it complains that the selection is empty. I want to do this because I don't want to select these residues again and again in all the frames of my huge trajectory. I just want to use $sel frame $frameno. I guess I can alternatively select them again and again in a loop while keeping deleting them by $sel delete, but I am not sure if this would be as fast.
I would appreciate your comments.