Index: LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_aerosol_optics.F90
===================================================================
--- LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_aerosol_optics.F90	(revision 4660)
+++ LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_aerosol_optics.F90	(revision 4669)
@@ -53,6 +53,5 @@
         ! properties and average to the spectral intervals of the
         ! current gas-optics scheme
-!        call setup_general_aerosol_optics(config)
-        call setup_general_aerosol_optics_lmdz(config,trim(config%aerosol_optics_file_name))
+        call setup_general_aerosol_optics(config)
       else
         ! Read file containing optical properties already in the bands
@@ -334,311 +333,4 @@
 
   end subroutine setup_general_aerosol_optics
-
-    !---------------------------------------------------------------------
-  ! Read LMDZ file containing high spectral resolution optical properties
-  ! and average to the spectral intervals of the current gas-optics
-  ! scheme
-  subroutine setup_general_aerosol_optics_lmdz(config,file_name)
-
-    use parkind1,                      only : jprb
-    use yomhook,                       only : lhook, dr_hook
-!    use easy_netcdf,                   only : netcdf_file
-    use radiation_config,              only : config_type
-    use radiation_aerosol_optics_data, only : aerosol_optics_type
-    use radiation_spectral_definition, only : SolarReferenceTemperature, &
-         &                                    TerrestrialReferenceTemperature
-    use radiation_io,                  only : nulout
-    use netcdf95, only: nf95_open, nf95_inq_grp_full_ncid, nf95_close, &
-         nf95_inq_dimid, nf95_inq_varid, nf95_inquire_dimension, &
-         nf95_get_var, nf95_gw_var
-    use netcdf, only: nf90_nowrite
-
-
-    type(config_type), intent(inout), target :: config
-
-!    ! The NetCDF file containing the aerosol optics data
-!    type(netcdf_file)  :: file
-
-    character(len=*), intent(in):: file_name
-    ! NetCDF file containing the aerosol optics data
-
-    ! Wavenumber points in NetCDF file
-    real(jprb), allocatable :: wavenumber(:) ! cm-1
-
-    ! Hydrophilic aerosol properties
-    real(jprb), allocatable :: mass_ext_philic(:,:,:)    ! Mass-ext coefficient (m2 kg-1)
-    real(jprb), allocatable :: ssa_philic(:,:,:)         ! Single-scattering albedo
-    real(jprb), allocatable :: g_philic(:,:,:)           ! Asymmetry factor
-    real(jprb), allocatable :: lidar_ratio_philic(:,:,:) ! Lidar ratio (sr)
-
-    ! Hydrophobic aerosol properties
-    real(jprb), allocatable :: mass_ext_phobic(:,:)      ! Mass-ext coefficient (m2 kg-1)
-    real(jprb), allocatable :: ssa_phobic(:,:)           ! Single-scattering albedo
-    real(jprb), allocatable :: g_phobic(:,:)             ! Asymmetry factor
-    real(jprb), allocatable :: lidar_ratio_phobic(:,:)   ! Lidar ratio (sr)
-
-    ! Mapping matrix between optical properties at the wavenumbers in
-    ! the file, and spectral intervals used by the gas-optics scheme
-    real(jprb), allocatable :: mapping(:,:)
-
-    ! Pointer to the aerosol optics coefficients for brevity of access
-    type(aerosol_optics_type), pointer :: ao
-
-    ! Target monochromatic wavenumber for interpolation (cm-1)
-    real(jprb) :: wavenumber_target
-
-    ! Number of spectral points describing aerosol properties in the
-    ! shortwave and longwave
-    integer    :: nspecsw, nspeclw
-
-    ! Number of monochromatic wavelengths required
-    integer    :: nmono
-
-    integer    :: n_type_philic, n_type_phobic, nrh, nwn
-    integer    :: jtype, jwl, iwn
-
-    ! Weight of first point in interpolation
-    real(jprb) :: weight1
-
-    real(jprb) :: hook_handle
-
-    ! Local:
-    integer ncid, grpid, dimid, varid
-
-    if (lhook) call dr_hook('radiation_aerosol_optics:setup_general_aerosol_optics',0,hook_handle)
-
-    ao => config%aerosol_optics
-
-    ao%use_hydrophilic = .true.
-    ao%use_monochromatic = .true.
-    print*,'file_name= ',file_name
-    call nf95_open(file_name, nf90_nowrite, ncid)
-    call nf95_inq_grp_full_ncid(ncid, "Hydrophilic", grpid)
-    call nf95_inq_dimid(grpid, "hur", dimid)
-    call nf95_inquire_dimension(grpid, dimid, nclen = ao%nrh)
-!    allocate(ao%rh_lower(ao%nrh))
-    call nf95_inq_varid(grpid, "hur_bounds", varid)
-    call nf95_get_var(grpid, varid, ao%rh_lower, count_nc = [1, ao%nrh])
-
-    ! Hydrophilic/LW_bands:
-    call nf95_inq_grp_full_ncid(ncid, "Hydrophilic/LW_bands", grpid)
-    call nf95_inq_varid(grpid, "asymmetry", varid)
-    call nf95_gw_var(grpid, varid, ao%g_lw_philic)
-    call nf95_inq_varid(grpid, "single_scat_alb", varid)
-    call nf95_gw_var(grpid, varid, ao%ssa_lw_philic)
-    call nf95_inq_varid(grpid, "mass_ext", varid)
-    call nf95_gw_var(grpid, varid, ao%mass_ext_lw_philic)
-
-    ! Hydrophilic/SW_bands:
-    call nf95_inq_grp_full_ncid(ncid, "Hydrophilic/SW_bands", grpid)
-    call nf95_inq_varid(grpid, "asymmetry", varid)
-    call nf95_gw_var(grpid, varid, ao%g_sw_philic)
-    ao%g_sw_philic = cshift(ao%g_sw_philic, 1)
-    call nf95_inq_varid(grpid, "single_scat_alb", varid)
-    call nf95_gw_var(grpid, varid, ao%ssa_sw_philic)
-    ao%g_sw_philic = cshift(ao%ssa_sw_philic, 1)
-    call nf95_inq_varid(grpid, "mass_ext", varid)
-    call nf95_gw_var(grpid, varid, ao%mass_ext_sw_philic)
-    ao%g_sw_philic = cshift(ao%mass_ext_sw_philic, 1)
-
-    ! Hydrophilic/Monochromatic:
-    call nf95_inq_grp_full_ncid(ncid, "Hydrophilic/Monochromatic", grpid)
-    call nf95_inq_varid(grpid, "mass_ext", varid)
-    call nf95_gw_var(grpid, varid, ao%mass_ext_mono_philic)
-
-    ! Hydrophobic/LW_bands:
-    call nf95_inq_grp_full_ncid(ncid, "Hydrophobic/LW_bands", grpid)
-    call nf95_inq_varid(grpid, "asymmetry", varid)
-    call nf95_gw_var(grpid, varid, ao%g_lw_phobic)
-    call nf95_inq_varid(grpid, "single_scat_alb", varid)
-    call nf95_gw_var(grpid, varid, ao%ssa_lw_phobic)
-    call nf95_inq_varid(grpid, "mass_ext", varid)
-    call nf95_gw_var(grpid, varid, ao%mass_ext_lw_phobic)
-
-    ! Hydrophobic/SW_bands:
-    call nf95_inq_grp_full_ncid(ncid, "Hydrophobic/SW_bands", grpid)
-    call nf95_inq_varid(grpid, "asymmetry", varid)
-    call nf95_gw_var(grpid, varid, ao%g_sw_phobic)
-    ao%g_sw_phobic = cshift(ao%g_sw_phobic, 1)
-    call nf95_inq_varid(grpid, "single_scat_alb", varid)
-    call nf95_gw_var(grpid, varid, ao%ssa_sw_phobic)
-    ao%g_sw_phobic = cshift(ao%ssa_sw_phobic, 1)
-    call nf95_inq_varid(grpid, "mass_ext", varid)
-    call nf95_gw_var(grpid, varid, ao%mass_ext_sw_phobic)
-    ao%g_sw_phobic = cshift(ao%mass_ext_sw_phobic, 1)
-! AI ATTENTION    
-    call nf95_inq_varid(grpid, "wavenumber", varid)
-    call nf95_gw_var(grpid, varid, wavenumber)
-
-    ! Hydrophobic/Monochromatic:
-    call nf95_inq_grp_full_ncid(ncid, "Hydrophobic/Monochromatic", grpid)
-    call nf95_inq_varid(grpid, "mass_ext", varid)
-    call nf95_gw_var(grpid, varid, ao%mass_ext_mono_phobic)
-
-!    call file%get('wavenumber', wavenumber)
-!    nwn = size(wavenumber)
-
-!    call file%get_global_attribute('description_hydrophobic', &
-!         &                         ao%description_phobic_str)
-
-
-!      call file%get('relative_humidity1',      ao%rh_lower)
-
-!      call file%get_global_attribute('description_hydrophilic', &
-!           &                         ao%description_philic_str)
-
-    ! Close aerosol scattering file
-!    call file%close()
-
-    call nf95_close(ncid)
-
-    ! Get array sizes
-!    ao%n_bands_lw = size(ao%mass_ext_lw_phobic, 1)
-!    ao%n_bands_sw = size(ao%mass_ext_sw_phobic, 1)
-!    ao%n_mono_wl = size(ao%mass_ext_mono_phobic, 1)
-!    ao%n_type_phobic = size(ao%mass_ext_lw_phobic, 2)
-!    ao%n_type_philic = size(ao%mass_ext_lw_philic, 3)
-
-    ! Allocate memory for mapping arrays
-!    ao%ntype = ao%n_type_phobic + ao%n_type_philic
-!    allocate(ao%iclass(ao%ntype))
-!    allocate(ao%itype(ao%ntype))
-
-!    ao%iclass = IAerosolClassUndefined
-!    ao%itype  = 0
-
-    n_type_phobic = size(mass_ext_phobic, 2)
-    if (ao%use_hydrophilic) then
-      n_type_philic = size(mass_ext_philic, 3)
-      nrh = size(ao%rh_lower)
-    else
-      n_type_philic = 0
-      nrh = 0
-    end if
-
-    if (config%do_cloud_aerosol_per_sw_g_point) then
-      nspecsw = config%gas_optics_sw%spectral_def%ng
-    else
-      nspecsw = config%gas_optics_sw%spectral_def%nband
-    end if
-
-    if (config%do_cloud_aerosol_per_lw_g_point) then
-      nspeclw = config%gas_optics_lw%spectral_def%ng
-    else
-      nspeclw = config%gas_optics_lw%spectral_def%nband
-    end if
-
-    if (allocated(ao%wavelength_mono)) then
-      ! Monochromatic wavelengths also required
-      nmono = size(ao%wavelength_mono)
-    else
-      nmono = 0
-    end if
-
-    call ao%allocate(n_type_phobic, n_type_philic, nrh, nspeclw, nspecsw, nmono)
-
-    if (config%do_sw) then
-      call config%gas_optics_sw%spectral_def%calc_mapping(SolarReferenceTemperature, &
-           &  wavenumber, mapping, use_bands=(.not. config%do_cloud_aerosol_per_sw_g_point))
-
-      ao%mass_ext_sw_phobic = matmul(mapping, mass_ext_phobic)
-      ao%ssa_sw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic) &
-           &           / ao%mass_ext_sw_phobic
-      ao%g_sw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic*g_phobic) &
-           &         / (ao%mass_ext_sw_phobic*ao%ssa_sw_phobic)
-
-      if (ao%use_hydrophilic) then
-        do jtype = 1,n_type_philic
-          ao%mass_ext_sw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype))
-          ao%ssa_sw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
-               &                                        *ssa_philic(:,:,jtype)) &
-               &           / ao%mass_ext_sw_philic(:,:,jtype)
-          ao%g_sw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
-               &                       *ssa_philic(:,:,jtype)*g_philic(:,:,jtype)) &
-               &         / (ao%mass_ext_sw_philic(:,:,jtype)*ao%ssa_sw_philic(:,:,jtype))
-        end do
-      end if
-    end if
-    if (config%do_lw) then
-      call config%gas_optics_lw%spectral_def%calc_mapping(TerrestrialReferenceTemperature, &
-           &  wavenumber, mapping, use_bands=(.not. config%do_cloud_aerosol_per_lw_g_point))
-
-      ao%mass_ext_lw_phobic = matmul(mapping, mass_ext_phobic)
-      ao%ssa_lw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic) &
-           &           / ao%mass_ext_lw_phobic
-      ao%g_lw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic*g_phobic) &
-           &         / (ao%mass_ext_lw_phobic*ao%ssa_lw_phobic)
-
-      if (ao%use_hydrophilic) then
-        do jtype = 1,n_type_philic
-          ao%mass_ext_lw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype))
-          ao%ssa_lw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
-               &                                        *ssa_philic(:,:,jtype)) &
-               &           / ao%mass_ext_lw_philic(:,:,jtype)
-          ao%g_lw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
-               &                       *ssa_philic(:,:,jtype)*g_philic(:,:,jtype)) &
-               &         / (ao%mass_ext_lw_philic(:,:,jtype)*ao%ssa_lw_philic(:,:,jtype))
-        end do
-      end if
-    end if
-
-    if (allocated(ao%wavelength_mono)) then
-      ! Monochromatic wavelengths also required
-      do jwl = 1,nmono
-        ! Wavelength (m) to wavenumber (cm-1)
-        wavenumber_target = 0.01_jprb / ao%wavelength_mono(jwl)
-        ! Find index to first interpolation point, and its weight
-        if (wavenumber_target <= wavenumber(1)) then
-          weight1 = 1.0_jprb
-          iwn = 1
-        else if (wavenumber_target >= wavenumber(nwn)) then
-          iwn = nwn-1
-          weight1 = 0.0_jprb
-        else
-          iwn = 1
-          do while (wavenumber(iwn+1) < wavenumber_target .and. iwn < nwn-1)
-            iwn = iwn + 1
-          end do
-          weight1 = (wavenumber(iwn+1)-wavenumber_target) &
-               &  / (wavenumber(iwn+1)-wavenumber(iwn))
-        end if
-        ! Linear interpolation
-        ao%mass_ext_mono_phobic(jwl,:) = weight1 * mass_ext_phobic(iwn,:) &
-             &             + (1.0_jprb - weight1)* mass_ext_phobic(iwn+1,:)
-        ao%ssa_mono_phobic(jwl,:)      = weight1 * ssa_phobic(iwn,:) &
-             &             + (1.0_jprb - weight1)* ssa_phobic(iwn+1,:)
-        ao%g_mono_phobic(jwl,:)        = weight1 * g_phobic(iwn,:) &
-             &             + (1.0_jprb - weight1)* g_phobic(iwn+1,:)
-        ao%lidar_ratio_mono_phobic(jwl,:) = weight1 * lidar_ratio_phobic(iwn,:) &
-             &                + (1.0_jprb - weight1)* lidar_ratio_phobic(iwn+1,:)
-        if (ao%use_hydrophilic) then
-          ao%mass_ext_mono_philic(jwl,:,:) = weight1 * mass_ext_philic(iwn,:,:) &
-               &               + (1.0_jprb - weight1)* mass_ext_philic(iwn+1,:,:)
-          ao%ssa_mono_philic(jwl,:,:)      = weight1 * ssa_philic(iwn,:,:) &
-               &               + (1.0_jprb - weight1)* ssa_philic(iwn+1,:,:)
-          ao%g_mono_philic(jwl,:,:)        = weight1 * g_philic(iwn,:,:) &
-               &               + (1.0_jprb - weight1)* g_philic(iwn+1,:,:)
-          ao%lidar_ratio_mono_philic(jwl,:,:) = weight1 * lidar_ratio_philic(iwn,:,:) &
-               &                  + (1.0_jprb - weight1)* lidar_ratio_philic(iwn+1,:,:)
-        end if
-      end do
-    end if
-
-    ! Deallocate memory local to this routine
-    deallocate(mass_ext_phobic)
-    deallocate(ssa_phobic)
-    deallocate(g_phobic)
-    deallocate(lidar_ratio_phobic)
-    if (ao%use_hydrophilic) then
-      deallocate(mass_ext_philic)
-      deallocate(ssa_philic)
-      deallocate(g_philic)
-      deallocate(lidar_ratio_philic)
-    end if
-
-    if (lhook) call dr_hook('radiation_aerosol_optics:setup_general_aerosol_optics',1,hook_handle)
-
-  end subroutine setup_general_aerosol_optics_lmdz
-    
 
   !---------------------------------------------------------------------
