#! /bin/sh 
# $Id: setup.sh,v 1.107 2006/04/05 17:15:06 software Exp software $
# Version and license info # {{{
# /bin/sh environment setup script for running software for multiple
# architectures from a single NFS mounted disk
# Copyright (C) 1999 Robert L. Campbell
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# 
# or find it at: http://www.gnu.org/copyleft/gpl.html
# 
# Robert L. Campbell <rlc1@post.queensu.ca>
# Dept. of Biochemistry
# Queen's University
# Kingston, ON K7L 3N6
# Canada
#
# }}}
# set some variables # {{{
# main program directory environment variable
PROGDIR=/software
PROG_SCRIPTS=${PROGDIR}/misc/scripts
NOT_FOUND=0
BOLD='[1m'
UNDERLINE='[4m'
NORMAL='[m'

# determine operating system (architecture)
OS=`uname -s`
OSm=`uname -m`

# create usage function definition
usage() {
  echo ""
  echo "usage: source ${PROGDIR}/setup <program>"
  echo ""
  echo "       where <program> is one of:"
  \grep "^[   ]*[a-z_.0-9]*)" ${PROGDIR}/setup.sh | sed 's/)//' | sort +0b 
  echo ""
}

# make sure /usr/freeware/bin is in path for IRIX
if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
  export PATH=`${PROG_SCRIPTS}/add_path -sh /usr/freeware/bin`
fi
# make some big programs run better!
ulimit -Ss unlimited
ulimit -Sc 0

# }}}
# check for existance of scripts necessary to the rest # {{{
# echo exit script if it will mess up the $PATH do to missing or inaccessible $PROG_SCRIPTS !
if [[ -z ${PROG_SCRIPTS} ]]; then
echo "\n    The ${BOLD}${PROG_SCRIPTS}${NORMAL} directory is apparently not available."
echo "    This script will abort to avoid messing up your PATH "
echo "    environment variable.\n"

elif [[ ! -e /usr/bin/perl ]]; then
  echo "${BOLD}Warning\!${NORMAL} The following script expects to find /usr/bin/perl on your machine"
  echo "and would have wiped-out your path if we did not exit from the setup script here."
  echo "Contact me (rlc1@post.queensu.ca) to resolve this."

elif [[ $SHELL != */bin/sh && $SHELL != */zsh && $SHELL != */bash ]]; then
  echo "This script can only be run from the Bourne, Bash or Zsh shells"
# }}}
# test for argument and echo usage if none given # {{{

elif [[ "$#argv" < 1 ]]; then
  usage
else

  # ok, argument found, set to lower case and then look for a "case" with
  # that name.

  # force lower case and swap '-' to '_' and swap '_v' to just '_'
#  program=`echo $1 | sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" -e 's/-/_/' -e 's/_v/_/'`
  program=`echo $1 | sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" -e 's/_v/_/'`
  echo "Setting up environment for ${program} ...   "

  # save a log of usage (includes erroneous setups, though)
#  if [[ -w ${PROGDIR}/mgr/log/setup.log ]]; then
#    echo "`date '+%Y-%m-%d %T'` $USER $HOST $program" >> ${PROGDIR}/mgr/log/setup.log
#  fi
# }}}
# find a program name to set up # {{{
  case $program in
# aqua # {{{
  aqua|aqua_3.2)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export aquaroot=${PROGDIR}/aqua/aqua3.2
      source $aquaroot/aqsetup.sh
      echo "See the ${BOLD}${aquaroot}/bin_${OS}${NORMAL} directory for programs, "
      echo "the ${BOLD}${aquaroot}/exmpls${NORMAL} directory for examples and "
      echo "the web site ${BOLD}http://www.bmrb.wisc.edu/~jurgen/aqua/${NORMAL} for instructions."
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  aria1.2 # {{{
  aria_1.2)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/cns`
        echo "Setting up cns for ${BOLD}${program}${NORMAL}"
        source ${PROGDIR}/aria/cns-aria/1.1/.cns_solve_env_sh
        export ARIA=${PROGDIR}/aria/aria1.2
        if [[ -z $PYTHONPATH ]]; then
          export PYTHONPATH=${ARIA}
        else
          export PYTHONPATH=${PYTHONPATH}:${ARIA}
        fi
        alias aria='python ${ARIA}/Aria/RunAria.py'
        echo "   Type ${BOLD}aria${NORMAL} to run"
        echo "   Examples can be found in ${BOLD}${ARIA}/example/werner/README${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  aria|aria2.0 # {{{
  aria|aria_2.0)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/cns`
        echo "Setting up cns for ${BOLD}${program}${NORMAL}"
        source ${PROGDIR}/aria/cns-aria/1.1/.cns_solve_env_sh
        export ARIA2=${PROGDIR}/aria/aria2.0
        alias aria='python ${ARIA2}/aria2.py'
        echo "   Type ${BOLD}aria${NORMAL} to run"
        echo "   Examples can be found in ${BOLD}${ARIA2}/examples/werner/README${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# arp # {{{
  arp_6.0| arp_warp_6.0)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export WARPDIR=${PROGDIR}/arp_warp/arp_warp_6.0
        export warpbin=${WARPDIR}/bin/${OS}
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${warpbin}`
        if [[ -z $CCP4 ]]; then
          source ${PROGDIR}/setup ccp4
        elif [[ $CCP4 != *ccp4-4.2.2*  && $CCP4 != *ccp4-5.0* ]]; then
          source ${PROGDIR}/setup ccp4
        fi
        echo "See the ${BOLD}${warpbin}${NORMAL} directory for programs, "
        echo "the ${BOLD}${WARPDIR}/examples${NORMAL} directory for examples and "
        echo "the web site ${BOLD}http://www.arp-warp.org${NORMAL} for instructions."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  arp| arp_warp| arp_6.1| arp_warp_6.1)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export WARPDIR=${PROGDIR}/arp_warp/arp_warp_6.1.1
        export warpbin=${WARPDIR}/bin/${OS}
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${warpbin}`
        if [[ -z $CCP4 ]]; then
          source ${PROGDIR}/setup ccp4
        elif [[ $CCP4 != *ccp4-5.0* ]]; then
          source ${PROGDIR}/setup ccp4
        fi
        echo "See the ${BOLD}${warpbin}${NORMAL} directory for programs, "
        echo "the ${BOLD}${WARPDIR}/examples${NORMAL} directory for examples and "
        echo "the web site ${BOLD}http://www.arp-warp.org${NORMAL} for instructions."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  artemis # {{{
  artemis)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export ARTEMISDIR=${PROGDIR}/artemis/v5/artemis
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${ARTEMISDIR}`
        echo "   Type ${BOLD}art${NORMAL} to run"
        echo "   Manual is at the Artemis web site: ${BOLD}http://www.sanger.ac.uk/Software/Artemis/v4/manual/${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  autodock # {{{
  autodock)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export AUTODOCK_DIR=${PROGDIR}/autodock/3.05
      export AUTODOCK_UTI=${AUTODOCK_DIR}/share
      export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/autodock`
      if [[ $OS == "Linux" ]]; then
        if [[ $OSm == "x86_64" ]]; then
          OS=${OS}_${OSm}
        fi
      fi
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${AUTODOCK_DIR}/bin_${OS} ${AUTODOCK_UTI}`
   #   source ${PROGDIR}/autodock/mglTools_1.2/initPython.bash
      echo "   Type ${BOLD}autodock3${NORMAL} to run"
      echo "   There is an HTML-format manual in: ${BOLD}file://${AUTODOCK_DIR}/doc/html/Using_AutoDock_305.html"
      echo "   There is a PostScript-format manual in: ${BOLD}file://${AUTODOCK_DIR}/doc/AutoDock3.0.5_UserGuide.ps"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
# b # {{{
  b)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/B`
      echo "   Type ${BOLD}B${NORMAL} to run"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  belvu # {{{
  belvu)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        alias belvu=${PROGDIR}/belvu/belvu_${OS}
        echo "   Type ${BOLD}belvu${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# biopython # {{{
  biopython|biopython_CVS)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        if [[ $OS == "Linux" ]]; then
          if [[ $OSm == "x86_64" ]]; then
            export OS=${OS}_${OSm}
          fi
        fi
        if [[ -z $PYTHONPATH ]]; then
          export PYTHONPATH=${PROGDIR}/${OS}/lib/python2.3/site-packages
        else
          export PYTHONPATH=`${PROG_SCRIPTS}/remove_pythonpath -sh ${PROGDIR}/${OS}/lib/python2.3/site-packages/`
          export PYTHONPATH=${PYTHONPATH}:${PROGDIR}/${OS}/lib/python2.3/site-packages
        fi
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# blast # {{{
  blast_2.2.9)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      BLASTDIR=${PROGDIR}/blast/blast-2.2.9
      PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${BLASTDIR}`
      PATH=`${PROG_SCRIPTS}/add_path -sh $BLASTDIR/bin_${OS}`
      if [[ ! -e ~/.ncbirc ]]; then
        ln -sf ${PROGDIR}/NCBI/.ncbirc ~/
      fi
      echo "Documentation is in ${BOLD}${BLASTDIR}/Doc${NORMAL}"
      echo "Example:"
      echo "blastall -i unknown_sequence.fasta -p blastp -d /software/NCBI/db/nr"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
  blast|blast_2.2.11)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      if [[ $OS == "Linux" ]]; then
        if [[ $OSm == "x86_64" ]]; then
          OS=${OS}_${OSm}
        fi
      fi
      BLASTDIR=${PROGDIR}/blast/blast-2.2.11
      PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${BLASTDIR}`
      PATH=`${PROG_SCRIPTS}/add_path -sh $BLASTDIR/bin_${OS}`
      if [[ ! -e ~/.ncbirc ]]; then
        ln -sf ${PROGDIR}/NCBI/.ncbirc ~/
      fi
      echo "Documentation is in ${BOLD}${BLASTDIR}/Doc${NORMAL}"
      echo "Example:"
      echo "blastall -i unknown_sequence.fasta -p blastp -d /software/NCBI/db/nr"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  boxshade # {{{
  boxshade)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export BOXDIR=${PROGDIR}/boxshade
        PATH=`${PROG_SCRIPTS}/add_path -sh $BOXDIR`
        alias boxshade=boxshade_${OS}
        echo "Documentation is in ${BOLD}${BOXDIR}/boxshad3.txt${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  ccp4 # {{{
  ccp4|ccp4_5.0.2)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/ccp4`
        source ${PROGDIR}/ccp4/ccp4-5.0.2/include/ccp4.setup-bash
        if [[ -z $WARPDIR ]]; then
          source ${PROGDIR}/setup arp
        elif [[ $WARPDIR != *arp_warp_6.1.1 ]]; then
          source ${PROGDIR}/setup arp
        fi
        source ${PROGDIR}/setup xtalview
        echo "   CCP4 programs are now in your path"
        echo "   Type ${BOLD}ccp4i${NORMAL} to start the GUI"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# ccpnmr # {{{
  ccpnmr)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export CCPNMR_TOP_DIR=${PROGDIR}/ccpnmr
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/ccpnmr/bin`
      if [[ -z $PYTHONPATH ]]; then
        export PYTHONPATH=${CCPNMR_TOP_DIR}/ccpnmr1.0/python
      else
        export PYTHONPATH=`${PROG_SCRIPTS}/remove_pythonpath -sh -re ccpnmr`
        export PYTHONPATH=${PYTHONPATH}:${CCPNMR_TOP_DIR}/ccpnmr1.0/python
      fi
      echo "Type ${BOLD}formatConverter${NORMAL} to run"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
