From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Thu Jul 23 2009 - 07:45:34 CDT

On Thu, 2009-07-23 at 12:15 +0200, Nicolas SAPAY wrote:
> Hello,

hello nicolas,

> I have noticed that scripts run -e options systematically echo the result
> of the "set command". For example, if there is something like that:
> set i "hello"
>
> The VMD console will display:
> hello

yes. that is the documented behavior of the tcl interpreter.
it always displays the return value of the last command.

> Is there a way to disable that? I know, it is really a silly problem, but
> sometimes that makes the display a bit confusing. I have also noticed that
> the set command doesn't return anything if it is embedded in a loop.

exactly, as the return value would be the return value of the looping
command. the same is true for subroutines, if you use and explicit
return, so that would be a trick to work around it. check out:
http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/cpmd-vmd/part7.html#chap9_sect10

over the last years i've been on and off working on a more
flexible console output handling for VMD (it works fine for me, and
is included in the VMD source, but not ready for prime time and thus
not enabled in the official VMD builds)... and i have been pondering
for a while, if i should try and change this behavior for the VMD
console (or at least make it an option). having the current behavior
can seriously impact performance, if one processes large data sets
on the command line, as it take much more time to format and print
them, than to do the calculations. the downside of disabling this
behavior is, that fast calculations with expr would not work anymore.
one would have to define a new command, e.g. something like this

proc compute {args} {
  set res [expr $args]
  puts "$res"
}

to recover this. if people here would give their opinion on this,
it would help us to make an appropriate choice.

cheers,
   axel.

> Nicolas
>

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