Index: LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_cloud_generator.F90
===================================================================
--- LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_cloud_generator.F90	(revision 4660)
+++ LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_cloud_generator.F90	(revision 4669)
@@ -541,9 +541,4 @@
     use radiation_pdf_sampler, only : pdf_sampler_type
     implicit none
-#if defined(__GFORTRAN__) || defined(__PGI) || defined(__NEC__)
-#else
-    !$omp declare simd(sample_from_pdf_simd) uniform(this) &
-    !$omp linear(ref(fsd)) linear(ref(cdf))
-#endif
     type(pdf_sampler_type), intent(in)  :: this
 
Index: LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_scheme.F90
===================================================================
--- LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_scheme.F90	(revision 4660)
+++ LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/radiation_scheme.F90	(revision 4669)
@@ -87,5 +87,5 @@
      &  NWEIGHT_PAR, IBAND_PAR, WEIGHT_PAR, &
      &  ITYPE_TROP_BG_AER,  TROP_BG_AER_MASS_EXT, &
-     &  ITYPE_STRAT_BG_AER, STRAT_BG_AER_MASS_EXT
+     &  ITYPE_STRAT_BG_AER, STRAT_BG_AER_MASS_EXT, ISolverSpartacus
 ! Commentes : jour, date de la simulation 
 !USE YOMRIP0  , ONLY : NINDAT
