#
#     Copyright (C) 1999-2004  Liz Potterton, Peter Briggs
#
#     This code is distributed under the terms and conditions of the
#     CCP4 Program Suite Licence Agreement as a CCP4 Library.
#     A copy of the CCP4 licence can be obtained by writing to the
#     CCP4 Secretary, Daresbury Laboratory, Warrington WA4 4AD, UK.
#
#CCP4i_cvs_Id $Id$
#===========================================================================
#
# simbad.script
#
#===========================================================================

set RUN_DIR [GetDefaultDirPath]

set prefix [string trimright [file join $RUN_DIR SIMBAD_$job_params(JOB_ID) _] _]
AddOutputDir $prefix

set default_args "-F $F -SIGF $SIGF -FREE $FreeR_flag -output_mtz $HKLOUT -output_pdb $XYZOUT --display_gui -nproc $NProc -run_dir $RUN_DIR -ccp4_jobid $job_params(JOB_ID)"
set additional_options ""

if { $NSIMBADARG > 0 } {
     for {set i 1} {$i <= $NSIMBADARG} {incr i} {
        append additional_options " $SIMBADARG($i)" 
   }
}

CreateComScript demoprog simbad_script

if { $SIMBAD_MODE == "LATTCONTAM" } {
      set cmd "simbad $HKLIN $default_args $additional_options"
} elseif { $SIMBAD_MODE == "LATTICE" } {
      set cmd "simbad-lattice $HKLIN $default_args $additional_options"
} elseif { $SIMBAD_MODE == "CONTAMINANT" } {
      set cmd "simbad-contaminant $HKLIN $default_args $additional_options"
}
#} elseif { $SIMBAD_MODE == "MORDA" } {
#      set cmd "simbad-morda $HKLIN $default_args $additional_options"
#}
 
set status [Execute $cmd $simbad_script program_status report]