From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Dec 01 2004 - 10:43:51 CST

Lubos,
  In order to print the output (to screen or to file) you
need to use 'puts'. Unlike when you run the commands interactively,
Tcl won't print the results of '$sel num' on the screen, so to do
this you'd want to do something like:
  set rescount [$sel num]
  puts "Residue count: $rescount"

To write stuff to files, you need to use commands like these:
  set fildes [open $file w]
  puts $fildes "Tcl hacking in vmd is fun"
  close $fildes

  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Dec 01, 2004 at 05:29:25PM +0100, Lubos Vrbka wrote:
> thanks to jerry and john...
>
> i played with it a bit and it seems to be almost done...
>
> following commands
> set sel [atomselect top "...selection text..."]
> $sel num
> print out the correct number of residues conforming to selection.
>
> i tried to cycle this
> set n [molinfo top get numframes]
> for { set i 0 } { $i < $n} { incr i } {
> $sel frame $i
> $sel update
> $sel num
> }
> computer does the calculation, but nothing is printed to the console.
> what is wrong here? how do i print the output and how can i redirect
> such an output to a file?
>
> regards,
> --
> Lubos
> _@_"

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