tclforces- tcl extension written in c and built with swig

From: Eva Gonzalez Noya (
Date: Mon Oct 17 2011 - 18:30:33 CDT


I am trying to use the tclforces interfase to apply some forces to my
To calculate the forces I am using a tcl extension, written in C and
built using swig. Everything seems to be working fine when I run it
in a single processor, but when I submit it in parallel I get the error:

TCL: couldn't load file "./": ./
wrong ELF class: ELFCLASS64

It seems that while running in parallel namd is not able to find the tcl
I tried to specify the full path when loading it, but that doesn't seem
to be working.

I attached below detailed information about how I am doing this:
Any idea about how I can solve this problem?



I build the tcl module using the directives given in the swig webpage:
unix % swig -tcl example.i
unix % gcc -fpic -c example.c example_wrap.c \
unix % gcc -shared example.o example_wrap.o -o

and I used the following tcl script:

load ./ calculate_forces
proc calcforces {} {
     global lista num grupo num_monomer
     loadcoords x
     set outfile [open w]
     foreach i $grupo {
        puts $outfile "$x($i) "
     close $outfile
     set forces [new_double 21]
     print "forces now $forces"
     calculate_forces $forces
     set lforces [Array2Tcl $forces 21]

     #print "lforces $lforces"
     set index 0
     foreach i $grupo {
        set j [expr $index*3]
        set fx [lindex $lforces $j]
        set fy [lindex $lforces [expr $j+1]]
        set fz [lindex $lforces [expr $j+2]]
        set force "$fx $fy $fz"
        addforce $i $force
        set index [expr $index+1]

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