# cctbx # {{{
  cctbx)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/cctbx`
      export PYTHONPATH=`${PROG_SCRIPTS}/remove_pythonpath -sh -re ${PROGDIR}/cctbx`
      if [[ $OS == "Linux" ]]; then
        if [[ $OSm == "x86_64" ]]; then
          OS=${OS}_${OSm}
        fi
      fi
      source /software/cctbx/${OS}/cctbx_build/setpaths.sh  
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
# cdpro # {{{
  cdpro)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/CDPro`
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/CDPro/${OS}`
      echo "    Type the command ${BOLD}cdpro_links${NORMAL} in your working directory to create"
      echo "    links to the data files needed by the ${BOLD}cdpro${NORMAL} programs."
      echo "    Then type ${BOLD}crdata, selcon3, cluster, cdsstr${NORMAL} to run those programs."
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  charmm # {{{
  charmm)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/charmm`
        export CHARMMDIR=${PROGDIR}/charmm/c28b2
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${CHARMMDIR}/exec/${OS}`
        echo "    Type ${BOLD}charmm${NORMAL} to run charmm version 28b2 for 60120 atoms"
        echo "    or ${BOLD}charmm_xxlarge${NORMAL} to run the extra large version for 360720 atoms."
        echo "    Documentation is in ${CHARMMDIR}/doc"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# chimera # {{{
  chimera|chimera_1.19)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/chimera`
        export CHIMERADIR=${PROGDIR}/chimera/chimera_1.1951/${OS}
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${CHIMERADIR}/bin`
        echo "    Type ${BOLD}chimera${NORMAL} to run "
        echo "    Documentation can be found in ${BOLD}${CHIMERADIR}/share/chimera/helpdir/index.html${NORMAL}"
        echo "    The paper from the Journal of Computation Chemistry is here: ${BOLD}${CHIMERADIR}/doc/chimera.pdf${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# clustal|clustalw|clustalx # {{{ 
  clustal|clustalw|clustalx)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/clustal`
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/clustal/bin_${OS}`
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
# cn3d #{{{
  cn3d)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]];  then
      export CN3D_HOME=${PROGDIR}/Cn3D/Cn3D-4.1/${OS}
      export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/Cn3D`
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${CN3D_HOME}`
      echo "   Type ${BOLD}Cn3D${NORMAL} to run, or configure your web browser by"
      echo "   adding the following to your ~/.mime.type file:"
      echo 'type=chemical/ncbi-asn1-binary desc="NCBI ASN1" exts="asn1"'
      echo "   and by adding the following to your ~/.mailcap file:"
      echo " application/chemical/ncbi-asn1-binary; Cn3D %s"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  cns|cns_1.1 # {{{
  cns_1.0)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/cns`
        source ${PROGDIR}/cns/1.0/.cns_solve_env_sh
        echo "The current default version of CNS for this setup file is ${BOLD}CNSsolve v1.0${NORMAL}"
        echo "Execute cns v1.0 with ${BOLD}cns${NORMAL} or ${BOLD}cns_1.0${NORMAL}"
        echo "The manual is in ${BOLD}${PROGDIR}/cns/1.1/doc/html/index.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  cns|cns_1.1)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/cns`
        source ${PROGDIR}/cns/1.1/.cns_solve_env_sh
        echo "The current default version of CNS for this setup file is ${BOLD}CNSsolve v1.1${NORMAL}"
        echo "Execute cns v1.1 with ${BOLD}cns${NORMAL} or ${BOLD}cns_1.1${NORMAL}"
        echo "The manual is in ${BOLD}${PROGDIR}/cns/1.1/doc/html/index.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  conscript # {{{
  conscript)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
  #  It may be necessary to set the following (or bigger)
  #      export CONVERT=1000000
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/conscript`
        alias conscript=conscript_${OS}
        echo "    Type ${BOLD}conscript${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  consensus # {{{
  consensus)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/consensus/bin_${OS}`
        echo "    The following programs are in ${BOLD}${PROGDIR}/consensus/bin_${OS}${NORMAL} which has been added to your path."
        for file in ${PROGDIR}/consensus/bin_${OS}/*; do
          echo "        `basename $file` "
        done
        echo "    Documentation is in ${BOLD}${PROGDIR}/consensus/docs/${NORMAL} (text format)"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  convrot # {{{
  convrot)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        if [[ -z $TK_LIBRARY ]]; then
          if [[ $OS == "Linux" ]]; then
            export TK_LIBRARY=/usr/lib/tk8.2
            export TCL_LIBRARY=/usr/lib/tcl8.2
          else
            export TK_LIBRARY=${PROGDIR}/ccp4/tcltkblt/lib/tk
            export TCL_LIBRARY=${PROGDIR}/ccp4/tcltkblt/lib/tcl
          fi
        fi
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/convrot`
        alias convrot=${PROGDIR}/convrot/convrot_${OS}
        echo "    Type ${BOLD}convrot${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# {{{ curvefit
  curvefit)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/curvefit/${OS}`
      echo "    Type ${BOLD}curvefit or curveplot${NORMAL} to run"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
# cyana # {{{
  cyana_1.1)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/CYANA/cyana-1.1`
        echo "    Type ${BOLD}cyana${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  cyana_2.0)
      if [[ $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/CYANA/cyana-2.0.32nanuc`
        echo "    Type ${BOLD}cyana${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  cyana|cyana_2.1)
      if [[ $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/CYANA/cyana-2.1/bin`
        echo "    Type ${BOLD}cyana${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
    
    
# }}}
#  ddq # {{{
  ddq)
      if [[ $OS == "Linux" || $OS == "IRIX" || $OS == "IRIX64" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/ddq/2.0`
  #      alias ddq=$DDQDIR/ddq_${OS}
        echo "  Type ${BOLD}ddq${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  dino # {{{
  dino)
      if [[ $OS == "Linux" || $OS == "IRIX" || $OS == "IRIX64" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/dino/0.9/bin_${OS}`
        echo "  Type ${BOLD}dino${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# dock # {{{
  dock)
    if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
      if [[ $OS == "Linux" ]]; then
        if [[ $OSm == "x86_64" ]]; then
          OS=${OS}_${OSm}
        fi
      fi
      export DOCKDIR=${PROGDIR}/dock/dock.5.4.0
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${DOCKDIR}/bin_${OS}`
      echo "    Type ${BOLD}dock5${NORMAL} to run "
      echo "    See demo in ${BOLD}${DOCKDIR}/demo${NORMAL} "
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;

# }}}
# dotter # {{{
  dotter)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/dotter/bin_${OS}`
        echo "    Type ${BOLD}${program}${NORMAL} to run "
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  dps|dps_2|dps_2.0 # {{{
  dps|dps_2|dps_2.0)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      source ${PROGDIR}/setup ccp4
        unalias mosflm
        export DPSHOME=${PROGDIR}/dps/processing_gui_V2.0
        export DPSBIN=${DPSHOME}/bin/${OS}
        if [[ -z $DISPLAY ]]; then
          echo "You will need to set the DISPLAY environment variable, in order to"
          echo "use ${BOLD}DPS${NORMAL}."
          echo "\nDPS has not been set up correctly.\n"
        fi
      #if [[ $OS ==  "IRIX" || $OS == "IRIX64" ]]; then
  #      xset -q | awk '($1 == "Font") {getline; font_list = $1; if (index(font_list,"${PROGDIR}/dps") == 0 ) {system("xset fp+ $DPSHOME/fonts")} }'
      #fi
        export PATH=`${PROG_SCRIPTS}/add_path -sh $DPSBIN ${DPSBIN}`
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  dssp # {{{
  dssp)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        alias dssp=${PROGDIR}/dssp/bin_${OS}/dsspcmbi
        echo "  Type ${BOLD}dssp <file.pdb> <file.dssp>${NORMAL} to run" 
        echo "  Manual is in ${BOLD}${PROGDIR}/dssp/dssp.html${NORMAL}"
      elif [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
        alias dssp=${PROGDIR}/whatcheck/dssp/DSSP.EXE
        echo "  Type ${BOLD}dssp <file.pdb> <file.dssp>${NORMAL} to run" 
        echo "  Manual is in ${BOLD}${PROGDIR}/dssp/dssp.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  elves # {{{
  elves)
    if [[ $OS == "Linux" || $OS == "IRIX64" || $OS == "IRIX" ]]; then
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/Elves`
      source ${PROGDIR}/setup mosflm
      echo "  Type ${BOLD} Elves ${NORMAL} to begin"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
# emboss {{{
  emboss_2.9|emboss_2.9.0)
    if [[ $OS == "Linux" || $OS == "IRIX64" || $OS == "IRIX" ]]; then
      export EMBOSS_DIR=${PROGDIR}/EMBOSS/EMBOSS-2.9.0
#      export EMBOSS_ACDROOT=${EMBOSS_DIR}/share/EMBOSS/acd
      export PLPLOT_LIB=${EMBOSS_DIR}/${OS}/lib
#      export PLPLOT_LIB=${EMBOSS_DIR}/plplot/lib
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${EMBOSS_DIR}/${OS}/bin`
      echo "   Programs are in ${BOLD}${EMBOSS_DIR}/${OS}/bin${NORMAL}"
      echo "   The manual is in"
      echo "   file://${EMBOSS_DIR}/doc/programs/"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
  emboss|emboss_3.0|emboss_3.0.0)
    if [[ $OS == "Linux" || $OS == "IRIX64" || $OS == "IRIX" ]]; then
      if [[ $OS == "Linux" ]]; then
        if [[ $OSm == "x86_64" ]]; then
          OS=${OS}_${OSm}
        fi
      fi
      export EMBOSS_DIR=${PROGDIR}/EMBOSS/EMBOSS-3.0.0
#      export EMBOSS_ACDROOT=${EMBOSS_DIR}/share/EMBOSS/acd
      export PLPLOT_LIB=${EMBOSS_DIR}/${OS}/lib
#      export PLPLOT_LIB=${EMBOSS_DIR}/plplot/lib
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${EMBOSS_DIR}/${OS}/bin`
      echo "   Programs are in ${BOLD}${EMBOSS_DIR}/${OS}/bin${NORMAL}"
      echo "   The manual is in"
      echo "   file://${EMBOSS_DIR}/doc/programs/html/index.html"
      echo "   and quick guide in file://${EMBOSS_DIR}/doc/manuals/emboss_qg.pdf"
      echo "   or type ${BOLD}wossname -auto${NORMAL} for a full list of programs available"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  epmr|epmr_2.5 # {{{
  epmr_2.5)
      if [[ $OS == "Linux" || $OS == "IRIX64" || $OS == "IRIX" ]]; then
        export EPMR_DIR=${PROGDIR}/epmr/2.5
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${EPMR_DIR}/bin_${OS}`
        echo "   Type ${BOLD}epmr${NORMAL} to run"
        echo "   The manual is in"
        echo "   file://${EPMR_DIR}/epmr.txt"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  epmr|epmr_0.4|openepmr_0.4)
      if [[ $OS == "Linux" || $OS == "IRIX64" || $OS == "IRIX" ]]; then
        if [[ $OS == "Linux" ]]; then
          if [[ $OSm == "x86_64" ]]; then
            OS=${OS}_${OSm}
          fi
        fi
        export EPMR_DIR=${PROGDIR}/epmr/epmr0.4
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${EPMR_DIR}/bin_${OS}`
        echo "   Type ${BOLD}epmr${NORMAL} to run"
        echo "   The manual is at"
        echo "   http://homepage.mac.com/crkissinger/epmr/epmr-user-guide.html"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  espript # {{{
  espript|espript_2.2)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export ESPRIPTDIR=${PROGDIR}/ESPript/ESPript-2_2-www-3_03
        export PATH=`${PROG_SCRIPTS}/add_path -sh $ESPRIPTDIR/${OS}/bin`
        echo "Documentation is in ${BOLD}${ESPRIPTDIR}/help.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
          
# }}}
# fasta # {{{
  fasta)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/fasta/fasta2/bin_${OS} ${PROGDIR}/fasta/fasta3/bin_${OS}`
#        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/fasta/fasta3/bin_${OS}`
        echo "Programs are in ${BOLD}${PROGDIR}/fasta/fasta2/bin_${OS}${NORMAL} and ${BOLD}${PROGDIR}/fasta/fasta3/bin_${OS}${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}          
#  indonesia # {{{
  indonesia)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/indonesia`
        echo "   Type ${BOLD}indonesia${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
# insight # {{{
  insight)
      if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
        echo " Please switch to the tcsh shell and do"
        echo " ${BOLD}source /software/setup insight${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
#  ftdock|3ddock|3d_dock # {{{
  ftdock|3ddock|3d_dock)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export FTDOCKDIR=${PROGDIR}/3D_Dock/2.0
        export MULTIDIR=${FTDOCKDIR}/multidock_${OS}
        if [[ $OS == "Linux" ]]; then
          if [[ $OSm == "x86_64" ]]; then
            OS=${OS}_${OSm}
          fi
        fi
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${FTDOCKDIR}/bin_${OS} ${FTDOCKDIR}/scripts ${MULTIDIR}`
        echo "Documentation is in ${BOLD}${FTDOCKDIR}/doc/3d-dock-manual.pdf${NORMAL}"
      echo "\n   In order to run rpdock and rpscore, you will need to copy the pair-wise"
      echo "   potential matrix into the directory in which you are "
      echo "   running ftdock:"
      echo "       ${BOLD}cp ${FTDOCKDIR}/bin_${OS}/best.matrix .${NORMAL}\n"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# gOpenMol # {{{
  gopenmol)
    if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
      export GOPENMOLDIR=/software/gOpenMol/gOpenMol-2.32/
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${GOPENMOLDIR}/bin_${OS}`
      alias gopenmol=rungOpenMol
      echo "  Type gopenmol to run"
    else
      echo "\nNo version of ^[[1m${program}^[[m is available for the ${OS} operating system."
    fi
    ;;
# }}}
# gramm|gramm_1.03 # {{{
  gramm|gramm_1.03)
    if [[ $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
      export GRAMMDIR=${PROGDIR}/gramm/gramm_1.03
      export GRAMMDAT=${GRAMMDIR}/data
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${GRAMMDIR}/bin_${OS}`
      echo " Type ${BOLD}gramm${NORMAL} to run"
      echo " Documentation is in ${BOLD}${GRAMMDIR}/doc${NORMAL}"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  gromacs|gromacs_3.1.4 # {{{
  gromacs|gromacs_3.1.4)
      if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/gromacs`
        export GRODIR=${PROGDIR}/gromacs/gromacs-3.1.4
        . ${GRODIR}/${OS}/bin/GMXRC
        #PATH=`${PROG_SCRIPTS}/add_path -sh ${GRODIR}/${ARCHDIR}/bin`
        echo "  The ${program} executables are in ${BOLD}${GRODIR}/${OS}/bin${NORMAL}, which "
        echo "  has been added to your path.  The man pages for the individual programs"
        echo "  have also been added to your MANPATH.  There is a set of tutorial files"
        echo "  in ${BOLD}${GRODIR}/share/tutor${NORMAL}"
        echo ""
        echo "  Documentation can be found at ${BOLD}http://gromacs.org/documentation/index.php${NORMAL}"
        echo "  or locally at ${BOLD}file://${GRODIR}/share/html/online.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  gromacs_3.3)
      if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
        if [[ $OS == "Linux" ]]; then
          if [[ $OSm == "x86_64" ]]; then
            OS=${OS}_${OSm}
          fi
        fi
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/gromacs`
        export GRODIR=${PROGDIR}/gromacs/gromacs-3.3
        . ${GRODIR}/${OS}/bin/GMXRC
        #PATH=`${PROG_SCRIPTS}/add_path -sh ${GRODIR}/${ARCHDIR}/bin`
        echo "  The ${program} executables are in ${BOLD}${GRODIR}/${OS}/bin${NORMAL}, which "
        echo "  has been added to your path.  The man pages for the individual programs"
        echo "  have also been added to your MANPATH.  There is a set of tutorial files"
        echo "  in ${BOLD}${GRODIR}/share/tutor${NORMAL}"
        echo ""
        echo "  Documentation can be found at ${BOLD}http://gromacs.org/documentation/index.php${NORMAL}"
        echo "  or locally at ${BOLD}file://${GRODIR}/share/html/online.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  hex # {{{
  hex_3.4)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export HEX_ROOT=${PROGDIR}/hex/3.4
        export HEX_CACHE=${HOME}/tmp/HEX_cache
        export HEX_PDB="./"
        if [[ ! -d $HEX_CACHE ]]; then
          mkdir -p $HEX_CACHE
        fi
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/hex`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${HEX_ROOT}/bin`
        echo "   Type ${BOLD}hex${NORMAL} to run."
        echo "   The manual is in: ${BOLD}file://${HEX_ROOT}/doc/hex_manual.html${NORMAL} and is"
        echo "   also available on-line from the program interface."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  hex|hex_4.5)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export HEX_ROOT=${PROGDIR}/hex/4.5
        export HEX_CACHE=${HOME}/tmp/HEX_cache
        export HEX_PDB="./"
        if [[ ! -d $HEX_CACHE ]]; then
          mkdir -p $HEX_CACHE
        fi
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/hex`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${HEX_ROOT}/bin`
        echo "   Type ${BOLD}hex${NORMAL} to run."
        echo "   The manual is in: ${BOLD}file://${HEX_ROOT}/doc/hex_manual.html${NORMAL} and is"
        echo "   also available on-line from the program interface."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
        echo "\n Try $BOLD setup hex_3.4 ${NORMAL}instead\n"
      fi
      ;;
# }}}
# jackal # {{{
  jackal)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export JACKALDIR=${PROGDIR}/jackal/jackal_v1.5/bin/jackal.dir
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/jackal/jackal_v1.5/bin`
        echo "   Look in ${BOLD}${PROGDIR}/jackal/jackal_v1.5/bin${NORMAL} for programs to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# jalview # {{{
  jalview)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/Jalview`
        echo "   Type ${BOLD}Jalview${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# k2d # {{{
  k2d)
      if [[ $OS == "SunOS" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/k2d/${OS}`
        ln -sf ${PROGDIR}/k2d/weights.dat .
        echo "   Type ${BOLD}k2d${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# ligin # {{{
  ligin)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/LIGIN/bin_${OS}`
        echo "   Type ${BOLD}ligin${NORMAL} to run"
        echo "   See the manuals, in ${PROGDIR}/LIGIN/doc"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;

# }}}
#  ligplot|nucplot # {{{
  ligplot|nucplot)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      # LIGPLOT
        ligdir=${PROGDIR}/ligplot
        export ligdir=${PROGDIR}/ligplot
        alias ligplot=${ligdir}/ligplot.scr
        alias ligonly=${ligdir}/ligonly.scr
        alias dimplot=${ligdir}/dimplot.scr
        alias dimonly=${ligdir}/dimonly.scr
      # NUCPLOT
        nucdir=${PROGDIR}/nucplot
        export nucdir=${PROGDIR}/nucplot
        alias nucplot=${nucdir}/nucplot.scr
        alias nuconly=${nucdir}/nuconly.scr
      # LigEd
        if [[ -z $CLASSPATH ]]; then
          export CLASSPATH=/usr/java/lib/rt.jar:/usr/java/lib/dev.jar:/usr/java/lib/i18n.jar:/usr/java/lib/tiny.jar:${PROGDIR}/netscape/java/java40.jar:${PROGDIR}/ligplot/LigEd
        else
          export CLASSPATH=${CLASSPATH}:${PROGDIR}/ligplot/LigEd
        fi
        alias LigEd="/usr/java/bin/java LigEd"
      
      # HBPLUS
        hbdir=${PROGDIR}/ligplot/hbplus
        export hbdir=${PROGDIR}/ligplot/hbplus
        alias hbplus=${hbdir}/hbplus_${OS}
        echo "   Type ${BOLD}ligplot${NORMAL}, ${BOLD}nucplot${NORMAL}, ${BOLD}hbplus${NORMAL} (or ${UNDERLINE}LigEd${NORMAL} after having run ligplot)"
        echo "   See the manuals, linked on the ${BOLD}software${NORMAL} web page."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  mead # {{{
  mead)
      if [[ $OS == "Linux"  ]]; then
        export MEADDIR=${PROGDIR}/mead/mead-2.2.0p3/
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${MEADDIR}/${OS}/bin`
        echo "Added path to MEAD programs"
        echo "Some documentation in ${BOLD}${MEADDIR}/doc${NORMAL}"
        echo "MEAD web site at ${BOLD}http://www.scripps.edu/bashford/${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      
# }}}
#  misc # {{{
  misc)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export XTAL=${PROGDIR}
        export SURF_HOME=${PROGDIR}/ms
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/misc/bin_${OS} ${PROGDIR}/misc/scripts`
        echo "Added path to rlcs miscellaneous programs"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  mmtk # {{{
  mmtk)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux"  ]]; then
        export MMTKDIR=${PROGDIR}/MMTK/MMTK-2.5.1
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${MMTKDIR}/bin`
        if [[ -z $PYTHONPATH ]]; then
          export PYTHONPATH=${PROGDIR}/${OS}/lib/python2.3/site-packages/
        else
          export PYTHONPATH=`${PROG_SCRIPTS}/remove_pythonpath -sh ${PROGDIR}/${OS}/lib/python2.3/site-packages/`
          export PYTHONPATH=${PYTHONPATH}:${PROGDIR}/${OS}/lib/python2.3/site-packages/
        fi
        echo "    The PYTHONPATH environment variable as been set to:"
        echo "    $PYTHONPATH"
        echo "    Documentation is in ${BOLD}${MMTKDIR}/Doc/HTML/MMTK.html${NORMAL} and in"
        echo "    ${BOLD}${MMTKDIR}/Doc/PDF/manual.pdf${NORMAL}"
        echo "    Examples can be found in ${BOLD}${MMTKDIR}/Examples${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  modeller # {{{
  modeller|modeller_8|modeller_8v2)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
      if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
        export EXECUTABLE_TYPE8v2=iris4d
      elif [[ $OS == "SunOS"  ]]; then
        export EXECUTABLE_TYPE8v2=sun4
      elif [[ $OS == "Linux"  ]]; then
        if [[ $OSm == "x86_64" ]]; then
          export EXECUTABLE_TYPE8v2=x86_64-intel8
        else
          export EXECUTABLE_TYPE8v2=i386-intel8
        fi
      fi
      export MODINSTALL8v2=${PROGDIR}/modeller/modeller8v2
      export LIBS_LIB8v2=$MODINSTALL8v2/modlib/libs.lib
      export KEY_MODELLER8v2=MODELIRANJE
      alias mod=mod8v2
      export PATH=`${PROG_SCRIPTS}/add_path -sh $MODINSTALL8v2/bin`
      #limit stacksize unlimited
      echo "   Type ${BOLD}mod <script[.top]>${NORMAL} to run"
      echo "   The manual is in ${BOLD}file://${MODINSTALL8v2}/doc/index.html${NORMAL}"
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  molmol_2k.1 # {{{
  molmol|molmol_2k.1)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux"  || $OS == "SunOS" ]]; then
        export MOLMOLDIR=${PROGDIR}/molmol/2k.1
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${MOLMOLDIR}`
        echo "   Type ${BOLD}molmol${NORMAL} to run"
        echo "   The manual is in ${BOLD}file://${MOLMOLDIR}/man/manual.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  molmol_2k.2 # {{{
  molmol_2k.2)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        export MOLMOLDIR=${PROGDIR}/molmol/2k.2
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${MOLMOLDIR}`
        echo "   Type ${BOLD}molmol${NORMAL} to run"
        echo "   The manual is in ${BOLD}file://${MOLMOLDIR}/man/manual.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  molscript|molscript_2.1.2 # {{{
  molscript|molscript_2.1.2)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/molscript`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/molscript/molscript-2.1.2/bin_${OS}`
        echo "   Type ${BOLD}molscript${NORMAL} and ${BOLD}molauto${NORMAL} to run"
        source ${PROGDIR}/setup raster3d_2.7
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  mosflm|mosflm_6.2.3 # {{{
  mosflm|mosflm_6.2.5)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/mosflm/6.2.5/bin_${OS}`
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/ccp4`
        source ${PROGDIR}/setup ccp4
        export MOSFLM_VERSION_NUMBERS=1
#        alias ipmosflm=${PROGDIR}/mosflm/6.2.5/bin_${OS}/mosflm
        echo "   Type ${BOLD}mosflm${NORMAL} to run"
        echo "   Documentation is at ${BOLD}http://www.mrc-lmb.cam.ac.uk/harry/mosflm/mosflm_user_guide.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the $OS operating system"
      fi
      ;;
# }}}
#  ms # {{{
  ms)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export SURF_HOME=${PROGDIR}/ms
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/ms/bin_${OS} ${PROGDIR}/ms/scripts`
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  msms # {{{
  msms)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export MSMSDIR=${PROGDIR}/msms/msms-2.5.3
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${MSMSDIR}/bin ${MSMSDIR}/bin_${OS}`
        echo "   Type ${BOLD}msms -h${NORMAL} to see options"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# muscle # {{{
  muscle_3.52)
      if [[ $OS == "Linux" ]]; then
        export MUSCLEDIR=${PROGDIR}/muscle/muscle3.52
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/muscle`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${MUSCLEDIR}/bin_${OS}`
        echo "   Type ${BOLD}muscle${NORMAL} to run"
        echo "   Documentation can be found in ${BOLD}${MUSCLEDIR}/doc/muscle.pdf${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;

  muscle|muscle_6)
      if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
        export MUSCLEDIR=${PROGDIR}/muscle/muscle6
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/muscle`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${MUSCLEDIR}/bin_${OS}`
        echo "   Type ${BOLD}muscle${NORMAL} to run"
        echo "   Documentation can be found in ${BOLD}${MUSCLEDIR}/doc/muscle.pdf${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;

# }}}
#  namd|namd_2.5 # {{{
  namd|namd_2.5)
      if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
        export NAMDVER='2.5'
        export NAMDDIR=${PROGDIR}/namd/${NAMDVER}
        if [[ $OS == "IRIX64" ]]; then
          export NAMDBINDIR=${NAMDDIR}/NAMD_${NAMDVER}_Origin2000-MPI
        elif [[ $OS == "Linux" ]]; then
          export NAMDBINDIR=${NAMDDIR}/NAMD_${NAMDVER}_Linux-i686
        fi
        export CONV_RSH=ssh
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/namd`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${NAMDBINDIR}`
        echo "   Type ${BOLD}charmrun ${NAMDBINDIR}/namd2 ++local +p<procs> <configfile>${NORMAL} to run"
        echo "   See ${NAMDBINDIR}/notes.txt for directions on running namd"
        echo "   and file://${NAMDDIR}/docs/ug/ug.html or file://${NAMDDIR}/docs/ug.pdf for the userguide."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
    # }}}
# namot # {{{
  namot)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export NAMOTDIR=${PROGDIR}/namot/namot-2.2.0/${OS}
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/namot`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${NAMOTDIR}/bin`
        echo "   Type ${BOLD}namot${NORMAL} to run"
        echo "   See ${NAMOTDIR}/notes.txt for directions on running ${program}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# nmrpipe {{{
  nmrpipe)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        export NMRPIPEDIR=${PROGDIR}/NMRPipe
        if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
          source $NMRPIPEDIR/com/nmrInit.sgi6x.sh
        elif [[ $OS == "Linux" ]]; then
          source /software/NMRPipe/com/nmrInit.linux9.sh
        elif [[ $OS == "SunOS" ]]; then
          source /software/NMRPipe/com/nmrInit.sol.sh
        fi
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# nmrview {{{
  nmrview)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        export NMRVIEWDIR=${PROGDIR}/nmrview
        export NMRVIEW5HOME=${NMRVIEWDIR}/nmrview5_${OS}
# deal with different tcl/tk versions!
        TK_DIR=`/bin/ls -1d ${NMRVIEW5HOME}/tk*`
        TCL_DIR=`/bin/ls -1d ${NMRVIEW5HOME}/tcl*`
        export TK_LIBRARY=${TK_DIR}
        export TCL_LIBRARY=${TCL_DIR}
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${NMRVIEW5HOME}/bin`
        source /software/setup curvefit
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# nmrview_titration {{{
  nv_titration|nmrview_titration)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        export NMRVIEWDIR=${PROGDIR}/nmrview_titration
        export NMRVIEW5HOME=${NMRVIEWDIR}/nmrview5_${OS}
# deal with different tcl/tk versions!
        TK_DIR=`/bin/ls -1d ${NMRVIEW5HOME}/tk*`
        TCL_DIR=`/bin/ls -1d ${NMRVIEW5HOME}/tcl*`
        export TK_LIBRARY=${TK_DIR}
        export TCL_LIBRARY=${TCL_DIR}
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${NMRVIEW5HOME}/bin`
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  novel_r # {{{
  novel_r)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/novel_R/bin_${OS}`
        echo "    Type ${BOLD}novel_R${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
#  o|o_7|o_8|usf # {{{
  o|o_7|o_8|usf)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export ODIR=${PROGDIR}/o
      if [[ -z $ODAT ]]; then
        export ODAT=${ODIR}/data/:${ODIR}/omac/:$ODAT
      else
        export ODAT=${ODIR}/data/:${ODIR}/omac/
      fi
      if [[ -z $CCP4_OPEN ]]; then
        export CCP4_OPEN=UNKNOWN
      fi
      export GKLIB=${ODIR}/gerard/lib
      export OSYM=${ODIR}/data/symm
      export OBIN=${ODIR}/bin_${OS}
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${ODIR}/bin_${OS}`
      if [[ $OS == "IRIX" || $OS == "IRIX64"  ]]; then
        alias o=sg_ono_8.0.11
        echo "   Type ${BOLD}o${NORMAL} to run version `alias o`"
        echo "   Type the program name (minus the ${UNDERLINE}6d_${NORMAL} prefix, e.g. ${BOLD}mapman${NORMAL}) to run the other"
        echo "   Uppsala Software Factory programs."
      elif [[ $OS == "Linux" ]]; then
        alias o=lin_ono_8.0.11
        echo "   Type ${BOLD}o8${NORMAL} to run version `alias o` for Linux"
        echo "   Type the program name (minus the ${UNDERLINE}lx_${NORMAL} prefix) to run the other"
        echo "   Uppsala Software Factory programs."
      fi
    else 
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the $OS operating system"
    fi
    ;;
    # }}}
# pdb2pqr # {{{
  pdb2pqr)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/pdb2pqr/pdb2pqr-1.0.1`
      echo "  Type ${BOLD}${program}.py${NORMAL} to run."
    else
      echo "\nNo version of ^[[1m${program}^[[m is available for the ${OS} operating system."
    fi
    ;;
# }}}
# phaser # {{{
  phaser)
    if [[ $OS == "Linux" ]]; then
      export PHASERDIR=${PROGDIR}/phaser/phaser-1.2
      export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/phaser`
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${PHASERDIR}/bin_${OS}`
      echo "  Type ${BOLD}${program}${NORMAL} to run."
      echo "  Documentation is available in ${BOLD}${PHASERDIR}/doc/${NORMAL} (MS Word and OpenOffice formats)"
      echo "  See tutorial in ${PHASERDIR}/tutorial and at"
      echo "  ${UNDERLINE}http://www-structmed.cimr.cam.ac.uk/phaser/script_tutorial.html${NORMAL}"
    else
      echo "\nNo version of ^[[1m${program}^[[m is available for the ${OS} operating system."
    fi
    ;;
# }}}
# procheck_nmr # {{{
  procheck_nmr)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        source ${PROGDIR}/procheck_nmr/setup.sh
        echo "  Documentation is in ${BOLD}file://${PROGDIR}/procheck_nmr/manual/index.html${NORMAL}"
        echo "  Executables and scripts are in ${BOLD}${PROGDIR}/procheck_nmr/bin_${OS}${NORMAL}"
    else
      echo "\nNo version of ^[[1m${program}^[[m is available for the ${OS} operating system."
    fi
    ;;
# }}}
#  pymol # {{{
  pymol)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        if [[ $OS == "Linux" ]]; then
          if [[ $OSm == "x86_64" ]]; then
            OS=${OS}_${OSm}
          fi
        fi
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/pymol`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/pymol/${OS}/pymol`
        if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
          if [[ -z $PYTHONPATH ]]; then
            export PYTHONPATH=${PROGDIR}/${OS}/lib/python2.3/site-packages
          else
            export PYTHONPATH=${PYTHONPATH}:${PROGDIR}/${OS}/lib/python2.3/site-packages
          fi
        elif [[ $OS == "Linux" ]]; then
          if [[ -z $PYTHONPATH ]]; then
            export PYTHONPATH=${PROGDIR}/${OS}/lib/python2.3/site-packages
          else
            export PYTHONPATH=`${PROG_SCRIPTS}/remove_pythonpath -sh ${PROGDIR}/${OS}/lib/python2.3/site-packages/`
            export PYTHONPATH=${PYTHONPATH}:${PROGDIR}/${OS}/lib/python2.3/site-packages
          fi
        fi
        echo "   Type ${BOLD}${program}${NORMAL} to run."
#        source ${PROGDIR}/setup cctbx
        source ${PROGDIR}/setup stride
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  pymolsvn|pymolcvs)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        if [[ $OS == "Linux" ]]; then
          if [[ $OSm == "x86_64" ]]; then
            OS=${OS}_${OSm}
          fi
        fi
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/pymol`
        export PYTHONPATH=`${PROG_SCRIPTS}/remove_pythonpath -sh -re ${PROGDIR}/pymol`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/pymol/${OS}/SVN/pymol`
        if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
          if [[ -z $PYTHONPATH ]]; then
            export PYTHONPATH=${PROGDIR}/${OS}/lib/python2.3/site-packages
          else
            export PYTHONPATH=${PYTHONPATH}:${PROGDIR}/${OS}/lib/python2.3/site-packages
          fi
        elif [[ $OS == "Linux" ]]; then
          if [[ -z $PYTHONPATH ]]; then
            export PYTHONPATH=${PROGDIR}/${OS}/lib/python2.3/site-packages
          else
            export PYTHONPATH=`${PROG_SCRIPTS}/remove_pythonpath -sh ${PROGDIR}/${OS}/lib/python2.3/site-packages/`
            export PYTHONPATH=${PYTHONPATH}:${PROGDIR}/${OS}/lib/python2.3/site-packages
          fi
        fi
        echo "   Type ${BOLD}pymol${NORMAL} to run."
        source ${PROGDIR}/setup cctbx
        source ${PROGDIR}/setup stride
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  quanta|quanta98|quanta2000 # {{{
  quanta|quanta98|quanta2000)
      if [[ $OS == "IRIX" || $OS == "IRIX64"  ]]; then
        echo " Please switch to the tcsh shell and do"
        echo " ${BOLD}source /software/setup quanta${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
#  raster3d|raster3d_2.7 # {{{
  raster3d|raster3d_2.7)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export R3DDIR=${PROGDIR}/raster3d/Raster3D_2.7a
        export R3D_LIB=${R3DDIR}/materials
        export R3D_BIN=${R3DDIR}/bin_$OS
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/raster3d`
        export PATH=`${PROG_SCRIPTS}/add_path -sh $R3D_BIN`
        echo "   Type one of the following to run: ${BOLD}\n   \c"
        for file in $R3D_BIN/*; do
          echo "`basename $file` \c"
        done 
        echo "${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# saxs  # {{{
  saxs)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export SAXSDIR=${PROGDIR}/SAXS
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${SAXSDIR}/bin_${OS}`
        echo "    Type "
        echo "${BOLD}`/bin/ls -1 ${SAXSDIR}/bin_${OS}`${NORMAL} "
        echo "to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# saxs3d # {{{
  saxs3d)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export SAXS3DDIR=${PROGDIR}/SAXS3D
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${SAXS3DDIR}/bin_${OS}`
        echo "    Type "
        echo "${BOLD}`/bin/ls -1 ${SAXS3DDIR}/bin_${OS}`${NORMAL} "
        echo "to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# scwrl # {{{
  scwrl|scwrl3)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        SCWRLVER=scwrl3
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/scwrl/${SCWRLVER}_${OS}`
        echo "    Type ${BOLD}${SCWRLVER}${NORMAL} to run "
        echo "    See instructions in ${BOLD}${PROGDIR}/scwrl/doc/Usage.txt${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  seaview # {{{
  seaview)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/seaview/${OS}`
  #      alias seaview=${PROGDIR}/seaview/seaview.${OS}
        echo "    Type ${BOLD}seaview${NORMAL} to run "
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
#  sequoia # {{{
  sequoia)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export SEQUOIADIR=${PROGDIR}/sequoia/0.9.9
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${SEQUOIADIR}/bin_${OS}`
        echo "    Type ${BOLD}sequoia${NORMAL} to run "
        echo "    Documentation is at:"
        echo "    ${BOLD}http://bruns.homeip.net/~bruns/sequoia.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  SeqVISTA # {{{
  seqvista)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/SeqVISTA`
        echo "    Type ${BOLD}seqvista${NORMAL} to run "
        echo "    Documentation is at:"
        echo "    ${BOLD}http://zlab.bu.edu/SeqVISTA/${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# solvate # {{{
  solvate)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export SOLVATEDIR=${PROGDIR}/solvate/solvate_1.0
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${SOLVATEDIR}/bin_${OS}`
        echo "   Type ${BOLD}solvate${NORMAL} to run "
        echo "   Documentation is in ${SOLVATEDIR}/doc/docu_html/docu.html"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# solve # {{{
  solve|solve_2.10)
      if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
        export SOLVE=${PROGDIR}/solve/solve-2.10
        export SOLVEDIR=${SOLVE}/lib
        export PHENIX_SOLVEDIR=$SOLVEDIR
        export SOLVEBIN=${SOLVE}/bin_${OS}
        export SOLVETMPDIR=/tmp/${USER}.SOLVE
        if [[ ! -d $SOLVETMPDIR ]]; then
          echo "Attempting to make a local temporary directory... ${SOLVETMPDIR}"
          mkdir $SOLVETMPDIR
        fi
        export SYMOP=${SOLVEDIR}/symop.lib
        export SYMINFO=${SOLVEDIR}/syminfo.lib
        export CCP4_OPEN=UNKNOWN
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/solve`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${SOLVEBIN}`
        unlimit memoryuse
  #      limit descriptors 200
        limit core 0
        echo "   Type ${BOLD}solve${NORMAL}, ${BOLD}solve_giant${NORMAL}, or ${BOLD}solve_huge${NORMAL} and"
        echo "   Type ${BOLD}resolve${NORMAL}, ${BOLD}resolve_giant${NORMAL}, or ${BOLD}resolve_huge${NORMAL} to run"
        echo "   The manual is in"
        echo "   file://${SOLVEDIR}/html/index.html"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  snb # {{{
  snb)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export SNB_HOME=${PROGDIR}/snb/2.2/${OS}
        if [[ $OS == "Linux" ]]; then
          export PATH=`${PROG_SCRIPTS}/add_path -sh /usr/local/java/bin $SNB_HOME/bin`
        elif [[ $OS == "IRIX" || $OS == "IRIX64"  ]]; then
          export PATH=`${PROG_SCRIPTS}/add_path -sh /usr/java/bin $SNB_HOME/bin`
        fi
        echo "   Type ${BOLD}SnB${NORMAL} to run Shake and Bake"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
#  spdbv # {{{
  spdbv)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/SPDBV/bin`
        echo "   Type ${BOLD}spdbv${NORMAL} to run"
        echo 
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
# stride # {{{
  stride)
    if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
      STRIDEDIR=${PROGDIR}/stride
      export PATH=`${PROG_SCRIPTS}/add_path -sh ${STRIDEDIR}/bin_${OS}`
      echo "  Type ${BOLD}${program}${NORMAL} to run."
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
    # }}}
# sybyl # {{{
  sybyl6.8)
    if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
      export TA_ROOT=/usr/people/tripos/sybyl6.8
      export TA_LICENSE=/usr/people/tripos/AdminTools7.0/
      source ${TA_ROOT}/lib/.profile
      export PATH=`${PROG_SCRIPTS}/add_path -sh $TA_ROOT/bin`
      echo "   Type ${BOLD}sybyl${NORMAL} to run."
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
  sybyl|sybyl6.91)
    if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
      export TA_ROOT=/software/tripos/sybyl6.91
      export TA_LICENSE=/software/tripos/AdminTools7.0A
      source ${TA_ROOT}/lib/.profile
      export PATH=`${PROG_SCRIPTS}/add_path -sh $TA_ROOT/bin`
      echo "   Type ${BOLD}sybyl${NORMAL} to run."
    elif [[ $OS == "Linux" ]]; then
      export TA_ROOT=/software/tripos/sybyl6.91
      export TA_LICENSE=/software/tripos/AdminTools7.0A
      source ${TA_ROOT}/lib/.profile
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      echo "\nBut I've set up the environment just the same..."
    else
      echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
    fi
    ;;
# }}}
# tinker # {{{
  tinker|tinker_4.2)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export TINKER_HOME=${PROGDIR}/tinker/v4.2
        if [[ $OS == "Linux" ]]; then
          if [[ $OSm == "x86_64" ]]; then
            OS=${OS}_${OSm}
          fi
        fi
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/tinker`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${TINKER_HOME}/bin_${OS}`
        if [[ $OS == "IRIX" || $OS == "IRIX64"  ]]; then
          export PATH=`${PROG_SCRIPTS}/add_path -sh /usr/java2/bin`
        fi
        echo "   Tinker executables are in ${BOLD}${TINKER_HOME}/bin_${OS}${NORMAL}."
        echo "   Manual is in ${BOLD}${TINKER_HOME}/doc/guide.pdf${NORMAL}."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}

#  tops # {{{
  tops)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export TOPS_HOME=${PROGDIR}/Tops
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${TOPS_HOME}/bin_${OS}`
        if [[ $OS == "IRIX" || $OS == "IRIX64"  ]]; then
          export PATH=`${PROG_SCRIPTS}/add_path -sh /usr/java2/bin`
        fi
        export CLASSPATH=${TOPS_HOME}/classes/TOPS.jar
        source ${PROGDIR}setup.sh dssp
        echo "   Type ${BOLD}Tops, and EditTops${NORMAL} to run"
        echo "   Type ${BOLD}dssp <pdbfilename>${NORMAL} to create a ${BOLD}.dssp${NORMAL} file if necessary."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# triton # {{{
  triton)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/triton/triton-3.0/${OS}/bin`
        echo "   Type ${BOLD}triton${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  us|us_6.2|ultrascan_6.2 # {{{
  us|us_6.2|ultrascan_6.2|us_6.2.0|ultrascan_6.2.0)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export ULTRASCAN=${PROGDIR}/ultrascan/ultrascan-6.2.0
        export LD_LIBRARY_PATH=${ULTRASCAN}/lib_${OS}
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re '/software/ultrascan'`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${ULTRASCAN}/bin_${OS}`
        ln -fs ${ULTRASCAN}/.uslicense_${OS} ~/.uslicense
#        alias us=${PROGDIR}/ultrascan/us-5.0/bin/us_${OS}
        echo "   Type ${BOLD}us${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      # }}}
# vadar # {{{
  vadar)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        export VADARDIR=${PROGDIR}/vadar/vadar-v1.4
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/vadar`
        if [[ $OS == "IRIX" ]]; then
          export PATH=`${PROG_SCRIPTS}/add_path -sh ${VADARDIR}/bin_IRIX64`
        else
          export PATH=`${PROG_SCRIPTS}/add_path -sh ${VADARDIR}/bin_${OS}`
        fi
        echo "   Type ${BOLD}${program}${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  vega # {{{
  vega)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export VEGADIR=${PROGDIR}/Vega
        if [[ -z $LD_LIBRARY_PATH ]]; then
          export LD_LIBRARY_PATH=$VEGADIR/lib_${OS}
        else
          export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$VEGADIR/lib_${OS}
        fi
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/Vega`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${VEGADIR}/bin_${OS}`
        echo "   Type ${BOLD}vega${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  vmd # {{{
  vmd_1.8.2)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export VMDDIR=${PROGDIR}/vmd/vmd-1.8.2
        export VMDTMPDIR=/tmp
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/vmd`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${VMDDIR}/bin ${VMDDIR}/bin_${OS}`
        echo "    Type ${BOLD}vmd${NORMAL} to run."
        source ${PROGDIR}/setup msms
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
  vmd|vmd_1.8.3)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export VMDDIR=${PROGDIR}/vmd/vmd-1.8.3
        export VMDTMPDIR=/tmp
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/vmd`
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${VMDDIR}/bin ${VMDDIR}/bin_${OS}`
        echo "    Type ${BOLD}vmd${NORMAL} to run."
        source ${PROGDIR}/setup msms
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  vmdxplor|vmdxplor_1.1.15 # {{{
  vmdxplor|vmdxplor_1.1.15)
      if [[ $OS == "IRIX64" || $OS == "Linux" ]]; then
        if [[ $OS == "Linux" ]]; then
          export ARCH=Linux_2.2_i686
        elif [[ $OS == "IRIX64" ]]; then
          export ARCH=IRIX64_6.5
        fi
        export VMDXDIR=${PROGDIR}/vmd-xplor/vmd-xplor-1.1.15-${ARCH}
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${VMDXDIR}`
        echo "    Type ${BOLD}vmd-xplor${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# vnc # {{{
  vnc)
      if [[ $OS == "IRIX64" || $OS == "IRIX" ]]; then
        export VNCDIR=${PROGDIR}/vnc/vnc-3.3.7
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${VNCDIR}/bin_${OS}`
        echo "    For example:"
        echo "    Type ${BOLD}vncserver -geometry 1024x768 :1${NORMAL} to run"
        echo "  or"
        echo "    Type ${BOLD}vncviewer hostname:1${NORMAL} to run"
      echo "    Documentation is in ${BOLD}file:///${VNCDIR}/vnc-3.3.7-documentation/documentation.html${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  x3dna|x3dna_1.4.3 # {{{
  x3dna|x3dna_1.5)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export X3DNA=${PROGDIR}/x3dna/1.5
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${X3DNA}/bin_${OS}`
        echo "Executables are in ${BOLD}${X3DNA}/bin_${OS}${NORMAL}"
        echo "Look in ${BOLD}${X3DNA}/Examples${NORMAL} for examples. A PDF version"
        echo "of the manual is in \c"
        echo "${BOLD}${X3DNA}/doc/x3dna.pdf${NORMAL}"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system"
      fi
      ;;
# }}}
#  xplor|xplor_3.8|xplor_3.851 # {{{
  xplor|xplor_3.8|xplor_3.851)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        source ${PROGDIR}/xplor/3.8/xplor_env.sh
        echo "    Type ${BOLD}xplor${NORMAL} to run."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
      
  xplor-nih)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/xplor-nih/xplor-nih-2.0.6/bin`
        echo "    Type ${BOLD}xplor${NORMAL} to run."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  xtalview_4.1 # {{{
  xtalview|xtalview_4.1)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" ]]; then
        export PATH=`${PROG_SCRIPTS}/remove_path -sh -re ${PROGDIR}/XtalView`
        source ${PROGDIR}/XtalView/XtalView_4.1/XtalView.env.sh
        export PATH=`${PROG_SCRIPTS}/add_path -sh '${PROGDIR}/kinemage/bin_${OS}'`
        source ${PROGDIR}/setup raster3d > /dev/null
        if [[ $OS == "IRIX" || $OS == "IRIX64" ]]; then
          $XTALVIEWHOME/bin/share/fonts
        fi
        echo "     Type ${BOLD}xtalmgr${NORMAL} to start XtalView."
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
# xcrvfit # {{{
    xcrvfit)
      if [[ $OS == "IRIX" || $OS == "IRIX64" || $OS == "Linux" || $OS == "SunOS" ]]; then
        export PATH=`${PROG_SCRIPTS}/add_path -sh ${PROGDIR}/xcrvfit/xcrvfit-v2.1.1/${OS}/bin`
        echo "     Type ${BOLD}xcrvfit${NORMAL} to start "
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
#  xrayview # {{{
  xrayview)
      if [[ $OS == "IRIX" || $OS == "IRIX64"  ]]; then
        alias XRayView=${PROGDIR}/XRayView/XRayView
        echo "   Type ${BOLD}XRayView${NORMAL} to run"
      else
        echo "\nNo version of ${BOLD}${program}${NORMAL} is available for the ${OS} operating system."
      fi
      ;;
# }}}
  *)
    echo "The program, $program was not found in the setup script"
    NOT_FOUND=1
    ;;
  esac
# }}}
  # Program not found! # {{{
  # check exit status and print error log and usage instructions again if necessary
  #echo Status flag: $status
  #if [[ ! "$status" == 0 ]]; then
  if [[ ! -z $NOT_FOUND && $NOT_FOUND == 1 ]]; then
    echo "Program $1 is not in this setup script."
    # save a log of error messages
#    if [[ -w ${PROGDIR}/mgr/log/setup.log ]]; then
#      echo "`date '+%Y-%m-%d %T'` $USER $HOST $program" >> ${PROGDIR}/mgr/log/error.log
#    fi
    echo "    Try one of:"
#    match=`egrep "^[   ]*case.*$1" ${PROGDIR}/setup | sed 's/^[   ]*case 0/    /;s/^[   ]*case /    /;s/://;' | sort +0b`
    match=`egrep '^[   ]*[0-z_.|]*\)' ${PROGDIR}/setup.sh | awk 'BEGIN {FS="[|)]"} {print $1, "\n",$2}' | sed -e 's/  //g' -e 's/ //g' | egrep "$program"`
#    echo "match: $match"
    
    if [[ "$match" != '' ]]; then
      echo "$match"
    else
#      egrep "^[   ]*case" ${PROGDIR}/setup | sed 's/^[   ]*case 0/    /;s/^[   ]*case /    /;s/://;' | sort +0b
      egrep '^[   ]*[0-z_.|]*\)' ${PROGDIR}/setup.sh | awk 'BEGIN {FS="[|)]"} {print $1, "\n",$2}' | sed -e 's/  //g' -e 's/ //g' | egrep -v '^$'
    fi
  fi
fi
# }}}
