Index: trunk/libIGCM/libIGCM_post/libIGCM_post.ksh
===================================================================
--- trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 1552)
+++ trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 1598)
@@ -29,4 +29,5 @@
   TimeSeriesFrequency=false
   SeasonalFrequency=false
+  CesmepAtEnd=false
   unset list_post
   #
@@ -108,4 +109,10 @@
     fi
   fi
+
+  if ( [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] && [ X${config_Post_Cesmep} = XAtEnd ] ) ; then
+      CesmepAtEnd=true
+  fi
+  
+  
   IGCM_debug_PopStack "IGCM_post_Configure"
 }
@@ -197,4 +204,5 @@
             echo "export RESOL_SBG=${RESOL_SBG}                            " >> ${FunctionPath}
             echo "export listVarEnv=${listVarEnv}                          " >> ${FunctionPath}
+	    echo "export PostCesmep=${config_Post_Cesmep}                  " >> ${FunctionPath}
             echo "export Script_Post_Output=${Script_Post_Output}          " >> ${FunctionPath}
 #           if [ X${MASTER} = Xtitane ] ; then
@@ -234,4 +242,5 @@
                     export RESOL_SRF=${RESOL_SRF}
                     export RESOL_SBG=${RESOL_SBG}
+		    export PostCesmep=${config_Post_Cesmep}
                     export listVarEnv=${listVarEnv}
                     export Script_Post_Output=${Script_Post_Output}
@@ -315,4 +324,5 @@
               echo "export RESOL_SBG=${RESOL_SBG}                            " >> ${FunctionPath}
               echo "export listVarEnv=${listVarEnv}                          " >> ${FunctionPath}
+	      echo "export PostCesmep=${config_Post_Cesmep}                  " >> ${FunctionPath}
               echo "export Script_Post_Output=${Script_Post_Output}          " >> ${FunctionPath}
 #             if [ X${MASTER} = Xtitane ] ; then
@@ -353,4 +363,5 @@
                         export RESOL_SBG=${RESOL_SBG}
                         export listVarEnv=${listVarEnv}
+			export PostCesmep=${config_Post_Cesmep}
                         export Script_Post_Output=${Script_Post_Output}
                         . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
@@ -415,4 +426,5 @@
       echo "export RESOL_SBG=${RESOL_SBG}                            " >> ${FunctionPath}
       echo "export listVarEnv=${listVarEnv}                          " >> ${FunctionPath}
+      echo "export PostCesmep=${config_Post_Cesmep}                  " >> ${FunctionPath}
       echo "export Script_Post_Output=${Script_Post_Output}          " >> ${FunctionPath}
 #     if [ X${MASTER} = Xtitane ] ; then
@@ -448,4 +460,5 @@
             export RESOL_SBG=${RESOL_SBG}
             export listVarEnv=${listVarEnv}
+            export PostCesmep=${config_Post_Cesmep}
             export Script_Post_Output=${Script_Post_Output}
             . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
@@ -499,4 +512,5 @@
     export StandAlone=false
     export listVarEnv=${listVarEnv}
+    export PostCesmep=${config_Post_Cesmep}
     export Script_Post_Output=${Script_Post_Output}
     . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
@@ -529,4 +543,5 @@
       export StandAlone=false
       export listVarEnv=${listVarEnv}
+      export PostCesmep=${config_Post_Cesmep}
       export Script_Post_Output=${Script_Post_Output}
       . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
@@ -560,4 +575,5 @@
       echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
       echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+      echo "export PostCesmep=${config_Post_Cesmep}        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
       echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
       echo "export script=${script}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
@@ -590,4 +606,5 @@
         export StandAlone=false
         export listVarEnv=${listVarEnv}
+        export PostCesmep=${config_Post_Cesmep}
         export Script_Post_Output=${Script_Post_Output}
         . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
@@ -645,4 +662,5 @@
       export RESOL_SBG=${RESOL_SBG}
       export listVarEnv=${listVarEnv}
+      export PostCesmep=${config_Post_Cesmep}
       export Script_Post_Output=${Script_Post_Output}
       . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
@@ -655,4 +673,15 @@
 EOF
   fi
+
+  #========== CESMEP POST-PROCESSING at job end  ========#
+
+  if [ ${CesmepAtEnd} = true ] ; then
+      #
+      IGCM_debug_Print 1 "Launching C-ESM-EP run script"
+      TaskType=post
+      . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+      ${SUBMIT_DIR}/cesmep_lite/libIGCM_post.sh $DateBegin $PeriodDateEnd
+  fi
+
   IGCM_debug_PopStack "IGCM_post_Submit"
 }
@@ -790,5 +819,6 @@
   # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and
   # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d)
-  # --> turn on post-processing submission when their modulo is zero
+  # --> turn on post-processing submission when their modulo is zero by 
+  # setting env variable post_freq
   # Input parameter are the name of the variable, not the frequency value itself
   # example
