From: Nicolas Sapay (nicolas.sapay_at_cermav.cnrs.fr)
Date: Thu Jul 23 2009 - 09:28:13 CDT

Axel Kohlmeyer a écrit :
> 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
>
Thanks for the trick. My personal library of TCL functions is growing up
every day!
> 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
>
Indeed, I didn't think about that.
> 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.
Most of the time (especially when I have to play with large data set),
I just call a function coded in a seperated TCL file that is sourced in
VMD. So, this annoying text is not displayed at all. Additionally, I
don't use that often expr directly in the VMD console. I would favour a
silent set to keep the console as clear as possible.

Cheers,
Nicolas
> cheers,
> axel.
>
>
>
>> Nicolas
>>
>>
>
>