From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Apr 26 2016 - 17:14:43 CDT

On Tue, Apr 26, 2016 at 5:46 PM, Mihaela Drenscko <quo.physics_at_gmail.com>
wrote:

> Hi,
>
> I found this script:
>
> set sel [atomselect top "water and same residue as (within 2 of protein)"]
> set n [molinfo top get numframes]
> for { set i 0 } { $i < $n } { incr i } {
> $sel frame $i
> $sel update
> $sel writepdb water_$i.pdb
> }
>
>
> with the output of water atoms near a protein for each frame.
>
> But actually I need to know how many water molecules are near the protein
> , in other words, I need to read into each pdb file, or find other way to
> display the number of water molecule. How can this be accomplished?
>

‚Äčtrivial. after $sel update insert:

   set nw [expr {[$sel num]/3}]
   puts "$i $nw"

that will count all water atoms and divide by 3 and then print out that
number.
writing and then reading back a pdb file is a huge wasted effort.

axel.

>
> Thank you,
> Mihaela
>
> P.S. Or perhaps the number the water molecules can be counted with
> "measure" command? I haven't seen listed a counting results for measuring
> anything. I there an alternative with "measure"?
>
>
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.