From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Thu Nov 16 2006 - 20:08:01 CST

On Thu, 16 Nov 2006, Myunggi Yi wrote:

MY> foreach atom1 $crd1 id1 $list1 {
MY> foreach atom2 $crd2 id2 $list2 {

try changing the following block. actually using "text" as selection
will get you an error and hence no value in $close.

MY> set dist($id1,$id2) [veclength [vecsub $atom2 $atom1]]
MY> set min [mymin $min $dist($id1,$id2)]
MY> if {[expr $dist($id1,$id2) < $min]} {
MY> set close [atomselect [molinfo $id2] "text"]
MY> }

                 set dist [veclength [vecsub $atom2 $atom1]]
                 if {$dist < $min} then {
                     set min $dist
                     set close "$id1 $id2"
                 }
MY> }
MY> }

and use this as output. you can optimize this a little more by storing
lists of resname and name outside the loop and lindex them here.

        puts $fout "[expr ($i + 1)*10] [lindex [$sel1 get resname] [lindex $close 0]] [lindex [$sel2 get name] [lindex $close 1]]"

MY> }
MY> close $fout
MY> }
MY> ++++++++++++++++++++++++++++
MY>
MY> I've got the following error message.
MY>
MY> "can't read "close": no such variable"

if you have a syntax error, a variable will not be defined...

cheers,
  axel.

MY>
MY> Please help me how to fix this script.

MY>
MY>
MY>
MY>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   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.