From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Sep 20 2011 - 07:20:43 CDT

On Mon, Sep 19, 2011 at 9:29 PM, kirtana S <skirtana4_at_gmail.com> wrote:
> My output is in the form of [a b c] after I sort this  ,
>
> I want to calculate the aspect ratio which will be a/b and a/c .
>
> Can you tell me how to do this because I am doing this for my entire
> trajectory.

first off, you could have saved yourself a _lot_ of time by
spending some quality time with the tcl tutorial,

http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

that very nicely explains a lot of basic tcl constructs
including list manipulations.

in your specific case, you can use lsort to sort the list
and then either lindex $list 0, lindex $list 1 and lindex $list 2
to access the individual elements, or use the tcl extension
lassign (which is part of VMD): lassign $list a b c
and then continue from there.

axel.
>
> Thanks
>
> On Mon, Sep 19, 2011 at 9:18 PM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>
>>
>>
>>
>> On Sep 19, 2011, at 6:31 PM, kirtana S <skirtana4_at_gmail.com> wrote:
>>
>> Sorry , I am using the De Hume linear algebra tcl package to calculate
>> eigen values and I get my output in the form of [a b c]
>> I need to calculate the aspect ratio as Iz/Iy where Iz>Iy>Ix , so I need
>> to sort them out first
>>
>>
>> So using lsort should work, where is the problem?
>> Axel.
>>
>>
>>
>>
>> Thanks
>> kirtana
>>
>>
>> On Mon, Sep 19, 2011 at 1:10 PM, Axel Kohlmeyer <akohlmey_at_gmail.com>
>> wrote:
>>>
>>> On Mon, Sep 19, 2011 at 12:11 PM, kirtana S <skirtana4_at_gmail.com> wrote:
>>> > Every output of my program is in this format [a b c]
>>> > c=[a b c] ,can I select only the first element of each row separately
>>> >
>>> > After getting my output I used
>>> >
>>> >  c3 = lsort [lindex $a 0] , this sorts only first row
>>> >
>>> > then I want to split them into separte elements to divide column 1 with
>>> > 2
>>> > store the values in a separate array .
>>>
>>> can you please rephrase this in plain and clear english
>>> and explain what the lsort has to do with splitting lists.
>>> i simply don't understand what you are asking for. i have
>>> a hunch, but before i got to large detail explaining things,
>>> i need to know whether this will be meaningful or not.
>>>
>>> thank you,
>>>    axel.
>>>
>>>
>>> > Please suggest can I do this within my program .
>>> >
>>> > Thanks
>>> > kirtana
>>>
>>>
>>>
>>> --
>>> Dr. Axel Kohlmeyer
>>> akohlmey_at_gmail.com  http://goo.gl/1wk0
>>>
>>> Institute for Computational Molecular Science
>>> Temple University, Philadelphia PA, USA.
>>
>
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.