#!/bin/csh -f

################################################################
#
# This is a simple script meant to be used for downloading
# J. Ponder's TINKER command line executables for Linux for use
# with H.Martinez's (et al.) interactive version of RNA2D3D. 
# The binaries will be deposited in the sub-dir Tinker-sta.dir.
#
# Written by Wojciech Kasprzak, NCI/SAIC-Frederick, Inc., 2008
#
################################################################

# Key assumtpions:
# 1. TINKER directory tree exists and contains the following
#    /rna_2d3d_path/Tinker-sta.dir/
#                              bin      - empty or not
#                              params   - at least amber99.prm
# 2. This script is to be run from the RNA2D3D directory
#    equal to the /rna_2d3d_path
  
  setenv TINKER `pwd`/Tinker-sta.dir

  printf "\n ===================================================================\n"
  printf "\n Installing package TINKER elements for Linux from its Web Home Page \n"
  printf "\n =================================================================== \n"

  cd $TINKER/bin
  wget ftp://dasher.wustl.edu/pub/tinker-bin/linux/README
  wget ftp://dasher.wustl.edu/pub/tinker-bin/linux/minimize.gz
  wget ftp://dasher.wustl.edu/pub/tinker-bin/linux/optimize.gz
  wget ftp://dasher.wustl.edu/pub/tinker-bin/linux/dynamic.gz
  wget ftp://dasher.wustl.edu/pub/tinker-bin/linux/minrigid.gz
  wget ftp://dasher.wustl.edu/pub/tinker-bin/linux/pdbxyz.gz
  wget ftp://dasher.wustl.edu/pub/tinker-bin/linux/xyzpdb.gz
  gunzip *.gz
  chmod 755 *
  printf "\n Displaying TINKER bin directory contents: \n"
  ls -l

  printf "\n Downloading Force Field parameters file amber99.prm \n"
  cd $TINKER/params
  wget ftp://dasher.wustl.edu/pub/tinker/params/amber99.prm
  chmod 755 *
  printf "\n Displaying TINKER params directory contents: \n"
  ls -l

  printf "\n\n******************************************************************* \n"
  printf " Please, register use of TINKER at http://dasher.wustl.edu/tinker/\n"
  printf "******************************************************************* \n\n"

  printf " The script TINKER-FOR2D3D has finished its job. \n\n\n"
