qbox_maxforce.sh 309 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/bash
# get the largest force component in a file of "<force> fx fy fz </force>"
# use: qbox_maxforce nat file.r
grep '<force>' $2 | tail -$1 | \
awk '{
  if ( mx*mx < $2*$2 ) mx = $2;
  if ( my*my < $3*$3 ) my = $3;
  if ( mz*mz < $4*$4 ) mz = $4;
} END {printf("%9.2e %9.2e %9.2e\n", mx, my, mz)}' -