#!/bin/sh
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  gfac2pdb.scr
#  ------------
#  Shell script for running the gfac2pdb program which
#  generates PDB files with the atomic B-factors representing
#  the corresponding torsion-angle G-factors
#
#  Roman Laskowski, July 1996
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
set -e
# Check that exactly parameter has been entered
if [ $# != 1 ]; then
  echo ' '
  echo '*** ERROR. Correct usage is:'
  echo ' '
  echo '           gfac2pdb  filename'
  echo ' '
  echo 'where  filename  =  the coordinates file containing the'
  echo '                    protein structure of interest'
  echo ' '
  echo 'For example:-'
  echo ' '
  echo '           gfac2pdb  /data/pdb/p1eca.pdb'
  echo ' '
  exit 1
fi

echo ' '
echo ' '
echo 'gfac2pdb - Output of torsion-angle G-factors as atomic B-values'
echo '---------------------------------------------------------------'
echo ' '
filename=$1
echo 'Coordinates file:   [' $filename ']'
echo ' '
#
# If the PDB file exists, then run gfac2pdb
#
if [ -f $filename ]; then
    #-----------------#
    # G F A C 2 P D B #
  echo ' '
  $CBIN/gfac2pdb << EOD
$1
EOD
  echo ' '
  echo '.................................................................'
else
  echo 'File not found: '$filename
fi
