Index: CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/lmdz.driver
===================================================================
--- CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/lmdz.driver	(revision 2331)
+++ CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/lmdz.driver	(revision 2332)
@@ -22,4 +22,5 @@
     return $RET
 }
+
 function LMDZ_sed_default
 {
@@ -36,4 +37,23 @@
 }
 
+function LMDZ_sed_xml
+{
+# Usage : LMDZ_sed_xml xml_file output_file attribute value 
+#         In file xml_file modify at the line containing id="output_file" the attribute "attribute=xxx" into "attribute=value"
+
+    IGCM_debug_PushStack "LMDZ_sed_xml"
+    # Test if the fichier exist
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : ${1} file does not exist. Following will not be done : LMDZ_sed : ${1} ${2} ${3} ${4}"
+      IGCM_debug_PopStack "LMDZ_sed_xml"
+      return
+    fi
+    sed -e "/id=\"${2}\"/s/\(${3}=\"\)[^\"]*\(\"\)/\1${4}\2/" ${1} > ${1}.tmp
+    RET=$?
+    echo "LMDZ_sed : ${1} ${2} ${3} ${4}"
+    \mv ${1}.tmp ${1}
+    IGCM_debug_PopStack "LMDZ_sed_xml"
+    return $RET
+}
 
 function ATM_Initialize
@@ -49,4 +69,5 @@
     RESOL_ATM_Y=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $2}' )
     RESOL_ATM_XY="${RESOL_ATM_X}x${RESOL_ATM_Y}"
+    FreqCoupling=${oasis_UserChoices_FreqCoupling:-86400}
 
     ##-- Calendar type for LMDZ and create_etat0_limit
@@ -345,4 +366,9 @@
 
 
+    ## Coupling Time Step
+    LMDZ_t_coupl=${oasis_UserChoices_FreqCoupling:-${lmdz_UserChoices_t_coupl}}
+    IGCM_debug_Print 3 "LMDZ_t_coupl "   ${LMDZ_t_coupl}
+    LMDZ_sed config.def t_coupl   ${LMDZ_t_coupl}
+
     ##-- Add special treatement for CARBON CYCLE
     if [ X"${lmdz_UserChoices_CARBON_CYCLE}" = X"control" ] || [ X"${lmdz_UserChoices_CARBON_CYCLE}" = X"historical" ] ; then
@@ -369,10 +395,86 @@
     LMDZ_sed output.def ok_histNMC  "${LMDZ_NMC_monthly} ${LMDZ_NMC_daily} ${LMDZ_NMC_hf}"
 
