From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Fri Sep 06 2019 - 08:52:22 CDT

Hmm... This isn't quite a minimal working example. What is in $shells? It should be a list of lists, since you are using lindex to get a specific element and then iterating over that element. I think the error is coming from how pcnt is created. The double indexing may just be failing, so you are trying to set the beta value for one atom to nothing, and VMD is then complaining.

-Josh

On 2019-09-06 07:26:35-06:00 owner-vmd-l_at_ks.uiuc.edu 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