Index: CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh
===================================================================
--- CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh	(revision 6629)
+++ CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh	(revision 6638)
@@ -44,4 +44,7 @@
 optchimie=GES
 
+# subconfig : which sub-configuration to compile. By default, the full extracted configuration is compiled.
+subconfig=default
+
 # orchversion tells if ORCHIDEE_2_2 or ORCHIDEE_trunk is compiled. This is used as argument and also in the suffix of the executables.
 # orchcomp is the key word needed for LMDZ for the compilation of coherent interface. Only used internal to the compilation script.
@@ -59,8 +62,6 @@
 
 
-echo "create out_compile_ipslcm7 link "
 rm -f out_compile_ipslcm7
 ln -s ${outfile} out_compile_ipslcm7
-
 
 
@@ -80,7 +81,8 @@
 Options: [-full] Full recompilation of all components. This option can be added to all other options.
          [-cleannemo] Full recompilation of NEMO component only.
-         [-regular_latlon]
+         [-regular_latlon XXXxYYYxZZ] Define which regular grid to compile in addition to the icosahedric grid. It is mandatory to specify the grid size.
          [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod.
-
+         [-subconfig X] Set this option if you want to compile a sub-configuration. X can be: ICOLMDZORINCA, ICOLMDZOR, LMDZORINCA or LMDZOR. 
+                        If this option is not set, all extracted components are compiled. 
 
 Example 1: Default compilation of IPSLCM7 for resolution LR 
@@ -117,4 +119,5 @@
 	"-prod")       optmode=prod ; shift ;;
 	"-regular_latlon")  regular_latlon=yes ; resol_atm=$2 ; shift ; shift ;;
+	"-subconfig")  subconfig=$2 ; shift ; shift ;;
 	"-full")       full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; shift ;;
 	"-full_xios")  full_xios="--full" ; shift ;;  # Note only full_xios is using double dash: --full
@@ -133,4 +136,8 @@
 done
 
+
+# Define which sub-configuration to compile. By default all extracted source components are compiled.
+source define_config.sh
+
 echo "Following options are set in current compiling:" >> $outfile
 echo "   regular_latlon=$regular_latlon (if yes, then resol_atm=${resol_atm})" >> $outfile 
@@ -138,5 +145,7 @@
 echo "   optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile 
 echo "   full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo, full_dyna=$full_dyna" >> $outfile 
+echo "   compinca=$compinca compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna complmdz=y comporch=y compxios=y" >> $outfile
 echo >> $outfile
+
 
 ### Read host dependent default values
@@ -227,4 +236,5 @@
 fi
 
+if [ $compoasis == y ] ; then
 ## 2.2 Compile oasis3-mct
 cd $modipsl/oasis3-mct/util/make_dir
@@ -236,4 +246,7 @@
      make -f TopMakefileOasis3 >> $outfile 2>&1
 
+else
+echo ; echo No compilation of OASIS
+fi
 
 ## 2.3 Compile xios
@@ -241,6 +254,11 @@
 echo; echo "NOW COMPILE XIOS"
 echo >> $outfile ; echo " NOW COMPILE XIOS"   >> $outfile 
-echo ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 
-     ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 2>&1
+if [ $compoasis == y ] ; then
+argoasis="--use_oasis oasis3_mct "
+else
+argoasis=" "
+fi
+echo ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 
+     ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 2>&1
 # Test if compiling succeded 
 if [[ $? != 0 ]] ; then 
@@ -300,4 +318,5 @@
 
 
+if [ $compnemo == y ] ; then
 ## 2.5 Compile NEMO
 nemo_root=$modipsl/modeles/NEMO
@@ -364,5 +383,9 @@
 fi
 
-
+else
+echo ; echo No compilation of NEMO
+fi
+
+if [ $compinca == y ] ; then
 ##2.6  Compile INCA 
     cd $modipsl/modeles/INCA
@@ -395,5 +418,7 @@
     fi
 
-
+else
+echo ; echo No compilation of INCA
+fi
 
 ## 2.7 Compile LMDZ 
@@ -432,6 +457,19 @@
 if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi
 