@@ -105,4 +105,5 @@
 
 USE mod_phys_lmdz_para
+USE setup_config_from_lmdz,   ONLY : driver_config_type
 
 IMPLICIT NONE
@@ -269,5 +270,16 @@
 ! Ratio of cloud overlap decorrelation length for cloud water
 ! inhomogeneities to that for cloud boundaries (typically 0.5)
-REAL(KIND=JPRB)           :: ZDECORR_LEN_RATIO
+!REAL(KIND=JPRB)           :: ZDECORR_LEN_RATIO = 0.5_jprb
+
+!AI mai 2023
+! A mettre dans namelist
+!real(jprb) :: high_inv_effective_size
+!real(jprb) :: middle_inv_effective_size
+!real(jprb) :: low_inv_effective_size
+
+!real(jprb) :: cloud_inhom_separation_factor
+!real(jprb) :: cloud_separation_scale_surface
+!real(jprb) :: cloud_separation_scale_toa
+!real(jprb) :: cloud_separation_scale_power
 
 ! The surface net longwave flux if the surface was a black body, used
@@ -290,5 +302,6 @@
 
 ! AI ATTENTION
-real(jprb), parameter    :: frac_std = 0.75
+! A mettre dans namelist
+!real(jprb), parameter    :: frac_std = 0.75
 
 ! Name of file names specified on command line
