Index: LMDZ5/branches/LMDZ5_SPLA/libf/phylmd/aeropt_spl.F
===================================================================
--- LMDZ5/branches/LMDZ5_SPLA/libf/phylmd/aeropt_spl.F	(revision 2175)
+++ LMDZ5/branches/LMDZ5_SPLA/libf/phylmd/aeropt_spl.F	(revision 2196)
@@ -1,4 +1,5 @@
       SUBROUTINE aeropt_spl(zdz, tr_seri, RHcl,
      .              id_prec, id_fine, id_coss, id_codu, id_scdu,
+     .              ok_chimeredust,
      .                      ztaue550,ztaue670,ztaue865,
      .                      taue550_tr2,taue670_tr2,taue865_tr2,
@@ -23,4 +24,5 @@
       REAL RHcl(klon,klev)     ! humidite relativen ciel clair
       INTEGER  id_prec, id_fine, id_coss, id_codu, id_scdu
+      LOGICAL ok_chimeredust
 c============================== OUTPUT =================================
       REAL ztaue550(klon) ! epaisseur optique aerosol 550 nm
@@ -47,4 +49,5 @@
       INTEGER rh_int
       PARAMETER (rh_int=12)
+      REAL auxreal
 c      REAL ss_a(nb_lambda,rh_int,nbtr-1)
 c      DATA ss_a/72*1./
@@ -72,6 +75,7 @@
 !JE20140915      DATA ss_dust/0.3188754,0.3430106,0.3829019/ !for bin 0.5-5um radius
 !JE20140915      DATA ss_dustsco/8.0582686E-02,8.1255026E-02,8.1861295E-02/ !for bin 5-15um radius
-      DATA ss_dust/0.5167768,0.5684330,0.6531643/ !for bin 0.5-3um radius
-      DATA ss_dustsco/0.1003391,0.1012288,0.1024651/ !for bin 3-15um radius
+
+!      DATA ss_dust/0.5167768,0.5684330,0.6531643/ !for bin 0.5-3um radius
+!      DATA ss_dustsco/0.1003391,0.1012288,0.1024651/ !for bin 3-15um radius
 
 
@@ -85,4 +89,12 @@
       DATA RH_tab/0.,10.,20.,30.,40.,50.,60.,70.,80.,85.,90.,95./
 c
+      IF (ok_chimeredust) THEN 
+      ss_dust=(/0.5167768,0.5684330,0.6531643/)
+      ss_dustsco=(/0.1003391,0.1012288,0.1024651/)
+      ELSE
+      ss_dust=(/0.564, 0.614, 0.700/)
+      ss_dustsco=(/0.,0.,0./)
+      ENDIF
+
       DO i=1, klon
         ztaue550(i)=0.0
@@ -106,5 +118,5 @@
       DO k=1, klev
       DO i=1, klon
-c
+c     
       rh=MIN(RHcl(i,k)*100.,RH_MAX)
       RH_num = INT( rh/10. + 1.)
@@ -124,8 +136,17 @@
      .            ss_acc550(RH_num))              !--m2/g
 cnhl_test TOTAL AOD
-        ztaue550(i)=ztaue550(i)+(alpha_acc*tr_seri(i,k,id_fine)+
-     .                 ss_ssalt550(RH_num)*tr_seri(i,k,id_coss)+
-     .                 ss_dust(1)*tr_seri(i,k,id_codu)+
-     .              ss_dustsco(1)*tr_seri(i,k,id_scdu)  )*zdz(i,k)*1.e6
+       auxreal=0.
+      IF(id_fine>0) auxreal=auxreal+alpha_acc*tr_seri(i,k,id_fine)
+      IF(id_coss>0) auxreal=auxreal+ss_ssalt550(RH_num)*
+     .                       tr_seri(i,k,id_coss)
+      IF(id_codu>0) auxreal=auxreal+ss_dust(1)*tr_seri(i,k,id_codu)
+      IF(id_scdu>0) auxreal=auxreal+ss_dustsco(1)*tr_seri(i,k,id_scdu)
+      ztaue550(i)=ztaue550(i)+auxreal*zdz(i,k)*1.e6
+    
+!JE20150128        ztaue550(i)=ztaue550(i)+(alpha_acc*tr_seri(i,k,id_fine)+
+!     .                 ss_ssalt550(RH_num)*tr_seri(i,k,id_coss)+
+!     .                 ss_dust(1)*tr_seri(i,k,id_codu)+
+!     .              ss_dustsco(1)*tr_seri(i,k,id_scdu)  )*zdz(i,k)*1.e6
+
 cnhl_test TOTAL AOD IS NOW AOD COARSE MODE ONLY
 cnhl_test        ztaue550(i)=ztaue550(i)+(                     
@@ -133,12 +154,13 @@
 cnhl_test     .                 ss_dust(1)*tr_seri(i,k,4))*zdz(i,k)*1.e6
 
