Index: /CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.card
===================================================================
--- /CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.card	(revision 1536)
+++ /CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.card	(revision 1537)
@@ -28,4 +28,6 @@
 LMDZ_NMC_hf=y
 
+# CARBON_CYCLE=NONE/control/historical
+CARBON_CYCLE=historical
 co2_init=284.725
 
Index: /CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.driver
===================================================================
--- /CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.driver	(revision 1536)
+++ /CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.driver	(revision 1537)
@@ -92,7 +92,4 @@
     IGCM_debug_PushStack "ATM_Update"
 
-    typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
-    typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
-    typeset PathCO2log 
 
     case ${config_UserChoices_PeriodLength} in
@@ -120,15 +117,4 @@
     fi
 
-    ## To have more variables in output files for aerosols. Parameters are set in lmdz.card
-    #if [ ${CumulPeriod}%${LMDZ_Freq_aero} -le ${LMDZ_Length_aero} ]; then
-    #   if [ ${CumulPeriod}%${LMDZ_Freq_aero} -ne 0 ]; then 
-    #      lev_histmth=4
-    #   else
-    #      lev_histmth=2    
-    #   fi
-    #else
-    #   lev_histmth=2
-    #fi    
-
     ## algo : For CumulPeriod=1 ; 
     ##        IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix
@@ -180,69 +166,85 @@
     fi
 
-    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+
+	typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
+	typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+	typeset PathCO2log 
+	typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
+
+	if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then
         ##--Initialization of fluxes to an undefined value at the first run
-        UndefinedValueCo2=-9999
-        InitPeriodCo2=0
-        InitDateBeginCo2=${UndefinedValueCo2}
-        InitYearCo2=$(( ${year} - 1 )) 
-        InitDateEndCo2=${InitYearCo2}1231
-        fCO2_ff=${UndefinedValueCo2} 
-        CO2SBG=${UndefinedValueCo2}
-        CO2LU=${UndefinedValueCo2}
-        CO2MBG=${UndefinedValueCo2}
-        CO2_ppm_prec=${UndefinedValueCo2}
+	    UndefinedValueCo2=-9999
+	    InitPeriodCo2=0
+	    InitDateBeginCo2=${UndefinedValueCo2}
+	    InitYearCo2=$(( ${year} - 1 )) 
+	    InitDateEndCo2=${InitYearCo2}1231
+	    fCO2_ff=${UndefinedValueCo2} 
+	    CO2SBG=${UndefinedValueCo2}
+	    CO2LU=${UndefinedValueCo2}
+	    CO2MBG=${UndefinedValueCo2}
+	    CO2_ppm_prec=${UndefinedValueCo2}
         # Get the initial value of atmosp. pco2 
-        CO2_ppm=${lmdz_UserChoices_co2_init}
-
-        IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
-        IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
-
+	    CO2_ppm=${lmdz_UserChoices_co2_init}
+	    
+	    IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+	    IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+	    
         # Save CO2 values in ExeCpuLog variable contents 5 fields
-        echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-             gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+	    echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
                               $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
-    
+	    
         # Get the path where the log file co2.log is
-        PathCO2log=${SUBMIT_DIR} 
+	    PathCO2log=${SUBMIT_DIR} 
         # Get Previous line in co2.log
-        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
-	
-    else
-
+	    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+	    
+	else
+	    
 	# NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ):
         # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2.
 	#SubmitRestartPath=
-	if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then
-            IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
-            PathCO2log=${config_ATM_SubmitRestartPath}
-            Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
-            PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
-    
-            IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
-            IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
-    
+	    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then
+		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
+		PathCO2log=${config_ATM_SubmitRestartPath}
+		Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
+		PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
+		
+		IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+		IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+		
             # Save Last Line of control in new co2.log file
-            InitPeriodCo2=0   
-            InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
-            InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
-            fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
-            CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
-            CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
-            CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
-            CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
-            CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
-
-            echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-                  gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+		InitPeriodCo2=0   
+		InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
+		InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
+		fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
+		CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
+		CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
+		CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
+		CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+		
+		echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
                               $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
-	else
+	    else
            # Get restart line in co2.log
-           PathCO2log=${SUBMIT_DIR}
-           PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+		PathCO2log=${SUBMIT_DIR}
+		PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
            # Get the value of atmosp. pco2 in co2.log
-           CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	    fi
+	    
 	fi
 
