From: Alex Hummels (alexhummels_at_me.com)
Date: Fri Sep 06 2019 - 07:23:54 CDT

Ok. This is the actual code that produced the error. I cut out the things after the puts $nshell statement because I presumed if I didn’t see an output of 31 it meant it must have failed before that line. But I guess that’s not necessarily the case

foreach nshell $valid_shells {
        puts $nshell
        set idx [expr $nshell - 1]
        set shell_i [lindex $shells $idx]
        foreach index $shell_i {
                set atom [atomselect top “index $index”]
                set pcnt [lindex [lindex $sorted_u2 $idx] 2]
                $atom set beta $pcnt
        }
}

Thanks,
Alex
> On Sep 6, 2019, at 4:34 AM, Jérôme Hénin <jerome.henin_at_ibpc.fr> wrote:
>
> Hi,
>
> this code would not print that error. Please show the code up to the offending atomselect statement, or we can't help.
>
> Jerome
>
> On Fri, 6 Sep 2019 at 00:03, Alex Hummels <alexhummels_at_me.com <mailto:alexhummels_at_me.com>> wrote:
> Hello all,
>
> I’m encountering a weird error with tcl. I have a list valid_shells. When I use puts, I see that this list is
>
> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 30 31
>
> Now I have a for loop that iterates over this list and prints the value. This works until I get to the very last component, where I get the error
>
> atomselect set: 0 data items doesn’t match 1 selected atoms.
>
> In my actual script there is more that happens after this put statement, but none of it happens and the loop stops after this error. The loop I’m using that gives me this error is below. I’ve tried changing the loop from a foreach loop to a for loop, also below, but the error remains the same.
>
> foreach nshell $valid_shells {
> puts $nshell
> }
>
> for {set nshell 1} {$nshell < 32} {incr nshell} {
> if {!($nshell in $valid_shells)} {continue}
> puts $nshell
> }
>
> The only other thing I can think of as pertinent is that the list valid_shells was initialized as an empty list, and these numbers were successively added with calls to lappend as below
>
> lappend valid_shells $number
>
> Any and all help is much appreciated.
>
> Best,
> Alex
>
>