Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 858)
+++ palm/trunk/SCRIPTS/mrun	(revision 892)
@@ -254,4 +254,7 @@
      # 12/03/12 - Siggi  - tasks_per_node divisor check not for lcflow
      # 21/03/12 - Matthias - default compiler on ibmh changed
+     # 02/05/12 - Bjoern  - lcxt4 is now lcxe6, adjustments for lcxe6, 
+     #                      bugfixes for the parameter file check, initial 
+     #                      commands on ssh calls sourced out to .mrun.config
 
 
@@ -333,5 +336,4 @@
  package_list=""
  punkte="..........................................................."
- p3d_suffix=""
  queue=none
  read_from_config=""
@@ -706,5 +708,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|nech|necriam|lckyoto|lcsgib|lcsgih|unics|lcxt4|lcxt5m|lck|lckordi)  true;;
+        (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|nech|necriam|lckyoto|lcsgib|lcsgih|unics|lcxe6|lcxt5m|lck|lckordi)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -870,5 +872,5 @@
                    do_remote=true
                    case  $host  in
-                       (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxt4|lcxt5m|lck|lckordi)  true;;
+                       (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxe6|lcxt5m|lck|lckordi)  true;;
                        (*)  printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
                             printf "\n      is not available"
@@ -1154,5 +1156,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxt4|lcxt5m|lck|lckordi)  true;;
+        (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxe6|lcxt5m|lck|lckordi)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -1335,4 +1337,6 @@
        eval filename=${pathin[$i]}/${afname}${endin[$i]}
     fi
+    eval pathname=${pathin[$i]}
+
 
        # PRUEFEN AUF VORHANDENSEIN
@@ -2036,5 +2040,5 @@
  lopts="$lopts $netcdf_lib $dvr_lib"
  ROPTS="$ropts"
- if [[ ( $(echo $host | cut -c1-3) = nec  ||  $(echo $host | cut -c1-3) = ibm  ||  $host = lckyoto  ||  $host = lcsgih  ||  $host = lcsgib  ||  $host = lctit  ||  $host = lcfimm  ||  $host = lcxt4 ||  $host = lcxt5m || $host = lck || $host = lckordi)  &&  -n $numprocs ]]
+ if [[ ( $(echo $host | cut -c1-3) = nec  ||  $(echo $host | cut -c1-3) = ibm  ||  $host = lckyoto  ||  $host = lcsgih  ||  $host = lcsgib  ||  $host = lctit  ||  $host = lcfimm  ||  $host = lcxe6 ||  $host = lcxt5m || $host = lck || $host = lckordi)  &&  -n $numprocs ]]
  then
     XOPT="-X $numprocs"
@@ -2100,4 +2104,10 @@
     done
     mc="$mc -u$remote_username"
+ fi
+
+    # CHECK FOR INITIAL COMMANDS AFTER LOGIN
+ if [[ "$login_init_cmd" != "" ]]
+ then
+    export init_cmds="${login_init_cmd};"
  fi
 
@@ -2378,30 +2388,60 @@
  if [[ ! -f $check_depository/check_namelist_files.tar || ! -f $PALM_BIN/check_namelist_files.x ]]
  then
-    skip_check=true 
-
+      skip_check=true 
+      reason="parameter file check has not been compiled."
+ fi
+
+#CHECK FOR PARALLEL RUN; OTHERWISE SKIP CHECK
+ if [[ "$cond1" != "parallel"  &&  "$cond2" != "parallel" ]]
+ then
+     skip_check=true 
+     reason="serial run."
  fi
 
 #ONLY PERFORM CHECK IF -z OPTION IS NOT SET, NO RESTART RUN IS CARRIED OUT AND IF THE EXECUTION HOST IS THE LOCAL HOST
- if [[ $check_namelist_files == false || $fromhost != $localhost || $run_coupled_model == true || $restart_run == true ]]
+ if [[ $check_namelist_files == false ]]
+ then
+     skip_check=true
+     reason="-z option set."
+ fi
+
+ if [[ $fromhost != $localhost ]]
+ then
+     skip_check=true
+     reason="submitting host is local host."  
+ fi  
+
+ if [[ $run_coupled_model == true ]]
  then
     skip_check=true
- fi
+    reason="coupled run."  
+ fi
+
+ if [[ $restart_run == true ]]
+ then
+    skip_check=true
+    reason="restart run."     
+
+ fi
+
+#SKIP CHECK IN CASE OF RESTART RUN: CHECK WHETHER THE LAST CHAR IS "f" IN PARIN
+ ((last_char = `echo $filename | wc -c` - 1))
+ last_char=`echo $filename |cut -c$last_char`
+ if [[ "$last_char" == "f" ]]
+ then
+    skip_check=true
+    reason="restart run.)"
+ fi 
+
  if [[ $skip_check == false ]]
  then
