From: Jim Pfaendtner (
Date: Mon Aug 13 2007 - 18:38:12 CDT

Dear VMD list,

I am still trying to figure out why my badwater script is not
working. Here is the script I am currently using:

set overlap [atomselect top "segid WT1 to WT12 and within 2.4 of (not
segid WT1 to WT12)"]
set reslist [$overlap get resid]
set reslist [lsort -unique -integer $reslist]
set seglist [$overlap get segid]
foreach segid $seglist resid $reslist { delatom $segid $resid }
writepdb tt2.pdb
writepsf tt2.psf

My pdb file is a solvated protein that was solvated using the VMD
plugin, so the segids for the water groups are WT1 through WT12.

When I run this script on my protein I dont get any errors, but the
"writepsf / writepdb" commands just write empty files - it's as
though my selection is grabbing all the atoms.

I adapted this script from the psfgen usermanual and a previous post
on the namd userlist about badwater scripts. John previously replied
to this and asked if I was sure that I was getting the right
selection - I am reasonably sure that I am.

Thank you,

On Jul 16, 2007, at 3:19 PM, Jim Pfaendtner wrote:

> hello,
> I am a new VMD user. I'm trying to write/adapt a TCL script to
> select overlapping waters and delete them and I'm getting something
> wrong.
> Here is my script:
> set badwat [atomselect top "name OH2 and within 3.0 of protein"]
> foreach segid [$badwat get segid] resid [$badwat get resid]
> {
> delatom $segid $resid
> }
> I am running it in the vmd console after loading my psf/pdb files.
> The output just says:
> no segment WT1
> thanks,
> Jim