[gmx-users] Reading XTC files from fortran90

Mark Abraham Mark.Abraham at anu.edu.au
Mon Oct 1 10:36:21 CEST 2007


Jones de Andrade wrote:
> Hi all.
> 
> First: ok, lets stop the C X Fortran issue here: this kind of subject 
> always look like a "ready to become flamme war" one.  ;) Sorry for 
> rising the subject a bit in the previous email.
> 
> The point is: when this project started, almost 4 years ago, I already 
> knew very well frotran90, and gromacs was not still in the sight for us, 
> but fortran codes like mdynamix still were. So, at that point it was 
> pointless to learn C.
> 
> Three years later, at the end of the project, gromacs becomes all-day 
> tool, and thousands of lines of code already written and optimized for 
> fortran90 also are standard here.  ;)  That's the reason why it would be 
> crazzyness to try to translate everything to C. So, the aim here is to 
> just change the reading procedures, to read the information needed from 
> gromacs. One way would be to rewrite everything on fortran, and that 
> will be painfull. The other is to link to the objects and libraries in 
> the proper way.
> 
> If everything goes smoothly here, the next project I get in will include 
> two years of implementing a few extra features inside gromacs code. 
> Then, of course, learning C will be a must, and the first thing to be 
> done.  :)

Fine :-) That's the sort of reason that you'd want to have to keep 
Fortran for the present problem.

> I can already do that for .xtc files. Seems that, unfortunatelly, the 
> least odd way is to find a way to get the last pieces of information 
> needed (atomic charges and masses) from the .tpr files. Other ways would 
> include lots of file translations, or adaptions in the codes themselves 
> which would lead to "non-generality" of it.

Like I said, the masses are easy to infer from the atom names. You don't 
need to read them... you know anything starting with N has mass 14.011 
(or whatever it is). Or you can read share/gromacs/top/atommass.dat to 
do the lookups.

> Sorry for not noticing the box shape in the .xtc file. I passed over 
> that integer in the reading, dismissing it as only some kind of old 
> feature useless now. Really sorry for that point.
> 
> Which files should I look for in order to get the proper way of reading 
> masses and atomic charges from a .tpr file? And which objects will need 
> to be included in the linking stage? Is there any "outsider" program 
> (fortran would be perfect, but I don't think it will be too common too) 
> that works directly with the .tpr files?

tpxio.c will have relevant functions. Or, follow the execution of mdrun 
until it reads the .tpr file and see how it handles these things.

If you use the editconf suggestion to get charges, you don't need to 
read a .tpr file.

> Thanks a lot everybody for all the help, and sorry for taking so much of 
> your time,

Help is fine, but repeating myself is tiresome :-)

Mark



More information about the gromacs.org_gmx-users mailing list