-    if [[ $ocean_file_appendix == true ]]
-    then
-       d3par_string="d3o#"
-       d3fpar_string="d3of"
-    else
-       d3par_string="d3#"
-       d3fpar_string="d3f"
-    fi
 
     tmp_check=${working_directory}/tmp_check
 
-#   GET PARAMETER FILE SUFFIX (USUALLY "_P3D")
+#   GET TOPOGRAPHY PARAMETER FILE SUFFIX (USUALLY "_P3DF"). THIS FILE MIGHT IS
+#   NOT NECESSARILY REQUIRED
     line=""
     found=false
-    grep  "$d3par_string" $config_file | grep "PARIN"  >  $tmp_check
+    grep  "TOPOGRAPHY_DATA" $config_file  >  $tmp_check
     while read line1
     do
@@ -2409,47 +2449,4 @@
        if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
        then
-             # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN
-          p3d_suffix=`echo $line | tr -s " " | cut -d" " -s -f5`
-          found=true
-       fi
-    done < $tmp_check
-
-    if [[ $found = false ]]
-    then
-       printf "\n  +++ no PARIN list entry found for $d3par_string in the configuration file."
-
-       locat=check_namelist; exit
-    fi
-
-#   GET RESTART PARAMETER FILE SUFFIX (USUALLY "_P3DF"). THIS FILE MIGHT IS
-#   NOT NECESSARILY REQUIRED
-    line=""
-    found=false
-    grep  "d3f" $config_file | grep "PARIN"  >  $tmp_check
-    while read line1
-    do
-       line="$line1"
-       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
-       then
-          p3df_suffix=`echo $line | tr -s " " | cut -d" " -s -f5`
-          found=true
-       fi
-    done < $tmp_check
-
-    if [[ $found = false ]]
-    then
-       printf "\n  +++ no PARIN list entry found for d3f in the configuration file."
-    fi
-
-#   GET TOPOGRAPHY PARAMETER FILE SUFFIX (USUALLY "_P3DF"). THIS FILE MIGHT IS
-#   NOT NECESSARILY REQUIRED
-    line=""
-    found=false
-    grep  "d3f" $config_file | grep "TOPOGRAPHY_DATA"  >  $tmp_check
-    while read line1
-    do
-       line="$line1"
-       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
-       then
           topo_suffix=`echo $line | tr -s " " | cut -d" " -s -f5`
           found=true
@@ -2467,5 +2464,5 @@
     for  item  in  $input_list
     do
-       if [[ "$item" == "restart" || "$item" == d3f || "$item" == d3of ]]
+       if [[ "$item" == "restart" ]]
        then
           check_restart=1
@@ -2476,7 +2473,7 @@
 
 #   ERROR IF NO PARAMETER FILE WAS FOUND, OTHERWISE PROCEED
-    if [[ ! -f $working_directory/JOBS/$fname/INPUT/${fname}${p3d_suffix} ]]
-    then
-       printf "\n\n  +++ ERROR: parameter file (${fname}${p3d_suffix}) not found." 
+    if [[ ! -f $filename ]]
+    then
+       printf "\n\n  +++ ERROR: parameter file ($filename) not found." 
        locat=check_namelist; exit
     fi
@@ -2485,7 +2482,11 @@
     if  [[ $check_restart == 1 ]]
     then
-       if [[ ! -f $working_directory/JOBS/$fname/INPUT/${fname}${p3df_suffix} ]]
-       then
-          printf "\n\n  +++ WARNING: restart parameter file (${fname}${p3df_suffix}) is missing."  
+
+
+
+       filenamef="${filename}f"
+       if [[ ! -f $filenamef ]]
+       then
+          printf "\n\n  +++ WARNING: restart parameter file ($filenamef) is missing."  
           check_restart=0
           answer=dummy
@@ -2514,6 +2515,7 @@
     cd $check_sources
 
+
 #   CHECK FOR USER CODE, OTHERWISE USE THE PRECOMPILED CHECK_NAMELIST_FILES.X
-    if [[ -d $working_directory/USER_CODE/$fname ]]
+    if [[ -d $add_source_path ]]
     then
        printf "\n\n  *** copying files from $check_depository" 
@@ -2524,5 +2526,5 @@
 
        printf "\n\n  *** adding user code." 
