From: sally cii (cii.sally_at_googlemail.com)
Date: Fri Jul 13 2007 - 12:02:02 CDT

 Dear all,
I want to write a tcl script that can return the list of atom index in $sel1
that within a certain distance contact with atoms in $sel2 during a
trajectory. Here is the trial script, after I load this script, I got the
atom index printed out in tcl console together with complain about 'bad
option', but not saved in the file I wanted. Can anyone tell me how to
return a list in a file? thank you in advance!

#####################################################
proc num_contact {mol dist fname} {

set nf [molinfo top get numframes]

set f [open $fname "w"]

for {set i 0} {$i < $nf} {incr i} {

$sel1 frame $i

$sel1 update

$sel2 frame $i

$sel2 update

set lists [measure contacts $dist $sel1 $sel2]

set list1 [lsort -increasing $lists 0]

puts $f "$list1"}

close $f

$sel1 delete

$sel2 delete
}
####################################################

Sincerely,
Sally Cii