From: Vlad Cojocaru (
Date: Tue Apr 17 2007 - 07:25:19 CDT

Dear vmd users,

I thought of doing something like in the script below ($A, $B are 2
selections). However "foreach {atom1 atom2} .." does not properly map
the output of "measure contacts".
I realized that by checking the output of "measure contacts" but I
couldnt figure yet how to assign that output to properly get the pair of
atoms {$atom1 $atom2}. Can somebody give me a hint how to do that ?


-------------------trial script
foreach {atom1 atom2} [measure contacts 8.0 $B $A] {
   set d [measure bond {$atom1 $atom2}]
   set resid1 [$atom1 get resid]
   set resname1 [$atom1 get resname]
   set atomname1 [$atom1 get name]
   set resid2 [$atom2 get resid]
   set resname2 [$atom2 get resname]
   set atomname2 [$atom2 get name]
   puts $cFILE "$atom1:$atomname1:$resname1:$resid1
$atom2:$atomname2:$resname2:$resid2 $d"
   unset $atom1
   unset $atom2
   unset $atomname1
   unset $atomname2
   unset $resname1
   unset $resname2
   unset $resid1
   unset $resid2
   unset d

Dr. Vlad Cojocaru
EML Research gGmbH
Schloss-Wolfsbrunnenweg 33
69118 Heidelberg
Tel: ++49-6221-533266
Fax: ++49-6221-533298
EML Research gGmbH
Amtgericht Mannheim / HRB 337446
Managing Partner: Dr. h.c. Klaus Tschira
Scientific and Managing Director: Prof. Dr.-Ing. Andreas Reuter