#!/usr/local/bin/perl -w

#is given as an arugument the name of a pdb file
#filters the contents of the pdb file to extract xyz coords of all all atom and hetatm records
#prints them to standard out

open (PDBFILE, $ARGV[0])||die "input file could not be opened";
#open (TEMP,">temp")||die "could not open temp storage";
#open (QHULLFILE,">pointfile")||die "output file could not be opened";

while (<PDBFILE>){


    if((/ATOM\s+.+\s+(\w\s+\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+\d+.+\d+.+\d+.+/) ||
       (/HETATM\s+.+\s+(\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+\d+.+\d+.+\d+.+/) ||
       (/ATOM\s+.+\s+(\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+\d+.+\d+.+\d+.+/)
				    ){
			



#if
#((
 

#/ATOM\s+.+\d+\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+\d+.+\d+.+\d+.+/)||
#(/HETATM\s+.+\d+\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+\d+.+\d+.+\d+.+/)){
	print( $2," ",$3," ",$4,"\n");
}
}
#print QHULLFILE "3\n";
#<PDBFILE>;

close PDBFILE;
#close TEMP;
#close QHULLFILE;

