From: Peter Freddolino (petefred_at_ks.uiuc.edu)
Date: Tue Feb 06 2007 - 11:12:11 CST

You can use a loop like the following:

set sel [atomselect top water]
set segnames [lsort -unique [$sel get segname]]
$sel delete

foreach segname $segnames {
set sel [atomselect top "segname $segname"]
$sel writepdb wat-$segname.pdb
$sel delete
}

Here you're getting a list of all the water segments, and then writing
each in turn.
Peter

namd vmd wrote:
> Hello !
>
> Solvation of my protein results in a large number of water segments.
> Can I write a pdb separately for each segment using some vmd commands
> (I do not want to use awk or grep)
>
> Thank you !
>
> Rose
>