-echo ./makelmdz_fcm -p lmd -c OMCT $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp -chimie INCA  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 
-     ./makelmdz_fcm -p lmd -c OMCT $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp -chimie INCA  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 2>&1
+if [ $compinca == y ] ; then
+    arginca="-chimie INCA "
+else
+    arginca=" "
+fi
+
+if [ $compoasis == y ] ; then
+    argoasis="-c OMCT "
+else
+    argoasis=" "
+fi
+    echo ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp $arginca  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 
+         ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp $arginca  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 2>&1
+
+
 # Test if compiling finished
 if [[ $? != 0 ]] ; then
@@ -439,4 +477,5 @@
     exit
 fi
+
 
 
@@ -446,6 +485,18 @@
 echo >> $outfile ; echo " NOW COMPILE DYNAMICO"   >> $outfile 
 
-echo ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_oasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 
-     ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_oasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 2>&1
+if [ $compoasis == y ] ; then
+ argoasis="-with_oasis "
+else
+ argoasis=" "
+fi
+if [ $compinca == y ] ; then
+ arginca="-with_inca "
+else
+ arginca=" "
+fi
+
+
+echo ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 
+     ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 2>&1
 # Test if compiling finished
 if [[ $? != 0 ]] ; then
@@ -460,6 +511,6 @@
 echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ"   >> $outfile 
 
-echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_oasis -with_orchidee -with_inca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 
-     ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_oasis -with_orchidee -with_inca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 2>&1
+echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 
+     ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 2>&1
 # Test if compiling finished
 if [[ $? != 0 ]] ; then
@@ -469,9 +520,13 @@
 # Move executables to modipsl/bin
 if [ -f $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then 
-    mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe
-    #create link to be use by IPSLCM and LMDZOR without any change in the executable name
-    cd  $modipsl/bin
-    rm -f icosa_lmdz_${orchversion}_${optmode}.exe
-    ln -s icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe icosa_lmdz_${orchversion}_${optmode}.exe
+    if [ $compinca == y ] ; then
+	mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe
+	# Create link to be use by IPSLCM and LMDZOR without any change in the executable name
+	cd  $modipsl/bin
+        rm -f icosa_lmdz_${orchversion}_${optmode}.exe
+	ln -s icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe icosa_lmdz_${orchversion}_${optmode}.exe
+    else
+	mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}.exe
+    fi
 else
     echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP"
@@ -500,6 +555,18 @@
 	rm -f .lock
     fi
-    echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd $opt_rad -$optmode -mem -parallel $parallel -chimie INCA  -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 
-         ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd $opt_rad -$optmode -mem -parallel $parallel -chimie INCA  -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
+
+    if [ $compinca == y ] ; then
+	arginca="-chimie INCA"
+    else
+	arginca=""
+    fi
+    
+    if [ $compoasis == y ] ; then
+	argoasis="-c OMCT"
+    else
+	argoasis=""
+    fi
+    echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd $opt_rad -$optmode -mem -parallel $parallel $arginca  -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 
+         ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd $opt_rad -$optmode -mem -parallel $parallel $arginca  -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
     # Test if compiling finished
     if [[ $? != 0 ]] ; then
@@ -514,5 +581,14 @@
 	suffix=${suffix}_seq_orch_inca.e
     else
-	suffix=${suffix}_para_mem_orch_couple_inca.e
+	if [ $compoasis == y ] ; then
+	    suffix=${suffix}_para_mem_orch_couple
+	else
+	    suffix=${suffix}_para_mem_orch
+	fi
+	if [ $compinca == y ] ; then
+	    suffix=${suffix}_inca.e
+	else
+	    suffix=${suffix}.e
+	fi
     fi
     echo gcm suffix = $suffix
@@ -521,9 +597,13 @@
     echo "Move gcm.e executable to modipsl/bin"
     if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ;  then
-	mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e
-	#create link to be use by IPSLCM and LMDZOR without any change in the executable name
-	cd $modipsl/bin
-	rm -f gcm_${resol_atm}_${orchversion}_${optmode}.e
-	ln -s gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e gcm_${resol_atm}_${orchversion}_${optmode}.e
+	if [ $compinca == y ] ; then
+	    mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e
+	    # Create link to be use by IPSLCM and LMDZOR without any change in the executable name
+	    cd $modipsl/bin
+            rm -f gcm_${resol_atm}_${orchversion}_${optmode}.e
+	    ln -s gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e gcm_${resol_atm}_${orchversion}_${optmode}.e
+	else
+	    mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}.e
+	fi
     else
 	echo "ERROR gcm${suffix} executable does not exist." 