@@ -301,4 +314,5 @@
 !$OMP THREADPRIVATE(debut_ecrad)
 
+type(driver_config_type) :: driver_config
 ! Import time functions for iseed calculation
 ! AI ATTENTION propre a ifs
@@ -342,4 +356,23 @@
 ! AI appel radiation_setup
 call SETUP_RADIATION_SCHEME(loutput)
+! Read "radiation_driver" namelist into radiation driver config type
+  file_name="namelist_ecrad"
+call driver_config%read(file_name)
+
+if (rad_config%i_solver_sw == ISolverSPARTACUS &
+      & .or.   rad_config%i_solver_lw == ISolverSPARTACUS) then
+       print*,'Solveur SW: ', rad_config%i_solver_sw
+       print*,'Solveur LW: ', rad_config%i_solver_lw
+   if (driver_config%ok_effective_size) then
+       print*,'low_inv_effective_size = ',driver_config%low_inv_effective_size
+       print*,'middle_inv_effective_size = ',driver_config%middle_inv_effective_size
+       print*,'high_inv_effective_size = ',driver_config%high_inv_effective_size
+   else if (driver_config%ok_separation) then   
+       print*,'cloud_separation_scale_surface =',driver_config%cloud_separation_scale_surface
+       print*,'cloud_separation_scale_toa =',driver_config%cloud_separation_scale_toa
+       print*,'cloud_separation_scale_power =',driver_config%cloud_separation_scale_power
+       print*,'cloud_inhom_separation_factor =',driver_config%cloud_inhom_separation_factor
+   endif   
+endif   
 
  if (lprint_config) then