-    fi
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	    # Modify co2_ppm in physiq.def only for historical run
+	    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
+	fi
+    fi
+    # end CARBON_CYCLE
 
     ##-- For historical daily cosp must be output during 1979-2005 period
@@ -253,5 +255,4 @@
     LMDZ_sed physiq.def OK_journe   ${OK_journe}
     LMDZ_sed physiq.def OK_mensuel  ${OK_mensuel}
-    #LMDZ_sed physiq.def lev_histmth ${lev_histmth}
     LMDZ_sed physiq.def ok_hf       ${ok_hf}
     LMDZ_sed physiq.def ecrit_mth   ${LMDZ_ecrit_mth}
@@ -262,5 +263,4 @@
     LMDZ_sed physiq.def ok_hfCOSP   ${LMDZ_COSP_hf}
     LMDZ_sed physiq.def ok_histNMC  "${LMDZ_NMC_monthly}, ${LMDZ_NMC_daily}, ${LMDZ_NMC_hf}"
-    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
 
     ## gcm.def parameters : no change since gcm.def_${RESOL_ATM_3D} is used and already modified
@@ -335,36 +335,49 @@
     [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
 
-    typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
-
-#   get the fossile fuel file :
-    fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt )
-    echo "Fossil Fuel for historical run  :" ${fCO2_ff}
-
-    # Get the value of ocean carbon flux
-    CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
-    CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
-    echo "Ocean carbon flux  :" ${CO2MBG}
-    
-    # Get the value of land fluxes
-    set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
-    CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
-    CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
-    CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
-    echo "Land carbon flux (NEP)         :" ${CO2SRF}
-    echo "LU flux          (FLUC)        :" ${CO2LU}
-    echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
-
-    # Previous CO2
-    CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
-    echo "Previous CO2  :" ${CO2_ppm_prec}
-
-    # Formula
-    CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
-    echo "New CO2  :" ${CO2_ppm}
-
-    # Save CO2 values in ExeCpuLog variable contents 5 fields
-    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-         gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+
+	# Fossil fuel emission
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then
+            # For Control, no fossil fuel emission :
+	    fCO2_ff=0
+	    echo "Fossil Fuel for control run  :" ${fCO2_ff}
+	else
+            # For historical, get the fossile fuel file :
+	    fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt )
+	    echo "Fossil Fuel for historical run  :" ${fCO2_ff}
+	fi
+
+        # Get the value of ocean carbon flux
+	CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
+	CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
+	echo "Ocean carbon flux  :" ${CO2MBG}
+
+        # Get the value of land fluxes
+	set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
+	CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
+	CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
+	CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
+	echo "Land carbon flux (NEP)         :" ${CO2SRF}
+	echo "LU flux          (FLUC)        :" ${CO2LU}
+	echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
+
+        # Previous CO2
+	CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	echo "Previous CO2  :" ${CO2_ppm_prec}
+
+        # Formula
+	CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
+	echo "New CO2  :" ${CO2_ppm}
+
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+	    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
                            $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+
+    fi
+
     echo FINALIZE ATM !
 
Index: /CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.card
===================================================================
--- /CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.card	(revision 1536)
+++ /CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.card	(revision 1537)
@@ -28,4 +28,6 @@
 LMDZ_NMC_hf=y
 
+# CARBON_CYCLE=NONE/control/historical
+CARBON_CYCLE=control
 # CO2_ppm init
 co2_init=284.725
Index: /CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.driver
===================================================================
--- /CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.driver	(revision 1536)
+++ /CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.driver	(revision 1537)
@@ -89,6 +89,4 @@
     IGCM_debug_PushStack "ATM_Update"
 
-    typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
-    typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
 
     case ${config_UserChoices_PeriodLength} in
@@ -166,40 +164,86 @@
     fi
 
-    if ( ${FirstInitialize} ) ; then
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+
+	typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
+	typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+	typeset PathCO2log 
+	typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
+
+	if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then
         ##--Initialization of fluxes to an undefined value at the first run
