Hi all.<br><br>I'm writing this beucase I'm having terrible problems in trying to deal with gromacs trajectory files with my own programs, originally written on fortran90.<br><br>The codes themselves are enoughly big to make it out of question to try to "translate" them. What leads to some sort of mixed language compilation.
<br><br>My first guess was to try to use the guidelines from <a href="http://xray.bmc.uu.se/~spoel/md/online/xtc.html">http://xray.bmc.uu.se/~spoel/md/online/xtc.html</a>, but it absolutelly didn't worked. Could not find a compatible library. Tried to recompile gromacs in order to do so, but instead of a
libsdrf.a library file, it created just common .lo and .o object files.<br><br>Looked inside concoord program, as there are some mentions in the list to look at the code. Was a really good aprentize, could understand better the logics involved when dealing with .xtc files, BUT I could not use the library files that came with that. Somehow, it wasn't recognized as a valid file.
<br><br>My last try up to now was to try to link my test-read-program with the libxdrf object file. It yelded the following error:<br><br>CruNumMac src/own/B/9/xtc 238% ifort libxdrf.lo xtciof.f90 test_xtc.f90<br>IPO: WARNING: no IR in object file
libxdrf.lo; was the source file compiled with -ipo?<br>IPO Error: unresolved : xdrfint_<br> Referenced in /tmp/ipo_ifortZNvZHh.o<br>IPO Error: unresolved : xdrfclose_<br> Referenced in /tmp/ipo_ifortZNvZHh.o
<br>IPO Error: unresolved : xdrfopen_<br> Referenced in /tmp/ipo_ifortZNvZHh.o<br>IPO Error: unresolved : xdrffloat_<br> Referenced in /tmp/ipo_ifortZNvZHh.o<br>IPO Error: unresolved : xdrf3dfcoord_<br> Referenced in /tmp/ipo_ifortZNvZHh.o
<br>IPO: performing multi-file optimizations<br>IPO: generating object file /tmp/ipo_ifortZNvZHh.o<br>test_xtc.f90(17) : (col. 3) remark: LOOP WAS VECTORIZED.<br>test_xtc.f90(25) : (col. 8) remark: LOOP WAS VECTORIZED.<br>
xtciof.f90(112) : (col. 3) remark: LOOP WAS VECTORIZED.<br>libxdrf.lo: file not recognized: File format not recognized<br><br>If I try to link to the .o objetc:<br><br>CruNumMac src/own/B/9/xtc 240% ifort libxdrf.o xtciof.f90
test_xtc.f90<br>IPO: WARNING: no IR in object file libxdrf.o; was the source file compiled with -ipo?<br>IPO Error: unresolved : xdrfint_<br> Referenced in /tmp/ipo_ifort2f5KMw.o<br>IPO Error: unresolved : xdrfclose_
<br> Referenced in /tmp/ipo_ifort2f5KMw.o<br>IPO Error: unresolved : xdrfopen_<br> Referenced in /tmp/ipo_ifort2f5KMw.o<br>IPO Error: unresolved : xdrffloat_<br> Referenced in /tmp/ipo_ifort2f5KMw.o<br>
IPO Error: unresolved : xdrf3dfcoord_<br> Referenced in /tmp/ipo_ifort2f5KMw.o<br>IPO Error: unresolved : ffclose<br> Referenced in libxdrf.o<br>IPO: performing multi-file optimizations<br>IPO: generating object file /tmp/ipo_ifort2f5KMw.o
<br>test_xtc.f90(17) : (col. 3) remark: LOOP WAS VECTORIZED.<br>test_xtc.f90(25) : (col. 8) remark: LOOP WAS VECTORIZED.<br>xtciof.f90(112) : (col. 3) remark: LOOP WAS VECTORIZED.<br>/tmp/ipo_ifort2f5KMw.o(.text+0x1e1): In function `MAIN__':
<br>/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfopen_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x4ea):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfclose_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x517):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfopen_'
<br>/tmp/ipo_ifort2f5KMw.o(.text+0x92b): In function `xtciof_mp_xtcheader_':<br>/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfint_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x941):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfint_'
<br>/tmp/ipo_ifort2f5KMw.o(.text+0x95e):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfint_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x97b):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0xb8e): In function `xtciof_mp_xtcio_':
<br>/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0xbde):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0xc2e):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'
<br>/tmp/ipo_ifort2f5KMw.o(.text+0xc7e):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0xcce):/tmp/ipo_ifort2f5KMw.f: more undefined references to `xdrffloat_' follow<br>
/tmp/ipo_ifort2f5KMw.o(.text+0xe6b): In function `xtciof_mp_xtcio_':<br>/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrf3dfcoord_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0xfc6): In function `xtciof_mp_xtcopen_':<br>
/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfopen_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x1292):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfclose_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x12b3):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfopen_'
<br>/tmp/ipo_ifort2f5KMw.o(.text+0x134e): In function `xtciof_mp_xtccoord_':<br>/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x139f):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'
<br>/tmp/ipo_ifort2f5KMw.o(.text+0x13f0):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x1441):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'<br>/tmp/ipo_ifort2f5KMw.o(.text+0x1492):/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'
<br>/tmp/ipo_ifort2f5KMw.o(.text+0x14e3):/tmp/ipo_ifort2f5KMw.f: more undefined references to `xdrffloat_' follow<br>/tmp/ipo_ifort2f5KMw.o(.text+0x162d): In function `xtciof_mp_xtccoord_':<br>/tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrf3dfcoord_'
<br>libxdrf.o(.text+0x3d86): In function `xdrclose':<br>libxdrf.c: undefined reference to `ffclose'<br>libxdrf.o(.text+0x3da8):libxdrf.c: undefined reference to `ffclose'<br><br>I'm really not getting what can be the source of error. I placed the two test wources from above trials below, in case it can be of any help. But I really not getting what am I doing wrong, and also could not find any other clue in gromacs mail lists, neither google.
<br><br>Sorry it this is a much simpler question than it seems to me, but I'm really astonished not finding the source of error neither a workaround or an altertive way which I could follow and reach some results.<br>
<br>Thanks a lot in advance,<br><br>Sincerally yours,<br><br>Jones<br><br>********Attachments:<br><br>*****test_xtc.f90:<br>program test_xtc<br>use xtciof<br>implicit none<br>! Declaracao de Variaveis:<br> integer :: xd, natoms, step, ret
<br> integer :: nat, maxat<br>! real*4 :: time, box(9), x(*), prec<br> real :: time, box(9), prec<br> real, dimension(:), allocatable :: x<br> character*1 :: stat<br> character(len=1) :: file_name<br><br> maxat = 10000
<br> stat = 'a'<br> file_name = 'teste.xtc'<br> allocate(x(30000))<br> x(:) = 0.<br><br>! Aqui comeca o programa de teste:<br><br> call xtcopen(xd, file_name, stat, maxat, nat)<br><br> write(6,*) 'xtc file openned'
<br><br> call readxtc(xd, natoms, step, time, box, x, prec, ret)<br><br> write(6,*) 'xtc file readed'<br><br> call writextc(xd, natoms, step, time, box, x, prec, ret)<br><br> write(6,*) 'xtc file written'
<br><br> deallocate(x)<br><br>end program test_xtc<br><br>******xtciof.f90:<br>module xtciof<br><br>contains<br><br>subroutine xtccheck(ret,ivar)<br>implicit none<br>!<br>! Passed variables<br>!<br> integer, intent(in) :: ret, ivar
<br><br> if ( ret .eq. 0 ) then<br> if (ivar == 1) write(6,*) '> XTC-Error reading/writing natoms'<br> if (ivar == 2) write(6,*) '> XTC-Error reading/writing step'<br> if (ivar == 3) write(6,*) '> XTC-Error reading/writing time'
<br> if (ivar == 4) write(6,*) '> XTC-Error reading/writing box'<br> if (ivar == 5) write(6,*) '> XTC-Error reading/writing x'<br>! stop<br> endif<br>end subroutine xtccheck<br><br>subroutine xtcheader(xd,magic,natoms,step,time,ret)
<br>implicit none<br>!<br>! Passed variables<br>!<br> integer :: xd, natoms, step, ret, magic<br>! real*4 :: time<br> real :: time<br><br> call xdrfint(xd, magic, ret)<br> if (ret == 0) return<br><br> call xdrfint(xd, natoms, ret)
<br> call xtccheck(ret, 1)<br><br> call xdrfint(xd, step, ret)<br> call xtccheck(ret, 2)<br><br> call xdrffloat(xd, time, ret)<br> call xtccheck(ret, 3)<br><br>end subroutine xtcheader<br><br>subroutine xtccoord(xd,natoms,box,x,prec,ret)
<br>implicit none<br>!<br>! Passed variables<br>!<br> integer :: xd, natoms, ret<br>! real*4 :: box(9), x(*), prec<br> real :: box(9), x(*), prec<br>!<br>! local<br>!<br> integer :: i<br><br> do i=1, 9
<br> call xdrffloat(xd, box(i), ret)<br> call xtccheck(ret, 4)<br> enddo !i<br><br> call xdrf3dfcoord(xd, x, natoms, prec, ret)<br> call xtccheck(ret, 5)<br><br><br>end subroutine xtccoord<br><br>subroutine xtcio(xd, natoms, step, time, box, x, prec, mode, ret)
<br>implicit none<br>!<br>! Passed variables<br>!<br> integer :: xd, natoms, step, mode, ret<br>! real*4 :: box(9)<br>! real*4 :: box(9)<br>! real*4 :: x(*)<br> real :: time, prec<br> real :: x(*)<br>
real :: box(9)<br>!<br>! local variables<br>!<br> integer :: xtcmagic<br> integer :: magic<br><br> xtcmagic=1995<br><br> if (mode .eq. 0) magic = xtcmagic<br><br> call xtcheader(xd, magic, natoms, step, time, ret)
<br><br> if (ret == 0) return<br><br> if (mode == 1) then<br> if (magic == xtcmagic) write(6,*) '> Fatal error, magic number read as ',magic, ' should be ',xtcmagic<br> endif !(mode == 1)<br>
<br> call xtccoord(xd, natoms, box, x, prec, ret)<br><br>end subroutine xtcio<br><br>subroutine readxtc(xd, natoms, step, time, box, x, prec, ret)<br>implicit none<br><br> integer :: xd, natoms, step, ret<br> integer :: nat
<br>! real*4 :: time, box(9), x(*), prec<br> real :: time, box(9), prec<br> real, dimension(:), allocatable :: x<br><br> allocate (x(natoms))<br> x(:) = 0.<br><br> call xtcio(xd,natoms,step,time,box,x,prec,1,ret)
<br><br>end subroutine readxtc<br><br>subroutine writextc(xd, natoms, step, time, box, x, prec, ret)<br>implicit none<br><br> integer :: xd, natoms, step, ret<br> real :: time, box(9), x(*), prec<br><br> call xtcio(xd, natoms, step, time, box, x, prec, 0, ret)
<br><br>end subroutine writextc<br><br>subroutine xtcopen (xd, file_name, stat, maxat, nat)<br>implicit none<br><br> integer :: xd, ret, nat, maxat, magic, step<br>! real*4 :: time<br> real :: time<br> character*1 :: stat
<br> character*(*) :: file_name<br> integer, parameter :: xtcmagic = 1995<br><br> call xdrfopen(xd, file_name, stat, ret)<br> if (ret == 0) write(6,*) '> Fatal error, could not open ',file_name(1:20)<br>
<br> call xtcheader(xd, magic, nat, step, time, ret)<br><br> if (magic /= xtcmagic) then<br> write(6,*) '> Fatal error, magic number read as ',magic,' should be ',xtcmagic<br> stop<br> endif
<br><br> if (nat < 0) then<br> write(6,*) '> Fatal error, negative number of atoms'<br> stop<br> endif<br><br> if (nat > maxat) then<br> write(6,*) '> Fatal error, number of atoms (',nat,') ','larger than allowed (',maxat,')'
<br> stop<br> endif<br><br> call xdrfclose(xd, ret)<br><br> call xdrfopen(xd, file_name, stat, ret)<br><br>end subroutine xtcopen<br><br>!end contains<br><br>end module xtciof<br>