Created
April 6, 2015 20:41
-
-
Save SeanMcGrath/d08179fad237faa65fae to your computer and use it in GitHub Desktop.
Revisions
-
Sean McGrath renamed this gist
Apr 6, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Sean McGrath created this gist
Apr 6, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #!/usr/bin/env bash # Generates a standardized table of bond lengths and bond angles # from a gaussian .log file. if [[ $# > 0 ]] then # Find distance Matrix awk '/^ *1 *2 *3 *4 *5 *$/ {p=1}; p; /Stoich/ {p=0}' $1 | # Extract lines with distance data egrep '^[ \t]*[0-9]+[ \t]*[A-Z][ \t]*([-+]?[0-9]*\.?[0-9]+[ \t]*)' | # Build 2D distance array with awk awk ' BEGIN { old = 0 offset = 0 } { col = 0 current = $1 if (current < old){ offset = offset + 5 } if (current == 1){ offset = 0 } while (col++ < NF-2) { distances[current][col+offset] = $(col+2) } old = current } END{ for(i in distances){ for(j=1; j <= length(distances[i]); j++){ {printf "%f,", distances[i][j]} } print "" } } ' | awk '{ print length, $0 }' | sort -n | awk '{$1=""; print $0}' #Sort by line length else echo 'Enter a Gaussian .log file to parse' fi