-        UndefinedValueCo2=-9999
-        InitPeriodCo2=0
-        InitDateBeginCo2=${UndefinedValueCo2}
-        InitYearCo2=$(( ${year} - 1 )) 
-        InitDateEndCo2=${InitYearCo2}1231
-        fCO2_ff=${UndefinedValueCo2} 
-        CO2SBG=${UndefinedValueCo2}
-        CO2LU=${UndefinedValueCo2}
-        CO2MBG=${UndefinedValueCo2}
-        CO2_ppm_prec=${UndefinedValueCo2}
+	    UndefinedValueCo2=-9999
+	    InitPeriodCo2=0
+	    InitDateBeginCo2=${UndefinedValueCo2}
+	    InitYearCo2=$(( ${year} - 1 )) 
+	    InitDateEndCo2=${InitYearCo2}1231
+	    fCO2_ff=${UndefinedValueCo2} 
+	    CO2SBG=${UndefinedValueCo2}
+	    CO2LU=${UndefinedValueCo2}
+	    CO2MBG=${UndefinedValueCo2}
+	    CO2_ppm_prec=${UndefinedValueCo2}
         # Get the initial value of atmosp. pco2 
-        CO2_ppm=${lmdz_UserChoices_co2_init}
-
-        IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
-        IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
-    
-	# Save CO2 values in ExeCpuLog variable contents 5 fields
-        echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-             gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+	    CO2_ppm=${lmdz_UserChoices_co2_init}
+	    
+	    IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+	    IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+	    
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	    echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
                               $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
-    
-	# Get the path where the log file co2.log is
-        PathCO2log=${SUBMIT_DIR} 
-	# Get Previous line in co2.log
-        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
-
-    else
-        # Get restart line in co2.log
-        PathCO2log=${SUBMIT_DIR}
-        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 
-        # Get the value of atmosp. pco2 in co2.log
-        CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
-
-    fi
+	    
+        # Get the path where the log file co2.log is
+	    PathCO2log=${SUBMIT_DIR} 
+        # Get Previous line in co2.log
+	    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+	    
+	else
+	    
+	# NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ):
+        # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2.
+	#SubmitRestartPath=
+	    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then
+		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
+		PathCO2log=${config_ATM_SubmitRestartPath}
+		Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
+		PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
+		
+		IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+		IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+		
+            # Save Last Line of control in new co2.log file
+		InitPeriodCo2=0   
+		InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
+		InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
+		fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
+		CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
+		CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
+		CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
+		CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+		
+		echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+	    else
+           # Get restart line in co2.log
+		PathCO2log=${SUBMIT_DIR}
+		PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+           # Get the value of atmosp. pco2 in co2.log
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	    fi
+	    
+	fi
+
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	    # Modify co2_ppm in physiq.def only for historical run
+	    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
+	fi
+    fi
+    # end CARBON_CYCLE
+
 
     ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z}
@@ -215,6 +259,4 @@
     LMDZ_sed physiq.def ok_hfCOSP   ${LMDZ_COSP_hf}
     LMDZ_sed physiq.def ok_histNMC  "${LMDZ_NMC_monthly}, ${LMDZ_NMC_daily}, ${LMDZ_NMC_hf}"
-#   For Control, we won't modify ATM CO2 :
-#    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
 
     ## gcm.def parameters : no change since gcm.def_${RESOL_ATM_3D} is used and already modified
@@ -289,36 +331,48 @@
     [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
 
-    typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
-
-    # For Control, no fossil fuel emission :
-    fCO2_ff=0
-    echo "Fossil Fuel for control run  :" ${fCO2_ff}
-
-    # Get the value of ocean carbon flux
-    CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
-    CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
-    echo "Ocean carbon flux  :" ${CO2MBG}
-
-    # Get the value of land fluxes
-    set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
-    CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
-    CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
-    CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
-    echo "Land carbon flux (NEP)         :" ${CO2SRF}
-    echo "LU flux          (FLUC)        :" ${CO2LU}
-    echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
-
-    # Previous CO2
-    CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
-    echo "Previous CO2  :" ${CO2_ppm_prec}
-    
-    # Formula
-    CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
-    echo "New CO2  :" ${CO2_ppm}
-
-    # Save CO2 values in ExeCpuLog variable contents 5 fields
-    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-         gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+
+	# Fossil fuel emission
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then
+            # For Control, no fossil fuel emission :
+	    fCO2_ff=0
+	    echo "Fossil Fuel for control run  :" ${fCO2_ff}
+	else
+            # For historical, get the fossile fuel file :
+	    fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt )
+	    echo "Fossil Fuel for historical run  :" ${fCO2_ff}
+	fi
+
+        # Get the value of ocean carbon flux
+	CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
+	CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
+	echo "Ocean carbon flux  :" ${CO2MBG}
+
+        # Get the value of land fluxes
+	set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
+	CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
+	CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
+	CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
+	echo "Land carbon flux (NEP)         :" ${CO2SRF}
+	echo "LU flux          (FLUC)        :" ${CO2LU}
+	echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
+
+        # Previous CO2
+	CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	echo "Previous CO2  :" ${CO2_ppm_prec}
+
+        # Formula
+	CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
+	echo "New CO2  :" ${CO2_ppm}
+
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+	    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
                            $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+
