From: Ashar Malik (
Date: Tue Jul 23 2019 - 15:30:18 CDT


Two things

1) Do you want to select one set of molecules (solvent) in your first frame
and track them as they move around? or 2) Do you want to update your
selection every frame - which means some water will come in your selected
area while others will move out?

you need to loop over all your frames -
For selection of water have a look here: + append
to this selection your frame number like this "frame 89" to make sure that
the selection is in the current frame.

The write the selection out with $selection writepdb

I don't know of a way to write all selections in one PDB trajectory.
Instead try writing individual frames and then merge them using a simple
parsing/appending code.

If you want one set of molecules (in the first frame for instance) and want
to track them through the trajectory, then you can list their indices and
use catdcd with the index option to extract your atoms from the trajectory
and save them as a separate trajectory.

Hope this helps. If it doesn't write back.

On Tue, Jul 23, 2019 at 11:40 PM Lara rajam <> wrote:

> Dear Vmd users
> I would like to select the water moleceules with in 5A of the solute from
> the MD trajectory for each frame and write the solute and the water within
> the 5A range as separate PBD trajectory. Could any one please let me know
> the details or direct me to the earlier solutions
> Thanks in advance