From: Vlad Cojocaru (Vlad.Cojocaru_at_eml-r.villa-bosch.de)
Date: Tue Apr 17 2007 - 09:50:49 CDT

Hi guys,

Sorry I will reply to my own email ... Although now I think my question
was pretty trivial, if somebody is interested in the solution to my
question, below there is a script that works.

Cheers
vlad

------------------------------------script-------------------------------------

set cFILE [open contacts.dat w+]
set lists [measure contacts 8.0 $sel1 $sel2]
set l1_atoms [lindex $lists 0]
set l2_atoms [lindex $lists 1]

foreach {atom1} $l1_atoms {atom2} $l2_atoms {
   set atom1sel [atomselect 0 "index $atom1"]
   set atom2sel [atomselect 0 "index $atom2"]
   set d [measure bond "$atom1 $atom2"]
   set resid1 [$atom1sel get resid]
   set resname1 [$atom1sel get resname]
   set atomname1 [$atom1sel get name]
   set resid2 [$atom2sel get resid]
   set resname2 [$atom2sel get resname]
   set atomname2 [$atom2sel get name]
   puts $cFILE "$atom1:$atomname1:$resname1:$resid1
$atom2:$atomname2:$resname2:$resid2 $d"
}

Vlad Cojocaru wrote:

> 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 ?
>
> Thanks
> vlad
>
> -------------------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
e-mail:Vlad.Cojocaru[at]eml-r.villa-bosch.de
http://projects.villa-bosch.de/mcm/people/cojocaru/
----------------------------------------------------------------------------
EML Research gGmbH
Amtgericht Mannheim / HRB 337446
Managing Partner: Dr. h.c. Klaus Tschira
Scientific and Managing Director: Prof. Dr.-Ing. Andreas Reuter
http://www.eml-r.org
----------------------------------------------------------------------------