Re: if{} statements

From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Mar 05 2013 - 08:15:21 CST

On Tue, Mar 5, 2013 at 3:07 PM, Thomas C. Bishop <bishop_at_latech.edu> wrote:
> thanks for the quick responses. yes the tcl language is excellent source
> but what tricks can you play w/ namd-tcl and the run command.
>
>
> I guess I thought there might be more to the
> if {1} {
> and
> if {0} {
> and
>
> if {1} {
> minimize 1000
> reinitvels $temperature
> }
> run 250000 ;# 0.5 ns
>
> statements than just "commenting options".
>
> How might IF statements be altered by the "run" command.

they cannot.

you are looking at this from the wrong perspective. each config file
statement is like a Tcl command that sets some internal variables to
some value. so they are evaluated *immediately*. once the script
interpreter has passed them, they are gone.

the same goes for the "run" or "minimize" commands which then start a
calculation based on the internal status *at the time*. the only way
to then do manipulations is inside the Tcl scripting of TclForces and
alike.

axel.

>
> Thanks
> TOm
>
>
> On 03/05/2013 07:59 AM, Hannes Loeffler wrote:
>>
>> On Tue, 5 Mar 2013 07:46:29 -0600
>> "Thomas C. Bishop" <bishop_at_latech.edu> wrote:
>>
>>> A short explanation of "if-then-else" usage would be appreciated.
>>>
>>> (along w/ word "if-then-else" b/c searching for "if" in the manual
>>> does not help:-)
>>
>>
>> Have you tried something like "tcl if" with your favourite web search
>> engine? http://wiki.tcl.tk/ is a good start too. TCL's if statement
>> is pretty much the same as in other languages. If you wonder about why
>> your ifs tests for 1 and 0: 1 = true, 0 = false (effectively the same
>> as commenting out the code).
>>
>> Hannes.
>>
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
International Centre for Theoretical Physics, Trieste. Italy.

This archive was generated by hypermail 2.1.6 : Tue Dec 31 2013 - 23:23:02 CST