#!/usr/bin/awk -f BEGIN {count=0; natom=0; fbohr=0.529177; a0=0.0; scale=0.0;} /lattice parameter / {a0 = $5 * fbohr; } /number of atoms\/cell/ { natom = $5; } # coordinates at the beginning of a run. / positions \(a_0 units\)/ {print natom; print "step: ", count;} / *tau\(...\) =/ { printf "%4s %12.4f %12.4f %12.4f\n", $2, $7*a0, $8*a0, $9*a0; } # coordinates during geometry optimization. /ATOMIC_POSITIONS \(.+\)/ { ++count; print natom; print "step: ", count; if ($2 == "(angstrom)") { scale = 1.0; } else { print "unknown coordinate scaling"; } for (i=0; i