#!/bin/csh -f
#
# tutorial script for CNSsolve
#
# written by: Paul Adams
# copyright Yale University
#
set tutdir='doc/html/tutorial'
set lnfiles=(data/nsf/nsf.mtf \
             data/nsf/bgroup.pdb \
	     data/nsf/nsf.cv \
	     data/nsf/mad_phase2.hkl \
	     data/nsf/atp.pdb \
	     data/nsf/atp.top \
	     data/nsf/atp.param \
	     refinement_mlhl/model_complete/omac \
             refinement_mlhl/model_complete/model_map_1fofc.inp \
	     refinement_mlhl/model_complete/generate.inp \
	     refinement_mlhl/model_complete/minimize.inp \
	     refinement_mlhl/model_complete/bgroup_atp.inp)
#
if ( ! $?CNS_SOLVE ) then
  echo "CNS_SOLVE not defined"
  echo "CNS must be correctly setup to running this tutorial script"
  exit 1
endif
#
if ( ! -d $CNS_SOLVE/$tutdir ) then
  echo "cannot find tutorial directory $CNS_SOLVE/$tutdir"
  echo "please check that you are using the correct version of CNS"
  exit 1
endif
#
foreach file ( $lnfiles )
  if ( ! -e {$file}:t ) then
    echo "linking $tutdir/$file to current directory"
    ln -s $CNS_SOLVE/$tutdir/$file .
  endif
end
#
echo "        "
echo "running:"
echo "         cns_solve < model_map_1fofc.inp > model_map_1fofc.out"
echo "        "
#
cns_solve < model_map_1fofc.inp > model_map_1fofc.out
#
echo "        "
echo "running:"
echo "         cns_solve < generate.inp > generate.out"
echo "        "
#
cns_solve < generate.inp > generate.out
#
echo "        "
echo "running:"
echo "         cns_solve < minimize.inp > minimize.out"
echo "        "
#
cns_solve < minimize.inp > minimize.out
#
echo "        "
echo "running:"
echo "         cns_solve < bgroup_atp.inp > bgroup_atp.out"
echo "        "
#
cns_solve < bgroup_atp.inp > bgroup_atp.out
#
echo "        "
#
