From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Fri Jul 13 2007 - 13:04:16 CDT

On Fri, 13 Jul 2007, sally cii wrote:

dear sally,

> 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

where do you define $sel1 and $sel2 ?
when you don't set or import them, they
are not available in the subroutine.

axel.

>
> $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
>

-- 
=======================================================================
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.