Selecting waters from dynamics trajectory

From: Randy J. Zauhar (
Date: Tue Mar 20 2018 - 16:47:38 CDT

Hi wise ones,

I know his has been asked before, but I could not get a coherent answer plowing through the thread I found.

I am trying to simply extract all the waters from a trajectory within 5 A of my ligand, for every frame. Why does the code below not work?

I have tried this with and without the pbc wrap, same result, have also modified the atom selection - I always get a waters that are far away (like ~18 A)



package require pbctools
pbc wrap -all -compound res -center com -centersel "segname LIG"

set fp [ open "activeSiteWaters4.txt" w ]

set lastframe [ molinfo top get numframes ]

for { set frame 1 } { $frame <= $lastframe } { incr frame 1 } {

set select [ atomselect top "segname WT1 and oxygen within 5. of (segname LIG) " frame $frame ]
$select update
set watlist [ $select get {resid name x y z}]
puts $fp "#$frame"
foreach water $watlist {
set resid [ lindex $water 0 ]
set atom [ lindex $water 1 ]
set X [ lindex $water 2 ]
set Y [ lindex $water 3 ]
set Z [ lindex $water 4 ]
puts $fp "$resid\t$atom\t$X\t$Y\t$Z"


close $fp

Randy J. Zauhar, PhD

Prof. of Biochemistry

Dept. of Chemistry & Biochemistry
University of the Sciences in Philadelphia
600 S. 43rd Street
Philadelphia, PA 19104

Phone: (215)596-8691
FAX: (215)596-8543

“Yeah the night is gonna fall, and the vultures will surround you /
And when you’re lookin’ in the mirror what you see is gon’ astound you"

  — Death Cab for Cutie, “Monday Morning"

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2018 - 23:20:56 CST