From: Justin Gullingsrud (justinrocks_at_gmail.com)
Date: Thu Nov 11 2004 - 11:57:24 CST

I think you probably want something like this:

set hblist [... as before ... ]

# assign the three lists returned by measure hbonds to three variables
foreach {don acc hyd} $hblist { break }

# create atom selections for the three lists
set donsel [atomselect top "index $don"]
set accsel [atomselect top "index $acc"]
set hydsel [atomselect top "index $hyd"]

# write the selections to pdb files
$donsel writepdb don.pdb
$accsel writepdb acc.pdb
$hydsel writepdb hyd.pdb

Hope this helps,
Justin

On Tue, 09 Nov 2004 12:52:51 +0100, pl <ladam_at_smbh.univ-paris13.fr> wrote:
> Hi all,
> I want to use the writepdb function to save a list of selected
> atoms. To my understanding writepdb needs a list of integers and
> my list is text. This list was created using the 'measure hbond'
> command like this:
>
> set hblist [measure hbonds $cutoff $angle $DNA $WAT]
> set atom1 {}
> set atom2 {}
> set atom3 {}
> foreach atom1 [lindex $hblist 0] atom2 [lindex $hblist 1] atom3 [lindex
> $hblist 2] {
> set sel1 [atomselect top "index $atom1"]
> set sel2 [atomselect top "index $atom2"]
> set sel3 [atomselect top "index $atom3"]
> lappend pdblist $atom1
> lappend pdblist $atom2
> lappend pdblist $atom3
> }
>
> Now I want to throw this pdblist into a file using writepdb:
>
> $pdblist writepdb my_file.pdb
>
> As I said, this does not work as $pdblist cantains text and not
> a list of integer.
> How do I turn my list into integers. This is a dumb tcl question, boy
> how I hate this language....
>
> Bye
>
>

-- 
The spirit of Plato dies hard.  We have been unable to escape the
philosophical tradition that what we can see and measure in the world
is merely the superficial and imperfect representation of an
underlying reality.
                -- S.J. Gould, "The Mismeasure of Man"