Re: TCL force

From: Peter Freddolino (
Date: Tue Sep 23 2008 - 09:05:16 CDT

Is the segfault coming from your fortran code or namd itself?

If it's coming from namd, it's probably due to issues with floating
point math in tclforces when running in parallel; there have been
previous threads on the subject on namd-l, and while I know Jim is
currently working on it with the tcl developers, for now the best
solution is probably to move more of the floating point work into your
compiled external code, since you're already using something external

BIN ZHANG wrote:
> Hi, peter:
> Thanks a lot for your response.
> " set force [exec "./fortran_force $variable"] ", this is what I
> was doing. sorry for the typo.
> Now I think the problem is: while I was trying to run NAMD with my
> script in serial, everything is fine. But for parallel running, I
> always got segmentation violation. Do you have any idea about why?
> Thanks a lot.
> Bin
> On Sep 22, 2008, at 10:37 PM, Peter Freddolino wrote:
>> Hi Bin,
>> you certainly can, but you'd need to do something like
>> set force [exec "./fortran_force $variable"]
>> ie, properly call an external command from tcl -- you'll want to pay
>> careful attention to how exec works. If you're willing to use c/c++
>> instead of fortran, you can also use swig to put a tcl wrapper around
>> your external force calculation functions, which is something I do
>> frequently (one can always make this work in principle by writing a
>> tcl wrapper for your force application function, but swig makes the
>> process much easier).
>> With tclforces you don't need to distribute the executable because
>> tclforces only runs on the head node. With tclbc this could be a
>> problem if your compute nodes don't have access to the same
>> filesystem as node0; you'd need to work around this accordingly.
>> Peter
>> BIN ZHANG wrote:
>>> Hi, All:
>>> I was trying to use the TCL force utility of NAMD to apply some
>>> forces on the system. Since the calculation of the force is a little
>>> complicated, I don't want to use TCL to calculate it. So my question
>>> is : can I write a FORTRAN code and compile it as an executable,
>>> then in the calforces procedure, using :
>>> set force [./FORTRAN_force $variable] to get the force?(assuming the
>>> FORTRAN_force is an executable compiled from source code).
>>> If I want to run NAMD in parallel, do I need to copy the
>>> executable to each node explicitly?
>>> Thanks a lot in advance.
>>> Bin
> -------------------------------------------------------------
> The tree of liberty must be refreshed from time to time with the blood
> of patriots and tyrants.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:49:51 CST