From: Alex Hummels (alexhummels_at_me.com)
Date: Fri Sep 06 2019 - 08:50:48 CDT

Thank you for taking a look. I just ran a bunch of assertions through my code and it looks like everything checks out. Both lists are 29 components long, sorted_u2 is a list of lists, each sublist has length 3. The third component of each sublist is a unique number (relative to that of all other sublists) in [0,1]. Also shells (which is a list of lists, where each sublist contains atom indices) is 39 components, and the 31st component, our last valid shell, has multiple atoms in it. Do you have any other ideas why I’d be getting this error?
> On Sep 6, 2019, at 8:20 AM, Jérôme Hénin <jerome.henin_at_ibpc.fr> wrote:
>
> I see. The problem is likely that your list sorted_u2 is too short or otherwise doesn't have the right format, so that $pcnt is empty. That's when atomelect complains.
>
> By the way, it seems $pcnt does not depend on the loop iteration, it could be assigned before the loop. Or maybe you are not doing what you intended to do... If you do want to set the beta property of all atoms to the same value, then you could use a single selection and a single "set beta" statement.
>
> Jerome
>
> On Fri, 6 Sep 2019 at 14:24, Alex Hummels <alexhummels_at_me.com <mailto:alexhummels_at_me.com>> wrote:
> 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 <mailto: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
>>
>>
>