-        taue550_tr2(i)=taue550_tr2(i)+alpha_acc*tr_seri(i,k,id_fine)*
-     .                 zdz(i,k)*1.e6
-        taue550_ss(i)=taue550_ss(i)+
+        IF(id_fine>0) taue550_tr2(i)=taue550_tr2(i)
+     .               + alpha_acc*tr_seri(i,k,id_fine)*zdz(i,k)*1.e6
+        IF(id_coss>0) taue550_ss(i)=taue550_ss(i)+
      .                ss_ssalt550(RH_num)*tr_seri(i,k,id_coss)*
      .                zdz(i,k)*1.e6
-        taue550_dust(i)=taue550_dust(i)+ss_dust(1)*tr_seri(i,k,id_codu)*
-     .                zdz(i,k)*1.e6
-        taue550_dustsco(i)=taue550_dustsco(i)+
+        IF(id_codu>0) taue550_dust(i)=taue550_dust(i)+
+     .                ss_dust(1)*tr_seri(i,k,id_codu)*
+     .                zdz(i,k)*1.e6
+        IF(id_scdu>0) taue550_dustsco(i)=taue550_dustsco(i)+
      .                ss_dustsco(1)*tr_seri(i,k,id_scdu)*
      .                zdz(i,k)*1.e6
@@ -151,16 +173,27 @@
         alpha_acc=ss_acc670(RH_num) + DELTA*(ss_acc670(RH_num+1)-
      .            ss_acc670(RH_num))              !--m2/g
-        ztaue670(i)=ztaue670(i)+(alpha_acc*tr_seri(i,k,id_fine)+
-     .                 ss_ssalt670(RH_num)*tr_seri(i,k,id_coss)+
-     .                 ss_dust(2)*tr_seri(i,k,id_codu)+
-     .               ss_dustsco(2)*tr_seri(i,k,id_scdu))*zdz(i,k)*1.e6
-        taue670_tr2(i)=taue670_tr2(i)+alpha_acc*tr_seri(i,k,id_fine)*
+      auxreal=0.
+      IF(id_fine>0) auxreal=auxreal+alpha_acc*tr_seri(i,k,id_fine)
+      IF(id_coss>0) auxreal=auxreal+ss_ssalt670(RH_num)
+     .                      *tr_seri(i,k,id_coss)
+      IF(id_codu>0) auxreal=auxreal+ss_dust(2)*tr_seri(i,k,id_codu)
+      IF(id_scdu>0) auxreal=auxreal+ss_dustsco(2)*tr_seri(i,k,id_scdu)
+      ztaue670(i)=ztaue670(i)+auxreal*zdz(i,k)*1.e6
+
+!JE20150128        ztaue670(i)=ztaue670(i)+(alpha_acc*tr_seri(i,k,id_fine)+
+!     .                 ss_ssalt670(RH_num)*tr_seri(i,k,id_coss)+
+!     .                 ss_dust(2)*tr_seri(i,k,id_codu)+
+!     .               ss_dustsco(2)*tr_seri(i,k,id_scdu))*zdz(i,k)*1.e6
+
+      IF(id_fine>0)  taue670_tr2(i)=taue670_tr2(i)+
+     .                alpha_acc*tr_seri(i,k,id_fine)*
      .                 zdz(i,k)*1.e6
-        taue670_ss(i)=taue670_ss(i)+
+      IF(id_coss>0)  taue670_ss(i)=taue670_ss(i)+
      .                ss_ssalt670(RH_num)*tr_seri(i,k,id_coss)*
      .                zdz(i,k)*1.e6
