From: Philip Fowler (
Date: Mon Nov 07 2005 - 03:05:48 CST


I would simplify the script as follows

If you want to find the number of contacts within a radius of 3A for
a given atom ($a) then you can use

set a [atomselect top "protein and resid 1"]
set b [atomselect top "protein"]
set z [measure contacts 3 $a $b]
set zcount [llength [lindex $z 0]]

$zcount has the number of atoms and can be putted out, or set as the
beta value for $a e.g.

$a set beta $zcount

Then you just need to loop over the protein/trajectory.


> Hi,
> I've attached a script that I have taken from the vmd mailing list-
> WED 02
> 2005 - submitted by Mgr Lubos Vrbka.
> The script produces 4 files detailing the number of contact between
> two
> selections over a trajectory. The two files I am interested in are
> contact_A.dat and contact_B.dat. I was wondering if I could get
> some advice
> on how to modify the script so that all the residues in eg a protein a
> printed, not just the ones that actually make contact. So if there
> is no
> contact with a certain resdiue then to print the residue number,
> residue
> name and '0' for the number of contacts rather than just ignore it.
> My ultimate aim is to use the number of contacts to colour the
> protein, ie
> substitute no of contacts in the B factors column.
> Thank you
> -Syma
> ***************************************************
> Dr Syma Khalid
> Department of Biochemistry,
> University of Oxford
> South Parks Road,
> Oxford
> OX1 3QU
> U.K.
> ***************************************************
> <newcontacts.tcl>