@@ -538,8 +618,12 @@
 	suffix=${suffix}_seq_orch.e
     else
-	suffix=${suffix}_para_mem_orch_couple.e
+	if [ $compoasis == y ] ; then
+	    suffix=${suffix}_para_mem_orch_couple.e
+	else
+	    suffix=${suffix}_para_mem_orch.e
+	fi
     fi
     echo ce0l suffix = $suffix
- 
+
     # Compile ce0l initialization program for LMDZ regular lat-lon exectuable
     cd $modipsl/modeles/LMDZ
@@ -547,6 +631,6 @@
     echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"   >> $outfile 
 
-    echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 
-         ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 2>&1
+    echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 
+         ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 2>&1
     # Test if compiling finished
     if [[ $? != 0 ]] ; then
Index: CONFIG/UNIFORM/v7/IPSLCM7/define_config.sh
===================================================================
--- CONFIG/UNIFORM/v7/IPSLCM7/define_config.sh	(revision 6638)
+++ CONFIG/UNIFORM/v7/IPSLCM7/define_config.sh	(revision 6638)
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# define_config.sh is called from the main compilation script compile_ipslcm7.sh
+# The script will define which components to compile.
+# By default all availble components are compiled.
+#
+# Step 1: The avaible components are defined. 
+# Step 2: Define which components to compile. If argument [-subconfig subconfig] is set 
+#         to the main compilation script, a control if the components needed are avaiable. 
+#         If argument is subconfig is not set, the components defined in step 1 will be defined.
+
+
+### Step 1: Check available components possible to compile
+# LMDZ, ORCHIDEE and XIOS are considered mandatory and will not be checked.
+
+if [ -d ../../modeles/NEMO ] ; then
+    compnemo=y
+else
+    compnemo=n
+fi
+
+if [ -d ../../modeles/INCA ] ; then
+    compinca=y
+else
+    compinca=n
+fi
+
+if [ -d ../../modeles/DYNAMICO ] ; then
+    compdyna=y
+else
+    compdyna=n
+fi
+
+if [ -d ../../oasis3-mct ] ; then
+    compoasis=y
+else
+    compoasis=n
+fi
+
+
+
+### Step 2: Define which components to compile. Check if the configuration set as argument is possible
+if [ $subconfig == default ] ; then
+    echo ; echo Compilation of all availble components will be done:
+    echo compinca=$compinca compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna complmdz=y comporch=y compxios=y
+elif [ $subconfig == ICOLMDZORINCA ] ; then
+    if [ $compinca == n ] || [ $compdyna == n ] ; then
+	echo ; echo It is not possible to compile ICOLMDZORINCA.
+	echo INCA or DYNAMICO source code is missing
+        exit
+    else
+	echo Compilation of ICOLMDZORINCA configuration will be done
+    fi	
+elif [ $subconfig == ICOLMDZOR ] ; then
+    if [ $compdyna == n ] ; then
+	echo ; echo It is not possible to compile ICOLMDZOR
+	echo DYNAMICO source code is missing
+        exit
+    else
+	echo Compilation of ICOLMDZOR configuration will be done
+    fi
+elif [ $subconfig == LMDZORINCA ] ; then
+    if [ $compinca == n ] ; then
+	echo ; 	echo It is not possible to compile LMDZORINCA.
+	echo INCA source code is missing
+        exit
+    else
+	regular_latlon=yes
+	echo Compilation of regular LMDZORINCA configuration for grid $resol_atm will be done 
+    fi	
+elif [ $subconfig == LMDZOR ] ; then
+    regular_latlon=yes
+    # We always suppose that LMDZ and ORCHIDEE are extracted. No check needs to be done.
+    echo Compilation of regular LMDZOR configuration for grid $resol_atm will be done
+else
+    echo ; echo The configuration $subconfig is not available
+    echo Choose between ICOLMDZORINCA ICOLMDZOR LMDZORINCA or LMDZOR 
+    echo Exit now
+    exit
+fi
+echo ;
+
