#!/usr/bin/perl # # perl wf2dists.pl wffile distfile factor if (($#ARGV < 1) | ($#ARGV > 2)) { print " Usage: perl $0 wffile distfile [factor] This outputs to distfile distances corresponding to points in wffile. factor allows conversion to other units - what's printed is the distance in the current units multiplied by factor. "; exit; } $wffile = $ARGV[0]; $distfile = $ARGV[1]; open (WF,"$wffile"); open (DIST,">$distfile"); $factor = 1; if ($#ARGV >= 2) { $factor = $ARGV[2]; } while ($line = ) { ($x,$y,$z,@tmp) = split /\s+/, $line; $dist = sqrt ($x*$x + $y*$y + $z*$z) * $factor; print DIST "$dist\n"; } close(DIST); close(WF);