[gmx-users] Writing new tools?

Gerrit Groenhof G.Groenhof at chem.rug.nl
Fri Jan 9 11:04:01 CET 2004

Hi Arvid,

First of all: Why do you use fortran? :-)

Maybe you can use the template trajectory reader
(share/template/template.c) and write your tool in C instead.

It reads a trajectory and puts all the trajectory information into the
t_trxframe struct (see include/types). It looks more complicated than
it is. 

However, it is always possible to call fortran code in this
template.c.  For instance this is the preferred way if you have
already got the tool in fortran.

You simply progam a wrapperfunction in the template.c, which calls the
fortran subroutines with the arguments that you take from the
t_trxframe struct. IN that case compile the fortran code with
--nosecond-underscore, and declare the routines coming from the
fortran code as

void NAMEOFROUTINE_(arguments);

at the beginning of the template.c and you can simply make calls to
these. Then you compile template and link the fortran objects to
it. If you are using g77/gcc you also would need the -lg2c upon

I hope this is useful,

Good luck with your tool,


> Hi all 
> I am about to start to write a new trajectory analysis tool, but I want to
> check one thing in forehand:
> How to read the unformatted trajectories into a fortran program? Are there
> any examples of such things among the existing tools? (I have to admit
> that I have not yet been looking very closely.)
> Regards 
>    Arvid Soderhall
> _______________________________________________
> gmx-users mailing list
> gmx-users at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-users
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-users-request at gromacs.org.

More information about the gromacs.org_gmx-users mailing list