<br><br><div class="gmail_quote">On Sun, Mar 17, 2013 at 1:29 PM, Krzysztof Mlynarczyk <span dir="ltr">&lt;<a href="mailto:mitomaster@gmail.com" target="_blank">mitomaster@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br><br>I have a similar problem with tpr files.<br>Linking to the gromacs library is fine as long as one wishes to write yet another typical analysis tool. <br>I&#39;m writing an extension for another application and if the function from gromacs library calls gmx_fatal(), everything is getting killed while I&#39;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.<br>


Now I see two solutions:<br><ol><li>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).<br>


</li><li>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.</li>


</ol>Or maybe there is a third option I don&#39;t see? What would you advise?</blockquote><div><br></div><div>If your license constraints permit it, you could bundle (some of) the GROMACS source and just modify gmx_fatal() to do something more suitable. That would make it easy to get control back, but not to transfer execution from the point of the error to somewhere that can cope with it. So perhaps not very useful.</div>
<div><br></div><div>Unfortunately, the GROMACS code is pretty much not designed to propagate errors anywhere, since there&#39;s very few faults of which GROMACS can afford to be tolerant. We&#39;ll do better with exceptions in 5.0. For now, I&#39;d encourage your second solution.</div>
<div><br></div><div>Mark</div></div>