[gmx-users] how to compile and make a C analyzing code under GROMACS 5.0

qiaobf qiaobf at gmail.com
Mon Jul 28 18:05:43 CEST 2014

Dear Mark,

Thanks a lot for your kind help. I have corrected the linkages to the 
heading files. However, I got a few more problems:
1)  The math library is not recognized when compiling. See below for the 
error message. Is there a way to add the flag of "-lm" under cmake? For 
instance, "gcc test.c -lm -o test" works where sqrt is also used.
> undefined reference to symbol 'sqrt@@GLIBC_2.2.5'
2) If the line with "sqrt" function is commented out, the g_density2 can 
be successfully generated. however, the "./g_density2 -h" is not working 
to display the help contents. Could you please give me some suggestions?

I am looking forward to your kind help, and appreciate your time!

best regards,

On 07/24/2014 04:47 PM, qiaobf wrote:
> Dear all,
> Please help me out. Thanks in advance.
> I had written some analyzing codes, which can be easily compiled under 
> Gromacs 4.5.5. Since I switched to GMX 5.0 weeks ago, I want to 
> re-compile them under GMX5.0. But the GMX5.0 seems quite different 
> from GMX4.5.5. Anyone can help me? Thanks a lot!
> I have tried the following methods:
> 1)  (a) save the gmx_density2.c under 
> $HOME/programmes/backup/gromacs-5.0/src/gromacs/gmxana, which is the 
> folder to save all the gmx_XXX.c analyzing codes under the 
> distribution folder;
>      (b) re-install the whole package of GMX5.0 (cmake-->make--->make 
> install). I got no error message. All regular analyzing programs are 
> correctly installed, but not the gmx_density2!
> 2) (a) run "source $HOME/programmes/GROMACS-5.0/bin/GMXRC";
>     (b) save the gmx_density2.c under 
> $HOME/programmes/GROMACS-5.0/share/gromacs/template, which is under 
> the executable folder;
>     (c) modify the content of CMakeList.txt to change "template" to 
> "gmx_density2", and "template.cpp" to "gmx_density2.c";
>     (d) run "cmake .". No error message, and the Makefile and the 
> folder CMakeFiles are created;
>     (e) run "make". Then I get the error message
>> gmx_density2.c:42:22: fatal error: sysstuff.h: No such file or directory
>>  #include "sysstuff.h"
>>                       ^
>> compilation terminated.
>> make[2]: *** [CMakeFiles/gmx_density2.dir/gmx_density2.c.o] Error 1
>> make[1]: *** [CMakeFiles/gmx_density2.dir/all] Error 2
>> make: *** [all] Error 2
> best wishes,
> Baofu

Baofu Qiao
Department of Materials Science and Engineering,
Northwestern University
Tel: 224-420-1019
Email: qiaobf at gmail.com

More information about the gromacs.org_gmx-users mailing list