Index: LMDZ6/branches/LMDZ_ECRad/libf/phydev/iophy.F90
===================================================================
--- LMDZ6/branches/LMDZ_ECRad/libf/phydev/iophy.F90	(revision 4482)
+++ LMDZ6/branches/LMDZ_ECRad/libf/phydev/iophy.F90	(revision 4727)
@@ -13,27 +13,13 @@
   
 
-#ifdef CPP_XIOS
 ! interfaces for both IOIPSL and XIOS
   INTERFACE histwrite_phy
     MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_xios,histwrite3d_xios
   END INTERFACE
-#else
-! interfaces for IOIPSL
-  INTERFACE histwrite_phy
-    MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy
-  END INTERFACE
-#endif
-
-#ifdef CPP_XIOS
+
 ! interfaces for both IOIPSL and XIOS
   INTERFACE histbeg_phy_all
     MODULE PROCEDURE histbeg_phy, histbeg_phyxios
   END INTERFACE
-#else
-! interfaces for IOIPSL
-  INTERFACE histbeg_phy_all
-    MODULE PROCEDURE histbeg_phy
-  END INTERFACE
-#endif
 
 contains
@@ -51,7 +37,5 @@
   USE ioipsl, only: flio_dom_set
 #endif
-#ifdef CPP_XIOS
-  use wxios, only: wxios_domain_param
-#endif
+  use wxios, only: wxios_domain_param, using_xios
   implicit none
     real,dimension(klon),intent(in) :: rlon
@@ -122,32 +106,32 @@
                       'APPLE',phys_domain_id)
 #endif
-#ifdef CPP_XIOS
-    ! Set values for the mask:
-    IF (mpi_rank == 0) THEN
-        data_ibegin = 0
-    ELSE 
-        data_ibegin = ii_begin - 1
-    END IF
-
-    IF (mpi_rank == mpi_size-1) THEN
-        data_iend = nbp_lon
-    ELSE
-        data_iend = ii_end + 1
-    END IF
-
-    if (prt_level>=10) then
-      write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
-      write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
-      write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
-      write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
-      write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
-    endif
-
-    ! Initialize the XIOS domain coreesponding to this process:
-    CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
-                            1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
-                            klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
-                            io_lat, io_lon,is_south_pole_dyn,mpi_rank)
-#endif
+    IF (using_xios) THEN
+      ! Set values for the mask:
+      IF (mpi_rank == 0) THEN
+          data_ibegin = 0
+      ELSE 
+          data_ibegin = ii_begin - 1
+      END IF
+
+      IF (mpi_rank == mpi_size-1) THEN
+          data_iend = nbp_lon
+      ELSE
+          data_iend = ii_end + 1
+      END IF
+
+      if (prt_level>=10) then
+        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
+        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
+        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
+        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
+        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
+      endif
+
+      ! Initialize the XIOS domain coreesponding to this process:
+      CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
+                              1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
+                              klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
+                              io_lat, io_lon,is_south_pole_dyn,mpi_rank)
+    ENDIF
 !$OMP END MASTER
       
@@ -184,5 +168,4 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-#ifdef CPP_XIOS
 
 ! SUBROUTINE histbeg_phyxios(name,itau0,zjulian,dtime,ffreq,lev,nhori,nid_day)
@@ -213,5 +196,4 @@
   END SUBROUTINE histbeg_phyxios
 
-#endif
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -339,10 +321,10 @@
 
 ! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV
-#ifdef CPP_XIOS
+
   SUBROUTINE histwrite2d_xios(field_name,field)
   USE dimphy, only: klon
   USE mod_phys_lmdz_para, only: gather_omp, grid1Dto2D_mpi, &
                                 jj_nb, klon_mpi
-  USE xios, only: xios_send_field
+  USE lmdz_xios, only: xios_send_field
   USE print_control_mod, ONLY: prt_level, lunout
   USE mod_grid_phy_lmdz, ONLY: nbp_lon
@@ -368,15 +350,14 @@
     IF (prt_level >= 10) WRITE(lunout,*)'End histrwrite2d_xios ',trim(field_name)
   END SUBROUTINE histwrite2d_xios
-#endif
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 ! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV
-#ifdef CPP_XIOS
+
   SUBROUTINE histwrite3d_xios(field_name, field)
   USE dimphy, only: klon, klev
   USE mod_phys_lmdz_para, only: gather_omp, grid1Dto2D_mpi, &
                                 jj_nb, klon_mpi
-  USE xios, only: xios_send_field
+  USE lmdz_xios, only: xios_send_field
   USE print_control_mod, ONLY: prt_level,lunout
   USE mod_grid_phy_lmdz, ONLY: nbp_lon
@@ -407,5 +388,4 @@
     IF (prt_level >= 10) write(lunout,*)'End histrwrite3d_xios ',trim(field_name)
   END SUBROUTINE histwrite3d_xios
-#endif
 
 end module iophy
Index: LMDZ6/branches/LMDZ_ECRad/libf/phydev/physiq_mod.F90
===================================================================
--- LMDZ6/branches/LMDZ_ECRad/libf/phydev/physiq_mod.F90	(revision 4482)
+++ LMDZ6/branches/LMDZ_ECRad/libf/phydev/physiq_mod.F90	(revision 4727)
@@ -23,9 +23,7 @@
       USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat
 
-#ifdef CPP_XIOS
-      USE xios, ONLY: xios_update_calendar
+      USE lmdz_xios, ONLY: xios_update_calendar, using_xios
       USE wxios, only: wxios_add_vaxis, wxios_set_cal, wxios_closedef
       USE iophy, ONLY: histwrite_phy
-#endif
 
       IMPLICIT none
@@ -126,15 +124,15 @@
 #endif
 
-#ifdef CPP_XIOS
+    IF (using_xios) THEN
 !XIOS
-    ! Declare available vertical axes to be used in output files:    
-    CALL wxios_add_vaxis("presnivs", klev, presnivs)
+      ! Declare available vertical axes to be used in output files:    
+      CALL wxios_add_vaxis("presnivs", klev, presnivs)
 
-    ! Declare calendar and time step
-    CALL wxios_set_cal(dtime,"earth_360d",1,1,1,0.0,1,1,1,0.0)
+      ! Declare calendar and time step
+      CALL wxios_set_cal(dtime,"earth_360d",1,1,1,0.0,1,1,1,0.0)
     
-    !Finalize the context:
-    CALL wxios_closedef()
-#endif
+      !Finalize the context:
+      CALL wxios_closedef()
+    ENDIF
 !$OMP END MASTER
 !$OMP BARRIER
@@ -176,10 +174,10 @@
 
 !XIOS
-#ifdef CPP_XIOS
-!$OMP MASTER
+IF (using_xios) THEN
+  !$OMP MASTER
     !Increment XIOS time
     CALL xios_update_calendar(itau)
-!$OMP END MASTER
-!$OMP BARRIER
+  !$OMP END MASTER
+  !$OMP BARRIER
 
     !Send fields to XIOS: (NB these fields must also be defined as
@@ -190,5 +188,5 @@
     CALL histwrite_phy("v",v)
     CALL histwrite_phy("ps",paprs(:,1))
-#endif
+ENDIF
 
 ! if lastcall, then it is time to write "restartphy.nc" file
