From: Thomas C. Bishop (
Date: Thu Oct 23 2008 - 08:46:59 CDT

This is the beauty of VMD it's so simple to do this sort of thing w/out
having to know that atom numbers 4 to 3547 are the DNA, atoms 1,2345 and
3 are ions and proteins are here there...

analysis scripts.
So here's a script straight from the VMD documentation that does what
you want for systems contains protein (maybe yours does maybe it does
not contain protein)

*********** water within for proteins : ***********
*******this writes selected waters to pdbs ********

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

************** water within for DNA: **********
***************** this writes number of waters to screen ***********
set sel [atomselect top "water and within 5 of nucleic"]
set n [molinfo top get numframes]
for { set i 0 } { $i < $n } { incr i } {
  $sel frame $i
  $sel update
  puts "$i [$sel num] "

If you want to do this for a trajectory then
save one of the above scripts to some file "myscript.vmd"
then start vmd as indicated below and boom the analysis is done!
(or as Emeril says "bam" )

vmd -pdb initial.pdb -psf the.psf -dcd my.dcd -e myscript.vmd

you can easily extend this to load multile dcd.s to run w/out graphics
(add a -dispdev none option to command line) and to write the values to some file
by adding lines to the script for opening a file and using puts to a file rather than stdio.

with minor modifications you can quickly develop a suite of short analysis scripts to calculate
 rms values, water locations, radial distributions, DNA helical parameters (via calls to external programs) etc..etc...etc...
I imagine that most molec modelers have 10's or 100's of these short scripts sitting in someplace like
~/bin so that they can easily do

vmd ( a bunch of command line options ) -e ~/bin/mynifty.vmd

at least this is one way of using vmd.

On Thu, 2008-10-23 at 15:09 +0530, wrote:
> Dear All,
> I am working on nucleic acids simulations. I want to extract the
> information regarding the bound water molecules to the biomolecule during
> the simulation with say a cutoff of 3.5 angstrom or so, and it will surely
> change with the timeframe. If anyone has already written a script, it will
> be really helpful. All suggestions are welcome.
> Thanking you,
> Regards,
> Monika Sharma

*  Thomas C. Bishop   *
*Office: 504-862-3370 *
*CCS:    504-862-8391 *
*Fax:    504-862-8392 *