#! /usr/bin/awk -f # # Author: Artur Michalak # Date added to Database: 10/06/05 # # Purpose: This awk script processes an ADF output and creates a file containing # the geometries used in the calculation e.g. in a geometry optimization # of linear transit. The geometry is specified in terms of xyz coordinates. # There is a seperate version for QM/MM runs. # # Usage: mkxyz ADFoutputfile.log >geometryfile.xyz # BEGIN { ltparg=0 nat =0 } # # # / \*/ { if ($1!="\*" && $2!="") { ltat = $1 for (i=9;i<=11;i++) if ( $i == "\*") ltparg = i ltt=ltparg-3 ltparv = $ltt } } / ATOMS/ { getline getline getline getline nnn=$1 nat=0 while (nnn!="") { nat++ ats[nat]=$2 x[nat]=$3 y[nat]=$4 z[nat]=$5 getline nnn=$1 } printf "%6d \n", nat print " Initial geometry" for (i=1;i<=nat;i++) printf " %2s %10.4f %10.4f %10.4f \n", ats[i],x[i],y[i],z[i] } # # # /Coordinates/ && /Cartesian/ { for (i=1;i<=5;i++) getline printf "%6d \n", nat printf " %20s \n", title for (i=1;i<=nat;i++) { getline ats[i]=$2 x[i]=$6 y[i]=$7 z[i]=$8 printf " %2s %10.6f %10.6f %10.6f \n", ats[i],x[i],y[i],z[i] } } # # # / G E O M E T R Y U P D A T E ***/ { ngeo=$16 if ($18=="LT") { ltrun="OK" nlt=$19 title=sprintf(" Geometry No. %4d LT %4d (%10.3f)",ngeo,nlt,ltparv) } else title=sprintf(" Geometry No. %4d ",ngeo) } /New Linear Transit Point : Starting Geometry/ { nlt=nlt+1 title=sprintf(" Starting geometry - LT %4d" ,nlt) } /Final Geometry/ { if (ltrun=="OK") title=sprintf(" FINAL GEOMETRY - LT %4d (%10.3f)" ,nlt,ltparv) else title=" FINAL GEOMETRY" printf "%6d \n", nat >"ltgeos" printf " %20s \n", title >"ltgeos" for (i=1;i<=nat;i++) { printf " %2s %10.6f %10.6f %10.6f \n", ats[i],x[i],y[i],z[i] >"ltgeos" } }