-       cp $working_directory/USER_CODE/$fname/* ./
+       cp $add_source_path/* ./
        touch check_namelist_files.f90
 
@@ -2561,15 +2563,15 @@
     fi
 
-    cp $working_directory/JOBS/$fname/INPUT/${fname}${p3d_suffix} ./PARIN
+    cp $filename ./PARIN
     if [[ $check_restart == 1 ]] 
     then
-       cp $working_directory/JOBS/$fname/INPUT/${fname}${p3df_suffix} ./PARINF   
-    fi
-
-
-    if [[ -f $working_directory/JOBS/$fname/INPUT/${fname}${topo_suffix} && $skip_check == false ]]
+       cp $filenamef ./PARINF   
+    fi
+
+cat ${pathname}/${fname}${topo_suffix}
+    if [[ -f ${pathname}/${fname}${topo_suffix} && $skip_check == false ]]
     then
        printf "\n  *** adding topography data"
-       cp $working_directory/JOBS/$fname/INPUT/${fname}${topo_suffix} ./TOPOGRAPHY_DATA
+       cp ${pathname}/${fname}${topo_suffix} ./TOPOGRAPHY_DATA
 
 #      IN CASE OF TOPOGRAPHY AND HIGH GRID POINT NUMBERS, THE STACK SIZE 
@@ -2620,5 +2622,5 @@
 
 #      CHECKING THE P3D FILE
-       printf "\n\n      (1) checking $fname$p3d_suffix"  
+       printf "\n\n      (1) checking $filename"  
        echo "$numprocs 0" > VARIN
        errors=`./check_namelist_files.x < VARIN 2>&1`
@@ -2637,5 +2639,5 @@
        if [[ $check_restart == 1 && $check_error == false ]]
        then
-          printf "\n\n      (2) checking $fname$p3df_suffix"  
+          printf "\n\n      (2) checking $filenamef"  
 
 #         FIRST CHECK IF INITIALIZING_ACTIONS="READ_RESTART_DATA" IS SET IN &INIPAR LIST
@@ -2711,5 +2713,5 @@
     fi
  else
-    printf "\n\n  +++ skipping parameter file check\n" 
+    printf "\n\n  +++ skipping parameter file check due to following reason: $reason" 
  fi
 
@@ -2717,4 +2719,5 @@
  rm -rf  $check_sources
  cd $working_directory
+
 
     # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE-
@@ -2876,5 +2879,6 @@
        if [[ $localhost = nech ]]
        then
-          ssh  136.172.44.192 -l $usern ". /SX/opt/etc/initsx.sh; $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
+#         init_cmds was ". /SX/opt/etc/initsx.sh;" 
+          ssh  136.172.44.192 -l $usern "$init_cmds $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
           cp  $TEMPDIR_COMPILE/a.out  .
           [[ $? != 0 ]]  &&  compile_error=true
@@ -2883,5 +2887,5 @@
        then
           printf "      compiler is called via ssh on \"plogin1\" \n"
-          ssh  plogin1  -l $usern  "export PATH=/sw/ibm/xlf/13.1.0.8/usr/bin:$PATH; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
+          ssh  plogin1  -l $usern  "$init_cmds export PATH=/sw/ibm/xlf/13.1.0.8/usr/bin:$PATH; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
@@ -2889,5 +2893,5 @@
        then
           printf "      compiler is called via ssh on \"bicegate0\" \n"
-          ssh  bicegate0  -l $usern  ". /usr/share/modules/init/bash; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
+          ssh  bicegate0  -l $usern  "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
@@ -2895,5 +2899,5 @@
        then
           printf "      compiler is called via ssh on \"hicegate0\" \n"
-          ssh  hicegate0    -l $usern  ". /usr/share/modules/init/bash; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" 2>&1 "
+          ssh  hicegate0  -l $usern  "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" 2>&1 "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
@@ -2901,9 +2905,9 @@
        then 
           printf "      compiler is called via ssh on \"flow\" \n"
-          ssh  flow02.hpc.uni-oldenburg.de -l $usern ". /cm/local/apps/environment-modules/3.2.6/Modules/3.2.6/init/bash; echo $MODULEPATH; echo $MODULESHOME; MODULEPATH=/cm/shared/modulefiles/; module load netcdf/intel/64/4.1.3 intel/ics/64/2011.0.013 intel/impi/64/4.0.1.007 hdf5/intel/64/1.8.7; cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" "
+          ssh  flow02.hpc.uni-oldenburg.de -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
        else
-          [[ $localhost = lcxt4 ]]  &&  . /opt/modules/default/init/ksh
+          [[ $localhost = lcxe6 ]]  &&  eval $init_cmds
           [[ "$module_calls" != "" ]]  &&  eval $module_calls
           make $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$fopts"  LDFLAGS="$lopts"
@@ -3741,5 +3745,5 @@
                       mpirun -np $tasks_per_node inspxe-cl -r result -collect mi3 -- ./a.out  <  runfile_atmos
                    fi
-                elif [[ $host = lcxt4  ||  $host = lcxt5m ]]
+                elif [[ $host = lcxe6  ||  $host = lcxt5m ]]
                 then
                     aprun  -n $ii  -N $tasks_per_node  a.out  $ROPTS  < runfile_atmos
@@ -3780,5 +3784,5 @@
                       fi
 
-                   elif [[ $host = lcxt4  ||  $host = lcxt5m ]]
+                   elif [[ $host = lcxe6  ||  $host = lcxt5m ]]
                    then
 
@@ -3813,5 +3817,5 @@
                       fi
 
-                   elif [[ $host = lcxt4  ||  $host = lcxt5m ]]
+                   elif [[ $host = lcxe6  ||  $host = lcxt5m ]]
                    then
 
