FortranFormat, iChemLabs and Quixote (and a Test)

#jiscxyz

In the Quixote project (http://quixote.wikispot.org/Front_Page) we are systematically developing Java (and other) OpenSource tools for managing the input, output, transformation, storage, searching and publication of computational chemistry. We intend to parse complete logfiles (not just the juicy bits) and so come across a lot of really grotty FORTRAN output. If you are thinking of writing a tool to parse FORTRAN output:

  • Stop
  • Don’t

Because there are so many beartraps that you will fall into unless you have actively worked with FORTRAN.

Here’s a simple question:

How many INTEGERs have been output in this 7-character string output by a FORTRAN program?

123**75

There is an answer. (No, Unicode is not involved – these are honest to goodness EBCDIC characters punched into a standard Hollerith card…) But the answer is not trivial.

So I am starting with GamessUS punch files and running a tutorial on how to write a parser. Among other things we have to parse chunks of Fortran output. So before writing my own I went to StackOverflow and asked:

http://stackoverflow.com/questions/4051559/parsing-fortran-output-files-using-java/4051615#4051615

Within about 7 minutes I had an answer. I accepted this as the best answer. That gives me two points. And I have since got 2 votes! So I get 2*5+2 =12 points. Not bad.

So public thanks to iChemLabs and Kevin J. Theisen. It’s great to see a chemical software company producing Open Source. It means one less set of wasted days duplicating what other people have done. How many other companies have Open Source that would save everyone labour and allow us to do innovative work. Because writing a FORTRAN parser isn’t fun and isn’t innovative.

FWIW it looks to have been done properly – with a BNF and JavaCC. That means that the code is written by a Compiler Compiler. All that is required is the FORTRAN language spec and, of course code to parse the different elements.

I’m planning to mavenize this and put it in a repository. I’m allowed to do that as it’s Open Source. All I have to do is say thank you and keep the licence attached to the code distro.

 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *