From: Emmanuel Baribefe Naziga (
Date: Tue May 10 2011 - 10:26:52 CDT

Hi Maria,

If you can convert your trajectory to the AMBER format there is the *closest
* command in ptraj that can select the closest N waters over the course of a
simulation. This will give an exact number of water molecules but they may
not be the same waters over the trajectory.

Ptraj is available for free in the AmberTools package, so you don't need an
AMBER license. Also I think you can save your trajectory in AMBER format
(crd or crdbox) in VMD.



On Tue, May 10, 2011 at 8:51 AM, Eduard Schreiner <>wrote:

> Hi Maria,
> I have a proc which will do what you want (ww_nearest.tcl). The file
> get_closest.tcl shows how it can be used.
> Note:
> 1. it is SLOW for large systems and certainly can be improved
> 2. it's certainly not the best way to do that, but it seems to work
> for me (I tried it for water and for ions; I did not use it for
> anything serious, though)
> 3. it is not extensively tested
> Check it out and let me know how that works for you.
> Maybe somebody knows a better way; any suggestions/improvements are
> appreciated.
> let me know if you have any trouble with it
> eddi
> On Tue, May 10, 2011 at 9:27 AM, maria goranovic
> <> wrote:
> > Hi
> > I know this has been discussed before, but I did not figure out how to
> reply
> > to the original thread
> > So, like many other people here, I want to output a trajectory containing
> > only water molecules within 5 A of the protein. the obvious problem is
> that
> > VMD expects each frame to have exactly the same number of atoms.
> > However, is there no way to ask vmd to write frames containing the
> closest N
> > water molecules to the protein? Has someone written a script for this?
> > Thank you for helping.
> > Maria
> > --
> > Maria G.
> > Technical University of Denmark
> > Copenhagen
> >