From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Jun 16 2015 - 13:08:04 CDT

On Tue, Jun 16, 2015 at 12:01 PM, Mehdi Bagherpour
<mehdi.bpour_at_gmail.com> wrote:
> Dear vmd users,
>
> I want to find minimum value of index of my selected atom atoms
>
> for {set x 0} {$x <= 334} {incr x} {
> set sel1 [atomselect top "name P and within 6 of index $x"]
>
> set sel2 [$sel1 get index]
> .
> .
> .
>
> When I write $sel2 get index it takes 386 387 388
>
> What is command of finding minimum of $sel2, I need because for each loop we
> have different index number for $sel2.

index numbers are *always* printed in order.

if those numbers were not ordered, you could just use the lsort
command to sort the list by value.

>
> I have done with:
>
> expr min [$sel2 get index]

this is not Tcl syntax and thus nonsense.

>
> but I got this error:
>
> invalid bareword "min"
> in expression "min 382 383 384";
> should be "$min" or "{min}" or "min(...)" or ...

and deservedly so. it looks to me, that you should spend some time
with a Tcl tutorial and learn how to do basic scripting tasks in Tcl.

axel.

> Thanks
> Mahdi

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.