-        taue670_dust(i)=taue670_dust(i)+ss_dust(2)*tr_seri(i,k,id_codu)*
-     .                zdz(i,k)*1.e6
-        taue670_dustsco(i)=taue550_dustsco(i)+
+      IF(id_codu>0)  taue670_dust(i)=taue670_dust(i)
+     .                +ss_dust(2)*tr_seri(i,k,id_codu)*
+     .                zdz(i,k)*1.e6
+      IF(id_scdu>0)  taue670_dustsco(i)=taue550_dustsco(i)+
      .                ss_dustsco(2)*tr_seri(i,k,id_scdu)*
      .                zdz(i,k)*1.e6
@@ -171,16 +204,25 @@
         alpha_acc=ss_acc865(RH_num) + DELTA*(ss_acc865(RH_num+1)-
      .            ss_acc865(RH_num))              !--m2/g
-        ztaue865(i)=ztaue865(i)+(alpha_acc*tr_seri(i,k,id_fine)+
-     .                 ss_ssalt865(RH_num)*tr_seri(i,k,id_coss)+
-     .                 ss_dust(3)*tr_seri(i,k,id_codu)+
-     .               ss_dustsco(3)*tr_seri(i,k,id_scdu))*zdz(i,k)*1.e6
-        taue865_tr2(i)=taue865_tr2(i)+alpha_acc*tr_seri(i,k,id_fine)*
+        auxreal=0.
+      IF(id_fine>0) auxreal=auxreal+alpha_acc*tr_seri(i,k,id_fine)
+      IF(id_coss>0) auxreal=auxreal
+     .                     +ss_ssalt865(RH_num)*tr_seri(i,k,id_coss)
+      IF(id_codu>0) auxreal=auxreal+ss_dust(3)*tr_seri(i,k,id_codu)
+      IF(id_scdu>0) auxreal=auxreal+ss_dustsco(3)*tr_seri(i,k,id_scdu)
+        ztaue865(i)=ztaue865(i)+auxreal*zdz(i,k)*1.e6
+!JE20150128        ztaue865(i)=ztaue865(i)+(alpha_acc*tr_seri(i,k,id_fine)+
+!     .                 ss_ssalt865(RH_num)*tr_seri(i,k,id_coss)+
+!     .                 ss_dust(3)*tr_seri(i,k,id_codu)+
+!     .               ss_dustsco(3)*tr_seri(i,k,id_scdu))*zdz(i,k)*1.e6
+      IF(id_fine>0) taue865_tr2(i)=taue865_tr2(i)
+     .                +alpha_acc*tr_seri(i,k,id_fine)*
      .                 zdz(i,k)*1.e6
-        taue865_ss(i)=taue865_ss(i)+
+      IF(id_coss>0) taue865_ss(i)=taue865_ss(i)+
      .                ss_ssalt865(RH_num)*tr_seri(i,k,id_coss)*
      .                zdz(i,k)*1.e6
-        taue865_dust(i)=taue865_dust(i)+ss_dust(3)*tr_seri(i,k,id_codu)*
-     .                zdz(i,k)*1.e6
-        taue865_dustsco(i)=taue550_dustsco(i)+
+      IF(id_codu>0)  taue865_dust(i)=taue865_dust(i)
+     .                +ss_dust(3)*tr_seri(i,k,id_codu)*
+     .                zdz(i,k)*1.e6
+      IF(id_scdu>0)  taue865_dustsco(i)=taue550_dustsco(i)+
      .                ss_dustsco(3)*tr_seri(i,k,id_scdu)*
      .                zdz(i,k)*1.e6
@@ -188,5 +230,6 @@
 
 c
-       burden_ss(i)=burden_ss(i)+tr_seri(i,k,id_coss)*1.e6*1.e3*zdz(i,k)
+      IF(id_coss>0)  burden_ss(i)=burden_ss(i)
+     .                +tr_seri(i,k,id_coss)*1.e6*1.e3*zdz(i,k)
       ENDDO            !-loop on klev
       ENDDO            !-loop on klon
