From: Axel Kohlmeyer (
Date: Mon May 12 2008 - 17:32:55 CDT

On Mon, 12 May 2008, Andrew Huang wrote:

AH> Is there a tool or script within VMD that will output all the bonds
AH> specified in a PSF and their lengths? I'm getting a "Bad global exclusion
AH> count" error in NAMD, and I'm trying to figure out if the PSF connects atoms
AH> that are far apart.

it should be doable with vmd tcl scripting.
this is an untested suggestion of how it could work in principle.

make a selection of the area of interest, e.g.:

set sel [atomselect top protein]
set all [atomselect top all]

and then do

set bl [$sel getbonds]
set bi [$sel list]
get coords [$all get {x y z}]

this will give you lists of atomindices of the selected
atoms and the bonded atoms list for each atom. to do an
exhaustive search of all bondlengths you can do

foreach i $bi l $bl {
    foreach b $l {
        set vl [vecdist [lindex $coords $b] [lindex $coords $i]]
        if { $vl > 1.8 } {
           puts "bond from $i to $b is $vl"

that should catch all excessively long bonds.
i hope you get the general idea. use at your own risk.


AH> Andrew Huang
AH> Harvey Lab
AH> School of Biology
AH> Georgia Institute of Technology
AH> 310 Ferst Drive, Atlanta, GA 30332
AH> Office: 329 Cherry Emerson
AH> Email:

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.