[gmx-developers] TPR parsing

David van der Spoel spoel at xray.bmc.uu.se
Sun Mar 17 16:44:03 CET 2013

On 2013-03-17 13:29, Krzysztof Mlynarczyk wrote:
> Hello,
> I have a similar problem with tpr files.
> Linking to the gromacs library is fine as long as one wishes to write
> yet another typical analysis tool.
> I'm writing an extension for another application and if the function
> from gromacs library calls gmx_fatal(), everything is getting killed
> while I'd like to tell the user that there was an error and wait for
> further instructions. I can do that with trajectories if I use
> libxdrfile package that returns error codes instead of exiting.
> Now I see two solutions:
>  1. Port tpr reading routines to libxdrfile and make them return error
>     codes that can be checked and handled. This would be the most
>     elegant solution but requires quite a bit of work (and subsequent
>     maintenance to keep it in sync with current gmx version - but
>     perhaps that could be automated with a script).
>  2. Write an external program that will be called with system() function
>     and extracts the needed tpr data. Errors in it would not affect the
>     extension and main application. This is the fastest way, but makes
>     the plugin gromacs-dependent.
> Or maybe there is a third option I don't see? What would you advise?

The third option would be to make sure that the function that reads the 
tpr file does not end with a fatal error, and then use that by linking 
to the gromacs library.

As I said previously from gromacs 4.6 the license has changed so you can 
include everything in your program even if it is close source.

For the medium to long term we will try to factor the code such that the 
tpr reading routine becomes virtually independent from the rest of gromacs.
> Krzysztof Mlynarczyk
> 2013/3/9 David van der Spoel <spoel at xray.bmc.uu.se
> <mailto:spoel at xray.bmc.uu.se>>
>     On 2013-03-09 18:16, Gunther Lukat wrote:
>         Hi,
>         well, this requires a working gromacs installation. (The final
>         product
>         should run without the need to install Gromacs.)
>         However, I just started to take a deeper look into the Gromacs
>         library.
>     Just FYI in gmx 4.6 the license has changed to LGPL which means it
>     is allowed to link in the *unmodified* library in closed source
>     software. Check the COPYING file.
>         Thank you so far
>         Dipl.-Inf. Gunther Lukat
>         g.lukat at gmx.net <mailto:g.lukat at gmx.net> <mailto:g.lukat at gmx.net
>         <mailto:g.lukat at gmx.net>>
>         www.aplvoro.org <http://www.aplvoro.org> <http://www.aplvoro.org>
>         Am 09.03.2013 um 10:18 schrieb David van der Spoel
>         <spoel at xray.bmc.uu.se <mailto:spoel at xray.bmc.uu.se>
>         <mailto:spoel at xray.bmc.uu.se <mailto:spoel at xray.bmc.uu.se>>>__:
>             Why don't you simply link to the gromacs library and call the
>             appropriate reading function?
>             Note that all floating point numbers are coded for
>             portability using
>             the xdr libraries, so it will be close to impossible to read
>             with
>             anything but the native code.
>     --
>     David van der Spoel, Ph.D., Professor of Biology
>     Dept. of Cell & Molec. Biol., Uppsala University.
>     Box 596, 75124 Uppsala, Sweden. Phone: +46184714205
>     <tel:%2B46184714205>.
>     spoel at xray.bmc.uu.se <mailto:spoel at xray.bmc.uu.se>
>     http://folding.bmc.uu.se
>     --
>     gmx-developers mailing list
>     gmx-developers at gromacs.org <mailto:gmx-developers at gromacs.org>
>     http://lists.gromacs.org/__mailman/listinfo/gmx-__developers
>     <http://lists.gromacs.org/mailman/listinfo/gmx-developers>
>     Please don't post (un)subscribe requests to the list. Use the www
>     interface or send it to gmx-developers-request at __gromacs.org
>     <mailto:gmx-developers-request at gromacs.org>.

David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
spoel at xray.bmc.uu.se    http://folding.bmc.uu.se

More information about the gromacs.org_gmx-developers mailing list