+    # XIOS XML definition
+    # Default init : files are desactivated
+	LMDZ_sed_xml file_def_histmth_lmdz.xml histmth enabled .FALSE. 
+	LMDZ_sed_xml file_def_histday_lmdz.xml histday enabled .FALSE. 
+	LMDZ_sed_xml file_def_histhf_lmdz.xml histhf enabled .FALSE.
+	LMDZ_sed_xml file_def_histfh3h_lmdz.xml histfh3h enabled .FALSE.
+	LMDZ_sed_xml file_def_histhf3hm_lmdz.xml histfh3hm enabled .FALSE.
+	LMDZ_sed_xml file_def_histstn_lmdz.xml histstn enabled .FALSE.
+	LMDZ_sed_xml file_def_histmthNMC_lmdz.xml histmthNMC enabled .FALSE.
+	LMDZ_sed_xml file_def_histdayNMC_lmdz.xml histdayNMC enabled .FALSE.
+	LMDZ_sed_xml file_def_histhfNMC_lmdz.xml histhfNMC enabled .FALSE.
+	if [ X${lmdz_UserChoices_XIOS}  = Xy ] ; then
+    # Default output level : 5
+	    LMDZ_sed_xml file_def_histmth_lmdz.xml histmth output_level 5 
+	    LMDZ_sed_xml file_def_histday_lmdz.xml histday output_level 5 
+	    LMDZ_sed_xml file_def_histhf_lmdz.xml histhf output_level 5
+	    LMDZ_sed_xml file_def_histfh3h_lmdz.xml histfh3h output_level 5
+	    LMDZ_sed_xml file_def_histhf3hm_lmdz.xml histfh3hm output_level 5
+	    LMDZ_sed_xml file_def_histstn_lmdz.xml histstn output_level 5
+	    LMDZ_sed_xml file_def_histmthNMC_lmdz.xml histmthNMC output_level 5
+	    LMDZ_sed_xml file_def_histdayNMC_lmdz.xml histdayNMC output_level 5
+	    LMDZ_sed_xml file_def_histhfNMC_lmdz.xml histhfNMC output_level 5
+     # Filling of XML files 
+	if [ X${ok_mensuel} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histmth_lmdz.xml histmth enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histmth_lmdz.xml histmth output_freq 1mo
+	    LMDZ_sed_xml file_def_histmth_lmdz.xml histmth name histmth
+	fi
+	if [ X${ok_journe} = Xy ] ; then	
+	    LMDZ_sed_xml file_def_histday_lmdz.xml histday enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histday_lmdz.xml histday output_freq 1d
+	    LMDZ_sed_xml file_def_histday_lmdz.xml histday name histday
+	    if [ X${OutLevel} = Xlow ] || [ X${OutLevel} = Xmedium ] ; then
+		LMDZ_sed_xml file_def_histday_lmdz.xml histday output_level 2
+	    fi
+	fi
+	if [ X${ok_hf} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histhf_lmdz.xml histhf enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histhf_lmdz.xml histhf output_freq 6h
+	    LMDZ_sed_xml file_def_histhf_lmdz.xml histhf name histhf
+	    if [ X${OutLevel} = Xlow ] ; then
+		LMDZ_sed_xml file_def_histhf_lmdz.xml histhf output_level 2
+	    fi
+	fi	
+	if [ X${ok_hf3h} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histhf3h_lmdz.xml histhf3h enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histhf3h_lmdz.xml histhf3h output_freq 3h
+	    LMDZ_sed_xml file_def_histhf3h_lmdz.xml histhf3h name histhf3h
+	fi	
+	if [ X${ok_hf3hm} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histhf3hm_lmdz.xml histhf3hm enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histhf3hm_lmdz.xml histhf3hm output_freq 3h
+	    LMDZ_sed_xml file_def_histhf3hm_lmdz.xml histhf3hm name histhf3hm
+	fi
+	if [ X${ok_stn} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histstn_lmdz.xml histstn enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histstn_lmdz.xml histstn output_freq 1800s
+	    LMDZ_sed_xml file_def_histstn_lmdz.xml histstn name histstn
+	fi
+	if [ X${LMDZ_NMC_monthly} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histmthNMC_lmdz.xml histmthNMC enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histmthNMC_lmdz.xml histmthNMC output_freq 1mo
+	    LMDZ_sed_xml file_def_histmthNMC_lmdz.xml histmthNMC name histmthNMC
+	fi
+	if [ X${LMDZ_NMC_daily} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histdayNMC_lmdz.xml histdayNMC enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histdayNMC_lmdz.xml histdayNMC output_freq 1d
+	    LMDZ_sed_xml file_def_histdayNMC_lmdz.xml histdayNMC name histdayNMC
+	fi
+	if [ X${LMDZ_NMC_hf} = Xy ] ; then
+	    LMDZ_sed_xml file_def_histhfNMC_lmdz.xml histhfNMC enabled .TRUE. 
+	    LMDZ_sed_xml file_def_histhfNMC_lmdz.xml histhfNMC output_freq 6h
+	    LMDZ_sed_xml file_def_histhfNMC_lmdz.xml histhfNMC name histhfNMC
+	fi
+    fi
+
     ## gcm.def parameters : 
     # Modification only for new physics
-    if [ X${LMDZ_Physics} = X"NPv3.1" ] ; then
-	LMDZ_sed gcm.def iphysiq     5
-    else
-	LMDZ_sed_default gcm.def iphysiq
+    if [ X${LMDZ_Physics} = X"AP" ] ; then
+        LMDZ_sed gcm.def iphysiq     10
+    else
+        LMDZ_sed_default gcm.def iphysiq
     fi
 
@@ -516,14 +618,15 @@
     fi
 
+    if [ X${lmdz_UserChoices_XIOS}  = Xy ] ; then
     # Add include of LMDZ context in iodef.xml
     # In iodef.xml add on next line after "COMPONENT CONTEXT"
     #  <context id="LMDZ" src="./context_lmdz.xml"/>
-    echo '<context id="LMDZ" src="./context_lmdz.xml"/>' > add.tmp
-    cp iodef.xml iodef.xml.tmp
-    sed -e "/COMPONENT CONTEXT/r add.tmp" \
-	iodef.xml.tmp > iodef.xml
-    rm iodef.xml.tmp add.tmp
-
-
+	echo '<context id="LMDZ" src="./context_lmdz.xml"/>' > add.tmp
+	cp iodef.xml iodef.xml.tmp
+	sed -e "/COMPONENT CONTEXT/r add.tmp" \
+	    iodef.xml.tmp > iodef.xml
+	rm iodef.xml.tmp add.tmp
+    fi
+    
     IGCM_debug_PopStack "ATM_Update"
 }
Index: CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/orchidee.driver
===================================================================
--- CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/orchidee.driver	(revision 2331)
+++ CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/orchidee.driver	(revision 2332)
@@ -17,4 +17,23 @@
 }
 
+function ORCHIDEE_sed_xml
+{
+# Usage : ORCHIDEE_sed_xml xml_file output_file attribute value 
+#         In file xml_file modify at the line containing id="output_file" the attribute "attribute=xxx" into "attribute=value"
+    
+    # Test if the fichier exist
+    if [ ! -f ${1} ] ; then
+	echo "WARNING : ${1} file does not exist. Following will not be done : ORCHIDEE_sed : ${1} ${2} ${3} ${4}"
+        IGCM_debug_PopStack "LMDZ_sed"
+	return
+    fi
+    sed -e "/id=\"${2}\"/s/\(${3}=\"\)[^\"]*\(\"\)/\1${4}\2/" ${1} > ${1}.tmp
+    RET=$?
+    echo "ORCHIDEE_sed : ${1} ${2} ${3} ${4}"
+    \mv ${1}.tmp ${1}
+
+    return $RET
+}
+
 #-----------------------------------------------------------------
 function SRF_Initialize
@@ -49,4 +68,10 @@
     typeset SECHIBA_WRITE_STEP
 
+    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+	ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .FALSE. 
+	ORCHIDEE_sed_xml file_def_orchidee.xml sechiba2 enabled .FALSE. 
+	ORCHIDEE_sed XIOS_ORCHIDEE_OK y
+    fi    
+
     SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' ) 
     case ${SRF_WriteFrequency} in
@@ -54,6 +79,17 @@
 	    WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
 	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
-	    (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) ;;
+	    (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) 
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq ${WriteInYears}y
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history 
+	    fi
+	    ;;
 	1M)
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq 1mo
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history 
+	    fi
 	    case ${config_UserChoices_PeriodLength} in
 	    *Y|*y)
@@ -70,4 +106,9 @@
 	*M|*m) 
 	    WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq ${WriteInMonths}mo
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history 
+	    fi
 	    case ${config_UserChoices_PeriodLength} in
 	    *Y|*y)
@@ -81,13 +122,35 @@
 	    *)
 		(( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
+		if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		    ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		    ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq ${SECHIBA_WRITE_STEP}s
+		    ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history
+		fi
 		;;
 	    esac
 	    ;;
 	5D|5d) 
-	    (( SECHIBA_WRITE_STEP = 5 * 86400 )) ;;
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq 5d
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history 
+	    fi
+	    (( SECHIBA_WRITE_STEP = 5 * 86400 )) 
+	    ;;
 	1D|1d) 
