# This is CCP4 setup file for C-shell (or tcsh) users.
# The include/ccp4.setup-csh.in file is a template used to generate
# the bin/ccp4.setup-csh file.  Source the latter to use CCP4.
# You may add it to one of your shell startup files, such as ~/.cshrc:
# source /full/path/to/ccp4/ccp4-version/bin/ccp4.setup-csh

# To remove previously added CCP4 directories from the PATH, uncomment:
#if $?CCP4 setenv PATH `echo "$PATH" | sed "s,${CCP4}[^:]*:,,g"`

################### MOST-OFTEN CUSTOMIZED VARIABLES #####################

# CCP4_MASTER is the location of the top-level directory containing ccp4-N.N.
setenv CCP4_MASTER /xtal
setenv CCP4 $CCP4_MASTER/ccp4-7.0

# CCP4_SCR: a per-user directory for run-time-generated scratch files.
setenv CCP4_SCR /tmp/`whoami | tr ' \\\\' _`

# CCP4I_TCLTK - directory containing tclsh, wish and bltwish executables
#               for ccp4i. The CCP4 suite is distributed with Tcl/Tk 8.4.
setenv CCP4I_TCLTK $CCP4/bin

# BALBES pipeline with large database
if (-e $CCP4_MASTER/BALBES) setenv BALBES_ROOT $CCP4_MASTER/BALBES

### Optional - setting http proxy
#setenv HTTP_PROXY wwwblah.blah.ac.uk:xxxx/blah.blah


######################### ALL THE REST ###########################

# This variable is set to ensure that the logfile output from programs
# compiled with Gfortran is in the correct order.
setenv GFORTRAN_UNBUFFERED_PRECONNECTED Y

# CBIN: location of the executables -- must be on your path (see below)
setenv CBIN $CCP4/bin
# CLIB: location of (binary) library files such as libccp4.a and libccp4.so
setenv CLIB $CCP4/lib
# CLIBD: platform-independent data files
setenv CLIBD $CCP4/lib/data
# CETC: executable scripts (NOT configuration files)
setenv CETC $CCP4/etc
# CINCL: headers and two *.def files for handling "logical names" in CCP4
setenv CINCL $CCP4/include
# CHTML: html documentation
setenv CHTML $CCP4/html
# CEXAM: examples and some tests
setenv CEXAM $CCP4/examples
# source code directories
#setenv CLIBS $CCP4/lib/libccp4
#setenv CPROG $CCP4/src
# CCP4I_TOP: the top directory of the interface
setenv CCP4I_TOP $CCP4/share/ccp4i
# MMCIFDIC: platform-dependent (not in $CLIBD) data file for the ccif library
setenv MMCIFDIC $CLIB/ccp4/cif_mmdic.lib
# CRANK: location of Crank automation suite within ccp4i
setenv CRANK $CCP4I_TOP/crank
# CLIBD_MON: dictionary files for REFMAC5 (keep trailing /)
setenv CLIBD_MON $CCP4/lib/data/monomers/
# CCP4_HELPDIR: location of the VMS-style help file used by (ip)mosflm
setenv CCP4_HELPDIR $CCP4/help/            # NB trailing /

if (! -e $CCP4) then
    echo "WARNING: The directory $CCP4"
    echo 'WARNING: (assigned to $CCP4) does not exist.'
    echo "WARNING: The CCP4 programs will not run correctly."
endif

# check to see if $CCP4_SCR exists and if not try to make it
if (! -e $CCP4_SCR) mkdir $CCP4_SCR
if (! -e $CCP4_SCR) echo "Unable to assign CCP4_SCR. This will cause probs."

# HARVESTHOME specifies location of harvesting files (defaults to $HOME)
#setenv HARVESTHOME $HOME

# MOSFLM_WISH: if not set, ${CCP4I_TCLTK}/wish is used
#setenv MOSFLM_WISH ${CCP4I_TCLTK}/wish

# CCP4_OPEN is set to 'UNKNOWN' by default. When set to 'NEW' traditional
# CCP4 programs treat over-writing of existing files as a fatal error.
setenv CCP4_OPEN        UNKNOWN

setenv PATH $CCP4/etc:$CCP4/bin:${PATH}

if (${?MANPATH}) then
   setenv MANPATH $CCP4/share/man:$MANPATH
endif

# clean up - just in case older version of CCP4 is sourced
unsetenv DBCCP4I_TOP

# traditional aliases
alias ccp4   'pushd $CCP4>/dev/null'
alias xtal   'pushd $CCP4_MASTER>/dev/null'
alias cbin   'pushd $CBIN>/dev/null'
alias cetc   'pushd $CETC>/dev/null'
#alias cprog  'pushd $CPROG>/dev/null'
alias cincl  'pushd $CINCL>/dev/null'
alias clib   'pushd $CLIB>/dev/null'
alias clibd  'pushd $CLIBD>/dev/null'
#alias clibs  'pushd $CLIBS>/dev/null'
alias cbin   'pushd $CBIN>/dev/null'
alias cexam  'pushd $CEXAM>/dev/null'
alias chtml  'pushd $CHTML>/dev/null'