tclforces- tcl extension written in c and built with swig

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

Hi,

I am trying to use the tclforces interfase to apply some forces to my
system.
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 "./calculate_forces.so": ./calculate_forces.so:
wrong ELF class: ELFCLASS64

It seems that while running in parallel namd is not able to find the tcl
module.
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?

Thanks,

Eva

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 \
         -I/usr/local/include
unix % gcc -shared example.o example_wrap.o -o example.so

and I used the following tcl script:

load ./calculate_forces.so calculate_forces
proc calcforces {} {
     global lista num grupo num_monomer
     loadcoords x
     set outfile [open coords.xyz 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 : Mon Dec 31 2012 - 23:20:54 CST