Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver	(revision 2300)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver	(revision 2343)
@@ -1,39 +1,4 @@
 #!/bin/ksh
-
 #D- Driver du script pour ORCHIDEE
-
-function ORCHIDEE_sed
-{
-    IGCM_debug_PushStack "ORCHIDEE_sed"
-    
-    sed -e "s/^${1}\ *=.*/${1}= ${2}/" \
-	orchidee.def > orchidee.def.tmp
-    RET=$?
-    echo "ORCHIDEE_sed : ${1} ${2}"
-    \mv orchidee.def.tmp orchidee.def
-    
-    IGCM_debug_PopStack "ORCHIDEE_sed"
-    return $RET
-}
-
-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
@@ -66,10 +31,19 @@
     IGCM_debug_PushStack "SRF_Update"
 
+    # Activate STOMATE if the compontent SBG=stomate is set in config.card
+    if [ X${config_ListOfComponents_SBG} = Xstomate ] ; then
+	IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE y
+    else
+	IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE n
+    fi
+
     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
+	IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .FALSE. 
+	IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .FALSE. 
+	IGCM_comp_modifyDefFile nonblocker orchidee.def XIOS_ORCHIDEE_OK y
+    else
+	IGCM_comp_modifyDefFile nonblocker orchidee.def XIOS_ORCHIDEE_OK n
     fi    
 
@@ -81,14 +55,14 @@
 	    (( 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 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInYears}y
+		IGCM_comp_modifyXmlFile force 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 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1mo
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
 	    fi
 	    case ${config_UserChoices_PeriodLength} in
@@ -107,7 +81,7 @@
 	    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 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInMonths}mo
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
 	    fi
 	    case ${config_UserChoices_PeriodLength} in
@@ -123,7 +97,7 @@
 		(( 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
+		    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${SECHIBA_WRITE_STEP}s
+		    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
 		fi
 		;;
@@ -132,7 +106,7 @@
 	5D|5d) 
 	    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 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 5d
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
 	    fi
 	    (( SECHIBA_WRITE_STEP = 5 * 86400 )) 
@@ -140,7 +114,7 @@
 	1D|1d) 
 	    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 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1d
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
 	    fi
 	    (( SECHIBA_WRITE_STEP = 86400 )) 
@@ -149,7 +123,7 @@
 	    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 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s
+		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
 	    fi
 	    (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;;
@@ -164,38 +138,37 @@
 	(( SECHIBA_WRITE_STEP = 0 ))
     fi
-
-    ORCHIDEE_sed WRITE_STEP ${SECHIBA_WRITE_STEP}
-    ORCHIDEE_sed SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
+    IGCM_comp_modifyDefFile nonblocker orchidee.def WRITE_STEP ${SECHIBA_WRITE_STEP}
+    IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
 
     # Outputs HF in HISTFILE2 if required
     if [ X${SRF_ok_hf} = Xy ] ; then
-	ORCHIDEE_sed SECHIBA_HISTFILE2 y
+	IGCM_comp_modifyDefFile nonblocker orchidee.def 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
+	    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .TRUE. 
+	    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 output_freq 10800s
+	    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 name sechiba_out_2
 	fi
     else
-	ORCHIDEE_sed SECHIBA_HISTFILE2 n
-    fi
-    ORCHIDEE_sed SECHIBA_HISTLEVEL2 1
-    ORCHIDEE_sed WRITE_STEP2 10800.0
+	IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTFILE2 n
+    fi
+    IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTLEVEL2 1
+    IGCM_comp_modifyDefFile nonblocker orchidee.def WRITE_STEP2 10800.0
 
     if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
-	ORCHIDEE_sed SECHIBA_restart_in sechiba_rest_in.nc
-    else
-	ORCHIDEE_sed SECHIBA_restart_in NONE
+	IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in sechiba_rest_in.nc
+    else
+	IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in NONE
     fi
 
 # Modify in orchidee.def VEGET_UPDATE and LAND_COVER_CHANGE if they are set in orchidee.card section UserChoices
     if [ ! X${orchidee_UserChoices_VEGET_UPDATE} = X ] ; then
-	ORCHIDEE_sed VEGET_UPDATE   ${orchidee_UserChoices_VEGET_UPDATE}
-    else
-	ORCHIDEE_sed VEGET_UPDATE 0Y
+	IGCM_comp_modifyDefFile blocker orchidee.def VEGET_UPDATE   ${orchidee_UserChoices_VEGET_UPDATE}
+    else
+	IGCM_comp_modifyDefFile blocker orchidee.def VEGET_UPDATE 0Y
     fi
     if [ ! X${orchidee_UserChoices_LAND_COVER_CHANGE} = X ] ; then
-	ORCHIDEE_sed LAND_COVER_CHANGE ${orchidee_UserChoices_LAND_COVER_CHANGE}
-    else
-	ORCHIDEE_sed LAND_COVER_CHANGE n
+	IGCM_comp_modifyDefFile blocker orchidee.def LAND_COVER_CHANGE ${orchidee_UserChoices_LAND_COVER_CHANGE}
+    else
+	IGCM_comp_modifyDefFile blocker orchidee.def LAND_COVER_CHANGE n
     fi
 