-	    (( SECHIBA_WRITE_STEP = 86400 )) ;;
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq 1d
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history 
+	    fi
+	    (( SECHIBA_WRITE_STEP = 86400 )) 
+	    ;;
 	*s)
 	    WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history 
+	    fi
 	    (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;;
 	*) 
@@ -96,4 +159,10 @@
     esac
 
+#Use of XIOS ouputs only
+
+    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+	(( SECHIBA_WRITE_STEP = 0 ))
+    fi
+
     ORCHIDEE_sed WRITE_STEP ${SECHIBA_WRITE_STEP}
     ORCHIDEE_sed SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
@@ -102,4 +171,9 @@
     if [ X${SRF_ok_hf} = Xy ] ; then
 	ORCHIDEE_sed SECHIBA_HISTFILE2 y
+	if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+	    ORCHIDEE_sed_xml file_def_orchidee.xml sechiba2 enabled .TRUE. 
+	    ORCHIDEE_sed_xml file_def_orchidee.xml sechiba2 output_freq 10800s
+	    ORCHIDEE_sed_xml file_def_orchidee.xml sechiba2 name sechiba_out_2
+	fi
     else
 	ORCHIDEE_sed SECHIBA_HISTFILE2 n
@@ -130,13 +204,14 @@
 
 
+    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
     # Add include of orchidee context in iodef.xml
     # In iodef.xml add on next line after "COMPONENT CONTEXT"
     #  <context id="orchidee" src="./context_orchidee.xml"/>