+    fi
 
     echo FINALIZE ATM !
Index: /CONFIG/IPSLCM/IPSLCM5-2/EXP00/COMP/lmdz.driver
===================================================================
--- /CONFIG/IPSLCM/IPSLCM5-2/EXP00/COMP/lmdz.driver	(revision 1536)
+++ /CONFIG/IPSLCM/IPSLCM5-2/EXP00/COMP/lmdz.driver	(revision 1537)
@@ -88,4 +88,5 @@
 {
     IGCM_debug_PushStack "ATM_Update"
+
 
     case ${config_UserChoices_PeriodLength} in
@@ -135,4 +136,5 @@
     [ ${CumulPeriod} -gt 1 ] && ( IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ; IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat )
 
+
     ##-- GHG forcing :
     ##   If forcing file exist in run directory, read values for the current year and modify physiq.def
@@ -161,4 +163,87 @@
 	LMDZ_sed physiq.def CFC12_ppt   ${IPCC_CFC12}
     fi
+
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+
+	typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
+	typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+	typeset PathCO2log 
+	typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
+
+	if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then
+        ##--Initialization of fluxes to an undefined value at the first run
+	    UndefinedValueCo2=-9999
+	    InitPeriodCo2=0
+	    InitDateBeginCo2=${UndefinedValueCo2}
+	    InitYearCo2=$(( ${year} - 1 )) 
+	    InitDateEndCo2=${InitYearCo2}1231
+	    fCO2_ff=${UndefinedValueCo2} 
+	    CO2SBG=${UndefinedValueCo2}
+	    CO2LU=${UndefinedValueCo2}
+	    CO2MBG=${UndefinedValueCo2}
+	    CO2_ppm_prec=${UndefinedValueCo2}
+        # Get the initial value of atmosp. pco2 
+	    CO2_ppm=${lmdz_UserChoices_co2_init}
+	    
+	    IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+	    IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+	    
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	    echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+	    
+        # Get the path where the log file co2.log is
+	    PathCO2log=${SUBMIT_DIR} 
+        # Get Previous line in co2.log
+	    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+	    
+	else
+	    
+	# NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ):
+        # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2.
+	#SubmitRestartPath=
+	    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then
+		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
+		PathCO2log=${config_ATM_SubmitRestartPath}
+		Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
+		PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
+		
+		IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+		IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+		
+            # Save Last Line of control in new co2.log file
+		InitPeriodCo2=0   
+		InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
+		InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
+		fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
+		CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
+		CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
+		CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
+		CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+		
+		echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+	    else
+           # Get restart line in co2.log
+		PathCO2log=${SUBMIT_DIR}
+		PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+           # Get the value of atmosp. pco2 in co2.log
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	    fi
+	    
+	fi
+
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	    # Modify co2_ppm in physiq.def only for historical run
+	    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
+	fi
+    fi
+    # end CARBON_CYCLE
+
 
     ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z}
@@ -246,4 +331,49 @@
     [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
 
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+
+	# Fossil fuel emission
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then
+            # For Control, no fossil fuel emission :
+	    fCO2_ff=0
+	    echo "Fossil Fuel for control run  :" ${fCO2_ff}
+	else
+            # For historical, get the fossile fuel file :
+	    fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt )
+	    echo "Fossil Fuel for historical run  :" ${fCO2_ff}
+	fi
+
+        # Get the value of ocean carbon flux
+	CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
+	CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
+	echo "Ocean carbon flux  :" ${CO2MBG}
+
+        # Get the value of land fluxes
+	set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
+	CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
+	CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
+	CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
+	echo "Land carbon flux (NEP)         :" ${CO2SRF}
+	echo "LU flux          (FLUC)        :" ${CO2LU}
+	echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
+
+        # Previous CO2
+	CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	echo "Previous CO2  :" ${CO2_ppm_prec}
+
+        # Formula
+	CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
+	echo "New CO2  :" ${CO2_ppm}
+
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+	    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                           $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+
+    fi
+
     echo FINALIZE ATM !
 
