[gmx-developers] Modification of g_mdmat tool and compiling

Mark Abraham Mark.Abraham at anu.edu.au
Fri Jan 16 13:03:40 CET 2009

Joshua Adelman wrote:
> I'm attempting to write a modified version of g_mdmat to do some custom 
> analysis of a simulation trajectory. Since what I'm trying to do 
> requires only slight modification of the code, I thought the easiest 
> thing to do is just copy g_mdmat.c and gmx_mdmat.c to something like 
> g_mdmat2.c and gmx_mdmat2.c and compile them in the src/tools directory 
> (as opposed to writing something from scratch given the template in 
> shared/template). I'm just having a little bit of difficulty getting the 
> modified versions compiled and was hoping someone could point me in the 
> right direction. Since the Makefile and Makefile.in are auto-generated, 
> I believe I shouldn't be modifying them directly. I tried inserting 
> duplicating the enteries in Makefile.am that reference the g_mdmat 
> files, and then rerun ./configure, but I'm not getting any instructions 
> for the 'g_mdmat2' tool in Makefile and Makefile.in.

A more elegant solution than the one DvdS suggested, is to adapt 
Makefile.am suitably (wherever g_mdmat(.*) appears, modify suitably to 
add your version), return to the top-level GROMACS directory and invoke 
automake to create the Makefile.in files. Then invoke configure to 
create the Makefile files. Then things should work OK, and the GROMACS 
build process will build and install your utility.

You may run into versioning issues with the autotools. Invoking autom4te 
or autoconf in the top-level GROMACS directory may help resolve these. 
Test on a non-precious GROMACS build directory first!

If you're working in the CVS version, there's a "bootstrap" script that 
takes care of the invocation order for you. Grabbing a copy of it to 
apply to your modified 4.0.2 distribution may streamline things for you.


More information about the gromacs.org_gmx-developers mailing list