From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri Mar 30 2012 - 13:38:57 CDT

On Fri, Mar 30, 2012 at 1:16 PM, Mr Bernard Ramos <bgrquantum_at_yahoo.com> wrote:
> Hi everyone!
>
> I would like to have a text file output for the x,y,z-coordinates of my
> system for each frame arranged neatly in five columns. The first column will
> be the frame number, the second will be the atom ID number, and the x-y-z
> coordinates will follow next.
>
> I tried typing in what follows, but it does not work
>
> set frm [molinfo top get numframes]
> set sel [atomselect top "oxygen and within 4 of (serial 3 13 14 15 5 8 33 20
> 21 22)"]
> set fout [open Coords.txt w]
> for {set i 0} {$i<$frm} {incr i} {
> $sel get {resname resid x y z}
> }
> close $fout
>
> The resulting text file does not contain anything and I don't get any error

of course the file doesn't contain anything,
because you are not writing anything to it.

> message in TkConsole. Please help. I am very new to using the Console.

check this out:

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

and then consider that to capture the output of a command,
you have to enclose it in square brackets and assign it to
a variable, e.g.: set res [$sel get {resid resname x y z}]

finally, you have to take into account that $sel get will always!
return a list of lists, i.e. a list with one entry per selected atom,
that will have the list of requested properties. even if you have
selected only one atom and request only one property.

but before you get to that, familiarize yourself with Tcl
through the tutorial and spend some time on the discussion
on lists, as this is the core of a lot of analysis work in VMD/Tcl.

cheers,
     axel.

> Thanks,
>
> Bernard

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.