From: Joaquim Rui de Castro Rodrigues (joaquim.rodrigues_at_ipleiria.pt)
Date: Sun Mar 08 2015 - 13:50:57 CDT

Hi,

So, what you want is to have all the coordinates in a single file. You can build your list of residues before doing the atom selection, if that's what you're looking for:
set residlist {1 2 3 4 5}
set sel [atomselect top "resid $residlist"]
$sel writepdb out.pdb
$sel delete

There's no need for a loop get write a single pdb file.

Regards,
J Rui Rodrigues

________________________________________
De: Monika Madhavi [monikamadhavi_at_gmail.com]
Enviado: domingo, 8 de Março de 2015 17:33
Para: Joaquim Rui de Castro Rodrigues
Cc: vmd-l_at_ks.uiuc.edu
Assunto: Re: vmd-l: How to write coordinates to a pdb without replacing existing entries

I want to achieve the result I would get if I write this command while looping around without writing line 2 as it is.

set residlist {1 2 3 4 5}
set sel [atomselect top "resid 1 2 3 4 5"]
$sel writepdb out.pdb
$sel delete

Regards,
Monik

On Sun, Mar 8, 2015 at 10:47 PM, Monika Madhavi <monikamadhavi_at_gmail.com<mailto:monikamadhavi_at_gmail.com>> wrote:

Thanks Joaquim. Actually i set N outside the loop. What i want is to write all the coordinates in a single pdb file. As an example, something like

If my molecule is water,

Resid atomname coordinates
1 H1 .........
1 H2 ........
1 OH .........
2 H1 .........
2 H1 ..........
2 OH .........