Sunday, September 27, 2015

Automatic data extraction from multiple GAMESS output files: an example

Jimmy ran many PM6-D3H+ geometry optimizations using different starting geometries.  Typing "grep EQUILIBRIUM *.log" showed that they had all converged, but how to extract the heat of formation on the optimized geometry?  This python program does the trick.  It finds the last heat of formation in each file or, more precisely, it finds the second to last "word" in the last line where the first word is HEAT.

Update 2015.10.03.
1. Apologies to +Jimmy Charnley Kromann  for the poor formulation.  Jimmy ran the calculations, I wrote the script. After the post came online he was immediately teased mercilessly by his so-called friends for writing such crappy code. That's on me.

2. As +Anders Steen Christensen pointed out in the comments this can be done in one line using Bash: "for f in *.log; do tac $f | grep -m1 HEAT; done"

3. If you want to do it in Fortran +Lars Bratholm suggested the following code

This work is licensed under a Creative Commons Attribution 4.0

No comments: