From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Thu Aug 04 2016 - 18:11:15 CDT

Hi Jose,

If you just need the different possible segids from water, why not do something like this?

set allwaters [atomselect top "water"]
foreach segid [lsort -unique [$allwaters get segid]] {
    puts $segid
    #I assume you want to do some work here, maybe making a secondary atomselection, and writing it to a file.
}

I mean, its somewhat abusive to use lsort this way, but it will get you a list of segids with minimal fuss. Would this serve your purpose? I've never actually cared about the number of waters. :)

-Josh

On 08/04/2016 05:03 PM, José Gómez wrote:
Hi everyone,
I need to get all the water's segid of a pdb file and write them in different pdb file.
For example:

set water [atomselect top "segid W8"]
$water writepdb waterW8.pdb

In this case, my pdb file contains 8 different segid, so I could do it with a tcl for bucle from 1 to 8, but the problem is what if I have more than 8 segid? How can I count them in the same tcl script??? do I need to get the position of "WX" (X= segid number) of the line (as a string line)?

Hope you can help me!
Regards from Chile!

--
José Fernando Gómez Ponce
Ingeniero en Bioinformática.
Computational Biology Lab (DLab)
Fundación Ciencia para la Vida, Santiago.
+569 66622520<tel:%2B569%2066622520>