From: John Stone (johns_at_ks.uiuc.edu)
Date: Sat Jan 12 2008 - 00:23:09 CST

Hi,
  Just surround your other commands with a conditional, e.g.
something like:
  set truefalse [expr [llength of your other stuff] > 0]

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Jan 11, 2008 at 12:57:10PM +0100, L. Michel Espinoza-Fonseca wrote:
> Hi all,
>
> I'm trying to compute contacts between two proteins from a trajectory.
> To achieve that, I'm using the following simple script:
>
> set outfile [open output.txt w]
> set nf [molinfo top get numframes]
> set P2 [atomselect top "segname P2 and resid 28"]
> set P1 [atomselect top "segname P1 and resid 63"]
> for {set i 0} {$i<$nf} {incr i} {
> $P2 frame $i
> $P1 frame $i
> $P2 update
> $P1 update
> set contact [llength [lindex [measure contacts 4.7 $P2 $P1] 0]]
> puts $outfile "Frame $i, $contact"
> }
> close $outfile
>
> When I use the script, everything works well. However, The output
> gives me something like this:
>
> Frame 0, 58
> Frame 1, 80
> Frame 2, 62
> Frame 3, 43
> Frame 4, 59
> Frame 5, 80
> Frame 6, 57
> Frame 7, 94
> Frame 8, 65
> Frame 9, 137
> Frame 10, 104
> ...
>
> So I was wondering if you guys know a way to get a true/false output
> instead, so I can get something like this:
>
> Frame 0, 1
> Frame 1, 1
> Frame 2, 1
> Frame 3, 1
> Frame 4, 1
> Frame 5, 0
> Frame 6, 0
> Frame 7, 1
> Frame 8, 0
> Frame 9, 1
> Frame 10, 1
> ...
>
> All comments will be appreciated.
>
> Cheers,
> Michel

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078