Index: LMDZ5/trunk/libf/phylmd/Dust/splaeropt_5wv_rrtm.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/Dust/splaeropt_5wv_rrtm.F90	(revision 2753)
+++ LMDZ5/trunk/libf/phylmd/Dust/splaeropt_5wv_rrtm.F90	(revision 2753)
@@ -0,0 +1,180 @@
+!
+! $Id: splaeropt_5wv_rrtm.F90 2644 2016-10-02 16:55:08Z oboucher $
+!
+
+SUBROUTINE SPLAEROPT_5WV_RRTM(  &
+   zdm, zdh, tr_seri, RHcl,     &
+   tausum, tau )
+
+  USE DIMPHY
+  USE aero_mod
+  USE infotrac_phy
+  USE phys_local_var_mod, ONLY: od550aer,od865aer,ec550aer,od550lt1aer
+  !
+  ! Olivier Boucher Jan 2017
+  ! Based on Mie routines on ciclad CMIP6
+  !
+  IMPLICIT NONE
+  !
+  ! Input arguments:
+  !
+  REAL, DIMENSION(klon,klev), INTENT(IN)   :: zdh      !--m
+  REAL, DIMENSION(klon,klev), INTENT(IN)   :: zdm      !--kg/m2
+  REAL, DIMENSION(klon,klev), INTENT(IN)   :: RHcl     ! humidite relative ciel clair
+  REAL, DIMENSION(klon,klev,nbtr), INTENT(IN) :: tr_seri
+  !
+  ! Output arguments:
+  !
+  REAL, DIMENSION(klon,nwave,naero_tot), INTENT(OUT)      :: tausum
+  REAL, DIMENSION(klon,klev,nwave,naero_tot), INTENT(OUT) :: tau
+  !
+  ! Local
+  !
+  INTEGER, PARAMETER :: las = nwave_sw
+  LOGICAL :: soluble
+  
+  INTEGER :: i, k, m, itr, irh, aerindex
+  INTEGER :: spsol, spinsol, la
+  INTEGER :: RH_num(klon,klev)
+  INTEGER, PARAMETER :: la443 = 1
+  INTEGER, PARAMETER :: la550 = 2
+  INTEGER, PARAMETER :: la670 = 3
+  INTEGER, PARAMETER :: la765 = 4
+  INTEGER, PARAMETER :: la865 = 5
+  INTEGER, PARAMETER :: nbre_RH=12
+  INTEGER, PARAMETER :: naero_soluble=2
+  INTEGER, PARAMETER :: naero_insoluble=2
+  INTEGER, PARAMETER :: naero=naero_soluble+naero_insoluble
+
+  REAL, PARAMETER :: RH_tab(nbre_RH)=(/0.,10.,20.,30.,40.,50.,60.,70.,80.,85.,90.,95./)
+  REAL, PARAMETER :: RH_MAX=95.
+  REAL :: delta(klon,klev), rh(klon,klev)
+  REAL :: tau_ae5wv_int   ! Intermediate computation of epaisseur optique aerosol
+  REAL :: zrho
+  CHARACTER*20 modname
+  
+  ! Soluble components 1-accumulation mode soluble; 2- seasalt coarse
+  REAL :: alpha_aers_5wv(nbre_RH,las,naero_soluble)   ! Ext. coeff. ** m2/g 
+  ! Insoluble components 1- Dust: 2- BC; 3- POM
+  REAL :: alpha_aeri_5wv(las,naero_insoluble)         ! Ext. coeff. ** m2/g 
+  !
+  ! Proprietes optiques
+  !
+  REAL :: fact_RH(nbre_RH)
+
+! From here on we look at the optical parameters at 5 wavelengths:  
+! 443nm, 550, 670, 765 and 865 nm 
+!                                   le 12 AVRIL 2006 
+!  
+ DATA alpha_aers_5wv/ & 
+                           ! accumulation mode (sulfate+2% bc) soluble 
+       4.632, 4.632, 4.632, 4.632, 6.206, 6.827, 7.616, 8.716,10.514,12.025,14.688,21.539, &
+       3.981, 3.981, 3.981, 3.981, 5.346, 5.923, 6.662, 7.704, 9.437,10.914,13.562,20.591, &
+       3.265, 3.265, 3.265, 3.265, 4.400, 4.909, 5.565, 6.500, 8.081, 9.449,11.943,18.791, &
+       2.761, 2.761, 2.761, 2.761, 3.731, 4.182, 4.767, 5.606, 7.041, 8.294,10.610,17.118, &
+       2.307, 2.307, 2.307, 2.307, 3.129, 3.522, 4.034, 4.774, 6.052, 7.180, 9.286,15.340, &
+
+                           ! seasalt seasalt Coarse Soluble (CS)      
+       0.576, 0.690, 0.738, 0.789, 0.855, 0.935, 1.046, 1.212, 1.512, 1.785, 2.258, 3.449, &
+       0.595, 0.713, 0.763, 0.814, 0.880, 0.963, 1.079, 1.248, 1.550, 1.826, 2.306, 3.507, &
+       0.617, 0.738, 0.789, 0.842, 0.911, 0.996, 1.113, 1.286, 1.592, 1.871, 2.369, 3.562, &
+       0.632, 0.755, 0.808, 0.862, 0.931, 1.018, 1.140, 1.316, 1.626, 1.909, 2.409, 3.622, &
+       0.645, 0.771, 0.825, 0.880, 0.951, 1.039, 1.164, 1.344, 1.661, 1.948, 2.455, 3.682  /
+
+  DATA alpha_aeri_5wv/ &
+                                 ! coarse dust insoluble 
+       0.605, 0.611, 0.661, 0.714, 0.760, &
+                                 ! super coarse insoluble 
+       0.153, 0.156, 0.158, 0.157, 0.161 /
+  ! 
+  ! Initialisations
+  tausum(:,:,:)=0.
+  tau(:,:,:,:)=0.
+
+  modname='splaeropt_5wv_rrtm'
+
+  IF (naero.GT.naero_tot) THEN 
+    CALL abort_physic(modname,'Too many aerosol types',1)
+  ENDIF
+
+  DO irh=1,nbre_RH-1
+    fact_RH(irh)=1./(RH_tab(irh+1)-RH_tab(irh))
+  ENDDO
+   
+  DO k=1, klev
+    DO i=1, klon
+      rh(i,k)=MIN(RHcl(i,k)*100.,RH_MAX)
+      RH_num(i,k) = INT( rh(i,k)/10. + 1.)
+      IF (rh(i,k).GT.85.) RH_num(i,k)=10
+      IF (rh(i,k).GT.90.) RH_num(i,k)=11
+      delta(i,k)=(rh(i,k)-RH_tab(RH_num(i,k)))*fact_RH(RH_num(i,k))
+    ENDDO
+  ENDDO
+
+  DO itr=1,nbtr    !--loop over tracers  
+
+    IF (tname(itr+nqo)=='PREC') THEN       !--fine mode accumulation mode
+      CYCLE
+    ELSE IF (tname(itr+nqo)=='FINE') THEN  !--fine mode accumulation mode
+      soluble=.TRUE.
+      spsol=1
+      aerindex=1
+    ELSE IF (tname(itr+nqo)=='COSS') THEN  !--coarse mode sea salt
+      soluble=.TRUE.
+      spsol=2
+      aerindex=2
+    ELSE IF (tname(itr+nqo)=='CODU') THEN  !--coarse mode dust
+      soluble=.FALSE.
+      spinsol=1
+      aerindex=3
+    ELSE IF (tname(itr+nqo)=='SCDU') THEN  !--super coarse mode dust
+      soluble=.FALSE.
+      spinsol=2
+      aerindex=4
+    ELSE
+       CALL abort_physic(modname,'I cannot do aerosol optics for '//tname(itr+nqo),1)
+    ENDIF
+
+    DO la=1,las
+
+      !--only 550 and 865 nm are used
+      IF (la.NE.la550.AND.la.NE.la865) CYCLE
+
+      IF (soluble) THEN  !--soluble aerosol with RH dependence
+
+        DO k=1, klev
+          DO i=1, klon
+            tau_ae5wv_int = alpha_aers_5wv(RH_num(i,k),la,spsol)+DELTA(i,k)* &
+                           (alpha_aers_5wv(RH_num(i,k)+1,la,spsol) - & 
+                            alpha_aers_5wv(RH_num(i,k),la,spsol))
+            tau(i,k,la,aerindex) = tr_seri(i,k,itr)*zdm(i,k)*tau_ae5wv_int
+            tausum(i,la,aerindex)=tausum(i,la,aerindex)+tau(i,k,la,aerindex)
+          ENDDO
+        ENDDO
+
+      ELSE               !--cases of insoluble aerosol
+
+        DO k=1, klev
+          DO i=1, klon
+            tau_ae5wv_int = alpha_aeri_5wv(la,spinsol)
+            tau(i,k,la,aerindex) = tr_seri(i,k,itr)*zdm(i,k)*tau_ae5wv_int
+            tausum(i,la,aerindex)= tausum(i,la,aerindex)+tau(i,k,la,aerindex)
+          ENDDO
+        ENDDO
+
+      ENDIF
+
+    ENDDO   ! Boucle sur les longueurs d'onde
+  ENDDO     ! Boucle sur les masses de traceurs
+
+!--AOD calculations for diagnostics
+  od550aer(:)=SUM(tausum(:,la550,1:naero),dim=2)
+  od865aer(:)=SUM(tausum(:,la865,1:naero),dim=2)
+
+!--extinction coefficient for diagnostic
+  ec550aer(:,:)=SUM(tau(:,:,la550,1:naero),dim=3)/zdh(:,:)
+
+!--aod for particles lower than 1 micron
+  od550lt1aer(:)=tausum(:,la550,1)+tausum(:,la550,2)*0.3+tausum(:,la550,3)*0.2
+
+END SUBROUTINE SPLAEROPT_5WV_RRTM
Index: LMDZ5/trunk/libf/phylmd/Dust/splaeropt_6bands_rrtm.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/Dust/splaeropt_6bands_rrtm.F90	(revision 2753)
+++ LMDZ5/trunk/libf/phylmd/Dust/splaeropt_6bands_rrtm.F90	(revision 2753)
@@ -0,0 +1,264 @@
+!
+! $Id: splaeropt_6bands_rrtm.F90 2644 2016-10-02 16:55:08Z oboucher $
+!
+SUBROUTINE SPLAEROPT_6BANDS_RRTM ( &
+     zdm, tr_seri, RHcl,           &
+     tau_allaer, piz_allaer, cg_allaer )
+
+  USE dimphy
+  USE aero_mod
+  USE infotrac_phy
+  USE phys_local_var_mod, ONLY: absvisaer
+
+  ! Olivier Boucher Jan 2017
+  ! based on Mie routines on ciclad CMIP6
+  !
+  IMPLICIT NONE
+
+  INCLUDE "clesphys.h"
+  !
+  ! Input arguments:
+  !
+  REAL, DIMENSION(klon,klev),     INTENT(IN)  :: zdm        !--hauteur des couches en kg/m2
+  REAL, DIMENSION(klon,klev),     INTENT(IN)  :: RHcl       ! humidite relative ciel clair
+  REAL, DIMENSION(klon,klev,nbtr),INTENT(IN)  :: tr_seri
+  !
+  ! Output arguments:
+  ! 2= total aerosols 
+  ! 1= natural aerosols
+  !
+  REAL, DIMENSION(klon,klev,2,nbands_sw_rrtm), INTENT(OUT) :: tau_allaer ! epaisseur optique aerosol
+  REAL, DIMENSION(klon,klev,2,nbands_sw_rrtm), INTENT(OUT) :: piz_allaer ! single scattering albedo aerosol
+  REAL, DIMENSION(klon,klev,2,nbands_sw_rrtm), INTENT(OUT) :: cg_allaer  ! asymmetry parameter aerosol
+  !
+  ! Local
+  !
+  LOGICAL :: soluble
+  INTEGER :: i, k, irh, itr, inu
+  INTEGER :: aerindex, spsol, spinsol
+  INTEGER :: RH_num(klon,klev)
+
+  INTEGER, PARAMETER :: naero_soluble=2    ! 1- accumulation soluble; 2- coarse soluble
+  INTEGER, PARAMETER :: naero_insoluble=2  ! 1- coarse dust; 2- supercoarse dust
+  INTEGER, PARAMETER :: naero=naero_soluble+naero_insoluble
+
+  INTEGER, PARAMETER :: nbre_RH=12
+  REAL,PARAMETER :: RH_tab(nbre_RH)=(/0.,10.,20.,30.,40.,50.,60.,70.,80.,85.,90.,95./)
+  REAL, PARAMETER :: RH_MAX=95.
+  REAL :: delta(klon,klev), rh(klon,klev)
+  REAL :: tau_ae2b_int   ! Intermediate computation of epaisseur optique aerosol
+  REAL :: piz_ae2b_int   ! Intermediate computation of Single scattering albedo
+  REAL :: cg_ae2b_int    ! Intermediate computation of Assymetry parameter
+  REAL :: fact_RH(nbre_RH), tmp_var
+  !
+  REAL, DIMENSION(klon,klev,naero_tot,nbands_sw_rrtm) ::  tau_ae
+  REAL, DIMENSION(klon,klev,naero_tot,nbands_sw_rrtm) ::  piz_ae
+  REAL, DIMENSION(klon,klev,naero_tot,nbands_sw_rrtm) ::  cg_ae
+  !
+  ! Proprietes optiques
+  !
+  REAL:: alpha_aers_6bands(nbre_RH,nbands_sw_rrtm,naero_soluble)   !--unit m2/g aer
+  REAL:: alpha_aeri_6bands(nbands_sw_rrtm,naero_insoluble)         !--unit m2/g aer
+  REAL:: cg_aers_6bands(nbre_RH,nbands_sw_rrtm,naero_soluble)      !--unitless 
+  REAL:: cg_aeri_6bands(nbands_sw_rrtm,naero_insoluble)            !--unitless
+  REAL:: piz_aers_6bands(nbre_RH,nbands_sw_rrtm,naero_soluble)     !--unitless
+  REAL:: piz_aeri_6bands(nbands_sw_rrtm,naero_insoluble)           !--unitless
+  !
+  REAL, PARAMETER :: tau_min = 1.e-8
+  CHARACTER*20 modname
+
+!***************************************************************************
+!--the order of the soluble   species has to follow the spsol   index below
+!--the order of the insoluble species has to follow the spinsol index below
+
+  DATA alpha_aers_6bands/  & 
+       ! accumulation (sulfate+2% bc) mode soluble
+  5.212, 5.212, 5.212, 5.212, 6.973, 7.581, 8.349, 9.400,11.078,12.463,14.857,20.837, &
+  4.906, 4.906, 4.906, 4.906, 6.568, 7.195, 7.989, 9.088,10.869,12.354,14.951,21.545, &
+  3.940, 3.940, 3.940, 3.940, 5.291, 5.861, 6.591, 7.620, 9.332,10.791,13.410,20.370, &
+  2.292, 2.292, 2.292, 2.292, 3.105, 3.493, 3.996, 4.724, 5.978, 7.084, 9.146,15.067, &
+  0.762, 0.762, 0.762, 0.762, 1.050, 1.201, 1.401, 1.699, 2.232, 2.721, 3.675, 6.678, &
+  0.090, 0.090, 0.090, 0.090, 0.122, 0.141, 0.166, 0.204, 0.275, 0.344, 0.484, 0.973, &
+        ! coarse seasalt
+  0.547, 0.657, 0.705, 0.754, 0.817, 0.896, 1.008, 1.169, 1.456, 1.724, 2.199, 3.358, &
+  0.566, 0.679, 0.727, 0.776, 0.840, 0.920, 1.032, 1.196, 1.492, 1.760, 2.238, 3.416, &
+  0.596, 0.714, 0.764, 0.816, 0.882, 0.965, 1.081, 1.250, 1.552, 1.828, 2.310, 3.509, &
+  0.644, 0.771, 0.825, 0.880, 0.951, 1.040, 1.164, 1.345, 1.666, 1.957, 2.462, 3.700, &
+  0.640, 0.772, 0.829, 0.887, 0.965, 1.061, 1.198, 1.398, 1.758, 2.085, 2.658, 4.031, &
+  0.452, 0.562, 0.609, 0.659, 0.728, 0.813, 0.938, 1.125, 1.471, 1.797, 2.384, 3.855  /
+
+  DATA alpha_aeri_6bands/  & 
+       ! coarse dust insoluble
+  0.594, 0.610, 0.619, 0.762, 0.791, 0.495, &
+       ! supercoarse dust insoluble 
+  0.151, 0.152, 0.155, 0.159, 0.168, 0.167  /
+
+  DATA cg_aers_6bands/ &
+       ! accumulation (sulfate+2% bc) mode soluble 
+  0.692, 0.692, 0.692, 0.692, 0.735, 0.739, 0.744, 0.749, 0.755, 0.759, 0.765, 0.772, &
+  0.690, 0.690, 0.690, 0.690, 0.736, 0.740, 0.746, 0.752, 0.760, 0.765, 0.771, 0.779, &
+  0.678, 0.678, 0.678, 0.678, 0.727, 0.733, 0.740, 0.748, 0.759, 0.766, 0.775, 0.787, &
+  0.641, 0.641, 0.641, 0.641, 0.692, 0.700, 0.710, 0.721, 0.736, 0.746, 0.760, 0.781, &
+  0.553, 0.553, 0.553, 0.553, 0.603, 0.615, 0.627, 0.643, 0.664, 0.678, 0.699, 0.735, &
+  0.343, 0.343, 0.343, 0.343, 0.386, 0.399, 0.414, 0.433, 0.460, 0.480, 0.510, 0.569, &
+       ! seasalt coarse Soluble
+  0.754, 0.770, 0.776, 0.781, 0.784, 0.791, 0.797, 0.805, 0.815, 0.822, 0.828, 0.840, &
+  0.736, 0.753, 0.759, 0.765, 0.771, 0.778, 0.785, 0.793, 0.804, 0.811, 0.820, 0.831, &
+  0.716, 0.735, 0.742, 0.748, 0.754, 0.762, 0.769, 0.778, 0.789, 0.796, 0.807, 0.819, &
+  0.704, 0.725, 0.733, 0.739, 0.745, 0.752, 0.759, 0.768, 0.778, 0.784, 0.792, 0.803, &
+  0.716, 0.737, 0.744, 0.751, 0.756, 0.763, 0.770, 0.777, 0.786, 0.790, 0.795, 0.800, &
+  0.688, 0.730, 0.741, 0.751, 0.761, 0.771, 0.782, 0.795, 0.810, 0.820, 0.833, 0.849  /
+
+  DATA cg_aeri_6bands/ &
+       ! coarse dust insoluble
+  0.801, 0.779, 0.709, 0.698, 0.710, 0.687, &
+       ! super coarse dust insoluble
+  0.862, 0.871, 0.852, 0.799, 0.758, 0.651  /
+
+  DATA piz_aers_6bands/&
+       ! accumulation (sulfate+2% bc) mode soluble
+  0.941, 0.941, 0.941, 0.941, 0.958, 0.961, 0.965, 0.969, 0.974, 0.977, 0.981, 0.987, &
+  0.941, 0.941, 0.941, 0.941, 0.959, 0.963, 0.967, 0.971, 0.976, 0.979, 0.983, 0.988, &
+  0.953, 0.953, 0.953, 0.953, 0.967, 0.971, 0.974, 0.978, 0.982, 0.984, 0.988, 0.992, &
+  0.955, 0.955, 0.955, 0.955, 0.969, 0.972, 0.976, 0.980, 0.984, 0.986, 0.989, 0.994, &
+  0.936, 0.936, 0.936, 0.936, 0.955, 0.961, 0.966, 0.972, 0.978, 0.982, 0.987, 0.993, &
+  0.792, 0.792, 0.792, 0.792, 0.848, 0.867, 0.887, 0.907, 0.931, 0.944, 0.960, 0.980, &
+       ! seasalt coarse soluble
+  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.001, 1.000, &
+  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
+  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
+  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
+  0.994, 0.994, 0.995, 0.995, 0.995, 0.995, 0.996, 0.996, 0.996, 0.996, 0.996, 0.996, &
+  0.976, 0.867, 0.837, 0.814, 0.796, 0.774, 0.754, 0.735, 0.713, 0.702, 0.690, 0.675  /
+
+  DATA piz_aeri_6bands/ &
+       ! coarse dust insoluble
+  0.866, 0.875, 0.915, 0.977, 0.993, 0.971, &
+       ! super coarse dust insoluble
+  0.789, 0.749, 0.791, 0.918, 0.970, 0.909  /
+!
+  spsol = 0
+  spinsol = 0 
+
+  modname='splaeropt_6bands_rrt'
+
+  IF (NSW.NE.nbands_sw_rrtm) THEN
+     CALL abort_physic(modname,'Erreur NSW doit etre egal a 6 pour cette routine',1)
+  ENDIF
+
+  DO irh=1,nbre_RH-1
+    fact_RH(irh)=1./(RH_tab(irh+1)-RH_tab(irh))
+  ENDDO
+   
+  DO k=1, klev
+    DO i=1, klon
+      rh(i,k)=MIN(RHcl(i,k)*100.,RH_MAX)
+      RH_num(i,k) = INT(rh(i,k)/10. + 1.)
+      IF (rh(i,k).GT.85.) RH_num(i,k)=10
+      IF (rh(i,k).GT.90.) RH_num(i,k)=11
+      delta(i,k)=(rh(i,k)-RH_tab(RH_num(i,k)))*fact_RH(RH_num(i,k))
+    ENDDO
+  ENDDO
+
+  tau_ae(:,:,:,:)=0.
+  piz_ae(:,:,:,:)=0.
+  cg_ae(:,:,:,:)=0.
+    
+  DO itr=1, nbtr
+
+    IF (tname(itr+nqo)=='PREC') THEN       !--precursor
+      CYCLE
+    ELSE IF (tname(itr+nqo)=='FINE') THEN  !--fine mode accumulation mode
+      soluble=.TRUE.
+      spsol=1
+      aerindex=1
+    ELSE IF (tname(itr+nqo)=='COSS') THEN  !--coarse mode sea salt
+      soluble=.TRUE.
+      spsol=2
+      aerindex=2
+    ELSE IF (tname(itr+nqo)=='CODU') THEN  !--coarse mode dust
+      soluble=.FALSE.
+      spinsol=1
+      aerindex=3
+    ELSE IF (tname(itr+nqo)=='SCDU') THEN  !--super coarse mode dust
+      soluble=.FALSE.
+      spinsol=2
+      aerindex=4
+    ELSE
+       CALL abort_physic(modname,'I cannot do aerosol optics for '//tname(itr+nqo),1)
+    ENDIF
+
+    IF (soluble) THEN ! For aerosol soluble components
+
+         DO k=1, klev
+           DO i=1, klon
+
+             tmp_var=tr_seri(i,k,itr)*zdm(i,k) !-- g/m2
+
+             DO inu=1,NSW
+
+               tau_ae2b_int= alpha_aers_6bands(RH_num(i,k),inu,spsol)+ & 
+                             delta(i,k)* (alpha_aers_6bands(RH_num(i,k)+1,inu,spsol) - & 
+                             alpha_aers_6bands(RH_num(i,k),inu,spsol))
+                   
+               piz_ae2b_int = piz_aers_6bands(RH_num(i,k),inu,spsol) + & 
+                              delta(i,k)* (piz_aers_6bands(RH_num(i,k)+1,inu,spsol) - & 
+                              piz_aers_6bands(RH_num(i,k),inu,spsol))
+                   
+               cg_ae2b_int = cg_aers_6bands(RH_num(i,k),inu,spsol) + & 
+                             delta(i,k)* (cg_aers_6bands(RH_num(i,k)+1,inu,spsol) - & 
+                             cg_aers_6bands(RH_num(i,k),inu,spsol))
+
+               tau_ae(i,k,aerindex,inu)    = tmp_var*tau_ae2b_int
+               piz_ae(i,k,aerindex,inu)    = piz_ae2b_int
+               cg_ae(i,k,aerindex,inu)     = cg_ae2b_int
+
+             ENDDO
+           ENDDO
+         ENDDO
+
+    ELSE    ! For all aerosol insoluble components
+
+       DO k=1, klev
+         DO i=1, klon
+
+           tmp_var=tr_seri(i,k,itr)*zdm(i,k) !-- g/m2
+
+           DO inu=1,NSW
+             tau_ae2b_int = alpha_aeri_6bands(inu,spinsol)
+             piz_ae2b_int = piz_aeri_6bands(inu,spinsol)
+             cg_ae2b_int = cg_aeri_6bands(inu,spinsol) 
+
+             tau_ae(i,k,aerindex,inu) = tmp_var*tau_ae2b_int
+             piz_ae(i,k,aerindex,inu) = piz_ae2b_int
+             cg_ae(i,k,aerindex,inu)= cg_ae2b_int
+           ENDDO
+         ENDDO
+       ENDDO
+
+     ENDIF ! soluble / insoluble
+
+  ENDDO  ! nbtr
+
+!--all (natural + anthropogenic) aerosol
+  tau_allaer(:,:,2,:)=SUM(tau_ae(:,:,1:naero,:),dim=3) 
+  tau_allaer(:,:,2,:)=MAX(tau_allaer(:,:,2,:),tau_min)
+
+  piz_allaer(:,:,2,:)=SUM(tau_ae(:,:,1:naero,:)*piz_ae(:,:,1:naero,:),dim=3)/tau_allaer(:,:,2,:)
+  piz_allaer(:,:,2,:)=MIN(MAX(piz_allaer(:,:,2,:),0.01),1.0)
+  WHERE (tau_allaer(:,:,2,:).LE.tau_min) piz_allaer(:,:,2,:)=1.0
+
+  cg_allaer(:,:,2,:)=SUM(tau_ae(:,:,1:naero,:)*piz_ae(:,:,1:naero,:)*cg_ae(:,:,1:naero,:),dim=3)/  & 
+                     (tau_allaer(:,:,2,:)*piz_allaer(:,:,2,:))
+  cg_allaer(:,:,2,:)=MIN(MAX(cg_allaer(:,:,2,:),0.0),1.0)
+
+!--no aerosol
+  tau_allaer(:,:,1,:)=tau_min 
+  piz_allaer(:,:,1,:)=1.0 
+  cg_allaer(:,:,1,:)=0.0
+
+!--waveband 2 and all aerosol (third index = 2)
+  inu=2
+  absvisaer(:)=SUM((1-piz_allaer(:,:,2,inu))*tau_allaer(:,:,2,inu),dim=2)
+
+END SUBROUTINE SPLAEROPT_6BANDS_RRTM
Index: LMDZ5/trunk/libf/phylmd/Dust/splaeropt_lw_rrtm.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/Dust/splaeropt_lw_rrtm.F90	(revision 2753)
+++ LMDZ5/trunk/libf/phylmd/Dust/splaeropt_lw_rrtm.F90	(revision 2753)
@@ -0,0 +1,91 @@
+!
+! splaeropt_lw_rrtm.F90 2014-05-13 C. Kleinschmitt
+!                      2016-05-03 O. Boucher 
+!
+! This routine feeds aerosol LW properties to RRTM
+! we only consider absorption (not scattering)
+
+SUBROUTINE SPLAEROPT_LW_RRTM(ok_alw,zdm,tr_seri)
+
+  USE dimphy
+  USE aero_mod
+  USE infotrac_phy
+  USE phys_state_var_mod, ONLY : tau_aero_lw_rrtm
+  USE YOERAD, ONLY : NLW
+
+  IMPLICIT NONE
+
+  INCLUDE "clesphys.h"
+  !
+  ! Input arguments:
+  !
+  LOGICAL, INTENT(IN) :: ok_alw
+  REAL, DIMENSION(klon,klev), INTENT(IN)      :: zdm
+  REAL, DIMENSION(klon,klev,nbtr), INTENT(IN) :: tr_seri
+  !
+  ! Local arguments : 
+  !
+  INTEGER, PARAMETER :: naero_soluble=2    ! 1- accumulation soluble; 2- coarse soluble
+  INTEGER, PARAMETER :: naero_insoluble=2  ! 1- coarse dust; 2- supercoarse dust
+  INTEGER, PARAMETER :: naero=naero_soluble+naero_insoluble
+  !
+  INTEGER inu, itr, spinsol
+  CHARACTER*20 modname
+  !
+  !--absorption coefficient for coarse and super-coarse DUST
+  REAL:: alpha_abs_CIDUST_16bands(nbands_lw_rrtm,naero_insoluble)   !--unit m2/g 
+  DATA alpha_abs_CIDUST_16bands /                         &
+   ! Dust CO insoluble
+  0.001, 0.003, 0.005, 0.006, 0.011, 0.031, 0.157, 0.102, &
+  0.017, 0.056, 0.032, 0.008, 0.010, 0.011, 0.013, 0.016, & 
+   ! Dust SC insoluble
+  0.002, 0.004, 0.007, 0.010, 0.018, 0.043, 0.099, 0.071, &
+  0.021, 0.056, 0.033, 0.011, 0.013, 0.014, 0.016, 0.018 /
+
+  modname='splaeropt_lw_rrtm'
+  ! 
+  IF (NLW.NE.nbands_lw_rrtm) THEN
+    CALL abort_physic(modname,'Erreur NLW doit etre egal a 16 pour cette routine',1)
+  ENDIF
+  !
+  IF (ok_alw) THEN 
+    !
+    !--initialisation
+    tau_aero_lw_rrtm = 0.0
+    !
+    DO itr=1,nbtr
+      !
+      IF (tname(itr+nqo)=='PREC') THEN       !--precursor
+        CYCLE
+      ELSE IF (tname(itr+nqo)=='FINE') THEN  !--fine mode accumulation mode
+        CYCLE
+      ELSE IF (tname(itr+nqo)=='COSS') THEN  !--coarse mode sea salt
+        CYCLE
+      ELSE IF (tname(itr+nqo)=='CODU') THEN  !--coarse mode dust
+        spinsol=1
+      ELSE IF (tname(itr+nqo)=='SCDU') THEN  !--super coarse mode dust
+        spinsol=2
+      ELSE
+         CALL abort_physic(modname,'I cannot do aerosol optics for '//tname(itr+nqo),1)
+      ENDIF
+      !
+      DO inu=1,NLW
+        !
+        !--total aerosol
+        tau_aero_lw_rrtm(:,:,2,inu) = tau_aero_lw_rrtm(:,:,2,inu) + tr_seri(:,:,itr)*zdm(:,:)*alpha_abs_CIDUST_16bands(inu,spinsol)
+        !--no aerosol at all
+        tau_aero_lw_rrtm(:,:,1,inu) = tau_aero_lw_rrtm(:,:,1,inu) + 0.0
+        !
+      ENDDO
+    !
+    ENDDO
+    !
+    !--avoid very small values
+    tau_aero_lw_rrtm = MAX(tau_aero_lw_rrtm,1.e-15)
+    ! 
+  ELSE
+    !--default value
+    tau_aero_lw_rrtm = 1.e-15
+  ENDIF
+  !
+END SUBROUTINE SPLAEROPT_LW_RRTM
Index: LMDZ5/trunk/libf/phylmd/Dust/splaerosol_optic_rrtm.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/Dust/splaerosol_optic_rrtm.F90	(revision 2753)
+++ LMDZ5/trunk/libf/phylmd/Dust/splaerosol_optic_rrtm.F90	(revision 2753)
@@ -0,0 +1,83 @@
+! $Id: splaerosol_optic_rrtm.F90 2644 2016-10-02 16:55:08Z oboucher $
+!
+SUBROUTINE splaerosol_optic_rrtm( ok_alw, pplay, paprs, t_seri, rhcl, &
+     tr_seri, mass_solu_aero, mass_solu_aero_pi, &
+     tau_aero, piz_aero, cg_aero, &
+     tausum_aero, tau3d_aero )
+
+  ! This routine will :
+  ! 1) recevie the aerosols(already read and interpolated) corresponding to flag_aerosol
+  ! 2) calculate the optical properties for the aerosols
+  !
+
+  USE dimphy
+  USE aero_mod
+  USE infotrac_phy
+  USE YOMCST, ONLY: RD, RG
+
+  IMPLICIT NONE
+
+  INCLUDE "clesphys.h"
+
+
+  ! Input arguments
+  !****************************************************************************************
+  LOGICAL, INTENT(IN) :: ok_alw                      ! Apply aerosol LW effect or not
+  REAL, DIMENSION(klon,klev), INTENT(IN)   :: pplay
+  REAL, DIMENSION(klon,klev+1), INTENT(IN) :: paprs
+  REAL, DIMENSION(klon,klev), INTENT(IN)   :: t_seri
+  REAL, DIMENSION(klon,klev), INTENT(IN)   :: rhcl   ! humidite relative ciel clair
+  REAL, DIMENSION(klon,klev,nbtr), INTENT(IN) :: tr_seri ! concentration tracer
+
+  ! Output arguments
+  !****************************************************************************************
+  REAL, DIMENSION(klon,klev), INTENT(OUT)     :: mass_solu_aero    ! Total mass for all soluble aerosols
+  REAL, DIMENSION(klon,klev), INTENT(OUT)     :: mass_solu_aero_pi !     -"-     preindustrial values
+  REAL, DIMENSION(klon,klev,2,NSW), INTENT(OUT) :: tau_aero    ! Aerosol optical thickness
+  REAL, DIMENSION(klon,klev,2,NSW), INTENT(OUT) :: piz_aero    ! Single scattering albedo aerosol
+  REAL, DIMENSION(klon,klev,2,NSW), INTENT(OUT) :: cg_aero     ! asymmetry parameter aerosol
+  REAL, DIMENSION(klon,nwave,naero_tot), INTENT(OUT)       :: tausum_aero
+  REAL, DIMENSION(klon,klev,nwave,naero_tot), INTENT(OUT)  :: tau3d_aero
+
+  INTEGER i, k, itr
+  REAL, DIMENSION(klon,klev) :: zdm, zdh
+  REAL zrho, pdel
+  !
+  ! Calculate the total mass of all soluble accumulation mode aerosols
+  ! to be revisited for AR6
+  !
+  mass_solu_aero(:,:)    = 0.0
+  mass_solu_aero_pi(:,:) = 0.0
+  !
+  DO itr=1,nbtr
+    IF (tname(itr+nqo)=='FINE') THEN
+      mass_solu_aero(:,:)    = tr_seri(:,:,itr)
+      mass_solu_aero_pi(:,:) = tr_seri(:,:,itr)
+    ENDIF
+  ENDDO
+
+  ! Calculate layer thickness
+  DO k = 1, klev
+    DO i = 1, klon
+      pdel=paprs(i,k)-paprs(i,k+1)
+      zrho=pplay(i,k)/t_seri(i,k)/RD             ! kg/m3
+      zdh(i,k)=pdel/(RG*zrho)                    ! m
+      zdm(i,k)=pdel/RG                           ! kg/m2
+    ENDDO
+  ENDDO
+
+!--new aerosol properties
+! aeropt_6bands for rrtm
+  CALL splaeropt_6bands_rrtm(       &
+       zdm, tr_seri, rhcl,          & 
+       tau_aero, piz_aero, cg_aero )
+
+! aeropt_5wv only for validation and diagnostics
+  CALL splaeropt_5wv_rrtm(          &
+       zdm, zdh, tr_seri, rhcl,     & 
+       tausum_aero, tau3d_aero )
+
+! LW optical properties for tropospheric aerosols
+  CALL splaeropt_lw_rrtm(ok_alw,zdm,tr_seri)
+
+END SUBROUTINE splaerosol_optic_rrtm
