Index: CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/stomate.driver
===================================================================
--- CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/stomate.driver	(revision 2196)
+++ 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}