-    echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp
-    cp iodef.xml iodef.xml.tmp
-    sed -e "/COMPONENT CONTEXT/r add.tmp" \
-	iodef.xml.tmp > iodef.xml
-    rm iodef.xml.tmp add.tmp
-
+	echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp
+	cp iodef.xml iodef.xml.tmp
+	sed -e "/COMPONENT CONTEXT/r add.tmp" \
+	    iodef.xml.tmp > iodef.xml
+	rm iodef.xml.tmp add.tmp
+    fi
 
     IGCM_debug_PopStack "SRF_Update"
Index: CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/stomate.driver
===================================================================
--- CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/stomate.driver	(revision 2331)
+++ CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/stomate.driver	(revision 2332)
@@ -20,10 +20,32 @@
     typeset STOMATE_WRITE_STEP
 
+    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+	ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .FALSE. 
+	ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .FALSE. 
+    fi   
     case ${config_SBG_WriteFrequency} in
 	*Y|*y) 
 	    WriteInYears=$( echo ${config_SBG_WriteFrequency} | awk -F '[yY]' '{print $1}' )
 	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
-	    (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears )) ;;
+	    (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears )) 
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq ${WriteInYears}y
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${WriteInYears}y
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history 
+
+	    fi
+	    ;;
 	1M|1m) 
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq 1mo
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq 1mo
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history 
+	    fi
 	    case ${config_UserChoices_PeriodLength} in
 	    *Y|*y)
@@ -39,4 +61,12 @@
 	*M|*m) 
 	    WriteInMonths=$( echo ${config_SBG_WriteFrequency} | awk -F '[mM]' '{print $1}' )
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq ${WriteInMonths}mo
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${WriteInMonths}mo
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history 
+	    fi
 	    case ${config_UserChoices_PeriodLength} in
 	    *Y|*y)
@@ -49,13 +79,48 @@
 		;;
 	    *)
-		(( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) ;;
+		(( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) 
+		if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		    ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE. 
+		    ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq ${STOMATE_WRITE_STEP}s
+		    ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history
+		    ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE. 
+		    ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${STOMATE_WRITE_STEP}s
+		    ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
+		fi
+		;;
 	    esac
 	    ;;
 	5D|5d) 
-	    (( STOMATE_WRITE_STEP = 5 )) ;;
+	    (( STOMATE_WRITE_STEP = 5 ))
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq 5d
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq 5d
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history 
+	    fi
+	    ;;
 	1D|1d) 
-	    (( STOMATE_WRITE_STEP = 1 )) ;;
+	    (( STOMATE_WRITE_STEP = 1 )) 
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq 1d
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq 1d
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history 
+	    fi
+	    ;;
 	*s)
 	    WriteInSeconds=$( echo ${config_SBG_WriteFrequency} | awk -F '[s]' '{print $1}' )
+	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s
+		ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE. 
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${WriteInSeconds}s
+		ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history 
+	    fi
 	    (( STOMATE_WRITE_STEP = 1 )) ;;
 	*) 
@@ -65,4 +130,10 @@
 
     ORCHIDEE_sed STOMATE_OK_STOMATE y
+
+#Use of XIOS library only
+
+    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
+	(( STOMATE_WRITE_STEP = 0 ))
+    fi
 
     ORCHIDEE_sed STOMATE_HIST_DT ${STOMATE_WRITE_STEP}
