From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Fri Jul 05 2013 - 17:12:43 CDT

The foreach statement should be:
foreach x { $1 $2 $3 }. Without the dollar signs, you were looping over
the integers 1, 2, 3, not the variables contained in $1 $2 $3, and that
naturally leads to problems when you try to do operations on your
atomselections. The way I usually check for empty atomselections is to
look at what [$sel num] spits out, but I think in principle your method
should work too.
-Josh Vermaas

On 07/05/2013 03:54 PM, Bennion, Brian wrote:
> Hello,
>
> At some level this question is a tcl and vmd syntax issue.
>
>
> set 1 [atomselect $loop1 "resname OBDN and (name O34 or name O35)"]
> set 2 [atomselect $loop1 " resname I61 and name O9"]
> set 3 [atomselect $loop1 " resname hlo0 and (name O14 or name O17)"]
>
> foreach x { 1 2 3 } {
> if { [$x list ] != {} } {
> do something
> }
> }
>
> The error is: invalid command name "1"
>
> I am just trying to check to make sure the atomselection actually
> contains something before I operate on it.
>
> Brian
>