[gmx-users] gromacs/mopac compilation: linking libmopac (Javier Cerezo)

Javier Cerezo jcb1 at um.es
Thu Nov 17 11:37:03 CET 2011


Yes, I've checked water energy with gaussian09:

gaussian(am1) :              E=-0.09326880 a.u.
gromacs/mopac(am1):   E=-0.09318       a.u.

I supposed the differences may arise from some differences in the 
implementation in both codes (gaussian an mopac). I still have to go 
through some other tests.

Of course, place this info wherever you think it will be useful. By the 
way, do you have any idea about the problem to build build libmopac with 
ifort?

Regards,

Javier


El 17/11/11 11:26, Gerrit Groenhof escribió:
>>    3. Re: gromacs/mopac compilation: linking libmopac (Javier Cerezo)
> Dear Javier,
>
> Thanks for this update and your efforts. Can i put it on the website?
>
> Could you check however the outcome (energy and forces) of an am1 or pm3 computations with another program?
>
> Best wishes,
>
> Gerrit
>
>> Hi all
>>
>> I post here the present status of my query in case my findings may be
>> helpful for someone else. In the case B (using gfortran to compile
>> libmopac) I have some success building g the gromacs binary for mdrun in
>> my x86_64 system.
>>
>> **A
>> Regarding the compilation with ifort, making test with simple C code I
>> relized that (at least in my case), it is needed to add some extra intel
>> libreries during compilation. Concretely I added the mkl libraries
>> (maybe libm was enough, but just in case) and the additional libraries
>> libifcore, libifcore_pic, libimf, libifport and libintlc (actually the
>> two that seem strongly required were libifcore and libintlc). The case
>> is that libintlc is only available in shared version, so I fist
>> recompiled my libmopac library with -fPIC flag:
>>
>> ifort -O2 -fPIC -c *f; ar rcv libmopac.a *.o; ranlib  libifmopac.a
>>
>> In my test C simple program, it was possible to link against the static
>> libifmopac.a while using other shared libraries (omitting the flag
>> -static), so I used --enable-shared. The configure script was
>> subsequently called as follows (with double precision as well):
>>
>> ./configure --prefix
>> /home/cerezo/Programas/gromacs-4.5.5_with_ifort_mopac/
>> --program-suffix=_d_ifmopac LDFLAGS="-L/home/cerezo/lib
>> -L/home/cerezo/lib/fftw/lib -L/usr/share/intel/mkl/lib/intel64
>> -L/usr/share/intel/lib/intel64" CPPFLAGS="-DUSE_MOPAC
>> -I/home/cerezo/lib/fftw/include" --with-qmmm-mopac
>> LIBS="-lmkl_intel_ilp64 -lmkl_core -lmkl_sequential -lifcore
>> -lifcore_pic -limf -lirc -lifport -lintlc -lifmopac" --disable-threads
>> --disable-float
>> LD_LIBRARY_PATH=/usr/share/intel/mkl/lib/intel64:/usr/share/intel/lib/intel64::LD_LIBRARY_PATH
>>
>> Then
>>
>> make mdrun -j 4
>>
>> gave the following error:
>>
>> cc -O3 -fomit-frame-pointer -finline-functions -Wall -Wno-unused -msse2
>> -funroll-all-loops -std=gnu99 -fexcess-precision=fast -o .libs/mdrun
>> gctio.o ionize.o do_gct.o repl_ex.o xutils.o runner.o md.o mdrun.o
>> genalg.o md_openmm.o  -L/home/cerezo/lib -L/home/cerezo/lib/fftw/lib
>> -L/usr/share/intel/mkl/lib/intel64 -L/usr/share/intel/lib/intel64
>> ./.libs/libgmxpreprocess_d.so
>> /home/cerezo/Programas/src/GROMACS_vX/gromacs-4.5.5/src/mdlib/.libs/libmd_d.so
>> ../mdlib/.libs/libmd_d.so /home/cerezo/lib/fftw/lib/libfftw3.so
>> /home/cerezo/Programas/src/GROMACS_vX/gromacs-4.5.5/src/gmxlib/.libs/libgmx_d.so
>> ../gmxlib/.libs/libgmx_d.so -lnsl -lm -lmkl_intel_ilp64 -lmkl_core
>> -lmkl_sequential -lifcore -lifcore_pic -limf -lirc -lifport -lintlc
>> -lifmopac  -Wl,--rpath
>> -Wl,/home/cerezo/Programas/gromacs-4.5.5_with_ifort_mopac/lib
>> -Wl,--rpath -Wl,/home/cerezo/lib/fftw/lib
>> /home/cerezo/Programas/src/GROMACS_vX/gromacs-4.5.5/src/mdlib/.libs/libmd_d.so:
>> undefined reference to `__svml_asin2'
>> /home/cerezo/Programas/src/GROMACS_vX/gromacs-4.5.5/src/mdlib/.libs/libmd_d.so:
>> undefined reference to `__svml_exp2_mask'
>> collect2: ld returned 1 exit status
>> make[1]: *** [mdrun] Error 1
>> make[1]: se sale del directorio
>> «/home/cerezo/Programas/src/GROMACS_vX/gromacs-4.5.5/src/kernel»
>>
>>
>> **B
>> I succeeded to build gromacs/mopac with gfortran compiled libmopac.
>> Fisrt I compiled libmopac with:
>>
>> gfortran -std=legacy -c *.f; ar rcv libmopac.a *.o; ranlib libmopac.a
>> (I made the necessary changes to remove the warnings and errors, such as
>> changing the calls to SECOND(1) by SECOND() in polar.f and writmo.f)
>>
>> In this case, gfortran procedures are simply linked with a single
>> library: libgfortran, with static version. Thus, I deactivated shared
>> option in the configure script. Then, the configure script for gromacs
>> looked like:
>>
>>   ./configure --prefix
>> /home/cerezo/Programas/gromacs-4.5.5_with_gfor_mopac/
>> --program-suffix=_d_mopac LDFLAGS="-L/home/cerezo/lib
>> -L/home/cerezo/lib/fftw/lib" CPPFLAGS="-DUSE_MOPAC
>> -I/home/cerezo/lib/fftw/include" --with-qmmm-mopac LIBS="-lmopac
>> -lgfortran" --disable-threads --disable-float -disable-shared
>>
>> make mdrun -j 4
>>
>> make install-mdrun
>>
>> All worked correctly. However, I got a segmentation fault when running a
>> qm/mm calculation, the problem originated at libmopac subroutines.
>> Actually, the problem is in the subroutine FOCK2 (in fock2.f), at least
>> in my system compiling with gfortran: GNU Fortran (Ubuntu/Linaro
>> 4.5.2-8ubuntu4) 4.5.2. The work around comes as follows:
>>
>> In fock2.f:
>> Line 35:      IF(ICALCN.NE.NUMCAL) THEN
>> [This if loop assures that variable initialization is only made the
>> fisrt time the main program calls the subroutine. However, in my
>> gfortran compiled binary, the variables were not saved from calls. So I
>> capped this loop (is should end at line 89), so that now it looks like:]
>> Line 35:            IF(ICALCN.NE.NUMCAL) THEN
>> Line 36:               ICALCN=NUMCAL
>> Line 37(new):   ENDIF     [this was moved from line 89]
>>
>> And now I could run gromacs/mopac without errors. I guess with another
>> compiler, this problem will not arise, but at least here is a solution
>> for (standard?) gfortran in a x86_64 system
>>
>> Javier
>>
>>
>>
>> El 10/11/11 14:35, Javier Cerezo escribió:
>>> Hi all
>>>
>>> I am trying to compile gromacs with mopac but I'm experience some
>>> problems using libmopac.a. I have a x86_64 processor and I'm trying
>>> with gromacs-4.5.5. I've followed the instructions at the website
>>> (i.e. to compile libmopac.a, I've used the alternte dcart.f and
>>> gmxmop.f) but I didn't succeed. I've also seen that this topic have
>>> some times appeared in the mailing list but the trick proposed didn't
>>> work for me.
>>>
>>> Here you have the steps with different scenarios I've gone through:
>>>
>>> **A: Compilation of libmopac.a with fortran compiler then gromacs
>>> installation**
>>>
>>> [ in mopac fortran folder]
>>> javier at mopac/fortran/folder>  $FC -O2 -c *.f        (where FC=gfortran
>>> or ifort)
>>> javier at mopac/fortran/folder>  ar rcv libmopac.a *.o;ranlib libmopac.a
>>> javier at mopac/fortran/folder>  cp libmopac.a ~/lib/
>>>
>>> [in gromacs folder]
>>> javier at gromacs/folder>  ./configure --prefix
>>> /home/cerezo/Programas/gromacs-4.5.5_with_mopac/ --with-qmmm-mopac
>>> --without-qmmm-gaussian  --disable-threads --disable-shared
>>> LDFLAGS="-L/home/cerezo/lib" CPPFLAGS="-DUSE_MOPAC" LIBS="-lmopac"
>>> javier at gromacs/folder>  make -j 4
>>>
>>> Then I get lots of "undefined reference" errors:
>>> cc -O3 -fomit-frame-pointer -finline-functions -Wall -Wno-unused
>>> -msse2 -funroll-all-loops -std=gnu99 -fexcess-precision=fast -o
>>> tpbconv tpbconv.o  -L/home/cerezo/lib ./.libs/libgmxpreprocess.a
>>> /home/cerezo/Programas/src/GROMACS_vX/gromacs-4.5.5/src/mdlib/.libs/libmd.a
>>> ../mdlib/.libs/libmd.a -lfftw3f
>>> /home/cerezo/Programas/src/GROMACS_vX/gromacs-4.5.5/src/gmxlib/.libs/libgmx.a
>>> ../gmxlib/.libs/libgmx.a -ldl -lnsl -lm -lmopac
>>> /bin/bash ../../libtool --tag=CC   --mode=link cc  -O3
>>> -fomit-frame-pointer -finline-functions -Wall -Wno-unused -msse2
>>> -funroll-all-loops -std=gnu99 -fexcess-precision=fast
>>> -L/home/cerezo/lib   -o g_protonate g_protonate.o libgmxpreprocess.la
>>> ../mdlib/libmd.la ../gmxlib/libgmx.la  -lnsl -lm -lmopac
>>> /bin/bash ../../libtool --tag=CC   --mode=link cc  -O3
>>> -fomit-frame-pointer -finline-functions -Wall -Wno-unused -msse2
>>> -funroll-all-loops -std=gnu99 -fexcess-precision=fast
>>> -L/home/cerezo/lib   -o g_luck g_luck.o libgmxpreprocess.la
>>> ../mdlib/libmd.la ../gmxlib/libgmx.la  -lnsl -lm -lmopac
>>> /home/cerezo/lib/libmopac.a(gmxmop.o): In function `donhco_':
>>> gmxmop.f:(.text+0x23e): undefined reference to `for_f90_index'
>>> gmxmop.f:(.text+0x26c): undefined reference to `for_f90_index'
>>> gmxmop.f:(.text+0x298): undefined reference to `for_f90_index'
>>> ...
>>> /home/cerezo/lib/libmopac.a(gmxmop.o): In function `deriv_':
>>> gmxmop.f:(.text+0x792): undefined reference to `for_f90_index'
>>> gmxmop.f:(.text+0x7c0): undefined reference to `for_f90_index'
>>> gmxmop.f:(.text+0x7e1): undefined reference to `for_f90_index'
>>> /home/javier/lib/libmopac.a(timer.o)(.text+0x11d): In function `timer_':
>>> : undefined reference to `for_write_seq_fmt'
>>> ... (an so on for each mopac object)
>>>
>>> Where I think these refer to internal intel fortran functions
>>> (compilation with ifort, analogous errors come with gfortran internal
>>> functions). So probably I'm missing something to include this function
>>> at gromacs compilation time
>>>
>>> ---
>>>
>>> **B: Compilation of libmopac.a with f2c+gcc then gromacs installation**
>>> javier at mopac/fortran/folder>   f2c *.f
>>> javier at mopac/fortran/folder>  gcc -O2 -c *.c
>>> javier at mopac/fortran/folder>  ar rcv libmopac.a *.o;ranlib libmopac.a
>>> javier at mopac/fortran/folder>  cp libmopac.a ~/lib
>>>
>>> [in gromacs folder]
>>> javier at gromacs/folder>  ./configure --prefix
>>> /home/cerezo/Programas/gromacs-4.5.5_with_mopac/ --with-qmmm-mopac
>>> --without-qmmm-gaussian  --disable-threads --disable-shared
>>> LDFLAGS="-L/home/cerezo/lib" CPPFLAGS="-DUSE_MOPAC" LIBS="-lmopac"
>>> javier at gromacs/folder>  make -j 4
>>>
>>> This time I also get "undefined reference errors", but related to f2c
>>> funtions:
>>> +timout.c0x105:)(:. textundefined+ 0x3c8reference) :to  undefined`
>>> do_fioreference'
>>> totimer.c :`(do_fio.'text
>>>
>>> In this case, do I need to include the f2c.h file somewhere in the
>>> gromacs qmmm interface code?
>>>
>>> Could someone point me out where I'm mistaking and what should I do to
>>> complete the installation?
>>>
>>> Thanks
>>>
>>> Javier
>>>
>>>
>> -- 
>> Javier CEREZO BASTIDA
>> PhD Student
>> Physical Chemistry
>> Universidad de Murcia
>> Murcia (Spain)
>> Tlf.(+34)868887434
>>
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Thu, 17 Nov 2011 15:51:53 +0530
>> From: Ravi Kumar Venkatraman<ravikumarvenkatraman at gmail.com>
>> Subject: [gmx-users] Regarding TIP4P structure
>> To: gmx-users at gromacs.org
>> Message-ID:
>> 	<CA+c-nQzzdJZ25rkkL5qdUN-7SnBY6P5Sacp7zjZLt_vVp3PozQ at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Dear all,
>>              Could anybody send me the link for getting the tip4p tip3p and
>> tip5p single water structure in gro/pdb or in anyother format.
>>
>> Thank you.
>>
>> *With Regards,
>> Ravi Kumar Venkatraman,
>> IPC Dept., IISc,
>> Bangalore, INDIA.
>>
>> +91-9686933963.*
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: http://lists.gromacs.org/pipermail/gmx-users/attachments/20111117/4840f654/attachment.html
>>
>> ------------------------------
>>
>> -- 
>> gmx-users mailing list
>> gmx-users at gromacs.org
>> http://lists.gromacs.org/mailman/listinfo/gmx-users
>> Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
>>
>> End of gmx-users Digest, Vol 91, Issue 117
>> ******************************************

-- 
Javier CEREZO BASTIDA
PhD Student
Physical Chemistry
Universidad de Murcia
Murcia (Spain)
Tlf.(+34)868887434




More information about the gromacs.org_gmx-users mailing list