Gromacs

Reading XTC From Fortran

    Table of contents
    No headers

    There are a lot of questions on the gmx-users mailing list about reading .xtc files from Fortran programs. There are two or three solutions there, but nothing works as expected. The only way of reading .xtc files, which is working for me is using the molfile plugin from VMD.

    Basically, one need to download VMD source code and compile the molfile plugin (no need to compile VMD itself). It requires few dependencies (TCL and NETCDF), but no extra tricks are necessary. By the way, the xdr library is not used and thus not required. The plugin emulates it somehow.

    Then one need to compile a test Fortran program located in plugins/molfile_plugin/f77 directory, which shows how to use the plugin. This can be a bit tricky and requires some mangling with the Makefile (change f77 to gfortran and the like). In my case (Ubuntu 7.10) I had also to fight with incompatible libstdc++ by making a symbolic link to the needed file.

    Finally, the test program compiles and reads xtc files perfectly! You can also read any format supported by VMD. Unfortunately writing .xtc files (as well as other formats) is not supported.

    If somebody knows how to read .xtc files from Fortran with less effort, please share your experience!

    Page last modified 11:08, 10 Oct 2009 by JLemkul?