@@ -450,15 +483,8 @@
 cloud%fraction(KIDIA:KFDIA,:) = PCLOUD_FRAC(KIDIA:KFDIA,:)
 
-!AI ATTENTION a voir avec JL
-! Compute effective radii and convert to metres
-!CALL LIQUID_EFFECTIVE_RADIUS(KIDIA, KFDIA, KLON, KLEV, &
-!     &  PPRESSURE, PTEMPERATURE, PCLOUD_FRAC, PQ_LIQUID, PQ_RAIN, &
-!     &  PLAND_SEA_MASK, PCCN_LAND, PCCN_SEA, &
-!     &  ZRE_LIQUID_UM)
+!!! ok AI ATTENTION a voir avec JL
+! Compute effective radi and convert to metres
+! AI. : on passe directement les champs de LMDZ
 cloud%re_liq(KIDIA:KFDIA,:) = ZRE_LIQUID_UM(KIDIA:KFDIA,:)
-
-!CALL ICE_EFFECTIVE_RADIUS(KIDIA, KFDIA, KLON, KLEV, &
-!     &  PPRESSURE, PTEMPERATURE, PCLOUD_FRAC, PQ_ICE, PQ_SNOW, PGEMU, &
-!     &  ZRE_ICE_UM)
 cloud%re_ice(KIDIA:KFDIA,:) = ZRE_ICE_UM(KIDIA:KFDIA,:)
 
@@ -468,18 +494,20 @@
 ! decorrelation lengths for cloud water content inhomogeneities and
 ! cloud boundaries, and set it in the "rad_config" object.
+! IFS :
 !CALL CLOUD_OVERLAP_DECORR_LEN(KIDIA, KFDIA, KLON, PGEMU, YRERAD%NDECOLAT, &
 !     &    ZDECORR_LEN_KM, PDECORR_LEN_RATIO=ZDECORR_LEN_RATIO)
-
-! AI ATTENTION (valeur lue dans namelist)
-!ZDECORR_LEN_RATIO = 0.5_JPRB
-!rad_config%cloud_inhom_decorr_scaling = ZDECORR_LEN_RATIO
+! AI valeur dans namelist
+! rad_config%cloud_inhom_decorr_scaling = ZDECORR_LEN_RATIO
+
 !AI ATTENTION meme valeur que dans offline
-ZDECORR_LEN_KM = 2000.0_JPRB
+! A mettre dans namelist
+ZDECORR_LEN_KM = driver_config%overlap_decorr_length
 DO JLON = KIDIA,KFDIA
   CALL cloud%set_overlap_param(thermodynamics, &
-       &                       ZDECORR_LEN_KM(JLON), &
-       &                       istartcol=JLON, iendcol=JLON)
+       &                 ZDECORR_LEN_KM(JLON), &
+       &                 istartcol=JLON, iendcol=JLON)
 ENDDO
 
+! IFS :
 ! Cloud water content fractional standard deviation is configurable
 ! from namelist NAERAD but must be globally constant. Before it was
@@ -487,23 +515,34 @@
 !CALL cloud%create_fractional_std(KLON, KLEV, YRERAD%RCLOUD_FRAC_STD)
 ! AI ATTENTION frac_std=0.75 meme valeur que dans la version offline
-CALL cloud%create_fractional_std(KLON, KLEV, frac_std)
-
+CALL cloud%create_fractional_std(KLON, KLEV, driver_config%frac_std)
+
+if (rad_config%i_solver_sw == ISolverSPARTACUS &
+      & .or.   rad_config%i_solver_lw == ISolverSPARTACUS) then
 ! AI ! Read cloud properties needed by SPARTACUS
+!AI ATTENTION meme traitement dans le version offline
+
 ! By default mid and high cloud effective size is 10 km
 !CALL cloud%create_inv_cloud_effective_size(KLON,KLEV,1.0_JPRB/10000.0_JPRB)
-! But for boundary clouds (eta > 0.8) we set it to 1 km
-!DO JLEV = 1,KLEV
-!  DO JLON = KIDIA,KFDIA
-!    IF (PPRESSURE(JLON,JLEV) > 0.8_JPRB * PPRESSURE_H(JLON,KLEV+1)) THEN
-!      cloud%inv_cloud_effective_size(JLON,JLEV) = 1.0e-3_JPRB
-!    ENDIF
-!  ENDDO
-!ENDDO
-!AI ATTENTION meme traitement dans le version offline
-call cloud%create_inv_cloud_effective_size_eta(KLON, KLEV, &
+
+!  if (driver_config%low_inv_effective_size >= 0.0_jprb &
+!     & .or. driver_config%middle_inv_effective_size >= 0.0_jprb &
+!     & .or. driver_config%high_inv_effective_size >= 0.0_jprb) then
+  if (driver_config%ok_effective_size) then
+     call cloud%create_inv_cloud_effective_size_eta(klon, klev, &
                &  thermodynamics%pressure_hl, &
-               &  0.005_JPRB, &
-               &  0.0001_JPRB, &
-               &  0.0001, 0.8_jprb, 0.45_jprb)      
+               &  driver_config%low_inv_effective_size, &
+               &  driver_config%middle_inv_effective_size, &
+               &  driver_config%high_inv_effective_size, 0.8_jprb, 0.45_jprb)
+!  else if (driver_config%cloud_separation_scale_surface > 0.0_jprb &
+!         .and. driver_config%cloud_separation_scale_toa > 0.0_jprb) then
+  else if (driver_config%ok_separation) then
+      call cloud%param_cloud_effective_separation_eta(klon, klev, &
+               &  thermodynamics%pressure_hl, &
+               &  driver_config%cloud_separation_scale_surface, &
+               &  driver_config%cloud_separation_scale_toa, &
+               &  driver_config%cloud_separation_scale_power, &
+               &  driver_config%cloud_inhom_separation_factor)
+  endif
+endif  
 
 print*,'******** AEROSOLS (allocate + input) **************************************'
Index: LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/setup_aerosol_optics_lmdz_m.F90
===================================================================
--- LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/setup_aerosol_optics_lmdz_m.F90	(revision 4660)
+++ LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/setup_aerosol_optics_lmdz_m.F90	(revision 4669)
@@ -29,6 +29,5 @@
     use netcdf95, only: nf95_open, nf95_inq_grp_full_ncid, nf95_close, &
          nf95_inq_dimid, nf95_inq_varid, nf95_inquire_dimension, &
-         nf95_get_var, nf95_gw_var
-    use netcdf, only: nf90_nowrite
+         nf95_get_var, nf95_gw_var, nf95_nowrite
 
     type(aerosol_optics_type), intent(out):: ao
@@ -44,6 +43,5 @@
     ao%use_hydrophilic = .true.
     ao%use_monochromatic = .true.
-    print*,'file_name= ',file_name
-    call nf95_open(file_name, nf90_nowrite, ncid)
+    call nf95_open(file_name, nf95_nowrite, ncid)
     call nf95_inq_grp_full_ncid(ncid, "Hydrophilic", grpid)
     call nf95_inq_dimid(grpid, "hur", dimid)
@@ -69,8 +67,8 @@
     call nf95_inq_varid(grpid, "single_scat_alb", varid)
     call nf95_gw_var(grpid, varid, ao%ssa_sw_philic)
-    ao%g_sw_philic = cshift(ao%ssa_sw_philic, 1)
+    ao%ssa_sw_philic = cshift(ao%ssa_sw_philic, 1)
     call nf95_inq_varid(grpid, "mass_ext", varid)
     call nf95_gw_var(grpid, varid, ao%mass_ext_sw_philic)
-    ao%g_sw_philic = cshift(ao%mass_ext_sw_philic, 1)
+    ao%mass_ext_sw_philic = cshift(ao%mass_ext_sw_philic, 1)
 
     ! Hydrophilic/Monochromatic:
@@ -95,8 +93,8 @@
     call nf95_inq_varid(grpid, "single_scat_alb", varid)
     call nf95_gw_var(grpid, varid, ao%ssa_sw_phobic)
-    ao%g_sw_phobic = cshift(ao%ssa_sw_phobic, 1)
+    ao%ssa_sw_phobic = cshift(ao%ssa_sw_phobic, 1)
     call nf95_inq_varid(grpid, "mass_ext", varid)
     call nf95_gw_var(grpid, varid, ao%mass_ext_sw_phobic)
-    ao%g_sw_phobic = cshift(ao%mass_ext_sw_phobic, 1)
+    ao%mass_ext_sw_phobic = cshift(ao%mass_ext_sw_phobic, 1)
 
     ! Hydrophobic/Monochromatic:
