Re: queries about "Tclforces" utility in NAMD

From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri May 25 2012 - 05:54:27 CDT

On Fri, May 25, 2012 at 3:48 AM, Jérôme Hénin <jhenin_at_ifr88.cnrs-mrs.fr> wrote:

[...]

>> (c) it also appears that NAMD's tcl-interpreter does not understand tcl
>> commands: lassign, lvarpop...or am I missing something?..I have tried these
>> things on a serial binary of version 2.8/2.9..
>
> These commands are relatively recent additions to Tcl. If you manage
> to compile NAMD linked to a recent Tcl implementation (ie version
> 8.5), you'll have access to them.

those were previously part of TclX and can be easily emulated in Tcl script.
this is what VMD uses in one of its startup scripts.

# TclX commands we still use in VMD
proc lassign { listvar args } {
  set i 0
  foreach var $args {
    upvar $var x
    set x [lindex $listvar $i]
    incr i
  }
  return [lrange $listvar $i end]
}

proc lvarpush { listvar var } {
  upvar $listvar x
  set x [list $var $x]
}

proc lvarpop { var } {
  upvar $var x
  set retval [lindex $x 0]
  set x [lrange $x 1 end]
  return $retval
}

axel.

>
> Best,
> Jerome
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:21:33 CST