#!/bin/csh

# This script gives the command line entry for running MDD calculations
# on a single processor. Created by MDDGUI software
# The general calculation command is 
# mddnmr1.2cx <data file> <Rank> 0 <MaxIter> <Eps> <Lambda> <ini file or seed> <memory Mb>
# The script REQUIRES one argument - the list of regions produced when creating the MDD files
# The file name of the list should be mdd_out.list
# Check the readme files for MDDGUI or MDDNMR package for more information

if( $# != 1 ) then
  echo "Usage:" $0 "<File name>"
  echo "  The file should contain the list of regions for calculation"
  cat $0
  exit  
endif
set regions=`grep -v '#' $1 | gawk '{print $1}'`
foreach region ( $regions )
  echo now starting $region
  cd $region
  set mdd=$region'.mdd'
  echo mddnmr1.2c $mdd 100 0 300 1e-8 0.01 709 250 > out.log 
  sleep 6
  date >> out.log
  mddnmr1.2c $mdd 100 0 300 1e-8 0.01 709 250 >> out.log &
  cd ..
end

