Re: Making NAMD aware of Tcl packages?

From: Giacomo Fiorin (
Date: Thu Mar 31 2016 - 11:36:20 CDT

Yes, the Tcl interface allows for a lot of flexibility, and people do use
this feature quite a lot because it's very easy to develop new methods and
test them instantly.

The reason why there are few Tcl extensions to NAMD, compared to the large
number of VMD plugins, is performance: Tcl is an interpreted language.

Once a method reaches enough maturity, it makes more sense to use C++.
Years ago for one of my thesis projects I needed a new version of
metadynamics for NAMD, and because the basic method had already been tested
in other codes, it made more sense to write C++. Instead, the author of
the first implementation of ABF (Jérôme Hénin) chose Tcl because ABF is
mathematically more complex than metadynamics and several conventions had
to be tested: this took priority over performance in the short term.
Later, after the method was fully tested, he and I reimplemented ABF in C++
as part of the colvars module.

In general, you would want to use a combination of scripted and compiled
languages, to have both flexibility and performance.

Composing Tcl commands as you suggest is most likely the best way to test a
new algorithm. If you structure a Tcl code modular enough that the most
expensive procedures can be reimplemented as C++ backends, it could pretty
much benefit from the "best of both worlds".


On Thu, Mar 31, 2016 at 11:20 AM, Brian Radak <> wrote:

> So is the whole process of producing features strictly via Tcl considered
> deprecated in preference for Tcl commands implemented via C++? It would
> seem that composition of existing Tcl commands would provide a very
> flexible and powerful interface - I was wondering why this seems so
> underutilized.
> On 03/31/2016 10:17 AM, Giacomo Fiorin wrote:
> Hello Brian, in NAMD there are very few "packages" in the Tcl sense, i.e.
> those that you can load via "package require ...".
> The Tcl version of ABF (found under lib/) has now been superseded by the
> implementation provided by the colvars module.
> However, because most NAMD features come with at least one callable Tcl
> procedure, you can test for the presence of that procedure through "info"--047d7b1637ad891a3c052f5adea9--

This archive was generated by hypermail 2.1.6 : Tue Dec 27 2016 - 23:21:56 CST