Re: tclforces- tcl extension written in c and built with swig

From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Oct 17 2011 - 18:43:08 CDT

hi eva,

On Mon, Oct 17, 2011 at 7:30 PM, Eva Gonzalez Noya <evanoya_at_uchicago.edu> wrote:
> 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.

no. the error message indicates that are trying to load a 64-bit
shared object into a 32-bit binary. that would mean that your
parallel binary is 32-bit, while your serial binary is 64-bit.

try using the "file" command on both executables to verify this.

cheers,
    axel.

> 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]
>    }
> }
>
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:20:54 CST