Sunday 14 July 2013

Using Open Babel to package chemistry software

Let's suppose you want to write a piece of C++ code that manipulates molecules to do something or other, and generates an output, either more molecules (or indeed the original molecules filtered), some descriptors, or some text (a report, or table, or something).

I'm going to propose that you should write or adapt this code as an Open Babel plugin. I've just done this for Confab, the conformer generator I wrote some time back.

If you do this, you don't need to consider how to put together the build infrastructure, write the code for reading/writing file formats, or for handling command-line options and arguments (in fact, you get a lot of additional functionality for free). More generally, the software will compile cross-platform, be included in every major Linux distribution and be available to a very large number of people. It will also have a lifetime beyond the end of the grant that funded it.

I'm by no means the first to see the advantages of this. For example, Jiahao Chen added the QTPIE charge model he developed as one of Open Babel's charge model plugins.

Coming back to Confab, the original code was written as a modified version of Open Babel. I don't quite know what I was thinking but I meant to integrate it properly with the main Open Babel code at some point. In the end, the required push was provided by David Hall, who started off this integration early this year.

If you want to try it out now, clone the development version of Open Babel on github. The "--confab" option to obabel will invoke the Confab operation and "-oconfabreport" will replace calcrmsd in the original release. For command-line help on either, use "obabel -L confab" or " obabel -L confabreport".

Image credit: Plug In by Sebastian Anthony (Mr Seb) on Flickr (CC-BY ND)

No comments: