Index: LMDZ6/trunk/libf/phylmd/ecrad/radiation/radiation_ecckd.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/ecrad/radiation/radiation_ecckd.F90	(revision 4773)
+++ LMDZ6/trunk/libf/phylmd/ecrad/radiation/radiation_ecckd.F90	(revision 4853)
@@ -15,4 +15,6 @@
 !
 
+#include "ecrad_config.h"
+
 module radiation_ecckd
 
@@ -105,5 +107,5 @@
 ! Vectorized version of the optical depth look-up performs better on
 ! NEC, but slower on x86
-#ifdef __SX__
+#ifdef DWD_VECTOR_OPTIMIZATIONS
     procedure :: calc_optical_depth => calc_optical_depth_ckd_model_vec
 #else
@@ -125,7 +127,11 @@
   subroutine read_ckd_model(this, filename, iverbose)
 
-    use easy_netcdf,  only : netcdf_file
+#ifdef EASY_NETCDF_READ_MPI
+    use easy_netcdf_read_mpi, only : netcdf_file
+#else
+    use easy_netcdf,          only : netcdf_file
+#endif
     !use radiation_io, only : nulerr, radiation_abort
-    use yomhook,      only : lhook, dr_hook, jphook
+    use yomhook,              only : lhook, dr_hook, jphook
 
     class(ckd_model_type), intent(inout) :: this
@@ -166,6 +172,4 @@
     this%d_log_pressure = log(pressure_lut(2)) - this%log_pressure1
     call file%get('temperature', temperature_full)
-    ! AI oct 2023 ajout pour le double appel de ecrad    
-    if (allocated(this%temperature1)) deallocate(this%temperature1)
     allocate(this%temperature1(this%npress));
     this%temperature1 = temperature_full(:,1)
@@ -200,5 +204,4 @@
     ! Read gases
     call file%get('n_gases', this%ngas)
-    if (allocated(this%single_gas)) deallocate(this%single_gas)
     allocate(this%single_gas(this%ngas))
     call file%get_global_attribute('constituent_id', constituent_id)
@@ -292,7 +295,11 @@
   subroutine read_spectral_solar_cycle(this, filename, iverbose, use_updated_solar_spectrum)
 
-    use easy_netcdf,  only : netcdf_file
-    use radiation_io, only : nulout, nulerr, radiation_abort
-    use yomhook,      only : lhook, dr_hook, jphook
+#ifdef EASY_NETCDF_READ_MPI
+    use easy_netcdf_read_mpi, only : netcdf_file
+#else
+    use easy_netcdf,          only : netcdf_file
+#endif
+    use radiation_io,         only : nulout, nulerr, radiation_abort
+    use yomhook,              only : lhook, dr_hook, jphook
 
     ! Reference total solar irradiance (W m-2)
@@ -450,5 +457,5 @@
   subroutine calc_optical_depth_ckd_model(this, ncol, nlev, istartcol, iendcol, nmaxgas, &
        &  pressure_hl, temperature_fl, mole_fraction_fl, &
-       &  optical_depth_fl, rayleigh_od_fl)
+       &  optical_depth_fl, rayleigh_od_fl, concentration_scaling)
 
     use yomhook,             only : lhook, dr_hook, jphook
@@ -466,4 +473,6 @@
     ! Gas mole fractions at full levels (mol mol-1), dimensioned (ncol,nlev,nmaxgas)
     real(jprb),            intent(in)  :: mole_fraction_fl(ncol,nlev,nmaxgas)
+    ! Optional concentration scaling of each gas
+    real(jprb), optional,  intent(in)  :: concentration_scaling(nmaxgas)
     
     ! Output variables
@@ -486,4 +495,5 @@
 
     real(jprb) :: multiplier(nlev), simple_multiplier(nlev), global_multiplier, temperature1
+    real(jprb) :: scaling
 
     ! Indices and weights in temperature, pressure and concentration interpolation
@@ -547,4 +557,8 @@
             multiplier = simple_multiplier * mole_fraction_fl(jcol,:,igascode)
 
+            if (present(concentration_scaling)) then
+              multiplier = multiplier * concentration_scaling(igascode)
+            end if
+            
             do jlev = 1,nlev
               optical_depth_fl(:,jlev,jcol) = optical_depth_fl(:,jlev,jcol) &
@@ -557,6 +571,14 @@
           case (IConcDependenceRelativeLinear)
             molar_abs => this%single_gas(jgas)%molar_abs
-            multiplier = simple_multiplier  * (mole_fraction_fl(jcol,:,igascode) &
-                 &                            - single_gas%reference_mole_frac)
+
+            if (present(concentration_scaling)) then
+              multiplier = simple_multiplier &
+                   &  * (mole_fraction_fl(jcol,:,igascode)*concentration_scaling(igascode) &
+                   &     - single_gas%reference_mole_frac)
+            else
+              multiplier = simple_multiplier  * (mole_fraction_fl(jcol,:,igascode) &
+                   &                            - single_gas%reference_mole_frac)
+            end if
+            
             do jlev = 1,nlev
               optical_depth_fl(:,jlev,jcol) = optical_depth_fl(:,jlev,jcol) &
@@ -579,4 +601,11 @@
 
           case (IConcDependenceLUT)
+
+            if (present(concentration_scaling)) then
+              scaling = concentration_scaling(igascode)
+            else
+              scaling = 1.0_jprb
+            end if
+            
             ! Logarithmic interpolation in concentration space
             molar_abs_conc => this%single_gas(jgas)%molar_abs_conc
@@ -584,5 +613,5 @@
             do jlev = 1,nlev
               ! Take care of mole_fraction == 0
-              log_conc = log(max(mole_fraction_fl(jcol,jlev,igascode), mole_frac1))
+              log_conc = log(max(mole_fraction_fl(jcol,jlev,igascode)*scaling, mole_frac1))
               cindex1  = (log_conc - single_gas%log_mole_frac1) / single_gas%d_log_mole_frac
               cindex1  = 1.0_jprb + max(0.0_jprb, min(cindex1, single_gas%n_mole_frac-1.0001_jprb))
@@ -601,5 +630,5 @@
             do jlev = 1,nlev
               optical_depth_fl(:,jlev,jcol) = optical_depth_fl(:,jlev,jcol) &
-                   &  + (simple_multiplier(jlev) * mole_fraction_fl(jcol,jlev,igascode)) * ( &
+                   &  + (simple_multiplier(jlev) * mole_fraction_fl(jcol,jlev,igascode) * scaling) * ( &
                    &      (cw1(jlev) * tw1(jlev) * pw1(jlev)) * molar_abs_conc(:,ip1(jlev),it1(jlev),ic1(jlev)) &
                    &     +(cw1(jlev) * tw1(jlev) * pw2(jlev)) * molar_abs_conc(:,ip1(jlev)+1,it1(jlev),ic1(jlev)) &
