#!/bin/csh
#####################################
# Script for running HullRad on a collection of PDB files on UNIX or OSX
#
# Edit the basename of the PDB files below, i.e. "1qd5*.pdb" to your basename
#
# Edit the full path of your python installation that has the following libraries:
#       numpy, scipy
# if you are using these instead of the qhull version of qconvex
#####################################

if ( -e 'Rt.dat') then
    rm Rt.dat
endif
touch Rt.dat

if ( -e 's.dat') then
    rm s.dat
endif
touch s.dat

if ( -e 'filenames.lst') then
    rm filenames.lst
endif
touch filenames.lst

if ( -e 'Rg.dat') then
    rm Rg.dat
endif
touch Rg.dat

if ( -e 'Dmax.dat') then
    rm Dmax.dat
endif
touch Dmax.dat

if ( -e 'Asphericity.dat') then
    rm Asphericity.dat
endif
touch Asphericity.dat

set list1 = \
(`echo 9AAC-*_corr.pdb`)

foreach file ( $list1 )
  echo ${file} >> filenames.lst
end

set list = \
(`cat filenames.lst`)

foreach file ( $list )
  echo ${file}
  /opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 \
    HullRadV8.1.py {$file}> HRout.tmp 
  grep 'Rg\(Anhydrous\)' HRout.tmp | awk '{print $3}' >> Rg.dat
  grep 'R\(Translation\)' HRout.tmp | awk '{print $3}' >> Rt.dat
  grep 'Dmax ' HRout.tmp | awk '{print $3}' >> Dmax.dat
  grep 'Asphericity' HRout.tmp | awk '{print $3}' >> Asphericity.dat
  grep 's              ' HRout.tmp | awk '{print $3}' >> s.dat
end

rm HRout.tmp