Index: LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/setup_config_from_lmdz.F90
===================================================================
--- LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/setup_config_from_lmdz.F90	(revision 4669)
+++ LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/setup_config_from_lmdz.F90	(revision 4669)
@@ -0,0 +1,104 @@
+module setup_config_from_lmdz
+
+  use parkind1, only : jprb
+
+  implicit none
+
+  public
+
+  type driver_config_type
+     logical    :: ok_effective_size  = .true.
+     logical    :: ok_separation = .false.   
+     real(jprb) :: high_inv_effective_size   = -1.0_jprb ! m-1
+     real(jprb) :: middle_inv_effective_size = -1.0_jprb ! m-1
+     real(jprb) :: low_inv_effective_size    = -1.0_jprb ! m-1
+     real(jprb) :: cloud_inhom_separation_factor  = -1.0_jprb
+     real(jprb) :: cloud_separation_scale_surface = -1.0_jprb
+     real(jprb) :: cloud_separation_scale_toa     = -1.0_jprb
+     real(jprb) :: cloud_separation_scale_power   = -1.0_jprb
+     real(jprb) :: frac_std = 0.75_jprb
+     real(jprb) :: overlap_decorr_length = 2000.0_jprb
+
+
+ contains
+ procedure :: read => read_config_from_namelist
+
+  end type driver_config_type
+
+contains
+
+  !---------------------------------------------------------------------
+  subroutine read_config_from_namelist(this, file_name, is_success)
+
+    use radiation_io, only : nulerr, radiation_abort       
+
+    class(driver_config_type), intent(inout) :: this
+    character(*), intent(in)          :: file_name
+    logical, intent(out), optional    :: is_success
+    logical    :: ok_effective_size, ok_separation
+    integer    :: iosopen ! Status after calling open
+    real(jprb) :: high_inv_effective_size 
+    real(jprb) :: middle_inv_effective_size
+    real(jprb) :: low_inv_effective_size
+    real(jprb) :: cloud_inhom_separation_factor 
+    real(jprb) :: cloud_separation_scale_surface
+    real(jprb) :: cloud_separation_scale_toa
+    real(jprb) :: cloud_separation_scale_power
+    real(jprb) :: frac_std
+    real(jprb) :: overlap_decorr_length
+
+    namelist /radiation_driver/ ok_effective_size, ok_separation, &
+         &  frac_std, overlap_decorr_length, &
+         &  high_inv_effective_size, middle_inv_effective_size, low_inv_effective_size, &
+         &  cloud_inhom_separation_factor, cloud_separation_scale_surface, &
+         &  cloud_separation_scale_toa, cloud_separation_scale_power 
+
+    ok_effective_size = .false.
+    ok_separation = .false.
+    high_inv_effective_size   = -1.0_jprb 
+    middle_inv_effective_size = -1.0_jprb 
+    low_inv_effective_size    = -1.0_jprb 
+    cloud_inhom_separation_factor  = -1.0_jprb
+    cloud_separation_scale_surface = -1.0_jprb
+    cloud_separation_scale_toa     = -1.0_jprb
+    cloud_separation_scale_power   = -1.0_jprb
+    frac_std = 0.75_jprb
+    overlap_decorr_length = 2000.0_jprb
+
+    ! Open the namelist file and read the radiation_driver namelist
+    open(unit=10, iostat=iosopen, file=trim(file_name))
+    if (iosopen /= 0) then
+      ! An error occurred
+      if (present(is_success)) then
+        is_success = .false.
+        ! We now continue the subroutine so that the default values
+        ! are placed in the config structure
+      else
+        write(nulerr,'(a,a,a)') '*** Error: namelist file "', &
+             &                trim(file_name), '" not found'
+        call radiation_abort('Driver configuration error')
+      end if
+    else
+      ! Read the radiation_driver namelist, noting that it is not an
+      ! error if this namelist is not present, provided all the required
+      ! variables are present in the NetCDF data file instead
+      read(unit=10, nml=radiation_driver)
+      close(unit=10)
+    end if
+
+    ! Copy namelist data into configuration object
+    this%ok_effective_size = ok_effective_size 
+    this%ok_separation = ok_separation
+    this%frac_std = frac_std
+    this%overlap_decorr_length = overlap_decorr_length
+    this%cloud_inhom_separation_factor = cloud_inhom_separation_factor
+    this%cloud_separation_scale_surface = cloud_separation_scale_surface
+    this%cloud_separation_scale_toa = cloud_separation_scale_toa
+    this%cloud_separation_scale_power = cloud_separation_scale_power
+    this%high_inv_effective_size = high_inv_effective_size
+    this%middle_inv_effective_size = middle_inv_effective_size
+    this%low_inv_effective_size = low_inv_effective_size
+
+  end subroutine read_config_from_namelist          
+
+end module setup_config_from_lmdz