Index: /CONFIG/IPSLCM/IPSLCM5-2/historical/COMP/lmdz.driver
===================================================================
--- /CONFIG/IPSLCM/IPSLCM5-2/historical/COMP/lmdz.driver	(revision 1536)
+++ /CONFIG/IPSLCM/IPSLCM5-2/historical/COMP/lmdz.driver	(revision 1537)
@@ -91,4 +91,5 @@
 {
     IGCM_debug_PushStack "ATM_Update"
+
 
     case ${config_UserChoices_PeriodLength} in
@@ -116,15 +117,4 @@
     fi
 
-    ## To have more variables in output files for aerosols. Parameters are set in lmdz.card
-    #if [ ${CumulPeriod}%${LMDZ_Freq_aero} -le ${LMDZ_Length_aero} ]; then
-    #   if [ ${CumulPeriod}%${LMDZ_Freq_aero} -ne 0 ]; then 
-    #      lev_histmth=4
-    #   else
-    #      lev_histmth=2    
-    #   fi
-    #else
-    #   lev_histmth=2
-    #fi    
-
     ## algo : For CumulPeriod=1 ; 
     ##        IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix
@@ -176,4 +166,86 @@
     fi
 
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+
+	typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
+	typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+	typeset PathCO2log 
+	typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
+
+	if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then
+        ##--Initialization of fluxes to an undefined value at the first run
+	    UndefinedValueCo2=-9999
+	    InitPeriodCo2=0
+	    InitDateBeginCo2=${UndefinedValueCo2}
+	    InitYearCo2=$(( ${year} - 1 )) 
+	    InitDateEndCo2=${InitYearCo2}1231
+	    fCO2_ff=${UndefinedValueCo2} 
+	    CO2SBG=${UndefinedValueCo2}
+	    CO2LU=${UndefinedValueCo2}
+	    CO2MBG=${UndefinedValueCo2}
+	    CO2_ppm_prec=${UndefinedValueCo2}
+        # Get the initial value of atmosp. pco2 
+	    CO2_ppm=${lmdz_UserChoices_co2_init}
+	    
+	    IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+	    IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+	    
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	    echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+	    
+        # Get the path where the log file co2.log is
+	    PathCO2log=${SUBMIT_DIR} 
+        # Get Previous line in co2.log
+	    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+	    
+	else
+	    
+	# NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ):
+        # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2.
+	#SubmitRestartPath=
+	    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then
+		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
+		PathCO2log=${config_ATM_SubmitRestartPath}
+		Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
+		PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
+		
+		IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+		IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+		
+            # Save Last Line of control in new co2.log file
+		InitPeriodCo2=0   
+		InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
+		InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
+		fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
+		CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
+		CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
+		CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
+		CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+		
+		echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+	    else
+           # Get restart line in co2.log
+		PathCO2log=${SUBMIT_DIR}
+		PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+           # Get the value of atmosp. pco2 in co2.log
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	    fi
+	    
+	fi
+
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	    # Modify co2_ppm in physiq.def only for historical run
+	    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
+	fi
+    fi
+    # end CARBON_CYCLE
+
     ##-- For historical daily cosp must be output during 1979-2005 period
     [ ${year} -ge 1979 ] && LMDZ_COSP_daily=y
@@ -183,5 +255,4 @@
     LMDZ_sed physiq.def OK_journe   ${OK_journe}
     LMDZ_sed physiq.def OK_mensuel  ${OK_mensuel}
-    #LMDZ_sed physiq.def lev_histmth ${lev_histmth}
     LMDZ_sed physiq.def ok_hf       ${ok_hf}
     LMDZ_sed physiq.def ecrit_mth   ${LMDZ_ecrit_mth}
@@ -264,4 +335,49 @@
     [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
 
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+
+	# Fossil fuel emission
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then
+            # For Control, no fossil fuel emission :
+	    fCO2_ff=0
+	    echo "Fossil Fuel for control run  :" ${fCO2_ff}
+	else
+            # For historical, get the fossile fuel file :
+	    fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt )
+	    echo "Fossil Fuel for historical run  :" ${fCO2_ff}
+	fi
+
+        # Get the value of ocean carbon flux
+	CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
+	CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
+	echo "Ocean carbon flux  :" ${CO2MBG}
+
+        # Get the value of land fluxes
+	set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
+	CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
+	CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
+	CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
+	echo "Land carbon flux (NEP)         :" ${CO2SRF}
+	echo "LU flux          (FLUC)        :" ${CO2LU}
+	echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
+
+        # Previous CO2
+	CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	echo "Previous CO2  :" ${CO2_ppm_prec}
+
+        # Formula
+	CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
+	echo "New CO2  :" ${CO2_ppm}
+
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+	    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                           $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+
+    fi
+
     echo FINALIZE ATM !
 
Index: /CONFIG/IPSLCM/IPSLCM5-2/piControl/COMP/lmdz.driver
===================================================================
--- /CONFIG/IPSLCM/IPSLCM5-2/piControl/COMP/lmdz.driver	(revision 1536)
+++ /CONFIG/IPSLCM/IPSLCM5-2/piControl/COMP/lmdz.driver	(revision 1537)
@@ -88,4 +88,5 @@
 {
     IGCM_debug_PushStack "ATM_Update"
+
 
     case ${config_UserChoices_PeriodLength} in
@@ -135,4 +136,5 @@
     [ ${CumulPeriod} -gt 1 ] && ( IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ; IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat )
 
+
     ##-- GHG forcing :
     ##   If forcing file exist in run directory, read values for the current year and modify physiq.def
@@ -161,4 +163,87 @@
 	LMDZ_sed physiq.def CFC12_ppt   ${IPCC_CFC12}
     fi
+
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+
+	typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
+	typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+	typeset PathCO2log 
+	typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
+
+	if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then
+        ##--Initialization of fluxes to an undefined value at the first run
+	    UndefinedValueCo2=-9999
+	    InitPeriodCo2=0
+	    InitDateBeginCo2=${UndefinedValueCo2}
+	    InitYearCo2=$(( ${year} - 1 )) 
+	    InitDateEndCo2=${InitYearCo2}1231
+	    fCO2_ff=${UndefinedValueCo2} 
+	    CO2SBG=${UndefinedValueCo2}
+	    CO2LU=${UndefinedValueCo2}
+	    CO2MBG=${UndefinedValueCo2}
+	    CO2_ppm_prec=${UndefinedValueCo2}
+        # Get the initial value of atmosp. pco2 
+	    CO2_ppm=${lmdz_UserChoices_co2_init}
+	    
+	    IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+	    IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+	    
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	    echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+	    
+        # Get the path where the log file co2.log is
+	    PathCO2log=${SUBMIT_DIR} 
+        # Get Previous line in co2.log
+	    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+	    
+	else
+	    
+	# NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ):
+        # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2.
+	#SubmitRestartPath=
+	    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then
+		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
+		PathCO2log=${config_ATM_SubmitRestartPath}
+		Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
+		PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
+		
+		IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
+		IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
+		
+            # Save Last Line of control in new co2.log file
+		InitPeriodCo2=0   
+		InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
+		InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
+		fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
+		CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
+		CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
+		CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
+		CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+		
+		echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+		    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+	    else
+           # Get restart line in co2.log
+		PathCO2log=${SUBMIT_DIR}
+		PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
+           # Get the value of atmosp. pco2 in co2.log
+		CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	    fi
+	    
+	fi
+
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	    # Modify co2_ppm in physiq.def only for historical run
+	    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
+	fi
+    fi
+    # end CARBON_CYCLE
+
 
     ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z}
@@ -246,4 +331,49 @@
     [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
 
+
+    # Add special treatement for CARBON CYCLE
+    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
+	typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
+
+	# Fossil fuel emission
+	if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then
+            # For Control, no fossil fuel emission :
+	    fCO2_ff=0
+	    echo "Fossil Fuel for control run  :" ${fCO2_ff}
+	else
+            # For historical, get the fossile fuel file :
+	    fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt )
+	    echo "Fossil Fuel for historical run  :" ${fCO2_ff}
+	fi
+
+        # Get the value of ocean carbon flux
+	CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
+	CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
+	echo "Ocean carbon flux  :" ${CO2MBG}
+
+        # Get the value of land fluxes
+	set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
+	CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
+	CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
+	CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
+	echo "Land carbon flux (NEP)         :" ${CO2SRF}
+	echo "LU flux          (FLUC)        :" ${CO2LU}
+	echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
+
+        # Previous CO2
+	CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
+	echo "Previous CO2  :" ${CO2_ppm_prec}
+
+        # Formula
+	CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
+	echo "New CO2  :" ${CO2_ppm}
+
+        # Save CO2 values in ExeCpuLog variable contents 5 fields
+	echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
+	    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
+                           $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
+
+    fi
+
     echo FINALIZE ATM !
 
