Index: trunk/LMDZ.VENUS/libf/phyvenus/chemparam_mod.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/chemparam_mod.F90	(revision 1305)
+++ trunk/LMDZ.VENUS/libf/phyvenus/chemparam_mod.F90	(revision 1305)
@@ -0,0 +1,323 @@
+MODULE chemparam_mod
+
+!MODULE qui définit les indices des traceurs et leurs masses molaires.
+! utilise aussi pour variables communes nuages/photochimie
+
+IMPLICIT NONE
+
+!----------------------------------------------------------------------------  
+INTEGER, SAVE :: i_co2, i_co, i_h2, i_h2o, i_o1d,        &
+                 i_o, i_o2, i_o2dg, i_o3, i_h,           &
+                 i_oh, i_ho2, i_h2o2, i_cl, i_clo,       &
+                 i_cl2, i_hcl, i_hocl, i_clco, i_clco3,  &
+                 i_cocl2, i_s, i_so, i_so2, i_so3,       &
+                 i_s2o2, i_ocs, i_hso3, i_h2so4, i_s2,   &
+                 i_clso2, i_oscl, i_h2oliq, i_h2so4liq 
+                 
+REAL, DIMENSION(:), SAVE, ALLOCATABLE :: M_tr
+ 
+
+!----------------------------------------------------------------------------
+!     number of clouds layer modelized
+!      INTEGER, PARAMETER :: nbr_cloud = 1
+      INTEGER :: i_cloud
+      INTEGER, SAVE :: cloudmax
+      INTEGER, SAVE :: cloudmin
+      REAL, SAVE, DIMENSION(:,:), ALLOCATABLE :: R_MEDIAN
+      REAL, SAVE, DIMENSION(:,:), ALLOCATABLE :: STDDEV
+      REAL, SAVE :: RMI
+      REAL, SAVE :: RMA
+      REAL, SAVE, DIMENSION(:,:), ALLOCATABLE :: NBRTOT
+      REAL, SAVE, DIMENSION(:,:), ALLOCATABLE :: WH2SO4
+      REAL, SAVE, DIMENSION(:,:), ALLOCATABLE :: rho_droplet
+!----------------------------------------------------------------------------
+
+!---------------------------------------------------------------------------- 
+  CONTAINS
+!----------------------------------------------------------------------------
+
+  SUBROUTINE cloud_ini(nbr_lon,nbr_lev)
+
+!=============================================================
+!	cloud_ini definit le champ 3D des caracteristiques du nuage
+  
+      INTEGER :: nbr_lon,nbr_lev,i_lev
+    
+      ALLOCATE(NBRTOT(nbr_lon,nbr_lev))
+      ALLOCATE(R_MEDIAN(nbr_lon,nbr_lev))
+      ALLOCATE(STDDEV(nbr_lon,nbr_lev))
+      ALLOCATE(WH2SO4(nbr_lon,nbr_lev))
+      ALLOCATE(rho_droplet(nbr_lon,nbr_lev))
+            
+      PRINT*,'=========================='
+      PRINT*,'Initialisation cloud layer'
+      PRINT*,'=========================='
+      PRINT*,'nbr_lon',nbr_lon
+      PRINT*,'nbr_lev',nbr_lev
+      
+!=============================================================
+!		      Initialisation cloud layer 1
+!=============================================================
+!     cloudmin et cloudmax niveaux du GCM
+      cloudmin= 15
+      cloudmax= 50
+!     radius min et max en microns, *e-6 dans cloud_venus -> SETBIN
+!      RMI=0.001
+!      RMA=100.0
+!      NBRTOT= 0.
+
+!     radius R_MEDIAN en m (donc *e-6 pour microns)
+	
+	R_MEDIAN(:,:)=0.0		! Geometric Average Radius
+	STDDEV(:,:)=0.0	! Geometric Std Deviation
+
+!	===============================================
+!	Knollenberg & Hunten, 1980 and James et al 1997
+!	===============================================
+
+!     Lower Haze: mode 1
+      DO i_lev=cloudmin,20
+      R_MEDIAN(:,i_lev)=0.2e-6
+      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+      STDDEV(:,i_lev)=1.56
+      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+      END DO
+      	
+!     Lower Cloud: mode 2
+!      DO i_lev=21,23
+!      R_MEDIAN(:,i_lev)=1.4e-6
+!      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+!      STDDEV(:,i_lev)=1.23
+!      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+!      END DO
+
+!     Lower Cloud: mode 3
+      DO i_lev=21,23
+      R_MEDIAN(:,i_lev)=3.65e-6
+      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+      STDDEV(:,i_lev)=1.28
+      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+      END DO
+         
+!     Middle Cloud: mode 2 prime
+      DO i_lev=24,28
+      R_MEDIAN(:,i_lev)=1.4e-6
+      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+      STDDEV(:,i_lev)=1.23
+      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+      END DO
+   
+!     Middle Cloud: mode 3
+!      DO i_lev=24,28
+!      R_MEDIAN(:,i_lev)=3.65e-6
+!      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+!      STDDEV(:,i_lev)=1.28
+!      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+!      END DO
+   
+!     Middle Cloud: mode 4
+!      DO i_lev=24,28
+!      R_MEDIAN(:,i_lev)=7.0e-6
+!      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+!      STDDEV(:,i_lev)=1.3
+!      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+!      END DO
+
+!     Upper Cloud: mode 4
+!      DO i_lev=29,35
+!      R_MEDIAN(:,i_lev)=7.0e-6
+!      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+!      STDDEV(:,i_lev)=1.3
+!      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+!      END DO
+        
+!     Upper Cloud: mode 3
+!      DO i_lev=29,35
+!      R_MEDIAN(:,i_lev)=3.65e-6
+!      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+!      STDDEV(:,i_lev)=1.28
+!      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+!      END DO
+            
+!     Upper Cloud: mode 2
+      DO i_lev=29,35
+      R_MEDIAN(:,i_lev)=1.0e-6
+      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+      STDDEV(:,i_lev)=1.29
+      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+      END DO
+
+!     Upper Haze: mode 1
+      DO i_lev=36, cloudmax
+      R_MEDIAN(:,i_lev)=0.2e-6
+      PRINT*,'level',i_lev,'R R_MEDIAN',R_MEDIAN(1,i_lev)
+      STDDEV(:,i_lev)=2.16
+      PRINT*,'level',i_lev,'Dev Std',STDDEV(1,i_lev)
+      END DO
+       
+!=============================================================
+
+      PRINT*,'==============================='
+      PRINT*,'FIN Initialisation cloud layer'
+      PRINT*,'==============================='
+      
+	END SUBROUTINE 
+  
+  SUBROUTINE chemparam_ini
+  USE infotrac
+  IMPLICIT NONE
+  INTEGER :: i
+  
+  ALLOCATE(M_tr(nqtot))
+  
+  DO i=1, nqtot                                 
+	
+	PRINT*,'i',i
+	PRINT*,'tname(i)',tname(i)
+	
+  	SELECT CASE(tname(i))
+  		CASE('co2')
+  		i_co2=i
+  		PRINT*,'co2',i_co2
+  		M_tr(i_co2) = 44.0095  
+  		CASE('co')
+  		i_co=i
+  		PRINT*,'co',i_co
+  		M_tr(i_co)=28.0101 
+  		CASE('h2')
+  		i_h2=i
+  		PRINT*,'h2',i_h2
+  		M_tr(i_h2)= 18.0153
+  		CASE('h2o')
+  		i_h2o=i
+  		PRINT*,'h2o',i_h2o
+  		M_tr(i_h2o)=18.0153
+  		CASE('o1d')
+  		i_o1d=i
+  		PRINT*,'o1d',i_o1d
+  		M_tr(i_o1d)=15.994 
+  		CASE('o')
+  		i_o=i
+  		PRINT*,'o',i_o
+  		M_tr(i_o)=15.994 
+  		CASE('o2')
+  		i_o2=i
+  		PRINT*,'o2',i_o2
+  		M_tr(i_o2)=31.9988
+  		CASE('o2dg')
+  		i_o2dg=i
+  		PRINT*,'o2dg',i_o2dg
+  		M_tr(i_o2dg)=31.9988
+  		CASE('o3')
+  		i_o3=i
+  		PRINT*,'o3',i_o3
+  		M_tr(i_o3)= 47.9982 
+  		CASE('h')
+  		i_h=i
+  		PRINT*,'h',i_h
+  		M_tr(i_h)= 1.00794 
+  		CASE('oh')
+  		i_oh=i
+  		PRINT*,'oh',i_oh
+  		M_tr(i_oh)=17.0073
+  		CASE('ho2')
+  		i_ho2=i
+  		PRINT*,'ho2',i_ho2
+  		M_tr(i_ho2)=33.0067
+  		CASE('h2o2')
+  		i_h2o2=i
+  		PRINT*,'h2o2',i_h2o2
+  		M_tr(i_h2o2)=34.0147 
+  		CASE('cl')
+  		i_cl=i
+  		PRINT*,'cl',i_cl
+  		M_tr(i_cl)=35.453
+  		CASE('clo')
+  		i_clo=i
+  		PRINT*,'clo',i_clo
+  		M_tr(i_clo)=51.452
+  		CASE('cl2')
+  		i_cl2=i
+  		PRINT*,'cl2',i_cl2
+  		M_tr(i_cl2)=70.906
+  		CASE('hcl')
+  		i_hcl=i
+  		PRINT*,'hcl',i_hcl
+  		M_tr(i_hcl)=36.461
+  		CASE('hocl')
+  		i_hocl=i
+  		PRINT*,'hocl',i_hocl
+  		M_tr(i_hocl)=52.46
+  		CASE('clco')
+  		i_clco=i
+  		PRINT*,'clco',i_clco
+  		M_tr(i_clco)=63.463
+  		CASE('clco3')
+  		i_clco3=i
+  		PRINT*,'clco3',i_clco3
+  		M_tr(i_clco3)=95.462 
+  		CASE('cocl2')
+  		i_cocl2=i
+  		PRINT*,'cocl2',i_cocl2
+  		M_tr(i_cocl2)=98.916
+  		CASE('s')
+  		i_s=i
+  		PRINT*,'s',i_s
+  		M_tr(i_s)=32.065
+  		CASE('so')
+  		i_so=i
+  		PRINT*,'so',i_so
+  		M_tr(i_so)=48.0644
+  		CASE('so2')
+  		i_so2=i
+  		PRINT*,'so2',i_so2
+  		M_tr(i_so2)=64.064 
+  		CASE('so3')
+  		i_so3=i
+  		PRINT*,'so3',i_so3
+  		M_tr(i_so3)=80.063
+  		CASE('s2o2')
+  		i_s2o2=i
+  		PRINT*,'s2o2',i_s2o2
+  		M_tr(i_s2o2)= 96.1288 
+  		CASE('ocs')
+  		i_ocs=i
+  		PRINT*,'ocs',i_ocs
+  		M_tr(i_ocs)=60.0751
+  		CASE('hso3')
+  		i_hso3=i
+  		PRINT*,'hso3',i_hso3
+  		M_tr(i_hso3)=81.071
+  		CASE('h2so4')
+  		i_h2so4=i
+  		PRINT*,'h2so4',i_h2so4
+  		M_tr(i_h2so4)=98.078
+  		CASE('s2')
+  		i_s2=i
+  		PRINT*,'s2',i_s2
+  		M_tr(i_s2)=64.13
+  		CASE('clso2')
+  		i_clso2=i
+  		PRINT*,'clso2',i_clso2
+  		M_tr(i_clso2)=99.517
+  		CASE('oscl')
+  		i_oscl=i
+  		PRINT*,'oscl',i_oscl
+  		M_tr(i_oscl)=83.517
+  		CASE('h2oliq')
+  		i_h2oliq=i
+  		PRINT*,'h2oliq',i_h2oliq
+  		M_tr(i_h2oliq)=18.0153
+  		CASE('h2so4liq')
+  		i_h2so4liq=i
+  		PRINT*,'h2so4liq',i_h2so4liq
+  		M_tr(i_h2so4liq)=98.078
+  	END SELECT
+  	
+!  	PRINT*,'M_tr(i)',M_tr(i)
+  END DO
+  
+  END SUBROUTINE chemparam_ini
+  
+END MODULE chemparam_mod
+
Index: trunk/LMDZ.VENUS/libf/phyvenus/clesphys.h
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/clesphys.h	(revision 1301)
+++ trunk/LMDZ.VENUS/libf/phyvenus/clesphys.h	(revision 1305)
@@ -11,6 +11,7 @@
        LOGICAL ok_orodr,ok_orolf,ok_gw_nonoro
        LOGICAL ok_kzmin
+       LOGICAL ok_cloud, ok_chem, reinit_trac, ok_sedim
        INTEGER nbapp_rad, nbapp_chim, iflag_con, iflag_ajs
-       INTEGER lev_histhf, lev_histday, lev_histmth
+       INTEGER lev_histins, lev_histday, lev_histmth
        INTEGER tr_scheme
        REAL    ecriphy
@@ -19,12 +20,13 @@
        REAL    ksta, inertie
 
-       COMMON/clesphys_l/cycle_diurne, soil_model,                      &
-     &     ok_orodr, ok_orolf, ok_gw_nonoro, ok_kzmin
+       COMMON/clesphys_l/ cycle_diurne, soil_model,                     &
+     &     ok_orodr, ok_orolf, ok_gw_nonoro, ok_kzmin,                  &
+     &     ok_cloud, ok_chem, reinit_trac, ok_sedim
 
-       COMMON/clesphys_i/nbapp_rad, nbapp_chim,                         &
+       COMMON/clesphys_i/ nbapp_rad, nbapp_chim,                        &
      &     iflag_con, iflag_ajs,                                        &
-     &     lev_histhf, lev_histday, lev_histmth, tr_scheme
+     &     lev_histins, lev_histday, lev_histmth, tr_scheme
 
-       COMMON/clesphys_r/ecriphy, solaire, z0, lmixmin,                 &
+       COMMON/clesphys_r/ ecriphy, solaire, z0, lmixmin,                &
      &     ksta, inertie
 
Index: trunk/LMDZ.VENUS/libf/phyvenus/conf_phys.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/conf_phys.F90	(revision 1301)
+++ trunk/LMDZ.VENUS/libf/phyvenus/conf_phys.F90	(revision 1305)
@@ -191,4 +191,106 @@
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! PARAMETER FOR THE PLANETARY BOUNDARY LAYER AND SOIL
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+!Config Key  = iflag_pbl
+!Config Desc =
+!Config Def  = 1
+!Config Help =
+!
+! 2   = calculs Cd et K simples pour VENUS :
+!       parametres = z0, lmixmin, ksta (en dur: umin2,ric,cepdu2,karman)
+! 1   = calculs Cd et K issus LMDZ Terre
+!       parametres = ksta, ok_kzmin (et plein d'autres en dur...)
+! 6-9 = schema des thermiques Fred
+  iflag_pbl = 1
+  call getin('iflag_pbl',iflag_pbl)
+
+!
+!Config Key  = ksta
+!Config Desc =
+!Config Def  = 1.0e-7
+!Config Help =
+!
+  ksta = 1.0e-7
+  call getin('ksta',ksta)
+
+!
+!Config Key  = z0
+!Config Desc =
+!Config Def  = 1.0e-2
+!Config Help =
+!
+  z0 = 1.0e-2
+  call getin('z0',z0)
+
+!
+!Config Key  = lmixmin
+!Config Desc =
+!Config Def  = 35.
+!Config Help =
+!
+  lmixmin = 35.
+  call getin('lmixmin',lmixmin)
+
+!
+!Config Key  = ok_kzmin
+!Config Desc =
+!Config Def  = .false.
+!Config Help =
+!
+  ok_kzmin = .false.
+  call getin('ok_kzmin',ok_kzmin)
+
+
+!Config Key  = iflag_ajs
+!Config Desc =
+!Config Def  = 0
+!Config Help =
+!
+  iflag_ajs = 1
+  call getin('iflag_ajs',iflag_ajs)
+
+!
+!Config Key  = inertie
+!Config Desc =
+!Config Def  = 2000.
+!Config Help =
+!
+  inertie = 2000.
+  call getin('inertie',inertie)
+!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! PARAMETER FOR THE OUTPUT LEVELS
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+!Config Key  = lev_histins
+!Config Desc =
+!Config Def  = 0
+!Config Help =
+!
+  lev_histins = 0
+  call getin('lev_histins',lev_histins)
+
+!
+!Config Key  = lev_histday
+!Config Desc =
+!Config Def  = 1
+!Config Help =
+!
+  lev_histday = 1
+  call getin('lev_histday',lev_histday)
+
+!
+!Config Key  = lev_histmth
+!Config Desc =
+!Config Def  = 2
+!Config Help =
+!
+  lev_histmth = 2
+  call getin('lev_histmth',lev_histmth)
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! PARAMETER FOR THE TRACERS
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -206,110 +308,58 @@
 !       However, the variable 'source' could be used in physiq
 !       so the call to phytrac_emiss could be to initialise it.
-! 3   = Full chemistry
-!       To be added by Aurelien
+! 3   = Full chemistry and/or clouds => phytrac_chimie
+!       Need ok_chem or ok_cloud
   tr_scheme = 0
   call getin('tr_scheme',tr_scheme)
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! PARAMETER FOR THE PLANETARY BOUNDARY LAYER AND SOIL
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-!Config Key  = iflag_pbl
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-! 2   = calculs Cd et K simples pour VENUS :
-!       parametres = z0, lmixmin, ksta (en dur: umin2,ric,cepdu2,karman)
-! 1   = calculs Cd et K issus LMDZ Terre
-!       parametres = ksta, ok_kzmin (et plein d'autres en dur...)
-! 6-9 = schema des thermiques Fred
-  iflag_pbl = 1
-  call getin('iflag_pbl',iflag_pbl)
-
-!
-!Config Key  = ksta
-!Config Desc =
-!Config Def  = 1.0e-7
-!Config Help =
-!
-  ksta = 1.0e-7
-  call getin('ksta',ksta)
-
-!
-!Config Key  = z0
-!Config Desc =
-!Config Def  = 1.0e-2
-!Config Help =
-!
-  z0 = 1.0e-2
-  call getin('z0',z0)
-
-!
-!Config Key  = lmixmin
-!Config Desc =
-!Config Def  = 35.
-!Config Help =
-!
-  lmixmin = 35.
-  call getin('lmixmin',lmixmin)
-
-!
-!Config Key  = ok_kzmin
-!Config Desc =
-!Config Def  = .false.
-!Config Help =
-!
-  ok_kzmin = .false.
-  call getin('ok_kzmin',ok_kzmin)
-
-
-!Config Key  = iflag_ajs
-!Config Desc =
-!Config Def  = 0
-!Config Help =
-!
-  iflag_ajs = 1
-  call getin('iflag_ajs',iflag_ajs)
-
-!
-!Config Key  = inertie
-!Config Desc =
-!Config Def  = 2000.
-!Config Help =
-!
-  inertie = 2000.
-  call getin('inertie',inertie)
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! PARAMETER FOR THE OUTPUT LEVELS
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-!Config Key  = lev_histhf
-!Config Desc =
-!Config Def  = 0
-!Config Help =
-!
-  lev_histhf = 0
-  call getin('lev_histhf',lev_histhf)
-
-!
-!Config Key  = lev_histday
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  lev_histday = 1
-  call getin('lev_histday',lev_histday)
-
-!
-!Config Key  = lev_histmth
-!Config Desc =
-!Config Def  = 2
-!Config Help =
-!
-  lev_histmth = 2
-  call getin('lev_histmth',lev_histmth)
-
+!   PARAMETRES DE LA CHIMIE/NUAGE dans physiq.def
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!
+!Config Key  = reinit_trac
+!Config Desc =  
+!Config Def  = .FALSE.
+!Config Help = 
+!
+  reinit_trac = .FALSE.
+  call getin('reinit_trac',reinit_trac)
+  
+!
+!Config Key  = ok_cloud
+!Config Desc =  
+!Config Def  = .FALSE.
+!Config Help = 
+!
+  ok_cloud = .FALSE.
+  call getin('ok_cloud',ok_cloud)
+
+!
+!Config Key  = ok_chem
+!Config Desc =  
+!Config Def  = .FALSE.
+!Config Help = 
+!
+  ok_chem = .FALSE.
+  call getin('ok_chem',ok_chem)
+
+  if (((tr_scheme.ne.3).and.(ok_chem.or.ok_cloud)).or. &
+      ((tr_scheme.eq.3).and.(.not.ok_chem.and..not.ok_cloud))) then
+    write(*,*) "Attention, incoherence :" 
+    write(*,*) "tr_scheme=",tr_scheme," / ok_chem=",ok_chem, &
+                                     " / ok_cloud=",ok_cloud
+    write(*,*) "Verifier votre physiq.def"
+    stop
+  endif
+
+!
+!Config Key  = ok_sedim
+!Config Desc =  
+!Config Def  = .FALSE.
+!Config Help = 
+!
+  ok_sedim = .FALSE.
+  call getin('ok_sedim',ok_sedim)
+ 
 !
 !
@@ -352,7 +402,11 @@
   write(numout,*)' inertie = ', inertie 
   write(numout,*)' iflag_ajs = ', iflag_ajs
-  write(numout,*)' lev_histhf = ',lev_histhf 
+  write(numout,*)' lev_histins = ',lev_histins 
   write(numout,*)' lev_histday = ',lev_histday 
   write(numout,*)' lev_histmth = ',lev_histmth 
+  write(numout,*)' reinit_trac = ',reinit_trac
+  write(numout,*)' ok_cloud = ',ok_cloud
+  write(numout,*)' ok_chem = ',ok_chem
+  write(numout,*)' ok_sedim = ',ok_sedim
 
   return
Index: trunk/LMDZ.VENUS/libf/phyvenus/ini_histins.h
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/ini_histins.h	(revision 1301)
+++ trunk/LMDZ.VENUS/libf/phyvenus/ini_histins.h	(revision 1305)
@@ -18,5 +18,5 @@
 
 c-------------------------------------------------------
-      IF(lev_histday.GE.1) THEN
+      IF(lev_histins.GE.1) THEN
 c
 ccccccccccccc 2D fields, basics
@@ -54,8 +54,8 @@
 c    .                "ins(X)", zsto,zout)
 c
-      ENDIF !lev_histday.GE.1
-c
-c-------------------------------------------------------
-      IF(lev_histday.GE.2) THEN
+      ENDIF !lev_histins.GE.1
+c
+c-------------------------------------------------------
+      IF(lev_histins.GE.2) THEN
 c
 ccccccccccccc 3D fields, basics
@@ -102,9 +102,9 @@
 c
 c plusieurs traceurs
-          if (iflag_trac.eq.1) THEN
+         if (iflag_trac.eq.1) THEN
             DO iq=1,nqmax
              IF (iq.LE.99) THEN
           WRITE(str2,'(i2.2)') iq
-          CALL histdef(nid_ins, tname(iq), ttext(iq), "ppm",
+          CALL histdef(nid_ins, tname(iq), ttext(iq), "vmr",
      .                iim,jj_nb,nhori, klev,1,klev,nvert, 32,
      .                "ins(X)", zsto,zout)
@@ -114,5 +114,5 @@
              ENDIF 
             ENDDO
-          endif
+         endif
 c
          CALL histdef(nid_ins, "tops", "Solar rad. at TOA", "W/m2",
@@ -120,8 +120,40 @@
      .                "ins(X)", zsto,zout)
 c
-      ENDIF !lev_histday.GE.2
-c
-c-------------------------------------------------------
-      IF(lev_histday.GE.3) THEN
+         if (ok_cloud) THEN
+          CALL histdef(nid_ins, "NBRTOT", "Nbr total droplet", "#/cm3",
+     .                iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+          CALL histdef(nid_ins, "WH2SO4", "Weight fraction H2SO4",
+     .     "fraction",iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+          CALL histdef(nid_ins, "R_MEDIAN",
+     .     "Median radius fo log normal distribution" ,
+     .     "fraction",iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+          CALL histdef(nid_ins, "STDDEV",
+     .     "Std Deviation for lor normaldistribution",
+     .     "fraction",iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+          CALL histdef(nid_ins, "rho_droplet", "density cloud droplet",
+     .       "kg.m-3",iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+         endif
+
+         if (ok_sedim) THEN
+          CALL histdef(nid_ins,"d_tr_sed_H2SO4","H2SO4 mmr from sedim",
+     .        "kg/kg",iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+          CALL histdef(nid_ins,"d_tr_sed_H2O", "H2O mmr from sedim",
+     .        "kg/kg",iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+          CALL histdef(nid_ins, "F_sedim", "tendency from sedim",
+     .   "kg.m-2.s-1",iim,jj_nb,nhori, klev,1,klev, nvert, 32, 
+     .                "ins(X)", zsto,zout)
+         endif
+
+      ENDIF !lev_histins.GE.2
+c
+c-------------------------------------------------------
+      IF(lev_histins.GE.3) THEN
 c
 cccccccccccccccccc  Radiative transfer
@@ -167,8 +199,8 @@
 c    .                32, "ins(X)", zsto,zout)
 c
-      ENDIF !lev_histday.GE.3
-c
-c-------------------------------------------------------
-      IF(lev_histday.GE.4) THEN
+      ENDIF !lev_histins.GE.3
+c
+c-------------------------------------------------------
+      IF(lev_histins.GE.4) THEN
 c
          CALL histdef(nid_ins, "dtdyn", "Dynamics dT", "K/s",
@@ -216,8 +248,8 @@
 c    .                "ins(X)", zsto,zout)
 c
-      ENDIF !lev_histday.GE.4
-c
-c-------------------------------------------------------
-      IF(lev_histday.GE.5) THEN
+      ENDIF !lev_histins.GE.4
+c
+c-------------------------------------------------------
+      IF(lev_histins.GE.5) THEN
 c
 c        call histdef(nid_ins, "taux", 
@@ -239,5 +271,5 @@
 c    .                "ins(X)", zsto,zout)
 c
-      ENDIF !lev_histday.GE.5
+      ENDIF !lev_histins.GE.5
 c-------------------------------------------------------
 c
Index: trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_sedim.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_sedim.F	(revision 1305)
+++ trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_sedim.F	(revision 1305)
@@ -0,0 +1,289 @@
+      SUBROUTINE new_cloud_sedim(n_lon,n_lev,ptimestep,
+     &                pmidlay,pbndlay, 
+     &                pt,wgt_h2so4,pq,nq,Np,rho_p,
+     &                F_sed,pdqsed,pdqs_sed)
+
+      USE ioipsl
+      USE infotrac
+      USE control_mod
+      USE dimphy
+      USE comgeomphy
+      USE chemparam_mod
+      IMPLICIT NONE
+
+c=======================================================================
+c      
+c=======================================================================
+
+c-----------------------------------------------------------------------
+c   declarations:
+c   -------------
+#include "YOMCST.h"     
+c#include "dimensions.h"
+c#include "dimphys.h"
+c#include "comcstfi.h"
+c#include "tracer.h"
+c#include "callkeys.h"
+	
+c
+c   arguments:
+c   ----------
+
+      INTEGER n_lon                 ! number of horizontal grid points
+      INTEGER n_lev                 ! number of atmospheric layers
+      REAL ptimestep                ! physics time step (s)
+      REAL pmidlay(n_lon,n_lev)     ! pressure at middle layers (Pa)
+      REAL pt(n_lon,n_lev)          ! temperature at mid-layer (l)
+      REAL pbndlay(n_lon,n_lev+1)   ! pressure at layer boundaries
+c    Aerosol radius provided by the water ice microphysical scheme:
+c    rdroplet non utilise ???
+c      REAL rdroplet(n_lon,n_lev)   ! Dust geometric mean radius (m)
+c      REAL rice(n_lon,n_lev)      	! Ice geometric mean radius (m)
+      REAL wgt_h2so4(n_lon,n_lev)   ! Fraction of H2SO4 in droplet
+
+c    Traceurs :
+      integer nq                    ! number of tracers
+      real pq(n_lon,n_lev,nq)       ! tracers (kg/kg)
+c      real pdqfi(n_lon,n_lev,nq)   ! tendency before sedimentation (kg/kg.s-1)
+      real pdqsed(n_lon,n_lev,2)    ! tendency due to sedimentation (kg/kg)
+      real pdqs_sed(n_lon)          ! surface density (Flux if /ptimestep) at surface due to sedimentation (kg.m-2)
+      
+c   local:
+c   ------
+
+      integer ig
+      integer iq
+      integer l
+
+      real zlev(n_lon,n_lev+1)      ! altitude at layer boundaries
+      real zlay(n_lon,n_lev)        ! altitude at the midlle layer
+      real zqi_wv(n_lon,n_lev)      ! to locally store H2O tracer
+      real zqi_sa(n_lon,n_lev)      ! to locally store H2SO4 tracer
+      real m_lay (n_lon,n_lev)      ! Layer Pressure over gavity (Dp/g == kg.m-2)
+      real wq(n_lon,n_lev+1)        ! displaced tracer mass (kg.m-2)
+
+c    Physical constant
+c    ~~~~~~~~~~~~~~~~~
+c     Gas molecular viscosity (N.s.m-2)
+      real,parameter :: visc=1.e-5       ! CO2
+c     Effective gas molecular radius (m)
+      real,parameter :: molrad=2.2e-10   ! CO2
+      
+c     Cloud density (kg.m-3)
+c     ~~~~~~~~~~~~~~~~~~~~~~
+      real, DIMENSION(n_lon,n_lev) ::  rho_p
+
+      REAL, DIMENSION(n_lon,n_lev+1) ::
+     + wgt_SA                         ! Fraction of H2SO4 in droplet local
+
+c     Stokes speed and sedimentation flux variable
+c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+      REAL :: A1,A2,A3,A4,            ! coeff du DL du Flux de sedimentation
+     + D_stokes,                      ! coeff de la vitesse de Stokes
+     + Rp_DL,                         ! "Point" du DL
+     + l_mean,                        ! libre parcours moyen (m)
+     + a,b_exp,c                      ! coeff du calcul du Flux de sedimentation
+      REAL, DIMENSION(n_lon,n_lev) ::
+     + Np                             ! Nombre de particules (#.cm-3)
+      REAL, DIMENSION(n_lon,n_lev+1) ::
+     + F_sed                          ! Flux de sedimentation (kg.m-2.s-1 puis en output kg.m-2)
+      
+      
+      REAL :: R_mode0                 ! Rayon mode 0 (m), rayon le plus frequent
+
+
+
+c-----------------------------------------------------------------------
+c    1. Initialization
+c    -----------------
+    
+c     Updating the droplet mass mixing ratio with the partition H2O/H2SO4
+c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+      do l=1,n_lev
+         do ig=1,n_lon
+         zqi_wv(ig,l) = pq(ig,l,i_h2oliq)
+         zqi_sa(ig,l) = pq(ig,l,i_h2so4liq)
+         wgt_SA(ig,l) = wgt_h2so4(ig,l)
+         enddo
+      enddo 
+      
+      wgt_SA(:,n_lev+1) = 0.0D0
+      F_sed(:,n_lev+1) = 0.0D0
+
+c    Computing the different layer properties
+c    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+c    m_lay (kg.m-2), thickness(m), crossing time (s)  etc.
+c    Ici g=8.87, conflit pour g entre #include "YOMCST.h" 
+c	et #include "comcstfi.h"
+
+      do  l=1,n_lev
+         do ig=1, n_lon
+         m_lay(ig,l)=(pbndlay(ig,l) - pbndlay(ig,l+1)) /8.87d0 
+            IF (m_lay(ig,l).LE.0.0) THEN
+            PRINT*,'!!!! STOP PROBLEME SEDIMENTATION!!!!'
+            PRINT*,'!!!!          m_lay <= 0        !!!!'
+            PRINT*,'!!!! STOP PROBLEME SEDIMENTATION!!!!'
+            ENDIF
+         end do
+      end do
+	
+c         Computing sedimentation for droplet "tracer"
+c         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+c	    pbndlay(:,51)=0 (en parallèle c'est sûr), ne pas l'utiliser pour Fse
+	
+      DO l = 1, n_lev
+         DO ig=1,n_lon
+
+c   On calcule un Flux de sedimentation uniquement pour les couche avec une partie
+c   significative de droplet
+
+           IF ((Np(ig,l).GT.1.0e-20)) THEN
+
+c     RD=1000.*RNAVO*RKBOL/RMD avec RMD=43.44 Masse molaire atm venus en g.mol-1     
+           D_stokes=(rho_p(ig,l)-pmidlay(ig,l)/(RD*pt(ig,l)))
+     &	*2./9.*RG/visc
+      
+           l_mean=(pt(ig,l)/pmidlay(ig,l))*
+     &	(0.707*R/(4.*RPI* molrad*molrad * RNAVO))
+      
+           R_mode0=R_MEDIAN(ig,l)*EXP(-LOG(STDDEV(ig,l))**2.)
+              IF ((l_mean/(R_mode0)).LT.1.) THEN
+              Rp_DL=R_MEDIAN(ig,l)*EXP(3.*LOG(STDDEV(ig,l))**2.)
+              ELSE
+              Rp_DL=R_MEDIAN(ig,l)*EXP(4.*LOG(STDDEV(ig,l))**2.)
+              ENDIF
+		
+           a=1.246*l_mean
+	
+           c=0.87/l_mean
+	
+           b_exp=0.42*l_mean*EXP(-c*Rp_DL)
+	
+           A1=a+b_exp*(1.+c*Rp_DL
+     &	+0.5*(Rp_DL*c)**2
+     &	+1./6.*(Rp_DL*c)**3)
+     
+           A2=1.-b_exp*(c
+     &	+Rp_DL*c**2
+     &	+0.5*Rp_DL**2*c**3)
+	
+           A3=0.5*b_exp*(c**2+Rp_DL*c**3)
+	
+           A4=-b_exp*1./6.*c**3
+	
+           F_sed(ig,l)=rho_p(ig,l)*4./3.*RPI*
+     &	Np(ig,l)*1.0e6*D_stokes*(
+     &	A1*R_MEDIAN(ig,l)**4*EXP(8.0*LOG(STDDEV(ig,l))**2.)
+     &	+A2*R_MEDIAN(ig,l)**5*EXP(12.5*LOG(STDDEV(ig,l))**2.)
+     &	+A3*R_MEDIAN(ig,l)**6*EXP(18.0*LOG(STDDEV(ig,l))**2.)
+     &	+A4*R_MEDIAN(ig,l)**7*EXP(24.5*LOG(STDDEV(ig,l))**2.))
+     
+c      PRINT*,' AVANT dTime: F_sed=',F_sed(ig,l), ig, l
+     
+           F_sed(ig,l)=F_sed(ig,l)*ptimestep
+      
+c      PRINT*,' APRES dTime: F_sed=',F_sed(ig,l), ig, l
+      
+c      	IF (F_sed(ig,l).GT.m_lay(ig,l)) THEN
+c      	PRINT*,'==============================================='
+c      	PRINT*,'WARNING On a epuise la couche', ig, l
+c      	PRINT*,'F_sed:',F_sed(ig,l),'m_lay:',m_lay(ig,l)
+c      	PRINT*,'F_sed/dtphy',F_sed(ig,l)/ptimestep
+c      	PRINT*,'Pbnd top',pbndlay(ig,l+1),'Temp',pt(ig,l),'Rho',
+c     & 	rho_p(ig,l)
+c     		PRINT*,'Ntot',Np(ig,l),'Ntot m3',Np(ig,l)*1.0e6
+c     		PRINT*,'StdDev',STDDEV(ig,l),'Rmed',R_MEDIAN(ig,l)
+     		
+c     		ELSE
+c     		
+c     		PRINT*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+c      	PRINT*,'WARNING On a PAS epuise la couche', ig, l
+c      	PRINT*,'F_sed:',F_sed(ig,l),'m_lay:',m_lay(ig,l)
+c      	PRINT*,'F_sed/dtphy',F_sed(ig,l)/ptimestep
+c      	PRINT*,'Pbnd top',pbndlay(ig,l+1),'Temp',pt(ig,l),'Rho',
+c     & 	rho_p(ig,l)(ig,l)
+c     		PRINT*,'Ntot',Np(ig,l),'Ntot m3',Np(ig,l)*1.0e6
+c     		PRINT*,'StdDev',STDDEV(ig,l),'Rmed',R_MEDIAN(ig,l)     		
+c      	ENDIF
+      
+           ELSE
+           F_sed(ig,l)=0.0d0
+           ENDIF
+	
+           IF (F_sed(ig,l).LT.0.0e0) THEN
+	      PRINT*,"F_sed est négatif !!!"
+	      PRINT*,'F_sed:',F_sed(ig,l),'m_lay:',m_lay(ig,l)
+      	PRINT*,'F_sed/dtphy',F_sed(ig,l)/ptimestep
+      	PRINT*,'Pbnd top',pbndlay(ig,l+1),'Pmid',pmidlay(ig,l)
+      	PRINT*,'Temp',pt(ig,l),'Rho',
+     & 	rho_p(ig,l)
+     		PRINT*,'Ntot',Np(ig,l),'Ntot m3',Np(ig,l)*1.0e6
+     		PRINT*,'StdDev',STDDEV(ig,l),'Rmed',R_MEDIAN(ig,l)
+     		PRINT*,'A1',A1,'A2',A2
+     		PRINT*,'A3',A1,'A4',A2
+     		PRINT*,'D_stokes',D_stokes
+     		STOP
+           ENDIF
+	
+         ENDDO
+      ENDDO
+
+
+c	VENUS: le flux à la surface est fixé à 0
+c     les conditions P/T en surface ne permettent pas la condensation
+      DO ig=1,n_lon
+      pdqs_sed(ig) = 0.0d0
+      ENDDO
+      
+c         Compute the final tendency:
+c         ---------------------------
+
+c     Partie H2SO4l
+c     ~~~~~~~~~~~~
+c      CALL vlz_fi_par(n_lon,n_lev,zqi_sa,2.,m_lay,F_sed,wq)
+
+      DO l = 1, n_lev
+         DO ig=1,n_lon
+            zqi_sa(ig,l) = zqi_sa(ig,l) + (
+     &                         F_sed(ig,l+1)*wgt_SA(ig,l+1)
+     &                       - F_sed(ig,l)*wgt_SA(ig,l))
+     &                       / m_lay(ig,l) 
+            pdqsed(ig,l,1) = zqi_sa(ig,l) - pq(ig,l,i_h2so4liq)                       
+         ENDDO
+      ENDDO
+
+c     Partie H2Ol
+c     ~~~~~~~~~~~
+c      CALL vlz_fi_par(n_lon,n_lev,zqi_wv,2.,m_lay,F_sed,wq)
+                     
+      DO l = 1, n_lev
+         DO ig=1,n_lon
+            zqi_wv(ig,l) = zqi_wv(ig,l) + (
+     &                         F_sed(ig,l+1)*(1. - wgt_SA(ig,l+1))
+     &                       - F_sed(ig,l)*(1. - wgt_SA(ig,l)))
+     &                       / m_lay(ig,l)
+            pdqsed(ig,l,2) = zqi_wv(ig,l) - pq(ig,l,i_h2oliq)                   
+         ENDDO
+      ENDDO
+
+
+c		Save output file in 1D model
+c		============================ 
+	        
+c      IF (n_lon .EQ. 1) THEN
+c      PRINT*,'Save output sedim' 	
+c      DO l = 1, n_lev
+c      	DO ig=1,n_lon
+c      	WRITE(77,"(i4,','11(e15.8,','))") l,pdqsed(ig,l),zqi(ig,l),
+c     & 	(wgt_h2so4(ig,l)*pq(ig,l,i_h2so4liq)+
+c     & 	(1.-wgt_h2so4(ig,l))*pq(ig,l,i_h2oliq)),
+c     & 	pq(ig,l,i_h2so4liq),pq(ig,l,i_h2oliq)
+c      ENDDO
+c      	ENDDO
+c      ENDIF   
+
+      RETURN
+      END
+
Index: trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_venus.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_venus.F	(revision 1305)
+++ trunk/LMDZ.VENUS/libf/phyvenus/new_cloud_venus.F	(revision 1305)
@@ -0,0 +1,1324 @@
+!******************************************************************************
+!*     venus_SAS_composition SUBROUTINE
+!*     modified from
+!*     PROGRAM PSC_MODEL_E
+!*     by A. Määttänen
+!*     subroutine for LMDZ+photochemistry VENUS
+!*     by A. Stolzenbach
+!*
+!*     Input/Output files:
+!*     -------------------
+!*
+!----------------------------------------------------------------------------
+      SUBROUTINE new_cloud_venus(deltaT,NDTOT,
+     + MEDIAN,GSTDEV,tt,
+     + pp,ppwv,
+     + mr_wv,mr_sa,
+     + niv,
+     + mrt_wv,mrt_sa,
+     + WSA,
+     + PSSA,SATPSSA,
+     + RHOSASL)
+
+
+!      USE real16
+      USE chemparam_mod
+      IMPLICIT NONE
+
+!     Niveau (correspond pression, altitude fixe des couches nuageuses)
+      INTEGER niv
+
+
+!     Aerosol and PSC variables:
+      REAL 
+     +        WSA,WWV
+!      REAL  RMIN,RMAX
+!----------------------------------------------------------------------------
+!     Ambient air state variables:
+      REAL 
+     +        tt,pp,
+     +        mr_wv,mr_sa,
+     +        PPWV,PPSA,
+     +        PSSA,SATPSSA
+
+!----------------------------------------------------------------------------
+!     Physical constants:
+      REAL  MH2O,MH2SO4,MAIR,CWV,CSA !,CNA,MHNO3
+      PARAMETER(
+     +          MH2O=18.0153d-3,
+!     +          MHNO3=63.01d-3,
+     +          MH2SO4=98.078d-3,
+!     +          MAIR=28.9644d-3,
+!AM Venus
+     +          MAIR=43.45d-3,
+     +          CWV=MAIR/MH2O,
+!     +          CNA=MAIR/MHNO3,
+     +          CSA=MAIR/MH2SO4)
+!     Thermodynamic functions:
+      REAL  ROSAS 
+!AM 
+!     Mathematical constants:
+      REAL  PI
+      PARAMETER(PI=3.1415926536)
+      
+!----------------------------------------------------------------------------
+!     Time variables:
+	REAL deltaT
+!----------------------------------------------------------------------------
+!     Auxilary variables:
+      REAL  
+     +     NDTOT,MEDIAN,GSTDEV,
+     +     mrt_wv,mrt_sa,
+     +     NH2SO4,NH2O,
+     +     MASS, 
+     +     X0,X1,X2,X3,X4,X5,X6,
+     +     RHOSASL,MSAL,
+     +     waterps,condmass,RMH2S4
+      REAL  H2SO4,H2SO4_liq,H2O_liq
+      REAL  RSTDEV
+      REAL  RMEDRA
+      REAL  R2SO4
+      REAL  DENSO4
+      REAL  CONHS4
+      REAL  H2O
+      REAL  ACTSO4
+      REAL  CONCM
+      REAL  mrsa_conc
+      REAL  RNLOG
+
+! >>> Program starts here:
+
+
+!     mass of an H2SO4 molecule (g)
+      RMH2S4=98.078/(6.02214129d23)
+
+!AM Venus
+!Here we call a subroutine that contains a nucleation parametrisation for stratosphere and 
+!Venus and use that for calculating the number density of liquid sulfate aerosols. These 
+!aerosols will then be given an equilibrium composition for the given size distribution
+! calculates binary nucleation rate using revised theory, stauffer+binder&stauffer kinetics
+ ! and   noppel hydrate correction
+ ! t     temperature [K]
+ ! rehu    relative humidity %/100 which means 100%=1
+ ! rhoa  concentration of h2so4 vapour [1/m^3] 
+ ! x     mole fraction in the core of the critical cluster  
+ ! nwtot total number of water molecules in the critical cluster
+ ! natot total number of h2so4 molecules in the critical cluster
+ ! rc    radius of the critical cluster core [m]
+ ! jnuc  nucleation rate [1/m^3s] 
+
+  ! Hanna Vehkamäki and Markku Kulmala and Ismo Napari 
+  ! and Kari E. J. Lehtinen and Claudia Timmreck and Madis Noppel and Ari Laaksonen, 2002,
+  ! An improved parameterization for sulfuric acid/water nucleation rates for tropospheric 
+  !and stratospheric conditions, () J. Geophys. Res., 107, pp. 4622-4631
+
+ 
+             IF (niv.GE.cloudmin .AND. niv.LE.cloudmax) THEN
+
+              CALL WGTGV(MEDIAN,TT,PPWV,WSA,RHOSASL,MSAL)          
+
+              R2SO4=WSA*100.
+!     R2SO4 -> activity coeff (ACTSO4)
+              CALL STRAACT(R2SO4,ACTSO4)
+!              write(*,*) 'R2SO4,ACTSO4 ',R2SO4,ACTSO4
+!     R2SO4, T -> aerosol density (R2SO4)
+
+              DENSO4=ROSAS(TT,WSA)
+!	units g/cm3 required by the following routines
+              DENSO4=DENSO4*1.d-3            
+
+              CONCM= (PP)/(1.3806488D-23*TT) !air number density, molec/m3? CHECK UNITS!
+              CONCM=CONCM*1.d-6 !in molec./cm3
+
+		  NH2SO4=mrt_sa*CONCM
+		  NH2O=mrt_wv*CONCM
+
+              CALL CALNLOG_SAT(ACTSO4,NH2SO4,NH2O,WSA,DENSO4,GSTDEV,
+     +             MEDIAN,TT,RNLOG,H2SO4_liq,H2O_liq,
+     +		 PSSA,SATPSSA)
+
+		  
+!		  NDTOT nbr # pour 1cm3
+              NDTOT=RNLOG
+
+!      IF ((NDTOT.GT.1.0d+3).OR.
+!     & ((niv.GT.45).AND.(mr_wv.GT.1.0e-6))) THEN
+!      PRINT*,'PROBLEME GENERAL AVEC CES PUTAINS DE ROUTINES'
+!      PRINT*,'H2SO4COND',H2SO4_liq/CONCM,'H2SO4',mr_sa
+!      PRINT*,'DND2',SATPSSA*1.0d-6/(1.38D-23*TT)
+!      PRINT*,'NH2O',NH2O,'NH2SO4',NH2SO4
+!      PRINT*,'H2OCOND',H2O_liq/CONCM,'H2O',mr_wv
+!      PRINT*,'H2SO4tot',mrt_sa,'H2Otot',mrt_wv
+!      PRINT*,'MEDIAN',MEDIAN,'GSTDEV',GSTDEV
+!      PRINT*,'NBRTOT',NDTOT,'level',niv,'WSA',WSA
+!      STOP
+!      ENDIF
+      
+      
+          mr_wv=mrt_wv-H2O_liq/CONCM
+          mr_sa=mrt_sa-H2SO4_liq/CONCM
+          
+          
+!          Problmes quand on a condense tout, on peut obtenir des -1e-24
+!		aprs la soustraction et conversion de ND  VMR
+          IF (mr_wv.LT.0.0) THEN
+          mr_wv=0.0d0
+          END IF
+          
+          IF (mr_sa.LT.0.0) THEN
+          mr_sa=0.0d0
+          END IF
+	
+	
+             ELSE
+!             PRINT*,'**** NDTOT OUT CLOUD ****'
+             NDTOT=0.0d0
+             WSA=0.0d0
+             PSSA=0.0d0
+             SATPSSA=0.0d0
+             RHOSASL=0.0d0
+!             write(*,*) 'NDTOT = 0.0!!'
+             END IF
+             
+      END
+
+
+******************************************************************************
+*     SUBROUTINE WGTGV(RADIUS,TAIR,PPWV,WSAS,RHOSAS,MSA)
+******************************************************************************
+*
+*     This subroutine calculates the acid mass fraction, density, and
+*     mass of sulfuric acid in a single aerosol droplet of a specified 
+*     radius in equilibrium with ambient water vapor partial pressure 
+*     and temperature.
+*
+*     The calculation is performed by iteration of
+*        ln(PPWV) - [(2Mh2o sigma)/(R T r rho) - ln(ph2osa)] = 0
+*     using the secant method. Vapor pressures by Gmitro and Vermeulen
+*     (PWVSAS_GV) are used.  
+*
+*     Input/output variables:
+*     REAL(KIND=4)  RADIUS,TAIR,PPWV,WSAS,RHOSAS,MSA
+*
+*     Input:       
+*         RADIUS:  m         Radius of aerosol droplet
+*         TAIR:    K         Temperature of ambient air 
+*         PPWV:    Pa        Partial pressure of ambient water vapor 
+*
+*     Output:
+*         WSAS:              mass fraction of sulfuric acid. [0.1;1]
+*         RHOSAS:  kg/m**3   Density of sulfuric acid solution droplet
+*         MSA:     kg        Mass of sulfuric acid in droplet
+*          CALL WGTGV(PTSIZE(25,1),TAIR,PPPWV,WSA,MSA1)
+      SUBROUTINE WGTGV(RADIUS,TAIR,PPWV,WSAS,RHOSAS,MSA)
+!
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      REAL   RADIUS,TAIR,PPWV,WSAS,RHOSAS,MSA
+!
+!     Physical constants:
+      REAL   MH2O, RGAS
+      PARAMETER(
+!       Molar weight of water (kg/mole)
+     +          MH2O=18.0153d-3,
+!       Universal gas constant (J/(mole K))
+     +          RGAS=8.31441d0)
+!
+!     Mathematical constants:
+      REAL   PI
+      PARAMETER(PI=3.1415926536d0)
+
+!
+!     External functions needed:
+      REAL   PWVSAS_GV,STSAS,ROSAS
+!     PWVSAS_GV:      Natural logaritm of water vapor pressure over
+!                  sulfuric acid solution
+!     STSAS:       Surface tension of sulfuric acid solution
+!     ROSAS:       Density of sulfuric acid solution
+!
+!     Auxiliary local variables:
+      REAL   DELW,DELLP,C1,C2,W0,W1,W2,F0,F1,WGUESS,LPPWV,RO
+      INTEGER ITERAT,MAXITE
+      REAL   WMIN
+      PARAMETER(
+!         Minimum H2SO4 weight fraction:
+     +    WMIN=0.1D0,
+!         Relative error on iterated weight fraction:
+     +        DELW=0.001D0,
+!         Relative error on iterated ln(pressure):
+     +        DELLP=0.0001D0,
+!         Guess of sulfuric acid mass fraction:
+     +        WGUESS=0.7D0,
+!         Maximum iteration number:
+     +        MAXITE=20)
+
+!
+      PARAMETER(
+     +        C1=2.0d0*MH2O/RGAS,
+     +        C2=4.0d0*PI/3.0d0)
+!
+
+!----------------------------------------------------------------------------
+!      write(*,*) 'in wgtgv, tair, radius, ppwv ', 
+!     + tair, radius, ppwv
+
+      W0=WGUESS
+      LPPWV=DLOG(PPWV)
+!      write(*,*) lppwv
+      RO=ROSAS(TAIR,W0)
+      F0=LPPWV-C1*STSAS(TAIR,W0)/(TAIR*RADIUS*RO)-PWVSAS_GV(TAIR,W0)
+!      write(*,*) 'st pwvsas_gv ', STSAS(TAIR,W0), PWVSAS_GV(TAIR,W0)
+!      write(*,*) 'F0, RO ', F0, RO
+      W1=W0*1.01D0
+      ITERAT=0
+!----------------------------------------------------------------------------
+10    RO=ROSAS(TAIR,W1)
+      F1=LPPWV-C1*STSAS(TAIR,W1)/(TAIR*RADIUS*RO)-PWVSAS_GV(TAIR,W1)
+!      write(*,*) 'st pwvsas_gv ', STSAS(TAIR,W1), PWVSAS_GV(TAIR,W1)
+!      write(*,*) 'F1, RO ', F1, RO
+      IF(ABS(F1-F0).LT.DELLP) THEN
+          WSAS=W1
+!          write(*,*) 'wsas1 in wgtgv ', WSAS
+          RHOSAS=RO
+          MSA=C2*WSAS*RHOSAS*RADIUS**3
+      ELSE
+          W2=MAX(0.0D0,MIN((F1*W0-F0*W1)/(F1-F0),1.0D0))
+!          write(*,*) 'w2 max ', w2
+          ITERAT=ITERAT+1
+          IF(ABS(W2-W1).LT.DELW*ABS(W2).OR.ABS(F1).LT.DELLP.OR.
+     +             ITERAT.GT.MAXITE) THEN
+              WSAS=W2
+!              write(*,*) 'wsas2 in wgtgv ', WSAS
+              RHOSAS=RO
+              MSA=C2*WSAS*RHOSAS*RADIUS**3
+          ELSE
+              W0=W1
+              W1=W2
+!              write(*,*) 'w0, w1, endloop wgtgv ', W0, W1
+              F0=F1
+              GOTO 10
+          ENDIF
+      ENDIF
+      IF(WSAS.LT.WMIN) THEN
+          WSAS=WMIN
+          RHOSAS=ROSAS(TAIR,WMIN)
+      ENDIF
+
+      if(wsas .eq. 1.0) then
+         wsas=0.999999d0
+      endif
+
+
+!----------------------------------------------------------------------------
+      RETURN 
+      END
+
+
+!*****************************************************************************
+!*     REAL FUNCTION ROSAS(TAIR,WSA)                                         
+      REAL	FUNCTION ROSAS(TAIR,WSA)
+!*****************************************************************************
+!*
+!*     Density of liquid sulfuric acid solution.
+!*
+!*     Source: John H.Perry (ed.):Chemical Engineers Handbook,
+!*                                McGraw-Hill, New York 1963, p. 3-79 & 3-80
+!*
+!*     The original data set in temp. range 0 ! to 20 ! and weight pct.
+!*     0 to 100 % has been fitted with a polynomium of two variables
+!*     of order 5 in W and lineary in T. Fit quality better than 0.5 %
+!*
+!*     Input:  TAIR: Temperature  (K)
+!*             WSA:  Weight fraction of H2SO4  [0;1] 
+!*     Output: Density of sulfuric acid solution  (kg/m**3)
+!*
+!
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      INTEGER I
+      REAL   TAIR,WSA
+      REAL, DIMENSION(6) :: C
+      REAL, DIMENSION(6) :: A
+      REAL, DIMENSION(6) :: B
+      REAL, DIMENSION(6) :: D
+      DATA (A(I),I=1,6)/
+     # 1.00190D+03, 5.50496D+02, 1.54093D+03,-4.89219D+03, 7.56555D+03,
+     #-3.92739D+03/
+      DATA (B(I),I=1,6)/
+     # 1.98378D+01, 1.02256D+03,-1.48665D+03,-7.24651D+02, 3.68348D+03,
+     #-2.22159D+03/
+      DATA (D(I),I=1,6)/
+     #-6.97011E-02,-3.59886D+00, 5.24992D+00, 2.54047D+00,-1.29355D+01,
+     # 7.80553D+00/
+!C
+      DO I=1,6
+              C(I)=A(I)+B(I)+D(I)*TAIR
+      ENDDO
+
+      ROSAS=C(1)+WSA*(C(2)+WSA*(C(3)+WSA*(C(4)+WSA*(C(5)+WSA*C(6)))))
+      
+      RETURN
+      END function rosas
+
+*****************************************************************************
+*     REAL FUNCTION STSAS(TAIR,WSA)                                         *
+!    REAL FUNCTION STSAS(TAIR,WSA)
+*****************************************************************************
+*
+*     Surface tension of sulfuric acid solution/vapor.
+*
+*     Source: Tabazadeh et al. JGR, 102,23845,1997
+*             Sabinina & Terpugov: Z. Phys. Chem. A173 ,237, 1935.
+*
+*
+*     Input:  TAIR: Temperature (K)
+*             WSA:  Weight fraction of H2SO4  [0;1]
+*     Output: Surface tension of sulfuric acid solution (N/m)
+*
+!    IMPLICIT NONE
+!    REAL(KIND=4)  TAIR,WSA,W
+!    W=WSA*100.0d0
+!    STSAS=1.0d-3*(142.35d0-0.96525d0*W-TAIR*(0.22954d0-0.0033948d0*W))
+!    RETURN
+!    END
+*****************************************************************************
+*     REAL FUNCTION STSAS(TAIR,WSA)                                         *
+      REAL     FUNCTION STSAS(TAIR,WSA)
+*****************************************************************************
+*
+*     Surface tension of sulfuric acid solution/vapor.
+*
+*     Source: Tabazadeh et al. submitted,1999
+*             Myhre et al., J. Chem. Eng. Data 43,617,1998.
+*
+*
+*     Input:  TAIR: Temperature (K)
+*             WSA:  Weight fraction of H2SO4  [0;1]
+*     Output: Surface tension of sulfuric acid solution (N/m)
+*
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      REAL   TAIR,WSA,W,T,S180,S220,S260
+!
+      W=DBLE(WSA)*100.0D0
+      T=DBLE(TAIR)
+      IF(W.LT.40.0D0) THEN
+          T=DMAX1(180.0D0,DMIN1(T,260.0D0))
+          S220=(((((8.969257061D-7*W-1.145573827D-4)*W+5.415260617D-3)
+     +          *W-1.050692123D-1)*W+5.312072092D-1)*W+82.01197792D0)
+          IF(T.LE.220.0D0) THEN
+            S180=(((((1.736789787D-6*W-1.912224154D-4)*W+7.485866933D-3)
+     +          *W-1.103647657D-1)*W+9.541966318D-2)*W+85.75507114D0)
+!            STSAS=REAL(1.0D-3*(S220+(5.5D0-0.025D0*T)*(S180-S220)))
+            STSAS=1.0D-3*(S220+(5.5D0-0.025D0*T)*(S180-S220))
+          ELSE IF(T.GT.220.0D0) THEN
+            S260=(((((2.095358048D-7*W-2.384669516D-5)*W+8.87979880D-4)
+     +          *W-9.682499074D-3)*W-6.9631232740D-3)*W+77.40682664D0)
+!            STSAS=REAL(1.0D-3*(S260+(6.5D0-0.025D0*T)*(S220-S260)))
+            STSAS=1.0D-3*(S260+(6.5D0-0.025D0*T)*(S220-S260))
+          ENDIF
+      ELSE
+!          STSAS=1.0d-3*
+!     +        REAL(142.35D0-0.96525D0*W-TAIR*(0.22954D0-0.0033948D0*W))
+          STSAS=1.0d-3*
+     +        142.35D0-0.96525D0*W-TAIR*(0.22954D0-0.0033948D0*W)
+      ENDIF
+
+      RETURN
+      END
+*****************************************************************************
+*     REAL FUNCTION PWVSAS_GV(TAIR,WSA)                                        
+      REAL FUNCTION PWVSAS_GV(TAIR,WSA)
+*****************************************************************************
+*
+*     Natural logaritm of saturated water vapor pressure over plane
+*     sulfuric acid solution.
+*
+*     Source: J.I.Gmitro & T.Vermeulen: A.I.Ch.E.J.  10,740,1964.
+*             W.F.Giauque et al.: J. Amer. Chem. Soc. 82,62,1960.
+*
+*     The formula of Gmitro & Vermeulen for saturation pressure
+*     is used:
+*                 ln(p) = A ln(298/T) + B/T + C + DT
+*     with values of A,B,C and D given by Gmitro & Vermeulen,
+*     and calculated from partial molal properties given by Giauque et al.
+*     
+*     
+*
+*     Input:  TAIR: Temperature (K)
+*             WSA:  Weight fraction of H2SO4  [0;1] 
+*     Output: Natural logaritm of water vapor pressure 
+*             over sulfuric acid solution   ( ln(Pa) )
+*
+*
+*     External functions needed for calculation of partial molal 
+*     properties of pure components at 25 ! as function of W.
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      REAL  CPH2O,ALH2O,FFH2O,LH2O
+*     CPH2O:  Partial molal heat capacity of sulfuric acid solution.
+*     ALH2O:  Temparature derivative of CPH2O
+*     FFH2O:  Partial molal free energy of sulfuric acid solution.
+*     LH2O:   Partial molal enthalpy of sulfuric acid
+*
+!
+!
+      REAL   TAIR,WSA
+      REAL   ADOT,BDOT,CDOT,DDOT
+      REAL   RGAS,MMHGPA
+      REAL   K1,K2
+      REAL   A,B,C,D,CP,L,F,ALFA
+!     Physical constants given by Gmitro & Vermeulen:
+      PARAMETER(
+     +        ADOT=-3.67340,
+     +        BDOT=-4143.5,
+     +        CDOT=10.24353,
+     +        DDOT=0.618943d-3)
+      PARAMETER(
+!     Gas constant (cal/(deg mole)):
+     +        RGAS=1.98726,
+!     Natural logarith of conversion factor between atm. and Pa:     
+     +     MMHGPA=11.52608845, 
+     +     K1=298.15,
+     +     K2=K1*K1/2.0)
+!
+!
+      CP=CPH2O(WSA)
+      F=-FFH2O(WSA)
+      L=-LH2O(WSA)
+      ALFA=ALH2O(WSA)
+!
+      A=ADOT+(CP-K1*ALFA)/RGAS
+      B=BDOT+(L-K1*CP+K2*ALFA)/RGAS
+      C=CDOT+(CP+(F-L)/K1)/RGAS
+      D=DDOT-ALFA/(2.0d0*RGAS)
+!
+!     WRITE(*,*) 'TAIR= ',TAIR,'  WSA= ',WSA
+!     WRITE(*,*) 'CPH2O(WSA)= ',CP
+!     WRITE(*,*) 'ALFAH2O(WSA)= ',ALFA
+!     WRITE(*,*) 'FFH2O(WSA)= ',F
+!     WRITE(*,*) 'LH2O(WSA)= ',L
+!
+      PWVSAS_GV=A*DLOG(K1/TAIR)+B/TAIR+C+D*TAIR+MMHGPA
+      RETURN
+      END
+*******************************************************************************
+*     REAL FUNCTION CPH2O(W)
+      REAL FUNCTION CPH2O(W)
+*******************************************************************************
+*
+*     Relative partial molal heat capacity of water (cal/(deg mole) in 
+*     sulfuric acid solution, as a function of H2SO4 weight fraction [0;1],
+*     calculated by cubic spline fitting.
+*
+*     Source: Giauque et al.: J. Amer. Chem. Soc. 82,62,1960.
+*
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      INTEGER NPOINT,I
+      PARAMETER(NPOINT=109)
+      REAL   W,WTAB(NPOINT),CPHTAB(NPOINT),
+     +              Y2(NPOINT),YWORK(NPOINT),CPH
+      LOGICAL FIRST
+      DATA (WTAB(I),I=1,NPOINT)/
+     +0.00000,0.08932,0.09819,0.10792,0.11980,0.13461,0.15360,0.16525,
+     +0.17882,0.19482,0.21397,0.23728,0.26629,0.27999,0.29517,0.31209,
+     +0.33107,0.35251,0.36430,0.37691,0.39043,0.40495,0.42059,0.43749,
+     +0.44646,0.45580,0.46555,0.47572,0.48634,0.49745,0.50908,0.52126,
+     +0.53405,0.54747,0.56159,0.57646,0.58263,0.58893,0.59537,0.60195,
+     +0.60868,0.61557,0.62261,0.62981,0.63718,0.64472,0.65245,0.66037,
+     +0.66847,0.67678,0.68530,0.69404,0.70300,0.71220,0.72164,0.73133,
+     +0.73628,0.74129,0.74637,0.75152,0.75675,0.76204,0.76741,0.77286,
+     +0.77839,0.78399,0.78968,0.79545,0.80130,0.80724,0.81327,0.81939,
+     +0.82560,0.83191,0.83832,0.84482,0.85143,0.85814,0.86495,0.87188,
+     +0.87892,0.88607,0.89334,0.90073,0.90824,0.91588,0.92365,0.93156,
+     +0.93959,0.94777,0.95610,0.96457,0.97319,0.98196,0.99090,0.99270,
+     +0.99452,0.99634,0.99725,0.99817,0.99835,0.99853,0.99872,0.99890,
+     +0.99908,0.99927,0.99945,0.99963,0.99982/
+      DATA (CPHTAB(I),I=1,NPOINT)/
+     + 17.996, 17.896, 17.875, 17.858, 17.840, 17.820, 17.800, 17.791,
+     + 17.783, 17.777, 17.771, 17.769, 17.806, 17.891, 18.057, 18.248,
+     + 18.429, 18.567, 18.613, 18.640, 18.660, 18.660, 18.642, 18.592,
+     + 18.544, 18.468, 18.348, 18.187, 17.995, 17.782, 17.562, 17.352,
+     + 17.162, 16.993, 16.829, 16.657, 16.581, 16.497, 16.405, 16.302,
+     + 16.186, 16.053, 15.901, 15.730, 15.540, 15.329, 15.101, 14.853,
+     + 14.586, 14.296, 13.980, 13.638, 13.274, 12.896, 12.507, 12.111,
+     + 11.911, 11.711, 11.514, 11.320, 11.130, 10.940, 10.760, 10.570,
+     + 10.390, 10.200, 10.000, 9.8400, 9.7600, 9.7900, 9.9500, 10.310,
+     + 10.950, 11.960, 13.370, 15.060, 16.860, 18.550, 20.000, 21.170,
+     + 22.030, 22.570, 22.800, 22.750, 22.420, 21.850, 21.120, 20.280,
+     + 19.360, 18.350, 17.220, 15.940, 14.490, 12.840, 10.800, 9.8000,
+     + 7.8000, 3.8000,0.20000,-5.4000,-7.0000,-8.8000,-10.900,-13.500,
+     +-17.000,-22.000,-29.000,-40.000,-59.000/
+      DATA FIRST/.TRUE./
+      SAVE FIRST,WTAB,CPHTAB,Y2
+!
+      IF(FIRST) THEN
+          FIRST=.FALSE.
+          CALL SPLINE(WTAB,CPHTAB,NPOINT,YWORK,Y2)
+      ENDIF
+      CALL SPLINT(WTAB,CPHTAB,Y2,NPOINT,W,CPH)
+      CPH2O=CPH
+      RETURN
+      END
+!
+*******************************************************************************
+      REAL  FUNCTION FFH2O(W)
+*     REAL FUNCTION FFH2O(W)
+*******************************************************************************
+*
+*     Relative partial molal free energy water (cal/mole) in 
+*     sulfuric acid solution, as a function of H2SO4 weight fraction [0;1],
+*     calculated by cubic spline fitting.
+*
+*     Source: Giauque et al.: J. Amer. Chem. Soc. 82,62,1960.
+*
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      INTEGER NPOINT,I
+      PARAMETER(NPOINT=110)
+      REAL   W,WTAB(NPOINT),FFTAB(NPOINT),
+     +              Y2(NPOINT),YWORK(NPOINT),FF
+      LOGICAL FIRST
+      DATA (WTAB(I),I=1,NPOINT)/
+     +0.00000,0.08932,0.09819,0.10792,0.11980,0.13461,0.15360,0.16525,
+     +0.17882,0.19482,0.21397,0.23728,0.26629,0.27999,0.29517,0.31209,
+     +0.33107,0.35251,0.36430,0.37691,0.39043,0.40495,0.42059,0.43749,
+     +0.44646,0.45580,0.46555,0.47572,0.48634,0.49745,0.50908,0.52126,
+     +0.53405,0.54747,0.56159,0.57646,0.58263,0.58893,0.59537,0.60195,
+     +0.60868,0.61557,0.62261,0.62981,0.63718,0.64472,0.65245,0.66037,
+     +0.66847,0.67678,0.68530,0.69404,0.70300,0.71220,0.72164,0.73133,
+     +0.73628,0.74129,0.74637,0.75152,0.75675,0.76204,0.76741,0.77286,
+     +0.77839,0.78399,0.78968,0.79545,0.80130,0.80724,0.81327,0.81939,
+     +0.82560,0.83191,0.83832,0.84482,0.85143,0.85814,0.86495,0.87188,
+     +0.87892,0.88607,0.89334,0.90073,0.90824,0.91588,0.92365,0.93156,
+     +0.93959,0.94777,0.95610,0.96457,0.97319,0.98196,0.99090,0.99270,
+     +0.99452,0.99634,0.99725,0.99817,0.99835,0.99853,0.99872,0.99890,
+     +0.99908,0.99927,0.99945,0.99963,0.99982, 1.0000/
+      DATA (FFTAB(I),I=1,NPOINT)/
+     +0.00000, 22.840, 25.810, 29.250, 33.790, 39.970, 48.690, 54.560,
+     + 61.990, 71.790, 85.040, 103.70, 130.70, 145.20, 163.00, 184.50,
+     + 211.50, 245.60, 266.40, 290.10, 317.40, 349.00, 385.60, 428.40,
+     + 452.50, 478.80, 507.50, 538.80, 573.30, 611.60, 653.70, 700.50,
+     + 752.60, 810.60, 875.60, 948.60, 980.60, 1014.3, 1049.7, 1087.1,
+     + 1126.7, 1168.7, 1213.5, 1261.2, 1312.0, 1366.2, 1424.3, 1486.0,
+     + 1551.8, 1622.3, 1697.8, 1778.5, 1864.9, 1956.8, 2055.8, 2162.0,
+     + 2218.0, 2276.0, 2337.0, 2400.0, 2466.0, 2535.0, 2607.0, 2682.0,
+     + 2760.0, 2842.0, 2928.0, 3018.0, 3111.0, 3209.0, 3311.0, 3417.0,
+     + 3527.0, 3640.0, 3757.0, 3878.0, 4002.0, 4130.0, 4262.0, 4397.0,
+     + 4535.0, 4678.0, 4824.0, 4973.0, 5128.0, 5287.0, 5454.0, 5630.0,
+     + 5820.0, 6031.0, 6268.0, 6541.0, 6873.0, 7318.0, 8054.0, 8284.0,
+     + 8579.0, 8997.0, 9295.0, 9720.0, 9831.0, 9954.0, 10092., 10248.,
+     + 10423., 10618., 10838., 11099., 11460., 12014./
+      DATA FIRST/.TRUE./
+      SAVE FIRST,WTAB,FFTAB,Y2
+!
+      IF(FIRST) THEN
+          FIRST=.FALSE.
+          CALL SPLINE(WTAB,FFTAB,NPOINT,YWORK,Y2)
+      ENDIF
+      CALL SPLINT(WTAB,FFTAB,Y2,NPOINT,W,FF)
+      FFH2O=FF
+      RETURN
+      END
+!
+*******************************************************************************
+      REAL FUNCTION LH2O(W)
+*     REAL FUNCTION LH2O(W)
+*******************************************************************************
+*
+*     Relative partial molal heat content of water (cal/mole) in 
+*     sulfuric acid solution, as a function of H2SO4 weight fraction [0;1],
+*     calculated by cubic spline fitting.
+*
+*     Source: Giauque et al.: J. Amer. Chem. Soc. 82,62,1960.
+*
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      INTEGER NPOINT,I
+      PARAMETER(NPOINT=110)
+      REAL   W,WTAB(NPOINT),LTAB(NPOINT),
+     +              Y2(NPOINT),YWORK(NPOINT),L
+      LOGICAL FIRST
+      DATA (WTAB(I),I=1,NPOINT)/
+     +0.00000,0.08932,0.09819,0.10792,0.11980,0.13461,0.15360,0.16525,
+     +0.17882,0.19482,0.21397,0.23728,0.26629,0.27999,0.29517,0.31209,
+     +0.33107,0.35251,0.36430,0.37691,0.39043,0.40495,0.42059,0.43749,
+     +0.44646,0.45580,0.46555,0.47572,0.48634,0.49745,0.50908,0.52126,
+     +0.53405,0.54747,0.56159,0.57646,0.58263,0.58893,0.59537,0.60195,
+     +0.60868,0.61557,0.62261,0.62981,0.63718,0.64472,0.65245,0.66037,
+     +0.66847,0.67678,0.68530,0.69404,0.70300,0.71220,0.72164,0.73133,
+     +0.73628,0.74129,0.74637,0.75152,0.75675,0.76204,0.76741,0.77286,
+     +0.77839,0.78399,0.78968,0.79545,0.80130,0.80724,0.81327,0.81939,
+     +0.82560,0.83191,0.83832,0.84482,0.85143,0.85814,0.86495,0.87188,
+     +0.87892,0.88607,0.89334,0.90073,0.90824,0.91588,0.92365,0.93156,
+     +0.93959,0.94777,0.95610,0.96457,0.97319,0.98196,0.99090,0.99270,
+     +0.99452,0.99634,0.99725,0.99817,0.99835,0.99853,0.99872,0.99890,
+     +0.99908,0.99927,0.99945,0.99963,0.99982, 1.0000/
+      DATA (LTAB(I),I=1,NPOINT)/
+     +0.00000, 5.2900, 6.1000, 7.1800, 8.7800, 11.210, 15.290, 18.680,
+     + 23.700, 31.180, 42.500, 59.900, 89.200, 106.70, 128.60, 156.00,
+     + 190.40, 233.80, 260.10, 290.00, 324.00, 362.50, 406.50, 456.10,
+     + 483.20, 512.40, 543.60, 577.40, 613.80, 653.50, 696.70, 744.50,
+     + 797.20, 855.80, 921.70, 995.70, 1028.1, 1062.3, 1098.3, 1136.4,
+     + 1176.7, 1219.3, 1264.7, 1313.0, 1364.3, 1418.9, 1477.3, 1539.9,
+     + 1607.2, 1679.7, 1757.9, 1842.7, 1934.8, 2035.4, 2145.5, 2267.0,
+     + 2332.0, 2401.0, 2473.0, 2550.0, 2631.0, 2716.0, 2807.0, 2904.0,
+     + 3007.0, 3118.0, 3238.0, 3367.0, 3507.0, 3657.0, 3821.0, 3997.0,
+     + 4186.0, 4387.0, 4599.0, 4819.0, 5039.0, 5258.0, 5476.0, 5694.0,
+     + 5906.0, 6103.0, 6275.0, 6434.0, 6592.0, 6743.0, 6880.0, 7008.0,
+     + 7133.0, 7255.0, 7376.0, 7497.0, 7618.0, 7739.0, 7855.0, 7876.0,
+     + 7905.0, 7985.0, 8110.0, 8415.0, 8515.0, 8655.0, 8835.0, 9125.0,
+     + 9575.0, 10325., 11575., 13500., 15200., 16125./
+      DATA FIRST/.TRUE./
+      SAVE FIRST,WTAB,LTAB,Y2
+!
+      IF(FIRST) THEN
+          FIRST=.FALSE.
+          CALL SPLINE(WTAB,LTAB,NPOINT,YWORK,Y2)
+      ENDIF
+      CALL SPLINT(WTAB,LTAB,Y2,NPOINT,W,L)
+      LH2O=L
+      RETURN
+      END
+*******************************************************************************
+      REAL FUNCTION ALH2O(W)
+*     REAL FUNCTION ALH2O(W)
+*******************************************************************************
+*
+*     Relative partial molal temperature derivative of heat capacity (water) 
+*     in sulfuric acid solution, (cal/deg**2), calculated by 
+*     cubic spline fitting.
+*
+*     Source: Giauque et al.: J. Amer. Chem. Soc. 82,62,1960.
+*
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      INTEGER NPOINT,I
+      PARAMETER(NPOINT=96)
+      REAL   W,WTAB(NPOINT),ATAB(NPOINT),
+     +              Y2(NPOINT),YWORK(NPOINT),A
+      LOGICAL FIRST
+      DATA (WTAB(I),I=1,NPOINT)/
+     +0.29517,0.31209,
+     +0.33107,0.35251,0.36430,0.37691,0.39043,0.40495,0.42059,0.43749,
+     +0.44646,0.45580,0.46555,0.47572,0.48634,0.49745,0.50908,0.52126,
+     +0.53405,0.54747,0.56159,0.57646,0.58263,0.58893,0.59537,0.60195,
+     +0.60868,0.61557,0.62261,0.62981,0.63718,0.64472,0.65245,0.66037,
+     +0.66847,0.67678,0.68530,0.69404,0.70300,0.71220,0.72164,0.73133,
+     +0.73628,0.74129,0.74637,0.75152,0.75675,0.76204,0.76741,0.77286,
+     +0.77839,0.78399,0.78968,0.79545,0.80130,0.80724,0.81327,0.81939,
+     +0.82560,0.83191,0.83832,0.84482,0.85143,0.85814,0.86495,0.87188,
+     +0.87892,0.88607,0.89334,0.90073,0.90824,0.91588,0.92365,0.93156,
+     +0.93959,0.94777,0.95610,0.96457,0.97319,0.98196,0.99090,0.99270,
+     +0.99452,0.99634,0.99725,0.99817,0.99835,0.99853,0.99872,0.99890,
+     +0.99908,0.99927,0.99945,0.99963,0.99982, 1.0000/
+      DATA (ATAB(I),I=1,NPOINT)/
+     + 0.0190, 0.0182, 0.0180, 0.0177, 0.0174, 0.0169, 0.0167, 0.0164,
+     + 0.0172, 0.0212, 0.0239, 0.0264, 0.0276, 0.0273, 0.0259, 0.0238,
+     + 0.0213, 0.0190, 0.0170, 0.0155, 0.0143, 0.0133, 0.0129, 0.0124,
+     + 0.0120, 0.0114, 0.0106, 0.0097, 0.0084, 0.0067, 0.0047, 0.0024,
+     +-0.0002,-0.0031,-0.0063,-0.0097,-0.0136,-0.0178,-0.0221,-0.0263,
+     +-0.0303,-0.0340,-0.0352,-0.0360,-0.0362,-0.0356,-0.0343,-0.0321,
+     +-0.0290,-0.0251,-0.0201,-0.0137,-0.0058, 0.0033, 0.0136, 0.0254,
+     + 0.0388, 0.0550, 0.0738, 0.0962, 0.1198, 0.1300, 0.1208, 0.0790,
+     + 0.0348, 0.0058,-0.0102,-0.0211,-0.0292,-0.0350,-0.0390,-0.0418,
+     +-0.0432,-0.0436,-0.0429,-0.0411,-0.0384,-0.0346,-0.0292,-0.0220,
+     +-0.0130,-0.0110,-0.0080,-0.0060,-0.0040,-0.0030,-0.0030,-0.0020,
+     +-0.0020,-0.0020,-0.0020,-0.0010,-0.0010, 0.0000, 0.0000, 0.0000/
+      DATA FIRST/.TRUE./
+      SAVE FIRST,WTAB,ATAB,Y2
+!
+      IF(FIRST) THEN
+          FIRST=.FALSE.
+          CALL SPLINE(WTAB,ATAB,NPOINT,YWORK,Y2)
+      ENDIF
+      CALL SPLINT(WTAB,ATAB,Y2,NPOINT,MAX(WTAB(1),W),A)
+      ALH2O=A
+      RETURN
+      END
+!******************************************************************************
+      SUBROUTINE SPLINE(X,Y,N,WORK,Y2)
+!******************************************************************************
+!     Routine to calculate 2.nd derivatives of tabulated function
+!     Y(i)=Y(Xi), to be used for cubic spline calculation.
+!
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      INTEGER N,I
+      REAL   X(N),Y(N),WORK(N),Y2(N)
+      REAL   SIG,P,QN,UN,YP1,YPN
+
+!AM Venus: Let's check the values
+!      write(*,*) 'In spline, N ', N
+
+      YP1=(Y(2)-Y(1))/(X(2)-X(1))
+      YPN=(Y(N)-Y(N-1))/(X(N)-X(N-1))
+      IF(YP1.GT.99.0E+30) THEN
+          Y2(1)=0.0
+          WORK(1)=0.0
+      ELSE
+          Y2(1)=-0.5d0
+          WORK(1)=(3.0d0/(X(2)-X(1)))*((Y(2)-Y(1))/(X(2)-X(1))-YP1)
+      ENDIF
+      DO I=2,N-1
+!         write(*,*) 'In spline, I ', I
+          SIG=(X(I)-X(I-1))/(X(I+1)-X(I-1))
+          P=SIG*Y2(I-1)+2.0d0
+          Y2(I)=(SIG-1.0d0)/P
+          WORK(I)=(6.0d0*((Y(I+1)-Y(I))/(X(I+1)-X(I))-(Y(I)-Y(I-1))
+     +             /(X(I)-X(I-1)))/(X(I+1)-X(I-1))-SIG*WORK(I-1))/P
+      ENDDO
+      IF(YPN.GT.99.0E+30) THEN
+          QN=0.0
+          UN=0.0
+      ELSE
+          QN=0.5d0
+          UN=(3.0d0/(X(N)-X(N-1)))*(YPN-(Y(N)-Y(N-1))/(X(N)-X(N-1)))
+      ENDIF
+      Y2(N)=(UN-QN*WORK(N-1))/(QN*Y2(N-1)+1.0d0)
+      DO I=N-1,1,-1
+!         write(*,*) 'In spline, I ', I
+          Y2(I)=Y2(I)*Y2(I+1)+WORK(I)
+      ENDDO
+!
+      RETURN
+      END
+
+!******************************************************************************
+      SUBROUTINE SPLINT(XA,YA,Y2A,N,X,Y)
+!******************************************************************************
+!     Cubic spline calculation
+!
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+      INTEGER KLO,KHI,N,K
+      REAL   XA(N),YA(N),Y2A(N)
+      REAL   X,Y,H,A,B
+!
+      KLO=1
+      KHI=N
+ 1    IF(KHI-KLO.GT.1) THEN
+          K=(KHI+KLO)/2
+          IF(XA(K).GT.X) THEN
+              KHI=K
+          ELSE
+              KLO=K
+          ENDIF
+          GOTO 1
+      ENDIF
+      H=XA(KHI)-XA(KLO)
+      A=(XA(KHI)-X)/H
+      B=(X-XA(KLO))/H
+      Y=A*YA(KLO)+B*YA(KHI)+
+     +        ((A**3-A)*Y2A(KLO)+(B**3-B)*Y2A(KHI))*(H**2)/6.0d0
+!
+      RETURN
+      END
+!******************************************************************
+      SUBROUTINE CALNLOG_SAT(ACTSO4,H2SO4,H2O,WFSA,DENSO4,RSTDEV,
+     + RMEDRA,T,RNLOG,H2SO4COND,H2OCOND,
+     + acidps,satpacid)
+
+!     DERIVE NO (TOTAL NUMBER OF AEROSOL PARTICLES CONCENTRATION) 
+!     FROM TOTAL H2SO4 AND RMOD/SIGMA OF AEROSOL LOG-NORMAL 
+!                                       SIZE DISTRIBTUION
+!     ASSUMING ALL THE H2SO4 ABOVE MIXTURE SAT PRESSURE IS CONDENSED
+!    ---------------------------------------------------------------
+!     INPUT:
+!     ACTSO4: H2SO4 activity 
+!     H2SO4: #/cm3 of total H2SO4
+!	H2O  : #/cm3 of total H2O
+!     WFSA: aerosol H2SO4 weight fraction (fraction)
+!     DENSO4: aerosol volumic mass (gr/cm3 = aerosol mass/aerosol volume)
+!!       for total mass, almost same result with ro=1.67 gr/cm3
+!     RSTDEV: standard deviation of aerosol distribution (no unit)
+!     RMEDRA: median radius (m)
+!     RMEDR : median radius converti en cm
+!     T: temperature (K)
+!
+!     OUTPUT: 
+!     RNLOG: total number of aerosol particles (VMR)
+!     RNLOG is in the same units as H2SO4
+!     if H2SO4 is in number density (for example, molec/cm3), 
+!          RNLOG (number of particles/cm3), etc...
+!	H2OCOND
+!	H2SO4COND
+
+!      USE real16
+      IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+!      INTEGER NOLAT,NOLEV
+      REAL  H2SO4, H2O, WFSA, ACTSO4
+      REAL  H2OCOND, H2SO4COND
+      REAL  RSTDEV, RMEDRA
+      REAL  DENSO4,  T
+      REAL  RNLOG,RMEDR
+!     working variables
+      INTEGER I,J
+      REAL  RMH2S4,PI1,RMTOT
+      REAL  DND2,pstand,lpar,acidps
+      REAL  x1, satpacid
+      REAL , DIMENSION(2):: act
+!
+!     masse of an H2SO4 molecule (g)
+      RMH2S4=98.078/(6.02214129e23)
+      
+!     3/4*PI
+      PI1    =3./(4.0*4.0*ATAN(1.0))
+
+      RMEDR=RMEDRA*1.e2 !AM: this needs to be in cm!
+      
+      pstand=1.01325e5 !Pa  1 atm pressure
+
+        x1=(WFSA/98.08)/(WFSA/98.08 + ((1.-WFSA)/18.0153))
+
+        call zeleznik(x1,t,act)
+
+!pure acid satur vapor pressure
+        lpar= -11.695+DLOG(pstand) ! Zeleznik
+        acidps=1/360.15-1.0/t+0.38/545.
+     + *(1.0+DLOG(360.15/t)-360.15/t)
+        acidps = 10156.0*acidps +lpar
+        acidps = DEXP(acidps)    !Pa
+
+!acid sat.vap.pres over mixture (flat surface):
+        satpacid=act(2)*acidps ! Pa 
+
+!       Conversion from Pa to N.D #/m3
+        DND2=satpacid/(1.3806488e-23*T)
+!       Conversion from N.D #/m3 TO #/cm3
+        DND2=DND2*1.d-6
+	        
+!	H2SO4COND N.D #/cm3 condensee ssi H2SO4>H2SO4sat
+	IF (H2SO4.GE.DND2) THEN
+	H2SO4COND=H2SO4-DND2
+!	calcul de H2O cond correspondant a H2SO4 cond
+	H2OCOND=H2SO4COND*98.078*(1.0-WFSA)/(18.0153*WFSA)
+
+!     RMTOT: = Mass of H2SO4 satur per cm3 of air/ Mass of sulfuric acid part of droplet solution per cm3 
+!	RMTOT=M_distrib/rho_droplet
+	
+	RMTOT=H2SO4COND*RMH2S4/(DENSO4*WFSA)
+
+!
+!       RNLOG: total number of aerosol particles per cm3
+        RNLOG= RMTOT*EXP(-4.5*DLOG(RSTDEV)*DLOG(RSTDEV)) 
+     +    *PI1/( RMEDR*RMEDR*RMEDR)
+
+!	Si on a H2SO4<H2SO4sat on ne condense rien et NDTOT=0
+	ELSE
+	H2SO4COND=0.0d0
+	H2OCOND=0.0d0
+	RNLOG=0.0d0
+	END IF
+	     	
+!	Test si H2O en defaut H2Ocond>H2O dispo
+	IF (H2OCOND.GT.H2O) THEN
+	
+!	On peut alors condenser tout le H2O dispo
+	H2OCOND=H2O
+!	On met alors egalement a jour le H2SO4 cond correspondant au H2O cond
+	H2SO4COND=H2OCOND*18.0153*WFSA/(98.078*(1.0-WFSA))
+	
+!     RMTOT: = Mass of H2SO4 satur per cm3 of air/ Mass of sulfuric acid part of droplet solution per cm3 
+!	RMTOT=Volume of aerosol cm3 /cm3 of air
+!	Volume of aerosol/cm3 air
+	
+	RMTOT=H2SO4COND*RMH2S4/(DENSO4*WFSA)
+
+!
+!       RNLOG: total number of aerosol particles per cm3
+        RNLOG= RMTOT*EXP(-4.5*DLOG(RSTDEV)*DLOG(RSTDEV)) 
+     +    *PI1/( RMEDR*RMEDR*RMEDR)
+      
+      END IF
+     	
+
+		
+      RETURN
+      END
+      
+!****************************************************************
+      SUBROUTINE STRAACT(R2SO4,ACTSO4)
+
+!     H2SO4 ACTIVITY (GIAUQUE) AS A FUNCTION OF H2SO4 WP
+!    ----------------------------------------
+!     INPUT:
+!	R2SO4: percent (%) of WSA (Weight fraction of Sulfuric Acid) 
+!
+!     OUTPUT: 
+!     ACTSO4: H2SO4 activity (percent)
+!       USE real16
+       IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+	   
+!       INTEGER NOLAT,NOLEV
+       REAL  R2SO4,     ACTSO4
+	  
+!      Working variables	  	   
+       INTEGER NN,I,J,JX,JX1
+       REAL  TC,TB,TA,XT
+       PARAMETER (NN=109)
+       REAL, DIMENSION(NN) :: XC, X
+
+!      H2SO4 activity 
+       DATA X/
+     *   0.0,0.25,0.78,1.437,2.19,3.07,4.03,5.04,6.08
+     *  ,7.13,8.18,14.33,18.59,28.59,39.17,49.49
+     *  ,102.4,157.8,215.7,276.9,341.6,409.8,481.5,556.6
+     *  ,635.5,719.,808.,902.,1000.,1103.,1211.,1322.,1437.,1555.
+     *  ,1677.,1800.,1926.,2054.,2183.,2312.,2442.,2572.,2701.,2829.
+     *  ,2955.,3080.,3203.,3325.,3446.,3564.,3681.,3796.,3910.,4022.
+     *  ,4134.,4351.,4564.,4771.,4974.,5171.,5364.,5551.,5732.,5908.
+     *  ,6079.,6244.,6404.,6559.,6709.,6854.,6994.,7131.,7264.,7393.
+     *  ,7520.,7821.,8105.,8373.,8627.,8867.,9093.,9308.,9511.,9703.
+     *  ,9885.,10060.,10225.,10535.,10819.,11079.,11318.,11537.
+     *  ,11740.,12097.,12407.,12676.,12915.,13126.,13564.,13910.
+     *  ,14191.,14423.,14617.,14786.,10568.,15299.,15491.,15654.
+     *  ,15811./
+!      H2SO4 weight fraction (percent)
+       DATA XC/
+     *   100.0,99.982,99.963,99.945,99.927,99.908,99.890,99.872
+     *  ,99.853,99.835,99.817,99.725,99.634,99.452,99.270
+     *  ,99.090,98.196,97.319,96.457,95.610,94.777,93.959,93.156
+     *  ,92.365,91.588,90.824,90.073,89.334,88.607,87.892,87.188
+     *  ,86.495,85.814,85.143,84.482,83.832,83.191,82.560,81.939
+     *  ,81.327,80.724,80.130,79.545,78.968,78.399,77.839,77.286
+     *  ,76.741,76.204,75.675,75.152,74.637,74.129,73.628,73.133
+     *  ,72.164,71.220,70.300,69.404,68.530,67.678,66.847,66.037
+     *  ,65.245,64.472,63.718,62.981,62.261,61.557,60.868,60.195
+     *  ,59.537,58.893,58.263,57.646,56.159,54.747,53.405,52.126
+     *  ,50.908,49.745,48.634,47.572,46.555,45.580,44.646,43.749
+     *  ,42.059,40.495,39.043,37.691,36.430,35.251,33.107,31.209
+     *  ,29.517,27.999,26.629,23.728,21.397,19.482,17.882,16.525
+     *  ,15.360,13.461,11.980,10.792,9.819,8.932/
+
+
+!     HERE LINEAR INTERPOLATIONS
+        XT=R2SO4
+        CALL POSACT(XT,XC,NN,JX)
+        JX1=JX+1
+        IF(JX.EQ.0) THEN
+          ACTSO4=0.0 
+        ELSE IF(JX.GE.NN) THEN
+          ACTSO4=15811.0 
+        ELSE 
+          TC=XT-XC(JX)
+          TB=X(JX1)-X(JX)
+          TA=XC(JX1)-XC(JX)
+          TA=TB/TA
+          ACTSO4=X(JX)+(TA*TC)
+        ENDIF
+10    CONTINUE
+
+      RETURN
+      END
+!********************************************************************
+       SUBROUTINE POSACT(XT,X_ARR,N,JX)
+	   
+!      POSITION OF XT IN THE ARRAY X
+!    ---------------------------------------------
+!       USE real16
+       IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       INTEGER N
+       REAL  XT
+       REAL, DIMENSION(N) :: X_ARR
+!      Working variables	  	   
+       INTEGER JX,I
+	   
+       IF(XT.GT.X_ARR(1)) THEN
+         JX=0
+       ELSE
+         DO 10 I=1,N
+           IF (XT.GT.X_ARR(I)) GO TO 20
+ 10      CONTINUE
+ 20      JX=I
+       ENDIF
+	   
+       RETURN
+       END
+
+       SUBROUTINE Zeleznik(x,T,act)
+
+  !+++++++++++++++++++++++++++++++++++++++++++++++++++
+  !     Water and sulfuric acid activities in liquid
+  !     aqueous solutions.
+  !     Frank J. Zeleznik, Thermodynnamic properties
+  !     of the aqueous sulfuric acid system to 220K-350K,
+  !     mole fraction 0,...,1
+  !     J. Phys. Chem. Ref. Data, Vol. 20, No. 6,pp.1157, 1991
+  !+++++++++++++++++++++++++++++++++++++++++++++++++++ 
+
+!         USE real16
+         IMPLICIT NONE
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+         REAL  x,T, activitya, activityw
+         REAL , DIMENSION(2):: act
+!         REAL x,T, activitya, activityw
+!         REAL, DIMENSION(2):: act
+
+
+!         write(*,*) 'x, T ', x, T
+
+         act(2)=activitya(x,T) 
+         act(1)=activityw(x,T)
+
+!         write(*,*) 'act ', act
+
+       END SUBROUTINE Zeleznik
+
+!start of functions related to zeleznik activities
+
+       FUNCTION m111(T)
+!       USE real16       
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  T,m111
+       m111=-23.524503387D0 
+     &    +0.0406889449841D0*T 
+     &    -0.151369362907D-4*T**2+2961.44445015D0/T 
+     &    +0.492476973663D0*dlog(T)
+       END FUNCTION m111
+
+       FUNCTION m121(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  m121,T
+       m121=1114.58541077D0-1.1833078936D0*T 
+     &    -0.00209946114412D0*T**2-246749.842271D0/T 
+     &    +34.1234558134D0*dlog(T)
+       END FUNCTION m121
+
+       FUNCTION m221(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  m221,T
+       m221=-80.1488100747D0-0.0116246143257D0*T 
+     &    +0.606767928954D-5*T**2+3092.72150882D0/T 
+     &    +12.7601667471D0*dlog(T)
+       END FUNCTION m221
+
+       FUNCTION m122(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  m122,T
+       m122=888.711613784D0-2.50531359687D0*T 
+     &    +0.000605638824061D0*T**2-196985.296431D0/T 
+     &    +74.550064338D0*dlog(T)
+       END FUNCTION m122
+
+       FUNCTION e111(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  e111,T
+       e111=2887.31663295D0-3.32602457749D0*T 
+     &    -0.2820472833D-2*T**2-528216.112353D0/T 
+     &    +0.68699743564D0*dlog(T)
+       END FUNCTION e111
+
+       FUNCTION e121(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  e121,T
+       e121=-370.944593249D0-0.690310834523D0*T 
+     &    +0.56345508422D-3*T**2-3822.52997064D0/T 
+     &    +94.2682037574D0*dlog(T)
+       END FUNCTION e121
+
+       FUNCTION e211(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  e211,T
+       e211=38.3025318809D0-0.0295997878789D0*T 
+     &    +0.120999746782D-4*T**2-3246.97498999D0/T 
+     &    -3.83566039532D0*dlog(T)
+       END FUNCTION e211
+
+       FUNCTION e221(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  e221,T
+       e221=2324.76399402D0-0.141626921317D0*T 
+     &    -0.00626760562881D0*T**2-450590.687961D0/T 
+     &    -61.2339472744D0*dlog(T)
+       END FUNCTION e221
+
+       FUNCTION e122(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  e122,T
+       e122=-1633.85547832D0-3.35344369968D0*T 
+     &    +0.00710978119903D0*T**2+198200.003569D0/T 
+     &    +246.693619189D0*dlog(T)
+       END FUNCTION e122
+
+       FUNCTION e212(T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  e212,T
+       e212=1273.75159848D0+1.03333898148D0*T 
+     &    +0.00341400487633D0*T**2+195290.667051D0/T 
+     &    -431.737442782D0*dlog(T)
+       END FUNCTION e212
+
+       FUNCTION lnAa(x1,T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  lnAa,T,x1 
+     &          ,m111,m121,m221,m122 
+     &            ,e111,e121,e211,e122,e212,e221
+       lnAa=-( 
+     &    (2*m111(T)+e111(T)*(2*dlog(x1)+1))*x1 
+     &    +(2*m121(T)+e211(T)*dlog(1-x1)+e121(T)*(dlog(x1)+1))*(1-x1) 
+     &    -(m111(T)+e111(T)*(dlog(x1)+1))*x1*x1 
+     &    -(2*m121(T)+e121(T)*(dlog(x1)+1)+e211(T)*(dlog(1-x1)+1) 
+     &    -(2*m122(T)+e122(T)*dlog(x1) 
+     &           +e212(T)*dlog(1-x1))*(1-x1))*x1*(1-x1) 
+     &    -(m221(T)+e221(T)*(dlog(1-x1)+1))*(1-x1)**2 
+     &    -x1*(1-x1)*( 
+     &                  (6*m122(T)+e122(T)*(3*dlog(x1)+1) 
+     &                          +e212(T)*(3*dlog(1-x1)+1) 
+     &                   )*x1*(1-x1) 
+     &                -(2*m122(T)+e122(T)*(dlog(x1)+1) 
+     &                                   +e212(T)*dlog(1-x1) 
+     &                    )*(1-x1)) 
+     &     )
+       END FUNCTION lnAa
+
+       FUNCTION lnAw(x1,T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  lnAw,T,x1 
+     &          ,m111,m121,m221,m122 
+     &            ,e111,e121,e211,e122,e212,e221
+       lnAw=-( 
+     &  (2*m121(T)+e121(T)*dlog(x1)+e211(T)*(dlog(1-x1)+1))*x1 
+     &  +(2*m221(T)+e221(T)*(2*dlog(1-x1)+1))*(1-x1) 
+     &  -(m111(T)+e111(T)*(dlog(x1)+1))*x1*x1 
+     & -(2*m121(T)+e121(T)*(dlog(x1)+1) 
+     &            +e211(T)*(dlog(1-x1)+1))*x1*(1-x1) 
+     &        -(m221(T)+e221(T)*(dlog(1-x1)+1))*(1-x1)**2 
+     &   +x1*(2*m122(T)+e122(T)*dlog(x1)+e212(T)*dlog(1-x1))*x1*(1-x1) 
+     &  +x1*(1-x1)*((2*m122(T)+e122(T)*dlog(x1) 
+     &                        +e212(T)*(dlog(1-x1)+1))*x1 
+     &               -(6*m122(T)+e122(T)*(3*dlog(x1)+1) 
+     &                        +e212(T)*(3*dlog(1-x1)+1))*(1-x1)*x1) 
+     &     )
+       END FUNCTION lnAw
+
+       FUNCTION activitya(xal,T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  lnAa,T,xal,activitya 
+!       &          ,m111,m121,m221,m122 &
+!       &            ,e111,e121,e211,e122,e212,e221
+
+!       write(*,*) 'in activitya ', xal, T
+       activitya=DEXP(lnAa(xal,T)-lnAa(1.D0-1.D-12,T))
+       END FUNCTION activitya
+
+       FUNCTION activityw(xal,T)
+!       USE real16
+!      integer, parameter :: sp_k = kind(1.0) ! Default Type of REAL
+!      integer, parameter :: real_8 = selected_real_kind(2*precision
+!     + (1.0_sp_k))
+
+       REAL  lnAw,T,xal,activityw 
+!       &          ,m111,m121,m221,m122 &
+!       &            ,e111,e121,e211,e122,e212,e221
+       activityw=DEXP(lnAw(xal,T)-lnAw(1.D-12,T))
+       END FUNCTION activityw
+
+! end of functions related to zeleznik activities
Index: trunk/LMDZ.VENUS/libf/phyvenus/new_photochemistry_venus.F90
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/new_photochemistry_venus.F90	(revision 1305)
+++ trunk/LMDZ.VENUS/libf/phyvenus/new_photochemistry_venus.F90	(revision 1305)
@@ -0,0 +1,6808 @@
+! STOLZENBACH Aurélien 10/12/2012
+! Reprise du modèle de photochimie 1D de Frank Lefèvre.
+! Couplage avec le LMDZ_VENUS
+ SUBROUTINE new_photochemistry_venus(nz, n_lon, ptimestep, p, t ,tr, sza_input, nesp)
+
+! USE ioipsl
+! USE infotrac
+! USE control_mod
+! USE dimphy
+! USE comgeomphy
+ USE chemparam_mod
+      
+ implicit none
+
+ INTEGER :: nz
+ INTEGER :: nesp
+ INTEGER :: n_lon  ! n_lon utile pr différencier 3D/1D
+ REAL, PARAMETER :: eps = 1.  ! mole/cm3 init a 1 pour eviter /0.
+ LOGICAL, SAVE :: first_call = .true.
+
+real, dimension(nz)  ::  conc
+real, dimension(nz)  :: surfice1d, surfdust1d
+
+! photolysis lookup table
+
+integer, parameter :: nj = 19, nztable = 201, nsza = 27, nso2 = 13
+real, dimension(nso2,nsza,nztable,nj), save :: jphot
+real, dimension(nztable), save :: table_colair
+real, dimension(nso2,nztable), save :: table_colso2
+real, dimension(nsza), save :: table_sza
+
+! Compteurs et divers
+
+integer :: ij, i, iesp, jesp, iz, iiz
+
+! matrix
+
+double precision, dimension(nesp,nesp) :: mat
+integer                    :: code
+integer, dimension(nesp)   :: indx
+
+! number densities
+
+double precision, dimension(nz,nesp) :: c
+double precision, dimension(nz,nesp) :: cold
+double precision, dimension(nz,nesp) :: cnew
+      
+! dates, angles
+
+real :: ptimestep, ctimestep
+real :: dist_sol, sza_input
+integer :: iter
+integer :: phychemrat
+integer, dimension(nz)  :: cpt
+
+real, dimension(nz)  :: p  ! pression pour le mileu de chaque couche (en hPa)
+real, dimension(nz)  :: t ! temperature
+real, dimension(nz, nesp) :: tr ! traceur
+
+real    :: ratio, curv, e, e1, e2, e3
+real    :: time, dtg, dt, dtmin, dt_guess, dt_corrected
+
+!===================================================================
+!     switches for heterogeneous chemistry
+!     hetero_ice  : reactions on ice clouds
+!     hetero_dust : reactions on dust
+!===================================================================
+
+logical,parameter :: hetero_ice  = .false.
+logical,parameter :: hetero_dust = .false.
+
+! reaction rates and indices
+
+integer, parameter :: nb_phot_max = 32
+integer, parameter :: nb_reaction_3_max = 12
+integer, parameter :: nb_reaction_4_max = 87
+
+real, dimension(6*nb_phot_max) :: indice_phot 
+real, dimension(6*nb_reaction_3_max) :: indice_3
+real, dimension(8*nb_reaction_4_max) :: indice_4
+
+double precision, dimension(nz,nb_phot_max) :: v_phot
+double precision, dimension(nz,nb_reaction_3_max) :: v_3
+double precision, dimension(nz,nb_reaction_4_max) :: v_4
+
+double precision, dimension(nb_reaction_4_max) :: eps_4
+
+      
+! ctimestep : pas de temps chimique nominal (s)
+
+phychemrat = 3
+ctimestep  = ptimestep/real(phychemrat)
+
+! dtmin : pas de temps minimum (s)
+
+dtmin = 1.
+
+! dist_sol : distance venus - soleil
+
+dist_sol = 0.72333
+
+! initialisation des especes
+
+if (first_call) then
+   call init_chimie(nj, nztable, nsza, nso2, jphot, table_colair, table_colso2, table_sza)
+
+   first_call = .false.
+
+! Initialisation des surfaces glaces et poussieres (a revoir car pas save et hetero_ice = false, probleme?)
+
+   do iz=1, nz
+      surfice1d(iz)  = 0.
+      surfdust1d(iz) = 0.
+   end do
+end if
+
+! Initialisation des conc et cold en molecule.cm-3
+
+do iz = 1,nz
+   conc(iz) = p(iz)/(1.38d-19*t(iz))
+   c(iz,:) = tr(iz,:)*conc(iz) 
+   cold(iz,:) = c(iz,:)     
+end do
+      
+!      IF (n_lon .EQ. 98) THEN
+!      PRINT*,'CO init',tr(:,i_co)
+!      END IF
+      
+cpt(:) = 0
+
+! initialisation des indices
+                                                  
+call indice(nb_phot_max, nb_reaction_3_max, nb_reaction_4_max,  &
+            indice_phot, indice_3, indice_4)
+                   
+! coefficients de photodissociation
+!   PRINT*,'sza_input avant phot: ',sza_input
+
+call phot(nj, nztable, nsza, nso2, sza_input, dist_sol, tr(:,i_co2), tr(:,i_so2),         &
+          jphot, table_colair, table_colso2, table_sza, nz, nb_phot_max, t, p, v_phot)
+
+! vitesses de reaction
+                   
+call krates(hetero_ice,hetero_dust, nz, nesp, nj, c, conc, t, p, nb_phot_max, nb_reaction_3_max, nb_reaction_4_max, v_3, v_4, v_phot,sza_input)
+
+!      IF (n_lon .EQ. 98) THEN
+!      DO iiz=1, nz
+!      PRINT*,'v_phot de iiz', iiz, v_phot(iiz,:)
+!      END DO
+!      PRINT*,'temperature', t
+!      END IF
+       
+! boucle sur les niveaux
+
+   DO iz = 1,nz
+
+! iteractions chimiques internes
+
+      time = 0.
+      iter = 0
+
+! initialisation du pas de temps du first-guess
+
+      dt_guess = ctimestep
+          
+      do while (time < ptimestep)
+      
+      iter = iter + 1
+      cpt(iz) = cpt(iz) + 1
+
+! coefficient d'implicité
+                  
+      call fill_eps(iz, nz, nesp, c, nb_reaction_4_max, eps_4)
+
+                   
+! first guess : remplissage de la matrice
+      call fill_matrix(iz, dt_guess, nz, nesp, v_phot, v_3, v_4, eps_4, c,nb_phot_max, nb_reaction_3_max, nb_reaction_4_max, indice_phot, indice_3, indice_4, mat)
+
+! first guess : resolution du systeme lineaire
+   
+      cnew(iz,:) = c(iz,:)
+      call dgesv(nesp,1,mat,nesp,indx,cnew(iz,:),nesp,code)
+! eliminate small values
+
+      where (cnew(iz,:)/conc(iz) < 1.d-30)
+         cnew(iz,:) = 0.
+      end where
+      
+      
+
+! test O/(O + O3)
+
+      ratio = 1.   ! rapport entre pas de temps courant/pas de temps du guess
+      curv = 2.*(ratio*cnew(iz,i_o) - (1. + ratio)*c(iz,i_o) + cold(iz,i_o)) &
+             /(1. + ratio)
+             e1 = (curv/(cnew(iz,i_o) + cnew(iz,i_o3) + eps))*100.0d0
+      
+      e1 = abs(e1)
+
+! test HO2/(H + OH + HO2 + 2*H2O2)
+
+      ratio = 1.   ! rapport entre pas de temps courant/pas de temps du guess
+      curv = 2.*(ratio*cnew(iz,i_ho2) - (1. + ratio)*c(iz,i_ho2) + cold(iz,i_ho2)) &
+             /(1. + ratio)
+             e2 = (curv/(cnew(iz,i_h) + cnew(iz,i_oh) + cnew(iz,i_ho2) + &
+             2.*cnew(iz,i_h2o2)+ eps))*100.0d0
+      
+      e2 = abs(e2)
+
+! test SO/(S + SO + SO2)
+ 
+      ratio = 1.
+      curv = 2.*(ratio*cnew(iz,i_so) - (1. + ratio)*c(iz,i_so) + cold(iz,i_so)) &
+             /(1. + ratio)
+             e3 = (curv/(cnew(iz,i_s) + cnew(iz,i_so) + cnew(iz,i_so2)+ eps))*100.0d0
+      
+      e3 = abs(e3)
+
+! modification du pas de temps
+
+      e = max(e1, e2)
+      e = max(e,  e3)
+      e = max(e, 0.1)
+      dtg = max(0.001, min(2.5,0.8/sqrt(e)))
+!     dtg = 1.         ! décommenter pour désactiver two-step
+      dt_corrected = max(dtmin,dtg*dt_guess)
+      dt_corrected = min(dt_corrected,ctimestep)
+
+      if (time + dt_corrected > ptimestep) then
+         dt_corrected = ptimestep - time
+      end if
+
+      if (dt_corrected /= dt_guess) then  ! alors le pas de temps a été modifié
+
+!     remplissage de la matrix
+         call fill_matrix(iz, dt_corrected, nz, nesp, v_phot, v_3, v_4, eps_4, c,nb_phot_max, nb_reaction_3_max, nb_reaction_4_max, indice_phot, indice_3, indice_4, mat)
+
+!     resolution du systeme lineaire
+   
+         cnew(iz,:) = c(iz,:)
+         call dgesv(nesp,1,mat,nesp,indx,cnew(iz,:),nesp,code)
+
+      end if
+
+!     eliminate small values
+
+      where (cnew(iz,:)/conc(iz) < 1.d-30)
+         cnew(iz,:) = 0.
+      end where
+
+      cold(iz,:)  = c(iz,:)
+      c(iz,:)   = cnew(iz,:)
+      cnew(iz,:) = 0.0d0
+
+      time = time + dt_corrected
+      dt_guess = dt_corrected ! pour first-guess à la prochaine iteration
+
+      end do ! while (time < ptimestep)
+
+
+!     Actualisation des VMR traceurs avec valeurs minimales 1d-30
+
+      tr(iz,:)  = max(c(iz,:)/conc(iz),1.0d-30)
+      
+            
+   END DO ! fin de boucle sur les niveaux
+   
+!   DO iz = 1,nz
+!   PRINT*,'compteur pour niveau',iz,' = ',cpt(iz)
+!   END DO
+
+        !PRINT*,'sza_input', sza_input
+!PRINT*,'CO2 surf alt',tr(1,i_co2) ,tr(nz,i_co2)
+!PRINT*,'CO altitude', tr(nz,i_co)
+!PRINT*,'HCL surf alt',tr(1,i_hcl) ,tr(nz,i_hcl)
+!PRINT*,'H2 surf alt',tr(1,i_h2) ,tr(nz,i_h2)
+!PRINT*,'O surf alt',tr(1,i_o) ,tr(nz,i_o)
+!PRINT*,'O3 surf alt',tr(1,i_o3) ,tr(nz,i_o3)
+!PRINT*,'HO2 surf alt',tr(1,i_ho2) ,tr(nz,i_ho2)
+!PRINT*,'H2O2 surf alt',tr(1,i_h2o2) ,tr(nz,i_h2o2)
+!PRINT*,'H surf alt',tr(1,i_h) ,tr(nz,i_h)
+!PRINT*,'S surf alt',tr(1,i_s) ,tr(nz,i_s)
+!PRINT*,'SO surf alt',tr(1,i_so) ,tr(nz,i_so)
+!PRINT*,'SO2 surf alt',tr(1,i_so2) ,tr(nz,i_so2)
+
+!==================
+!!!!! MODEL 1D !!!! ==> n_lon = 1 !!!!
+!==================
+
+IF(n_lon .EQ. 1) THEN
+!PRINT*,'On est en 1D'
+!PRINT*,"DEBUT rate_save"
+CALL rate_save(nz,p(:),t(:),tr(:,:),nesp,v_phot(:,:),v_3(:,:),v_4(:,:))
+!PRINT*,"FIN rate_save"
+END IF
+      
+end subroutine new_photochemistry_venus
+
+!======================================================================
+
+ subroutine init_chimie(nj, nztable, nsza, nso2, jphot, table_colair, &
+                        table_colso2, table_sza)
+
+!======================================================================
+
+implicit none
+
+! photolysis lookup table
+
+integer, INTENT(IN) :: nj, nztable, nsza, nso2
+real, INTENT(OUT), dimension(nso2,nsza,nztable,nj) :: jphot
+real, INTENT(OUT), dimension(nztable) :: table_colair
+real, INTENT(OUT), dimension(nso2,nztable) :: table_colso2
+real, INTENT(OUT), dimension(nsza) :: table_sza
+
+integer           :: iz, isza, iozo, iso2, ij
+character(len=44) :: jvenus
+
+! lecture de la table des j
+
+jphot(:,:,:,:) = 0.
+
+jvenus = 'jvenus.dat'
+open(30, form = 'formatted', status = 'old', file = jvenus)
+print*,'lecture de jvenus = ', jvenus
+
+do iso2 = 1,nso2
+   do isza = 1,nsza
+      do iz = nztable,1,-1
+         read(30,*) table_colair(iz), table_colso2(iso2,iz), table_sza(isza)
+         read(30,'(7e11.4)') (jphot(iso2,isza,iz,ij), ij = 1,nj)
+         do ij = 1,nj
+            if (jphot(iso2,isza,iz,ij) == 1.d-30) then 
+               jphot(iso2,isza,iz,ij) = 0.
+            end if
+         end do
+      end do
+      print*, "sza_input = ", table_sza(isza)
+   end do
+end do
+
+close(30)
+print*,'lecture de la table des j ok.'
+
+end subroutine init_chimie
+
+!======================================================================
+
+
+!======================================================================
+
+ subroutine indice(nb_phot_max, nb_reaction_3_max, nb_reaction_4_max, &
+                   indice_phot, indice_3, indice_4)
+
+
+!OUTPUT: indice_phot, indice_3, indice_4
+!================================================================
+! set the "indice" arrays used to fill the jacobian matrix      !
+!----------------------------------------------------------------
+! reaction               type                array              !
+!----------------------------------------------------------------
+! A + hv   --> B + C     photolysis          indice_phot        ! 
+! A + B    --> C + D     bimolecular         indice_4           !
+! A + A    --> B + C     quadratic           indice_3           !
+! A + C    --> B + C     quenching           indice_phot        !
+! A + ice  --> B + C     heterogeneous       indice_phot        !
+!================================================================
+
+
+ USE chemparam_mod
+ 
+implicit none
+
+integer :: nb_phot_max, nb_reaction_3_max, nb_reaction_4_max
+integer :: i_dummy
+
+! reaction rates and indices
+
+integer :: nb_phot, nb_reaction_3, nb_reaction_4
+
+real, dimension(6*nb_phot_max) :: indice_phot 
+real, dimension(6*nb_reaction_3_max) :: indice_3
+real, dimension(8*nb_reaction_4_max) :: indice_4
+
+
+i_dummy = 1
+
+nb_phot       = 0
+nb_reaction_3 = 0
+nb_reaction_4 = 0
+
+!===========================================================
+!      O2 + hv -> O + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o2
+indice_phot(6*(nb_phot - 1) + 3) = 2
+indice_phot(6*(nb_phot - 1) + 4) = i_o
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+!===========================================================
+!      O2 + hv -> O + O(1D)
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o2
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_o
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o1d
+
+
+
+!===========================================================
+!      CO2 + hv -> CO + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_co2
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_co
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o
+
+!===========================================================
+!      CO2 + hv -> CO + O(1D)
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_co2
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_co
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o1d
+
+!===========================================================
+!      O3 + hv -> O2(Dg) + O(1D)
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o3
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_o2dg
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o1d
+
+!===========================================================
+!      O3 + hv -> O2 + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o3
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_o2
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o
+
+!===========================================================
+!      H2O + hv -> H + OH
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_h2o
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_h
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_oh
+
+!===========================================================
+!      HO2 + hv -> OH + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_ho2
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_oh
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o
+
+!===========================================================
+!      H2O2 + hv -> OH + OH
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_h2o2
+indice_phot(6*(nb_phot - 1) + 3) = 2
+indice_phot(6*(nb_phot - 1) + 4) = i_oh
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+!===========================================================
+!      HCl + hv -> H + Cl
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_hcl
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_h
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_cl
+
+!===========================================================
+!      Cl2 + hv -> Cl + Cl
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_cl2
+indice_phot(6*(nb_phot - 1) + 3) = 2
+indice_phot(6*(nb_phot - 1) + 4) = i_cl
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+!===========================================================
+!      HOCl + hv -> OH + Cl
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_hocl
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_oh
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_cl
+
+!===========================================================
+!      SO2 + hv -> SO + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_so2
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_so
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o
+
+!===========================================================
+!      SO + hv -> S + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_so
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_s
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o
+
+!===========================================================
+!      SO3 + hv -> SO2 + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_so3
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_so2
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o
+
+!===========================================================
+!      ClO + hv -> Cl + O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_clo
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_cl
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_o
+
+!===========================================================
+!      OCS + hv -> CO + S
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_ocs
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_co
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_s
+
+!===========================================================
+!      COCl2 + hv -> Cl + Cl + CO
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_cocl2
+indice_phot(6*(nb_phot - 1) + 3) = 2
+indice_phot(6*(nb_phot - 1) + 4) = i_cl
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_co
+
+!===========================================================
+!      H2SO4 + hv -> SO3 + H2O
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_h2so4
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_so3
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_h2o
+
+!===========================================================
+!      a001 : O + O2 + CO2 -> O3 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      a002 : O + O + CO2 -> O2(Dg) + CO2
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_o
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_o2dg
+indice_3(6*(nb_reaction_3 - 1) + 5) = 0
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_dummy
+
+!===========================================================
+!      a003 : O + O3 -> O2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 2
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      b001 : O(1D) + CO2 -> O + CO2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o1d
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_o
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+!===========================================================
+!      b002 : O(1D) + H2O -> OH + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o1d
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 2
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      b003 : O(1D) + H2 -> OH + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o1d
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_h
+
+!===========================================================
+!      b004 : O(1D) + O2 -> O + O2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o1d
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_o
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+
+!===========================================================
+!      b005 : O(1D) + O3 -> O2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o1d
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 2
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      b006 : O(1D) + O3 -> O2 + O + O
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o1d
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 2
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o
+
+!===========================================================
+!      c001 : O + HO2 -> OH + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      c002 : O + OH -> O2 + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_h
+
+!===========================================================
+!      c003 : H + O3 -> OH + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      c004 : H + HO2 -> OH + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 2
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      c005 : H + HO2 -> H2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      c006 : H + HO2 -> H2O + O
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o
+
+!===========================================================
+!      c007 : OH + HO2 -> H2O + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+
+!===========================================================
+!      c008 : HO2 + HO2 -> H2O2 + O2
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_ho2
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_h2o2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 1
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_o2
+
+!===========================================================
+!      c009 : OH + H2O2 -> H2O + HO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_ho2
+
+
+!===========================================================
+!      c010 : OH + H2 -> H2O + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_h
+
+!===========================================================
+!      c011 : H + O2 + CO2 -> HO2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      c012 : O + H2O2 -> OH + HO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_ho2
+
+!===========================================================
+!      c013 : OH + OH -> H2O + O
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_oh
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_h2o
+indice_3(6*(nb_reaction_3 - 1) + 5) = 1
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_o
+
+
+!===========================================================
+!      c014 : OH + O3 -> HO2 + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      c015 : HO2 + O3 -> OH + O2 + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 2
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      c016 : HO2 + HO2 + CO2 -> H2O2 + O2 + CO2 
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_ho2
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_h2o2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 1
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_o2
+
+!===========================================================
+!      c017 : OH + OH + CO2 -> H2O2 + CO2 
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_oh
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_h2o2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 0
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_dummy
+
+!===========================================================
+!      c018 : H + H + CO2 -> H2 + CO2 
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_h
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_h2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 0
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_dummy
+
+!===========================================================
+!      e001 : CO + OH -> CO2 + H 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_co
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_co2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_h
+
+!===========================================================
+!      e002 : CO + O + M -> CO2 + M 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_co
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_co2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      f001 : HCl + O(1D) -> OH + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o1d
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      f002 : HCl + O(1D) -> H + ClO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o1d
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_clo
+
+!===========================================================
+!      f003 : HCl + O -> OH + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      f004 : HCl + OH -> H2O + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      f005 : ClO + O -> Cl + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      f006 : ClO + OH -> Cl + HO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_ho2
+
+!===========================================================
+!      f007 : ClO + OH -> HCl + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      f008 : Cl + H2 -> HCl + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_h
+
+!===========================================================
+!      f009 : Cl + O3 -> ClO + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      f010 : Cl + HO2 -> ClO + OH 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_oh
+
+!===========================================================
+!      f011 : Cl + HO2 -> HCl + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      f012 : Cl + H2O2 -> HCl + HO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_ho2
+
+!===========================================================
+!      f013 : Cl + CO + CO2 -> ClCO + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_co
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      f014 : ClCO + CO2 -> Cl + CO + CO2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_clco
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_cl
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_co
+
+!===========================================================
+!      f015 : ClCO + O2 + CO2 -> ClCO3 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clco3
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      f016 : 0.5 ClCO3 + 0.5 Cl -> Cl
+!             0.5 ClCO3 + 0.5 Cl -> ClO + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co2
+
+!===========================================================
+!      f017 : 0.5 ClCO3 + 0.5 O -> Cl
+!             0.5 ClCO3 + 0.5 O -> O2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co2
+
+!===========================================================
+!      f018 : ClO + HO2 -> HOCl + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hocl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      f019 : OH + HOCl -> H2O + ClO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_hocl
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_clo
+
+!===========================================================
+!      f020 : O + HOCl -> OH + ClO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_hocl
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_clo
+
+!===========================================================
+!      f021 : Cl + Cl + CO2 -> Cl2 + CO2 
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_cl
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_cl2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 0
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_dummy
+
+!===========================================================
+!      f022 : ClCO + O -> Cl + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co2
+
+!===========================================================
+!      f023 : Cl2 + O(1D) -> Cl + ClO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o1d
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_clo
+
+!===========================================================
+!      f024 : Cl2 + H -> HCl + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      f025 : Cl + ClCO -> Cl2 + CO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co
+
+!===========================================================
+!      f026 : ClCO + ClCO -> COCl2 + CO
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_clco
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_cocl2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 1
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_co
+
+!===========================================================
+!      f027 : Cl + SO2 + CO2 -> ClSO2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clso2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      f028 : ClSO2 + O -> SO2 + ClO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clso2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_clo
+
+!===========================================================
+!      f029 : ClSO2 + H -> SO2 + HCl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clso2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_hcl
+
+!===========================================================
+!      f030 : ClSO2 + ClSO2 -> Cl2 + SO2 + SO2
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_clso2
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_cl2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 2
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_so2
+
+!===========================================================
+!      f031 : Cl + O + CO2 -> ClO + CO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      f032 : Cl2 + O -> ClO + Cl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      f033 : ClCO + OH -> HOCl + CO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hocl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co
+
+!===========================================================
+!      f034 : Cl2 + OH -> Cl + HOCl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_hocl
+
+!===========================================================
+!      f035 : ClCO + O -> CO + ClO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_co
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_clo
+
+!===========================================================
+!      f036 : ClCO + Cl2 -> COCl2 + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_cl2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cocl2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      f037 : HCl + H -> H2 + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      f038 : ClCO + H -> HCl + CO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co
+
+!===========================================================
+!      f039 : Cl + H + M -> HCl + M
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hcl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g001 : S + O2 -> SO + O
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o
+
+!===========================================================
+!      g002 : S + O3 -> SO + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      g003 : SO + O2 -> SO2 + O
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o
+
+!===========================================================
+!      g004 : SO + O3 -> SO2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      g005 : SO + OH -> SO2 + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_h
+
+!===========================================================
+!      g006 : S + OH -> SO + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_h
+
+!===========================================================
+!      g007 : SO + O + CO2 -> SO2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g008 : SO + HO2 -> SO2 + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_oh
+
+!===========================================================
+!      g009 : SO2 + O + CO2 -> SO3 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so3
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g010 : S + O + CO2 -> SO + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g011 : SO3 + H2O -> H2SO4
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_h2o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_h2so4
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g012 : SO + ClO -> SO2 + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      g013 : SO + SO3 -> SO2 + SO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_so3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 2
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g014 : SO3 + O -> SO2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_o2
+
+!===========================================================
+!      g015 : SO + SO + CO2 -> S2O2 + CO2
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_so
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_s2o2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 0
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_dummy
+
+!===========================================================
+!      g016 : S2O2 + CO2 -> SO + SO + CO2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_s2o2
+indice_phot(6*(nb_phot - 1) + 3) = 2
+indice_phot(6*(nb_phot - 1) + 4) = i_so
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+!===========================================================
+!      g017 : 0.5 ClCO3 + 0.5 SO -> Cl  
+!             0.5 ClCO3 + 0.5 SO -> SO2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_cl
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co2
+
+!===========================================================
+!      g018 : S + CO + CO2 -> OCS + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_co
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_ocs
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g019 : ClCO + S -> OCS + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_clco
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_ocs
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      g020 : SO2 + OH + CO2 -> HSO3 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_oh
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_hso3
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+!===========================================================
+!      g021 : HSO3 + O2 -> HO2 + SO3
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_hso3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_so3
+
+!===========================================================
+!      g022 : S + S + CO2 -> S2 + CO2
+!===========================================================
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_s
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_s2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 0
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_dummy
+
+!===========================================================
+!      g023 : S2 + hv -> S + S 
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_s2
+indice_phot(6*(nb_phot - 1) + 3) = 2
+indice_phot(6*(nb_phot - 1) + 4) = i_s
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+!===========================================================
+!      g024 : S2 + O -> SO + S
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_s
+
+!===========================================================
+!      g025 : S + OCS -> S2 + CO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ocs
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_s2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co
+
+!===========================================================
+!      g026 : OCS + O -> SO + CO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_ocs
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_o
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co
+
+!===========================================================
+!      g027 : S + SO3 -> SO2 + SO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_so3
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_so
+
+!===========================================================
+!      g028 : S + HO2 -> SO + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ho2
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_oh
+
+!===========================================================
+!      g029 : S + ClO -> SO + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_clo
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_cl
+
+!===========================================================
+!      g030: h2so4 + h2o -> so3 + h2o + h2o
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_h2so4
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_so3
+indice_phot(6*(nb_phot - 1) + 5) = 1
+indice_phot(6*(nb_phot - 1) + 6) = i_h2o
+
+
+!===========================================================
+!      g031: so3 + ocs -> s2o2 +  co2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 1
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_so3
+indice_4(8*(nb_reaction_4 - 1) + 3) = 1
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ocs
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_s2o2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_co2
+
+!===========================================================
+!      g032: s2o2 + ocs -> co + so2 + s2
+!===========================================================
+!	decomposee en
+!	0.5 s2o2 + 0.5 ocs -> co
+!	0.5 s2o2 + 0.5 ocs -> so2 + s2
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s2o2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ocs
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_co
+indice_4(8*(nb_reaction_4 - 1) + 7) = 0
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_dummy
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+indice_4(8*(nb_reaction_4 - 1) + 1) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 2) = i_s2o2
+indice_4(8*(nb_reaction_4 - 1) + 3) = 0.5
+indice_4(8*(nb_reaction_4 - 1) + 4) = i_ocs
+indice_4(8*(nb_reaction_4 - 1) + 5) = 1
+indice_4(8*(nb_reaction_4 - 1) + 6) = i_so2
+indice_4(8*(nb_reaction_4 - 1) + 7) = 1
+indice_4(8*(nb_reaction_4 - 1) + 8) = i_s2
+
+!===========================================================
+!      g033: so + so -> so2 + s
+!===========================================================
+!  Krasnopolsky 2012 from Martinez & Heron 1983 or Moses et al 2002
+
+nb_reaction_3 = nb_reaction_3 + 1
+
+indice_3(6*(nb_reaction_3 - 1) + 1) = 2
+indice_3(6*(nb_reaction_3 - 1) + 2) = i_so
+indice_3(6*(nb_reaction_3 - 1) + 3) = 1
+indice_3(6*(nb_reaction_3 - 1) + 4) = i_so2
+indice_3(6*(nb_reaction_3 - 1) + 5) = 1
+indice_3(6*(nb_reaction_3 - 1) + 6) = i_s
+
+!===========================================================
+!      h001: HO2 + ice -> products
+!            treated as
+!            HO2 -> 0.5 H2O + 0.75 O2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_ho2
+indice_phot(6*(nb_phot - 1) + 3) = 0.5
+indice_phot(6*(nb_phot - 1) + 4) = i_h2o
+indice_phot(6*(nb_phot - 1) + 5) = 0.75
+indice_phot(6*(nb_phot - 1) + 6) = i_o2
+
+!===========================================================
+!      h002: OH + ice -> products
+!            treated as
+!            OH -> 0.5 H2O + 0.25 O2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_oh
+indice_phot(6*(nb_phot - 1) + 3) = 0.5
+indice_phot(6*(nb_phot - 1) + 4) = i_h2o
+indice_phot(6*(nb_phot - 1) + 5) = 0.25
+indice_phot(6*(nb_phot - 1) + 6) = i_o2
+
+!===========================================================
+!      h003: H2O2 + ice -> products
+!            treated as
+!            H2O2 -> H2O + 0.5 O2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_h2o2
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_h2o
+indice_phot(6*(nb_phot - 1) + 5) = 0.5
+indice_phot(6*(nb_phot - 1) + 6) = i_o2
+
+!===========================================================
+!      h004: HO2 + dust -> products
+!            treated as
+!            HO2 -> 0.5 H2O + 0.75 O2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_ho2
+indice_phot(6*(nb_phot - 1) + 3) = 0.5
+indice_phot(6*(nb_phot - 1) + 4) = i_h2o
+indice_phot(6*(nb_phot - 1) + 5) = 0.75
+indice_phot(6*(nb_phot - 1) + 6) = i_o2
+
+!===========================================================
+!      h005: H2O2 + dust -> products
+!            treated as
+!            H2O2 -> H2O + 0.5 O2
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_h2o2
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_h2o
+indice_phot(6*(nb_phot - 1) + 5) = 0.5
+indice_phot(6*(nb_phot - 1) + 6) = i_o2
+
+!===========================================================
+!      i001: O2(Dg) + CO2 -> O2 + CO2 + hv
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o2dg
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_o2
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+
+!===========================================================
+!      i002: O2(Dg) -> O2 + hv
+!===========================================================
+
+nb_phot = nb_phot + 1
+
+
+indice_phot(6*(nb_phot - 1) + 1) = 1
+indice_phot(6*(nb_phot - 1) + 2) = i_o2dg
+indice_phot(6*(nb_phot - 1) + 3) = 1
+indice_phot(6*(nb_phot - 1) + 4) = i_o2
+indice_phot(6*(nb_phot - 1) + 5) = 0
+indice_phot(6*(nb_phot - 1) + 6) = i_dummy
+ 
+!  check dimensions 
+
+!print*, 'nb_phot       = ', nb_phot
+!print*, 'nb_reaction_4 = ', nb_reaction_4
+!print*, 'nb_reaction_3 = ', nb_reaction_3
+
+!print*, 'check dimension'
+if ((nb_phot .NE. nb_phot_max)             .or.  &
+    (nb_reaction_3 .NE. nb_reaction_3_max) .or.  &
+    (nb_reaction_4 .NE. nb_reaction_4_max)) then
+  print*, 'wrong dimensions in indice' 
+  stop
+end if  
+
+end subroutine indice
+
+!===========================================================
+
+subroutine phot(nj, nztable, nsza, nso2, sza_input, dist_sol, rmco2, rmso2,                     &
+                jphot, table_colair, table_colso2, table_sza, nz, nb_phot_max, t, p, v_phot)
+
+!===========================================================
+
+implicit none
+
+integer, INTENT(IN) :: nz
+integer, INTENT(IN) :: nj, nztable, nsza, nso2
+
+real, INTENT(IN), dimension(nz) :: t, p
+real, INTENT(IN), dimension(nso2,nsza,nztable,nj) :: jphot
+real, INTENT(IN), dimension(nso2,nztable) :: table_colso2
+real, INTENT(IN), dimension(nztable) :: table_colair
+real, INTENT(IN), dimension(nsza) :: table_sza
+real, INTENT(IN), dimension(nz) :: rmco2, rmso2
+real, INTENT(IN) :: sza_input, dist_sol
+
+real, dimension(nz,nj) :: j
+real, dimension(nz) :: col, colso2
+real, dimension(nso2) :: colref
+real, dimension(2,2,2) :: poids
+real :: cicol, cisza, ciso2
+real :: mugaz, avogadro, gvenus, coef, dp
+
+integer :: indcol, indsza, indso2
+integer :: isza, iz, i, iso2, ij
+
+integer :: nb_phot_max
+double precision, dimension(nz,nb_phot_max), INTENT(INOUT) :: v_phot
+
+mugaz    = 43.44d-3
+avogadro = 6.022e23
+gvenus   = 8.87
+
+coef = avogadro/(gvenus*mugaz)*1.d-4
+
+! day/night test
+
+if (sza_input <= 95.) then      ! day
+
+! interpolation in solar zenith angle
+
+indsza = nsza - 1
+do isza = 1,nsza
+   if (table_sza(isza) >= sza_input) then
+      indsza = min(indsza,isza - 1)
+      indsza = max(indsza, 1)
+   end if
+end do
+
+cisza = (sza_input - table_sza(indsza))                       &
+       /(table_sza(indsza + 1) - table_sza(indsza))
+
+!    print*, 'indsza    = ', indsza
+!    print*, 'table_sza = ', table_sza(indsza)
+!    print*, 'cisza     = ', cisza
+
+! co2 and so2 columns
+
+col(nz)    = coef*rmco2(nz)*p(nz)*100.
+colso2(nz) = coef*rmso2(nz)*p(nz)*100.
+
+do iz = nz-1, 1, -1
+   dp = (p(iz) - p(iz+1))*100.
+   col(iz)    = col(iz+1) + coef*(rmco2(iz+1) + rmco2(iz))*0.5*dp
+   col(iz)    = min(col(iz), table_colair(1))
+   colso2(iz) = colso2(iz+1) + coef*(rmso2(iz+1) + rmso2(iz))*0.5*dp
+   colso2(iz) = min(colso2(iz), table_colso2(nso2,1))
+end do
+
+! loop over altitude
+
+do iz = 1,nz
+
+! interpolation in co2 column
+
+   do i = 1,nztable
+      if (table_colair(i) < col(iz)) then
+         cicol = (log(col(iz)) - log(table_colair(i)))           &
+                /(log(table_colair(i-1)) - log(table_colair(i)))
+         indcol = i - 1
+         exit
+      end if
+   end do
+
+! interpolation in so2 column
+
+! initialize indso2 and ciso2 in case colref is never larger
+! than the gcm so2 column.
+
+   indso2 = nso2 - 1
+   ciso2 = 1.
+
+! search for the index indso2 between which interpolate
+
+   do iso2 = 1,nso2 
+      colref(iso2) = cicol*table_colso2(iso2,indcol)               &
+                   + (1.-cicol)*table_colso2(iso2,indcol+1)
+      if (colref(iso2) > colso2(iz)) then
+         ciso2 = (colso2(iz) - colref(iso2-1))                     &
+                /(colref(iso2) - colref(iso2-1))
+         indso2 = iso2 - 1
+         exit
+      end if
+   end do
+
+! 4-dimensional interpolation weights
+
+! poids(so2,sza_input,co2)
+
+   poids(1,1,1) = (1.-ciso2)*(1.-cisza)*    cicol 
+   poids(1,1,2) = (1.-ciso2)*(1.-cisza)*(1.-cicol)
+   poids(1,2,1) = (1.-ciso2)*    cisza *    cicol 
+   poids(1,2,2) = (1.-ciso2)*    cisza *(1.-cicol)
+   poids(2,1,1) =     ciso2 *(1.-cisza)*    cicol 
+   poids(2,1,2) =     ciso2 *(1.-cisza)*(1.-cicol)
+   poids(2,2,1) =     ciso2 *    cisza *    cicol 
+   poids(2,2,2) =     ciso2 *    cisza *(1.-cicol)
+
+! 4-dimensional interpolation in the lookup table
+
+   do ij = 1,nj
+      j(iz,ij) =                                          &
+      poids(1,1,1)*jphot(indso2  ,indsza  ,indcol  ,ij)   &
+    + poids(1,1,2)*jphot(indso2  ,indsza  ,indcol+1,ij)   &
+    + poids(1,2,1)*jphot(indso2  ,indsza+1,indcol  ,ij)   &
+    + poids(1,2,2)*jphot(indso2  ,indsza+1,indcol+1,ij)   &
+    + poids(2,1,1)*jphot(indso2+1,indsza  ,indcol  ,ij)   &
+    + poids(2,1,2)*jphot(indso2+1,indsza  ,indcol+1,ij)   &
+    + poids(2,2,1)*jphot(indso2+1,indsza+1,indcol  ,ij)   &
+    + poids(2,2,2)*jphot(indso2+1,indsza+1,indcol+1,ij)
+   end do
+
+end do           ! end of loop over altitude
+
+else             ! night
+   j(:,:) = 0.
+end if
+
+! photodissociation rates numbering in the lookup table
+
+!    1     o2 + hv     -> o + o
+!    2     o2 + hv     -> o + o(1d)
+!    3     co2 + hv    -> co + o
+!    4     co2 + hv    -> co + o(1d)
+!    5     o3 + hv     -> o2(Dg) + o(1d)
+!    6     o3 + hv     -> o2 + o
+!    7     h2o + hv    -> h + oh
+!    8     ho2 + hv    -> oh + o
+!    9     h2o2 + hv   -> oh + oh
+!    10    hcl + hv    -> h + cl
+!    11    cl2 + hv    -> cl + cl
+!    12    hocl + hv   -> oh + cl
+!    13    so2 + hv    -> so + o
+!    14    so + hv     -> s + o
+!    15    so3 + hv    -> so2 + o
+!    16    clo + hv    -> cl + o
+!    17    ocs + hv    -> co + s
+!    18    cocl2 + hv  -> cl + cl + co
+!    19    h2so4 + hv  -> so3 + h2o
+
+! fill v_phot array
+
+do ij = 1,nj
+   v_phot(:,ij) = j(:,ij)
+end do
+
+!PRINT*,'sza_input: ',sza_input
+!IF (sza_input.le.40.5 .AND. sza_input.gt.39.5) THEN
+!open(200, form = 'formatted')
+!100    format(e20.6)
+!write(200,100)(v_phot(:,19))
+!stop
+!END IF
+
+end subroutine phot
+
+!======================================================================
+
+ subroutine krates(hetero_ice,hetero_dust, nz, nesp, nj, c, conc, t, p, nb_phot_max, nb_reaction_3_max, nb_reaction_4_max, v_3, v_4, v_phot,sza_input)
+ 
+!================================================================
+! compute reaction rates                                        !
+!----------------------------------------------------------------
+! reaction               type                array              !
+!----------------------------------------------------------------
+! A + B    --> C + D     bimolecular         v_4                !
+! A + A    --> B + C     quadratic           v_3                !
+! A + C    --> B + C     quenching           v_phot             !
+! A + ice  --> B + C     heterogeneous       v_phot             !
+!================================================================
+
+
+ USE chemparam_mod
+implicit none
+
+real, INTENT(IN), dimension(nz)  :: t, p, conc
+integer, INTENT(IN) :: nesp, nj, nz
+real, INTENT(IN) :: sza_input
+integer :: iz
+logical, INTENT(IN) :: hetero_ice, hetero_dust
+real    :: ak0, ak1, xpo, rate, pi, gam, bid
+real    :: k1a0, k1b0, k1ainf, k1a, k1b, fc, fx, x, y
+real, dimension(nz)  :: surfice1d, surfdust1d
+real, dimension(nz) :: deq
+real, dimension(nz) :: a001, a002, a003,                           &
+                       b001, b002, b003, b004, b005, b006, b007,   &
+                       b008, b009,                                 &
+                       c001, c002, c003, c004, c005, c006, c007,   &
+                       c008, c009, c010, c011, c012, c013, c014,   &
+                       c015, c016, c017, c018,                     &
+                       d001, d002, d003,                           &
+                       e001, e002, e003, e004, e005, e006, e007,   &
+                       e008, e009, e010, e011, e012, e013, e014,   &
+                       e015, e016, e017, e018, e019, e020, e021,   &
+                       e022, e023, e024, e025, e026, e027, e028,   &
+                       e029, e030, e031, e032, e033, e034, e035,   &
+                       e036, e037, e038, e039, e040, e041, e042,   &
+                       e043,                                       &
+                       f001, f002, f003, f004, f005, f006, f007,   &
+                       f008, f009, f010, f011, f012, f013, f014,   &
+                       f015, f016, f017, f018, f019, f020, f021,   &
+                       f022, f023, f024, f025, f026, f027, f028,   &
+                       f029, f030, f031, f032, f033, f034, f035,   &
+                       f036, f037, f038, f039,                     &
+                       g001, g002, g003, g004, g005, g006, g007,   &
+                       g008, g009, g010, g011, g012, g013, g014,   &
+                       g015, g016, g017, g018, g019, g020, g021,   &
+                       g022, g023, g024, g025, g026, g027, g028,   &
+                       g029, g030, g031, g032, g033,               &
+                       h001, h002, h003, h004, h005,               &
+                       i001, i002
+
+double precision, INTENT(IN), dimension(nz,nesp) :: c
+
+integer :: nb_phot_max, nb_reaction_3_max, nb_reaction_4_max, nb_reaction_3, nb_reaction_4, nb_phot
+
+double precision, dimension(nz,nb_phot_max) :: v_phot
+double precision, dimension(nz,nb_reaction_3_max) :: v_3
+double precision, dimension(nz,nb_reaction_4_max) :: v_4
+
+pi = acos(-1.)
+
+nb_phot       = nj
+nb_reaction_3 = 0
+nb_reaction_4 = 0
+
+!----------------------------------------------------------------------
+!        reactions avec ox
+!----------------------------------------------------------------------
+
+!---  a001: o + o2 + co2 -> o3 + co2
+
+!     jpl 2003
+
+      a001(:) = 2.5*6.0d-34*(t(:)/300.)**(-2.4)*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = a001(:)
+
+!---  a002: o + o + co2 -> o2 + co2
+
+!     Tsang and Hampson, J. Chem. Phys. Ref. Data, 15, 1087, 1986
+
+!     a002(:) = 2.5*5.2d-35*exp(900./t(:))*conc(:)
+
+!     Campbell and Gray, Chem. Phys. Lett., 18, 607, 1973
+
+      a002(:) = 2.5*9.46d-34*exp(485./t(:))*conc(:) ! nist expression
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = a002(:)
+
+!---  a003: o + o3 -> o2 + o2
+
+!     jpl 2003
+
+      a003(:) = 8.0d-12*exp(-2060./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = a003(:)
+
+!----------------------------------------------------------------------
+!        reactions avec o(1d)
+!----------------------------------------------------------------------
+
+!---  b001: o(1d) + co2  -> o + co2
+
+!     jpl 2006
+
+      b001(:) = 7.5d-11*exp(115./t(:))
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = b001(:)*c(:,i_co2)
+
+!---  b002: o(1d) + h2o  -> oh + oh
+
+!     jpl 2006
+ 
+      b002(:) = 1.63d-10*exp(60./t(:))
+      
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = b002(:)
+
+!---  b003: o(1d) + h2  -> oh + h
+
+!     jpl 2003
+
+      b003(:) = 1.1d-10
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = b003(:)
+
+!---  b004: o(1d) + o2  -> o + o2
+
+!     jpl 2006
+
+      b004(:) = 3.3d-11*exp(55./t(:))
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = b004(:)*c(:,i_o2)
+    
+!---  b005: o(1d) + o3  -> o2 + o2
+
+!     jpl 2003
+
+      b005(:) = 1.2d-10
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = b005(:)
+    
+!---  b006: o(1d) + o3  -> o2 + o + o
+
+!     jpl 2003
+
+      b006(:) = 1.2d-10
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = b006(:)
+    
+!----------------------------------------------------------------------
+!        reactions des hox    
+!----------------------------------------------------------------------
+
+!---  c001: o + ho2 -> oh + o2
+
+!     jpl 2003
+
+      c001(:) = 3.0d-11*exp(200./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c001(:)
+
+!---  c002: o + oh -> o2 + h
+
+!     jpl 2003
+
+      c002(:) = 2.2d-11*exp(120./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c002(:)
+
+!---  c003: h + o3 -> oh + o2
+
+!     jpl 2003
+
+      c003(:) = 1.4d-10*exp(-470./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c003(:)
+
+!---  c004: h + ho2 -> oh + oh
+
+!     jpl 2006
+
+      c004(:) = 7.2d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c004(:)
+
+!---  c005: h + ho2 -> h2 + o2
+
+!     jpl 2006
+
+      c005(:) = 6.9d-12
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c005(:)
+
+!---  c006: h + ho2 -> h2o + o
+
+!     jpl 2006
+
+      c006(:) = 1.6d-12
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c006(:)
+
+!---  c007: oh + ho2 -> h2o + o2
+
+!     jpl 2003
+
+      c007(:) = 4.8d-11*exp(250./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c007(:)
+
+!---  c008: ho2 + ho2 -> h2o2 + o2
+
+!     jpl 2006
+
+!     c008(:) = 3.5d-13*exp(430./t(:))
+
+!     christensen et al., grl, 13, 2002
+
+      c008(:) = 1.5d-12*exp(19./t(:))
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = c008(:)
+
+!---  c009: oh + h2o2 -> h2o + ho2
+
+!     jpl 2006
+
+      c009(:) = 1.8d-12
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c009(:)
+
+!---  c010: oh + h2 -> h2o + h
+
+!     jpl 2006
+
+      c010(:) = 2.8d-12*exp(-1800./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c010(:)
+
+!---  c011: h + o2 + co2 -> ho2 + co2
+
+!     jpl 2006
+
+      do iz = 1,nz
+         ak0 = 2.5*4.4d-32*(t(iz)/300.)**(-1.3)
+         ak1 = 4.7d-11*(t(iz)/300.)**(-0.2)
+
+         rate = (ak0*conc(iz))/(1. + ak0*conc(iz)/ak1)
+         xpo = 1./(1. + alog10((ak0*conc(iz))/ak1)**2)
+         c011(iz) = rate*0.6**xpo
+      end do
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c011(:)
+
+!---  c012: o + h2o2 -> oh + ho2
+
+!     jpl 2003
+
+      c012(:) = 1.4d-12*exp(-2000./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c012(:)
+
+!---  c013: oh + oh -> h2o + o
+
+!     jpl 2006
+
+      c013(:) = 1.8d-12
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = c013(:)
+
+!---  c014: oh + o3 -> ho2 + o2
+
+!     jpl 2003
+
+      c014(:) = 1.7d-12*exp(-940./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c014(:)
+
+!---  c015: ho2 + o3 -> oh + o2 + o2
+
+!     jpl 2003
+
+      c015(:) = 1.0d-14*exp(-490./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = c015(:)
+
+!---  c016: ho2 + ho2 + co2 -> h2o2 + o2 + co2
+
+!     jpl 2003
+
+      c016(:) = 2.5*1.7d-33*exp(1000./t(:))*conc(:)
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = c016(:)
+
+!---  c017: oh + oh + co2 -> h2o2 + co2
+
+!     jpl 2003
+
+      do iz = 1,nz
+         ak0 = 2.5*6.9d-31*(t(iz)/300.)**(-1.0)
+         ak1 = 2.6d-11*(t(iz)/300.)**(0.0)
+
+         rate = (ak0*conc(iz))/(1. + ak0*conc(iz)/ak1)
+         xpo = 1./(1. + alog10((ak0*conc(iz))/ak1)**2)
+         c017(iz) = rate*0.6**xpo
+      end do
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = c017(:)
+
+!---  c018: h + h + co2 -> h2 + co2
+
+!     baulch et al., 2005
+
+      c018(:) = 2.5*1.8d-30*(t(:)**(-1.0))*conc(:)
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = c018(:)
+
+!----------------------------------------------------------------------
+!        reactions des composes azotes
+!----------------------------------------------------------------------
+
+!---  d001: no2 + o -> no + o2
+
+!     jpl 2006
+
+      d001(:) = 5.1d-12*exp(210./t(:))
+
+!---  d002: no + o3 -> no2 + o2
+
+!     jpl 2006
+
+      d002(:) = 3.0d-12*exp(-1500./t(:))
+
+!---  d003: no + ho2 -> no2 + oh
+
+!     jpl 2006
+
+      d003(:) = 3.5d-12*exp(250./t(:))
+
+!----------------------------------------------------------------------
+!        reactions des composes carbones
+!----------------------------------------------------------------------
+
+!---  e001: oh + co -> co2 + h
+
+!     jpl 2003
+
+!     e001(:) = 1.5d-13*(1 + 0.6*p(:)/1013.)
+
+!     mccabe et al., grl, 28, 3135, 2001
+
+!     e001(:) = 1.57d-13 + 3.54d-33*conc(:)
+
+!     jpl 2006
+
+!     ak0 = 1.5d-13*(t(:)/300.)**(0.6)
+!     ak1 = 2.1d-9*(t(:)/300.)**(6.1)
+!     rate1 = ak0/(1. + ak0/(ak1/conc(:)))
+!     xpo1 = 1./(1. + alog10(ak0/(ak1/conc(:)))**2)
+
+!     ak0 = 5.9d-33*(t(:)/300.)**(-1.4)
+!     ak1 = 1.1d-12*(t(:)/300.)**(1.3)
+!     rate2 = (ak0*conc(:))/(1. + ak0*conc(:)/ak1)
+!     xpo2 = 1./(1. + alog10((ak0*conc(:))/ak1)**2)
+
+!     e001(:) = rate1*0.6**xpo1 + rate2*0.6**xpo2
+
+!     joshi et al., 2006
+
+      do iz = 1,nz
+         k1a0 = 1.34*2.5*conc(iz)                                &
+               *1/(1/(3.62d-26*t(iz)**(-2.739)*exp(-20./t(iz)))  &
+               + 1/(6.48d-33*t(iz)**(0.14)*exp(-57./t(iz))))     ! corrige de l'erreur publi
+         k1b0 = 1.17d-19*t(iz)**(2.053)*exp(139./t(iz))          &
+              + 9.56d-12*t(iz)**(-0.664)*exp(-167./t(iz))
+         k1ainf = 1.52d-17*t(iz)**(1.858)*exp(28.8/t(iz))        &
+                + 4.78d-8*t(iz)**(-1.851)*exp(-318./t(iz))
+         x = k1a0/(k1ainf - k1b0)
+         y = k1b0/(k1ainf - k1b0)
+         fc = 0.628*exp(-1223./t(iz)) + (1. - 0.628)*exp(-39./t(iz))  &
+            + exp(-t(iz)/255.)
+         fx = fc**(1./(1. + (alog(x))**2))                   ! corrige de l'erreur publi
+         k1a = k1a0*((1. + y)/(1. + x))*fx
+         k1b = k1b0*(1./(1.+x))*fx
+
+         e001(iz) = k1a + k1b
+      end do
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = e001(:)
+
+!---  e002: o + co + m -> co2 + m
+
+!     tsang and hampson, 1986.
+
+      e002(:) = 2.5*6.5d-33*exp(-2184./t(:))*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = e002(:)
+
+!----------------------------------------------------------------------
+!        reactions des composes chlores
+!----------------------------------------------------------------------
+
+!---  f001: hcl + o(1d) -> oh + cl
+
+!     jpl 2011
+
+      f001(:) = 1.0d-10
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f001(:)
+
+!---  f002: hcl + o(1d) -> h + clo
+
+!     jpl 2011
+
+      f002(:) = 3.6d-11
+      
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f002(:)
+
+!---  f003: hcl + o -> oh + cl
+
+!     jpl 2006
+
+      f003(:) = 1.0d-11*exp(-3300./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f003(:)
+
+!---  f004: hcl + oh -> h2o + cl
+
+!     jpl 2006
+
+      f004(:) = 2.6d-12*exp(-350./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f004(:)
+
+!---  f005: clo + o -> cl + o2
+
+!     jpl 2006
+
+      f005(:) = 2.8d-11*exp(85./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f005(:)
+
+!---  f006: clo + oh -> cl + ho2
+
+!     jpl 2006
+
+      f006(:) = 7.4d-12*exp(270./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f006(:)
+
+!---  f007: clo + oh -> hcl + o2
+
+!     jpl 2006
+
+      f007(:) = 6.0d-13*exp(230./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f007(:)
+
+!---  f008: cl + h2 -> hcl + h
+
+!     jpl 2006
+
+      f008(:) = 3.05d-11*exp(-2270./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f008(:)
+
+!---  f009: cl + o3 -> clo + o2
+
+!     jpl 2006
+
+      f009(:) = 2.3d-11*exp(-200./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f009(:)
+
+!---  f010: cl + ho2 -> clo + oh
+
+!     jpl 2006
+
+      f010(:) = 4.1d-11*exp(-450./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f010(:)
+
+!---  f011: cl + ho2 -> hcl + o2
+
+!     jpl 2006
+
+      f011(:) = 1.8d-11*exp(170./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f011(:)
+
+!---  f012: cl + h2o2 -> hcl + ho2
+
+!     jpl 2006
+
+      f012(:) = 1.1d-11*exp(-980./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f012(:)
+
+!---  f013: cl + co + co2 -> clco + co2
+
+!     jpl 2011 + nicovich et al., j. phys. chem., 1990
+
+      f013(:) = 3.2*1.3d-33*(t(:)/300.)**(-3.8)*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f013(:)
+
+!---  f014: clco + co2 -> cl + co + co2
+
+!     jpl 2011
+
+!     deq(:) = 3.2*3.5d-25*exp(3730./t(:))
+
+!     mills, 1998
+
+      deq(:) = 1.6d-25*exp(4000./t(:))
+
+      f014(:) = f013(:)/(deq(:)*conc(:))
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = f014(:)*conc(:)
+
+!     do iz = 1, nz
+!     print*, z(iz), t(iz), f013(iz), f014(iz), v_phot(iz,nb_phot)
+!     end do
+!     stop
+
+!---  f015: clco + o2 + m -> clco3 + m
+
+!     yung and demore, icarus, 51, 199-247, 1982.
+
+      f015(:) = 5.7d-15*exp(500./t(:))*conc(:)   &
+               /(1.e17 + 0.05*conc(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f015(:)
+
+!---  f016: clco3 + cl -> cl + clo + co2
+
+!     yung and demore, icarus, 51, 199-247, 1982.
+
+!     decomposee en :
+!     0.5 clco3 + 0.5 cl -> cl + 0.5 co2
+!     0.5 clco3 + 0.5 cl -> clo + 0.5 co2
+
+      f016(:) = 1.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f016(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f016(:)
+
+!---  f017: clco3 + o -> cl + o2 + co2
+
+!     yung and demore, icarus, 51, 199-247, 1982.
+
+!     decomposee en :
+!     0.5 clco3 + 0.5 o -> cl
+!     0.5 clco3 + 0.5 o -> o2 + co2
+
+      f017(:) = 1.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f017(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f017(:)
+
+!---  f018: clo + ho2  -> hocl + o2
+
+      f018(:) = 2.7d-12*exp(220./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f018(:)
+
+!---  f019: oh + hocl -> h2o + clo
+
+      f019(:) = 3.0d-12*exp(-500./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f019(:)
+
+!---  f020: o + hocl -> oh + clo
+
+      f020(:) = 1.7d-13
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f020(:)
+
+!---  f021: cl + cl + co2 -> cl2 + co2
+
+!     donohoue et al., j. phys. chem. a, 109, 7732-7741, 2005
+
+!     f021(:) = 2.5*8.4d-33*exp(850.*(1./t(:) - 1./298.))*conc(:)
+
+!     valeur utilisee par Zhang et al., 2011:
+
+      f021(:) = 2.6d-33*exp(900./t(:))*conc(:)
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = f021(:)
+
+!---  f022: clco + o -> cl + co2
+
+!     yung et al., icarus, 1982 (estimated)
+
+      f022(:) = 3.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f022(:)
+
+!---  f023: cl2 + o(1d) -> cl + clo
+
+!     jpl 2011
+
+      f023(:) = 2.0d-10
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f023(:)
+
+!---  f024: cl2 + h  -> hcl + cl
+
+!     baulch et al., j. phys. chem. ref. data, 1981
+
+      f024(:) = 1.43d-10*exp(-591./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f024(:)
+
+!---  f025: cl + clco  -> cl2 + co
+
+!     baulch et al., j. phys. chem. ref. data, 1981
+
+      f025(:) = 2.16d-9*exp(-1670./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f025(:)
+
+!---  f026: clco + clco  -> cocl2 + co
+
+!     zhang et al., icarus, 2011 (estimated)
+
+      f026(:) = 5.0d-11
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = f026(:)
+
+!---  f027: cl + so2 + co2  -> clso2 + co2
+
+!     mills, phd, 1998
+
+      f027(:) = 1.3d-34*exp(940./t(:))*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f027(:)
+
+!---  f028: clso2 + o  -> so2 + clo
+
+!     mills, phd, 1998
+
+      f028(:) = 1.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f028(:)
+
+!---  f029: clso2 + h  -> so2 + hcl
+
+!     mills, phd, 1998
+
+      f029(:) = 1.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f029(:)
+
+!---  f030: clso2 + clso2  -> cl2 + so2 + so2
+
+!     moses et al. 2002
+
+      f030(:) = 5.0d-13
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = f030(:)
+
+!---  f031: cl + o + co2  -> clo + co2
+
+!     yung and demore, 1999 (estimated)
+
+      f031(:) = 5.0d-32*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f031(:)
+
+!---  f032: cl2 + o -> clo + cl
+
+!     mills, phd, 1998
+
+      f032(:) = 7.4d-12*exp(-1650./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f032(:)
+
+!---  f033: clco + oh -> hocl + co
+
+!     mills, phd, 1998
+
+      f033(:) = 1.5d-10
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f033(:)
+
+!---  f034: cl2 + oh -> cl + hocl
+
+!     jpl 2011
+
+      f034(:) = 2.6d-12*exp(-1100./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f034(:)
+
+!---  f035: clco + o -> co + clo
+
+!     yung and demore, 1982
+
+      f035(:) = 3.0d-12
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f035(:)
+
+!---  f036: clco + cl2 -> cocl2 + cl
+
+!     ohta, bull. chem. soc. jpn., 1983
+
+      f036(:) = 6.45d-2*f015(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f036(:)
+
+!---  f037: hcl + h -> h2 + cl
+
+!     mills, phd, 1998
+
+      f037(:) = 1.5d-11*exp(-1750./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f037(:)
+
+!---  f038: clco + h -> hcl + co
+
+!     yung and demore, 1982
+
+      f038(:) = 1.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f038(:)
+
+!---  f039: cl + h + m -> hcl + m
+
+!     yung and demore, 1982 (estimate)
+
+      f039(:) = 1.0d-32*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = f039(:)
+
+!----------------------------------------------------------------------
+!        reactions des composes soufres
+!----------------------------------------------------------------------
+
+!---  g001: s + o2 -> so + o
+
+      g001(:) = 2.3d-12
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g001(:)
+
+!---  g002: s + o3 -> so + o2
+
+      g002(:) = 1.2d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g002(:)
+
+!---  g003: so + o2 -> so2 + o
+
+      g003(:) = 1.25d-13*exp(-2190./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g003(:)
+
+!---  g004: so + o3 -> so2 + o2
+
+      g004(:) = 3.4d-12*exp(-1100./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g004(:)
+
+!---  g005: so + oh -> so2 + h
+
+      g005(:) = 2.7d-11*exp(335./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g005(:)
+
+!---  g006: s + oh -> so + h
+
+      g006(:) = 6.6d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g006(:)
+
+!---  g007: so + o + co2 -> so2 + co2
+
+!     singleton and cvetanovic, j. phys. chem. ref. data, 1988
+!     measured with co2 as third body
+
+      do iz = 1,nz
+         ak0 = 4.2d-30
+         ak1 = 5.3d-11
+
+         rate = (ak0*conc(iz))/(1. + ak0*conc(iz)/ak1)
+         xpo = 1./(1. + alog10((ak0*conc(iz))/ak1)**2)
+         g007(iz) = rate*0.6**xpo
+      end do
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g007(:)
+
+!---  g008: so + ho2 -> so2 + oh 
+
+      g008(:) = 2.8d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g008(:)
+
+!---  g009: so2 + o + co2 -> so3 + co2
+
+!     jpl 2011
+
+      do iz = 1,nz
+         ak0 = 2.5*1.8d-33*(t(iz)/300.)**(2.0)
+         ak1 = 4.2d-14*(t(iz)/300.)**(1.8)
+
+         rate = (ak0*conc(iz))/(1. + ak0*conc(iz)/ak1)
+         xpo = 1./(1. + alog10((ak0*conc(iz))/ak1)**2)
+         g009(iz) = rate*0.6**xpo
+      end do
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g009(:)
+
+!---  g010: s + o + co2 -> so + co2
+
+!     zhang et al., icarus, 2011
+
+      g010(:) = 1.5d-34*exp(900./t(:))*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g010(:)
+
+!---  g011: so3 + h2o -> h2so4
+
+!     jpl 2011
+
+!      g011(:) = 8.5d-21*exp(6540./t(:))*c(:,i_h2o)
+      g011(:) = 2.26d-23*t(:)*exp(6540/t(:))*c(:,i_h2o)
+      g011(:) = g011(:)*1.d-20
+!      g011(:) = 0. ! SANS H2SO4
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g011(:)
+
+!---  g012: so + clo -> so2 + cl 
+
+!     jpl 2011
+
+      g012(:) = 2.8d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g012(:)
+
+!---  g013: so + so3 -> so2 + so2 
+
+!     chung et al., int. j. chem. kinet., 1975
+
+      g013(:) = 2.0d-15
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g013(:)
+
+!---  g014: so3 + o -> so2 + o2 
+
+!     jacob and winkler, j. chem. soc. faraday trans. 1, 1972
+
+      g014(:) = 2.32d-16*exp(-487./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g014(:)
+
+!---  g015: so + so + co2 -> s2o2 + co2
+
+!     herron and huie, chem. phys. lett., 1980.
+
+      do iz = 1,nz
+         ak0 = 2.5*4.4d-31
+         ak1 = 1.0d-11
+
+         rate = (ak0*conc(iz))/(1. + ak0*conc(iz)/ak1)
+         xpo = 1./(1. + alog10((ak0*conc(iz))/ak1)**2)
+         g015(iz) = rate*0.6**xpo
+      end do
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = g015(:)
+
+!---  g016: s2o2 + co2 -> so + so + co2
+
+!     mills, phd, 1998
+
+      deq(:) = 2.5*1.0d-28*exp(6000./t(:))
+
+      g016(:) = g015(:)/(deq(:)*conc(:))
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = g016(:)*conc(:)
+
+!---  g017: clco3 + so -> cl + so2 + co2
+
+!     mills, phd, 1998
+
+!     decomposee en :
+!     0.5 clco3 + 0.5 so -> cl
+!     0.5 clco3 + 0.5 so -> so2 + co2
+
+      g017(:) = 1.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g017(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g017(:)
+
+!---  g018: s + co + co2 -> ocs + co2
+
+!     zhang et al., icarus, 2011 (estimate?)
+
+      g018(:) = 2.5*4.0d-33*exp(-1940./t(:))*conc(:)
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g018(:)
+
+!---  g019: clco + s -> ocs + cl 
+
+!     zhang et al., icarus, 2011
+
+      g019(:) = 3.0d-12
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g019(:)
+
+!---  g020: so2 + oh + co2 -> hso3 + co2
+
+!     jpl 2011
+
+      do iz = 1,nz
+         ak0 = 2.5*3.3d-31*(t(iz)/300.)**(-4.3)
+         ak1 = 1.6d-12
+
+         rate = (ak0*conc(iz))/(1. + ak0*conc(iz)/ak1)
+         xpo = 1./(1. + alog10((ak0*conc(iz))/ak1)**2)
+         g020(iz) = rate*0.6**xpo
+      end do
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g020(:)
+
+!---  g021: hso3 + o2 -> ho2 + so3 
+
+!     jpl 2011
+
+      g021(:) = 1.3d-12*exp(-330./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g021(:)
+
+!---  g022: s + s + co2 -> s2 + co2
+
+!     nicholas et al., j. chem. soc. faraday trans. 1, 1979
+
+      do iz = 1,nz
+         ak0 = 1.19d-29
+         ak1 = 1.0d-10
+
+         rate = (ak0*conc(iz))/(1. + ak0*conc(iz)/ak1)
+         xpo = 1./(1. + alog10((ak0*conc(iz))/ak1)**2)
+         g022(iz) = rate*0.6**xpo
+      end do
+
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = g022(:)
+
+!---  g023: s2 + co2 -> s + s + co2
+
+!     chase et al., 1985
+
+!      deq(:) = 2.68d-25*exp(50860./t(:))
+
+!      g023(:) = g022(:)/(deq(:)*conc(:))
+
+!      nb_phot = nb_phot + 1
+!      v_phot(:,nb_phot) = g023(:)*conc(:)
+
+!     Changement pour g023 ==> s2 + hv -> s + s
+!     Pas encore inclu dans la table jphot
+
+      g023(:) = 6.5d-3
+      
+      nb_phot = nb_phot + 1
+      
+      IF (sza_input.LE.95.0) THEN
+      v_phot(:,nb_phot) = g023(:)
+      ELSE
+      v_phot(:,nb_phot) = 0.0d0
+      END IF
+
+!---  g024: s2 + o -> so + s 
+
+!     zhang et al., icarus, 2011
+
+      g024(:) = 2.2d-11*exp(-84./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g024(:)
+
+!---  g025: s + ocs -> s2 +  co
+
+!     lu et al., j. chem. phys., 2006
+
+      g025(:) = 6.63d-20*(t(:)**2.57)*exp(-1180./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g025(:)
+
+!---  g026: ocs + o -> so + co
+
+!     atkinson et al., 2004
+
+      g026(:) = 1.60d-11*exp(-2150./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g026(:)
+
+!---  g027: s + so3 -> so2 +  so
+
+!     moses et al., 2002
+
+      g027(:) = 1.0d-16
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g027(:)
+
+!---  g028: s + ho2 -> so +  oh
+
+!     yung and demore, 1982
+
+      g028(:) = 3.0d-11*exp(200./t(:))
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g028(:)
+
+!---  g029: s + clo -> so +  cl
+
+!     moses et al., 2002
+
+      g029(:) = 4.0d-11
+
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g029(:)
+
+!---  g030: h2so4 + h2o -> so3 + h2o + h2o 
+
+!     krasnopolsky , 2007 
+
+      g030(:) = 7.0d-14*exp(-5170./t(:))
+!      g030(:) = 0.0d0
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = g030(:)*c(:,i_h2o)
+      
+!---  g031: so3 + ocs -> s2o2 +  co2
+
+!     krasnopolsky , 2007 
+
+      g031(:) = 1.0d-11*exp(-10000./t(:))
+!      g031(:) = 0.0d0
+      
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g031(:)
+      
+!---  g032: s2o2 + ocs -> co + so2 + s2
+
+!	decomposee en
+!	0.5 s2o2 + 0.5 ocs -> co
+!	0.5 s2o2 + 0.5 ocs -> so2 + s2
+
+!     krasnopolsky , 2007 
+
+      g032(:) = 1.0d-20
+!      g032(:) = 0.0d0
+      
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g032(:)
+      
+      nb_reaction_4 = nb_reaction_4 + 1
+      v_4(:,nb_reaction_4) = g032(:)
+
+!      g033: so + so -> so2 + s
+!  Krasnopolsky 2012 from Martinez & Heron 1983 or Moses et al 2002
+
+!      g033(:) = 3.5d-15
+      g033(:) =1.0d-12*exp(-1700.0/t(:))
+      
+      nb_reaction_3 = nb_reaction_3 + 1
+      v_3(:,nb_reaction_3) = g033(:)
+            
+!----------------------------------------------------------------------
+!     heterogeneous chemistry 
+!----------------------------------------------------------------------
+
+      if (hetero_ice) then
+
+!        k = (surface*v*gamma)/4 (s-1)
+!        v = 100*sqrt(8rt/(pi*m))  (cm s-1)
+ 
+!---     h001: ho2 + ice -> products
+ 
+!        cooper and abbatt, 1996: gamma = 0.025
+      
+         gam = 0.025
+         h001(:) = surfice1d(:)*1.d-8       &
+                   *100.*sqrt(8.*8.31*t(:)/(33.d-3*pi))*gam/4.
+ 
+!        h002: oh + ice -> products
+ 
+!        cooper and abbatt, 1996: gamma = 0.03
+ 
+         gam = 0.03
+         h002(:) = surfice1d(:)*1.d-8       &
+                   *100.*sqrt(8.*8.31*t(:)/(17.d-3*pi))*gam/4.
+
+!---     h003: h2o2 + ice -> products
+ 
+!        gamma = 0.    test value
+ 
+         gam = 0.
+         h003(:) = surfice1d(:)*1.d-8        &
+                   *100.*sqrt(8.*8.31*t(:)/(34.d-3*pi))*gam/4.
+      else
+         h001(:) = 0.
+         h002(:) = 0.
+         h003(:) = 0.
+      end if
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = h001(:)
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = h002(:)
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = h003(:)
+
+!     do iz = 1,nz
+!        print*, z(iz), surfice1d(iz), h001(iz), h002(iz)
+!     end do
+!     stop
+
+      if (hetero_dust) then
+ 
+!---     h004: ho2 + dust -> products
+ 
+!        jacob, 2000: gamma = 0.2
+!        see dereus et al., atm. chem. phys., 2005
+ 
+         gam = 0.2
+         h004(:) = surfdust1d(:)*1.d-8  &
+                   *100.*sqrt(8.*8.31*t(:)/(33.d-3*pi))*gam/4.
+ 
+!---     h005: h2o2 + dust -> products
+ 
+!        gamma = 5.d-4
+!        see dereus et al., atm. chem. phys., 2005
+ 
+         gam = 5.d-4
+         h005(:) = surfdust1d(:)*1.d-8  &
+                   *100.*sqrt(8.*8.31*t(:)/(34.d-3*pi))*gam/4.
+      else
+         h004(:) = 0.
+         h005(:) = 0.
+      end if
+ 
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = h004(:)
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = h005(:)
+
+!     print*, 'krates : nb_phot       = ', nb_phot
+!     print*, 'krates : nb_reaction_4 = ', nb_reaction_4
+!     print*, 'krates : nb_reaction_3 = ', nb_reaction_3
+!     stop
+
+!----------------------------------------------------------------------
+!     reactions avec 02(Dg) 
+!----------------------------------------------------------------------
+
+!---     i001: O2(Dg) + CO2 -> O2 + CO2 + hv
+
+!        Krasnopolsky (2010a)
+
+      i001(:) = 1.d-20
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = i001(:)*c(:,i_co2)
+
+!---     i002: O2(Dg) -> O2 + hv
+
+!        Lafferty et al; (1998)
+
+      i002(:) = 2.2d-4
+
+      nb_phot = nb_phot + 1
+      v_phot(:,nb_phot) = i002(:)
+
+return
+end subroutine krates
+
+!======================================================================
+
+ subroutine fill_eps(iz, nz, nesp, c, nb_reaction_4_max, eps_4)
+
+!======================================================================
+
+
+ USE chemparam_mod
+implicit none
+
+integer :: i4, iz, nb_reaction_4
+real    :: ep = 1.d-3
+integer, INTENT(IN) :: nz, nesp, nb_reaction_4_max
+double precision, dimension(nb_reaction_4_max), INTENT(OUT) :: eps_4
+
+! number densities
+
+double precision, dimension(nz,nesp) :: c
+
+nb_reaction_4 = 0
+eps_4(:) = 0.5
+
+!===========================================================
+!      a001 : O + O2 + CO2 -> O3 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o)/(c(iz,i_o) + c(iz,i_o2) + ep)
+
+
+!===========================================================
+!      a003 : O + O3 -> O2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o)/(c(iz,i_o) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      b002 : O(1D) + H2O -> OH + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o1d)/(c(iz,i_o1d) + c(iz,i_h2o) + ep)
+
+
+!===========================================================
+!      b003 : O(1D) + H2 -> OH + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o1d)/(c(iz,i_o1d) + c(iz,i_h2) + ep)
+
+
+!===========================================================
+!      b005 : O(1D) + O3 -> O2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o1d)/(c(iz,i_o1d) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      b006 : O(1D) + O3 -> O2 + O + O
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o1d)/(c(iz,i_o1d) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      c001 : O + HO2 -> OH + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o)/(c(iz,i_o) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      c002 : O + OH -> O2 + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o)/(c(iz,i_o) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      c003 : H + O3 -> OH + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_h)/(c(iz,i_h) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      c004 : H + HO2 -> OH + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_h)/(c(iz,i_h) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      c005 : H + HO2 -> H2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_h)/(c(iz,i_h) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      c006 : H + HO2 -> H2O + O
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_h)/(c(iz,i_h) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      c007 : OH + HO2 -> H2O + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_oh)/(c(iz,i_oh) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      c009 : OH + H2O2 -> H2O + HO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_oh)/(c(iz,i_oh) + c(iz,i_h2o2) + ep)
+
+
+!===========================================================
+!      c010 : OH + H2 -> H2O + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_oh)/(c(iz,i_oh) + c(iz,i_h2) + ep)
+
+
+!===========================================================
+!      c011 : H + O2 + CO2 -> HO2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_h)/(c(iz,i_h) + c(iz,i_o2) + ep)
+
+
+!===========================================================
+!      c012 : O + H2O2 -> OH + HO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o)/(c(iz,i_o) + c(iz,i_h2o2) + ep)
+
+
+!===========================================================
+!      c014 : OH + O3 -> HO2 + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_oh)/(c(iz,i_oh) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      c015 : HO2 + O3 -> OH + O2 + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_ho2)/(c(iz,i_ho2) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      e001 : CO + OH -> CO2 + H 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_co)/(c(iz,i_oh) + c(iz,i_co) + ep)
+
+
+!===========================================================
+!      e002 : CO + O + M -> CO2 + M 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_co)/(c(iz,i_o) + c(iz,i_co) + ep)
+
+
+!===========================================================
+!      f001 : HCl + O(1D) -> OH + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_hcl)/(c(iz,i_hcl) + c(iz,i_o1d) + ep)
+
+
+!===========================================================
+!      f002 : HCl + O(1D) -> H + ClO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_hcl)/(c(iz,i_hcl) + c(iz,i_o1d) + ep)
+
+
+!===========================================================
+!      f003 : HCl + O -> OH + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_hcl)/(c(iz,i_hcl) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f004 : HCl + OH -> H2O + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_hcl)/(c(iz,i_hcl) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      f005 : ClO + O -> Cl + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clo)/(c(iz,i_clo) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f006 : ClO + OH -> Cl + HO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clo)/(c(iz,i_clo) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      f007 : ClO + OH -> HCl + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clo)/(c(iz,i_clo) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      f008 : Cl + H2 -> HCl + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_h2) + ep)
+
+
+!===========================================================
+!      f009 : Cl + O3 -> ClO + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      f010 : Cl + HO2 -> ClO + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      f011 : Cl + HO2 -> HCl + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      f012 : Cl + H2O2 -> HCl + HO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_h2o2) + ep)
+
+
+!===========================================================
+!      f013 : Cl + CO + CO2 -> ClCO + CO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_co) + ep)
+
+
+!===========================================================
+!      f015 : ClCO + O2 + M -> ClCO3 + CO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco)/(c(iz,i_clco) + c(iz,i_o2) + ep)
+
+
+!===========================================================
+!      f016 : 0.5 ClCO3 + 0.5 Cl -> Cl  + 0.5 CO2  
+!             0.5 ClCO3 + 0.5 Cl -> ClO + 0.5 CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco3)/(c(iz,i_clco3) + c(iz,i_cl) + ep)
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco3)/(c(iz,i_clco3) + c(iz,i_cl) + ep)
+
+
+!===========================================================
+!      f017 : 0.5 ClCO3 + 0.5 O -> Cl  
+!             0.5 ClCO3 + 0.5 O -> O2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco3)/(c(iz,i_clco3) + c(iz,i_o) + ep)
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco3)/(c(iz,i_clco3) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f018 : ClO + HO2 -> HOCl + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clo)/(c(iz,i_clo) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      f019 : OH + HOCl -> H2O + ClO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_oh)/(c(iz,i_oh) + c(iz,i_hocl) + ep)
+
+
+!===========================================================
+!      f020 : O + HOCl -> OH + ClO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_o)/(c(iz,i_o) + c(iz,i_hocl) + ep)
+
+
+!===========================================================
+!      f022 : ClCO + O -> Cl + CO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco)/(c(iz,i_clco) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f023 : Cl2 + O(1D) -> Cl + ClO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl2)/(c(iz,i_cl2) + c(iz,i_o1d) + ep)
+
+
+!===========================================================
+!      f024 : Cl2 + H -> HCl + Cl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl2)/(c(iz,i_cl2) + c(iz,i_h) + ep)
+
+
+!===========================================================
+!      f025 : Cl + ClCO -> Cl2 + CO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_clco) + ep)
+
+
+!===========================================================
+!      f027 : Cl + SO2 + CO2 -> ClSO2 + CO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_so2) + ep)
+
+
+!===========================================================
+!      f028 : ClSO2 + O -> SO2 + ClO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clso2)/(c(iz,i_clso2) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f029 : ClSO2 + H -> SO2 + HCl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clso2)/(c(iz,i_clso2) + c(iz,i_h) + ep)
+
+
+!===========================================================
+!      f031 : Cl + O + CO2 -> ClO + CO2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f032 : Cl2 + O -> ClO + Cl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl2)/(c(iz,i_cl2) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f033 : ClCO + OH -> HOCl + CO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco)/(c(iz,i_clco) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      f034 : Cl2 + OH -> Cl + HOCl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl2)/(c(iz,i_cl2) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      f035 : ClCO + O -> CO + ClO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco)/(c(iz,i_clco) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      f036 : ClCO + Cl2 -> COCl2 + Cl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco)/(c(iz,i_clco) + c(iz,i_cl2) + ep)
+
+
+!===========================================================
+!      f037 : HCl + H -> H2 + Cl 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_hcl)/(c(iz,i_hcl) + c(iz,i_h) + ep)
+
+
+!===========================================================
+!      f038 : ClCO + H -> HCl + CO 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco)/(c(iz,i_clco) + c(iz,i_h) + ep)
+
+
+!===========================================================
+!      f039 : Cl + H + M -> HCl + M
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_cl)/(c(iz,i_cl) + c(iz,i_h) + ep)
+
+
+!===========================================================
+!      g001 : S + O2 -> SO + O 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_o2) + ep)
+
+
+!===========================================================
+!      g002 : S + O3 -> SO + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      g003 : SO + O2 -> SO2 + O 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so)/(c(iz,i_so) + c(iz,i_o2) + ep)
+
+
+!===========================================================
+!      g004 : SO + O3 -> SO2 + O2 
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so)/(c(iz,i_so) + c(iz,i_o3) + ep)
+
+
+!===========================================================
+!      g005 : SO + OH -> SO2 + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so)/(c(iz,i_so) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      g006 : S + OH -> SO + H
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      g007 : SO + O + CO2 -> SO2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so)/(c(iz,i_so) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      g008 : SO + HO2 -> SO2 + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so)/(c(iz,i_so) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      g009 : SO2 + O + CO2 -> SO3 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so2)/(c(iz,i_so2) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      g010 : S + O + CO2 -> SO + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      g011 : SO3 + H2O -> H2SO4
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so3)/(c(iz,i_so3) + c(iz,i_h2o) + ep)
+
+
+!===========================================================
+!      g012 : SO + ClO -> SO2 + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so)/(c(iz,i_so) + c(iz,i_clo) + ep)
+
+
+!===========================================================
+!      g013 : SO + SO3 -> SO2 + SO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so)/(c(iz,i_so) + c(iz,i_so3) + ep)
+
+
+!===========================================================
+!      g014 : SO3 + O -> SO2 + O2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so3)/(c(iz,i_so3) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      g017 : 0.5 ClCO3 + 0.5 SO -> Cl  
+!             0.5 ClCO3 + 0.5 SO -> SO2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco3)/(c(iz,i_clco3) + c(iz,i_so) + ep)
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco3)/(c(iz,i_clco3) + c(iz,i_so) + ep)
+
+
+!===========================================================
+!      g018 : S + CO + CO2 -> OCS + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_co) + ep)
+
+
+!===========================================================
+!      g019 : ClCO + S + -> OCS + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_clco)/(c(iz,i_clco) + c(iz,i_s) + ep)
+
+
+!===========================================================
+!      g020 : SO2 + OH + CO2 -> HSO3 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so2)/(c(iz,i_so2) + c(iz,i_oh) + ep)
+
+
+!===========================================================
+!      g021 : HSO3 + O2 -> HO2 + SO3
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_hso3)/(c(iz,i_hso3) + c(iz,i_o2) + ep)
+
+
+!===========================================================
+!      g024 : S2 + O -> SO + S
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s2)/(c(iz,i_s2) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      g025 : S + OCS -> S2 + CO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_ocs) + ep)
+
+
+!===========================================================
+!      g026 : OCS + O -> SO + CO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_ocs)/(c(iz,i_ocs) + c(iz,i_o) + ep)
+
+
+!===========================================================
+!      g027 : S + SO3 -> SO2 + SO
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_so3) + ep)
+
+
+!===========================================================
+!      g028 : S + HO2 -> SO + OH
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_ho2) + ep)
+
+
+!===========================================================
+!      g029 : S + ClO -> SO + Cl
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s)/(c(iz,i_s) + c(iz,i_clo) + ep)
+
+
+!===========================================================
+!      g031 : SO3 + OCS -> S2O2 + CO2
+!===========================================================
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_so3)/(c(iz,i_so3) + c(iz,i_ocs) + ep)
+
+!===========================================================
+!      g032 : 0.5 s2o2 + 0.5 ocs -> co
+!	        0.5 s2o2 + 0.5 ocs -> so2 + s2
+!===========================================================	
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s2o2)/(c(iz,i_s2o2) + c(iz,i_ocs) + ep)
+
+nb_reaction_4 = nb_reaction_4 + 1
+
+eps_4(nb_reaction_4) = c(iz,i_s2o2)/(c(iz,i_s2o2) + c(iz,i_ocs) + ep)
+
+!===========================================================
+
+
+
+do i4 = 1,nb_reaction_4
+   eps_4(i4) = max(eps_4(i4), 0.d0)
+   eps_4(i4) = min(eps_4(i4), 1.d0)
+end do
+
+return
+end subroutine fill_eps
+
+!======================================================================
+
+ subroutine fill_matrix(ind,dtx, nz, nesp, v_phot, v_3, v_4, eps_4, c,     &
+                        nb_phot_max, nb_reaction_3_max, nb_reaction_4_max, &
+                        indice_phot, indice_3, indice_4, mat)
+
+!======================================================================
+
+! filling of the jacobian matrix
+
+implicit none
+
+integer, INTENT(IN) :: nesp, nz
+integer, INTENT(IN) :: ind
+integer :: iesp,i_phot,i_3,i_4
+integer :: i_phot_2,i_phot_4,i_phot_6
+integer :: i_3_2,i_3_4,i_3_6
+integer :: i_4_2,i_4_4,i_4_6,i_4_8
+integer :: iphot,i3,i4
+
+double precision :: Xphot_11,Xphot_21,Xphot_31
+double precision :: X3_11,X3_21,X3_31
+double precision :: X4_11,X4_12,X4_21,X4_22,X4_31,X4_32,X4_41,X4_42
+real, INTENT(IN) :: dtx
+
+double precision, INTENT(IN), dimension(nz,nesp) :: c
+
+! matrix
+
+double precision, dimension(nesp,nesp), INTENT(OUT) :: mat
+!double precision              :: d
+!integer                    :: code
+!integer, dimension(nesp)   :: indx
+
+! reaction rates and indices
+
+integer :: nb_phot_max, nb_reaction_3_max, nb_reaction_4_max
+real, dimension(6*nb_phot_max), INTENT(IN) :: indice_phot
+real, dimension(6*nb_reaction_3_max), INTENT(IN) :: indice_3
+real, dimension(8*nb_reaction_4_max), INTENT(IN) :: indice_4
+double precision, dimension(nz, nb_phot_max), INTENT(IN) :: v_phot
+double precision, dimension(nz, nb_reaction_3_max), INTENT(IN) :: v_3
+double precision, dimension(nz, nb_reaction_4_max), INTENT(IN) :: v_4
+double precision, dimension(nb_reaction_4_max), INTENT(IN) :: eps_4
+      
+! initialisation 
+
+mat(:,:) = 0.
+do iesp = 1,nesp
+  mat(iesp,iesp) = 1.
+end do  
+
+! photodissociations
+! or reactions a + c -> b + c
+! or reactions a + ice -> b + c
+do iphot = 1,nb_phot_max   
+  i_phot = 6*(iphot-1)
+  i_phot_2 = int(indice_phot(i_phot+2))
+  i_phot_4 = int(indice_phot(i_phot+4))
+  i_phot_6 = int(indice_phot(i_phot+6))
+  Xphot_11 = indice_phot(i_phot+1)*v_phot(ind,iphot)*dtx
+  Xphot_21 =-indice_phot(i_phot+3)*v_phot(ind,iphot)*dtx
+  Xphot_31 =-indice_phot(i_phot+5)*v_phot(ind,iphot)*dtx
+  mat(i_phot_2,i_phot_2) = mat(i_phot_2,i_phot_2) + Xphot_11
+  mat(i_phot_4,i_phot_2) = mat(i_phot_4,i_phot_2) + Xphot_21
+  mat(i_phot_6,i_phot_2) = mat(i_phot_6,i_phot_2) + Xphot_31
+end do
+
+! reactions a + a -> b + c 
+
+do i3 = 1,nb_reaction_3_max
+  i_3 = 6*(i3-1)
+  i_3_2 = int(indice_3(i_3+2))
+  i_3_4 = int(indice_3(i_3+4))
+  i_3_6 = int(indice_3(i_3+6))
+  X3_11 = indice_3(i_3+1)*v_3(ind,i3)*c(ind,i_3_2)*dtx
+  X3_21 =-indice_3(i_3+3)*v_3(ind,i3)*c(ind,i_3_2)*dtx
+  X3_31 =-indice_3(i_3+5)*v_3(ind,i3)*c(ind,i_3_2)*dtx
+  mat(i_3_2,i_3_2) = mat(i_3_2,i_3_2) + X3_11
+  mat(i_3_4,i_3_2) = mat(i_3_4,i_3_2) + X3_21
+  mat(i_3_6,i_3_2) = mat(i_3_6,i_3_2) + X3_31
+end do
+
+! reactions a + b -> c + d 
+
+do i4 = 1,nb_reaction_4_max
+  i_4 = 8*(i4-1)
+  i_4_2 = int(indice_4(i_4+2))
+  i_4_4 = int(indice_4(i_4+4))
+  i_4_6 = int(indice_4(i_4+6))
+  i_4_8 = int(indice_4(i_4+8))
+  X4_11 = indice_4(i_4+1)*v_4(ind,i4)*dtx*(1-eps_4(i4))*c(ind,i_4_4)
+  X4_12 = indice_4(i_4+1)*v_4(ind,i4)*dtx*eps_4(i4)*c(ind,i_4_2)
+  X4_21 = indice_4(i_4+3)*v_4(ind,i4)*dtx*(1-eps_4(i4))*c(ind,i_4_4)
+  X4_22 = indice_4(i_4+3)*v_4(ind,i4)*dtx*eps_4(i4)*c(ind,i_4_2)
+  X4_31 =-indice_4(i_4+5)*v_4(ind,i4)*dtx*(1-eps_4(i4))*c(ind,i_4_4)
+  X4_32 =-indice_4(i_4+5)*v_4(ind,i4)*dtx*eps_4(i4)*c(ind,i_4_2)
+  X4_41 =-indice_4(i_4+7)*v_4(ind,i4)*dtx*(1-eps_4(i4))*c(ind,i_4_4)
+  X4_42 =-indice_4(i_4+7)*v_4(ind,i4)*dtx*eps_4(i4)*c(ind,i_4_2)
+  mat(i_4_2,i_4_2) = mat(i_4_2,i_4_2) + X4_11
+  mat(i_4_2,i_4_4) = mat(i_4_2,i_4_4) + X4_12
+  mat(i_4_4,i_4_2) = mat(i_4_4,i_4_2) + X4_21
+  mat(i_4_4,i_4_4) = mat(i_4_4,i_4_4) + X4_22   
+  mat(i_4_6,i_4_2) = mat(i_4_6,i_4_2) + X4_31
+  mat(i_4_6,i_4_4) = mat(i_4_6,i_4_4) + X4_32
+  mat(i_4_8,i_4_2) = mat(i_4_8,i_4_2) + X4_41
+  mat(i_4_8,i_4_4) = mat(i_4_8,i_4_4) + X4_42
+end do
+
+end subroutine fill_matrix
+
+      SUBROUTINE  rate_save(            &
+                           n_lev,       &
+                           pres,        &
+                           temperature, &
+                           traceur,     &
+                           nq_max,      &
+                           vphot,       &
+                           v3,          &
+                           v4)      
+!==================
+!!!!! MODEL 1D !!!! ==> n_lon = 1 !!!!
+!==================
+! Ici on a les variables pour le modele 1D, surtout pour la sauvegarde des taux de prod/consom
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!PENSER a changer les conditions de time_tot
+!time_tot=nbr_pdt*(nbr_jour-1)
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+      USE chemparam_mod
+      IMPLICIT none
+            
+
+!INTEGER, PARAMETER :: time_tot=6000*1
+
+INTEGER :: unit_loc, ierr_loc           ! unite de lecture de "rcm1d.def"
+      
+INTEGER, SAVE :: time_tot,nbr_pdt,nbr_jour
+INTEGER, SAVE :: cpt_time, cpt_time_rate
+DOUBLE PRECISION, DIMENSION(n_lev,126) :: rate_day
+DOUBLE PRECISION, DIMENSION(n_lev,126) :: rate_night
+DOUBLE PRECISION :: rate_local
+DOUBLE PRECISION :: concentration(n_lev)
+DOUBLE PRECISION :: pres(n_lev)
+DOUBLE PRECISION :: temperature(n_lev)
+DOUBLE PRECISION :: traceur(n_lev,nq_max)
+      
+INTEGER :: n_lev, nq_max
+INTEGER :: i_lev, i_react, i_v
+
+INTEGER :: i
+ 
+LOGICAL, SAVE :: f_call = .true.
+
+integer, parameter :: nb_phot_max = 31
+integer, parameter :: nb_reaction_3_max = 11
+integer, parameter :: nb_reaction_4_max = 84
+      
+double precision, dimension(n_lev,nb_phot_max) :: vphot
+double precision, dimension(n_lev,nb_reaction_3_max) :: v3
+double precision, dimension(n_lev,nb_reaction_4_max) :: v4
+
+!PRINT*,"DEBUT subroutine rate_save" 
+
+
+      IF (f_call) THEN
+! ------------------------------------------------------
+!  Lecture des parametres dans "rcm1d.def" 
+! ------------------------------------------------------
+
+!   Opening parameters file "rcm1d.def"
+!   ---------------------------------------
+      unit_loc =98
+      OPEN(unit_loc,file='rcm1d.def',status='old',form='formatted'  &
+          ,iostat=ierr_loc)
+
+      IF(ierr_loc.ne.0) THEN
+        write(*,*) 'Problem to open "rcm1d.def'
+        write(*,*) 'Is it there ?'
+        stop
+      ELSE
+        write(*,*) 'open rcm1d.def success '
+      END IF
+
+      do i=1, 2
+        read (unit_loc, *)
+      end do
+
+      PRINT *,'nombre de pas de temps par jour ?'
+      READ(unit_loc,*) nbr_pdt
+      print*,nbr_pdt
+
+      PRINT *,'nombre de jours simules ?'
+      READ(unit_loc,*) nbr_jour
+      print*,nbr_jour
+      
+ 
+      
+      time_tot = nbr_pdt*(nbr_jour-1)
+      PRINT *,'nombre de PdT avant calcul des taux production/consommation ?'
+      PRINT*,time_tot
+      
+      PRINT*,'nlev',n_lev
+           
+         cpt_time = 1
+         cpt_time_rate = 1
+         f_call = .false.
+         PRINT*,"f_call: ",f_call
+         rate_night(:,:)=0.
+         rate_day(:,:)=0.
+      
+      END IF           
+      
+!      PRINT*,"P	T"
+!      PRINT*,pres,temperature
+ 	     
+      IF (cpt_time .GE. time_tot) THEN
+
+! 	PRINT*,'cpt_time',cpt_time
+ 	      
+         DO i_lev=1, n_lev
+         concentration(i_lev) = pres(i_lev)/(1.3806488d-19 * temperature(i_lev))     
+         END DO
+         
+         IF (((cpt_time_rate .GE. 1).AND.(cpt_time_rate .LE. (nbr_pdt/4))).OR. &
+         (cpt_time_rate .GT. (3*(nbr_pdt/4)))) THEN
+         
+!===============================
+!        !!!! NUIT !!!!
+!===============================
+!	PRINT*,'NUIT'
+	
+           DO i_lev=1, n_lev
+           i_react=1
+           i_v=1
+!===============================
+!    1     o2 + hv     -> o + o
+!===============================
+		rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev)
+		rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+		i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    2     o2 + hv     -> o + o(1d)
+!===============================
+		rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev)
+		rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+		i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    3     co2 + hv    -> co + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_co2)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    4     co2 + hv    -> co + o(1d)
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_co2)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    5     o3 + hv     -> o2(Dg) + o(1d)
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    6     o3 + hv     -> o2 + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    7     h2o + hv    -> h + oh
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_h2o)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    8     ho2 + hv    -> oh + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_ho2)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    9     h2o2 + hv   -> oh + oh
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_h2o2)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    10    hcl + hv    -> h + cl
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    11    cl2 + hv    -> cl + cl
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    12    hocl + hv   -> oh + cl
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_hocl)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    13    so2 + hv    -> so + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    14    so + hv     -> s + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    15    so3 + hv    -> so2 + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_so3)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    16    clo + hv    -> cl + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    17    ocs + hv    -> co + s
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_ocs)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    18    cocl2 + hv  -> cl + cl + co
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_cocl2)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    19    h2so4 + hv  -> so3 + h2o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_h2so4)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!--- 20 b001 o(1d) + co2 -> o + co2
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 21 b004 o(1d) + o2 -> o + o2
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!--- 22 f014 clco + co2 -> cl + co + co2
+!===============================
+            rate_local = vphot(i_lev,22)*traceur(i_lev,i_clco)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 23 g016 s2o2 + co2 -> 2so + co2
+!===============================
+            rate_local = vphot(i_lev,23)*traceur(i_lev,i_s2o2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 24 g023 s2 + co2 -> 2s + co2
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 25 h001 ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!--- 26 h002 ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!--- 27 h003 ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!--- 28 h004 ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!--- 29 h005 ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!---  30 i001 o2(Dg) + CO2 -> O2 + CO2 + hv
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2dg)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!--- 31 i002 o2(Dg) -> O2 + hv
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2dg)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+
+! DEBUT DES REACTION V3
+		i_v = i_v - nb_phot_max
+!===============================
+!--- 32 a002: o + o + co2 -> o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 33 c008: ho2 + ho2 -> h2o2 + o2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_ho2)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 34 c013: oh + oh -> h2o + o
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 35 c016: ho2 + ho2 + co2 -> h2o2 + o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_ho2)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 36 c017: oh + oh + co2 -> h2o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 37 c018: h + h + co2 -> h2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 38 f021: cl + cl + co2 -> cl2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 39 f026: clco + clco  -> cocl2 + co
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 40 f030: clso2 + clso2  -> cl2 + so2 + so2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_clso2)*concentration(i_lev) &
+            *traceur(i_lev,i_clso2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 41 g015: so + so + co2 -> s2o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_so)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 42 g022: s + s + co2 -> s2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_s)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+
+! DEBUT DES REACTION V4
+
+		i_v = i_v - nb_reaction_3_max
+
+!===============================
+!--- 43 a001: o + o2 + co2 -> o3 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 44 a003: o + o3 -> o2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 45 b002: o(1d) + h2o  -> oh + oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 46 b003: o(1d) + h2  -> oh + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_h2)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 47 b005: o(1d) + o3  -> o2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 48 b006: o(1d) + o3  -> o2 + o + o
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 49 c001: o + ho2 -> oh + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 50 c002: o + oh -> o2 + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 51 c003: h + o3 -> oh + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 52 c004: h + ho2 -> oh + oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 53 c005: h + ho2 -> h2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 54 c006: h + ho2 -> h2o + o
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 55 c007: oh + ho2 -> h2o + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 56 c009: oh + h2o2 -> h2o + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 57 c010: oh + h2 -> h2o + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_h2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 58 c011: h + o2 + co2 -> ho2 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 59 c012: o + h2o2 -> oh + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 60 c014: oh + o3 -> ho2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 61 c015: ho2 + o3 -> oh + o2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 62 e001: oh + co -> co2 + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 63 e002: o + co + m -> co2 + m
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_co)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 64 f001: hcl + o(1d) -> oh + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 65 f002: hcl + o(1d) -> h + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 66 f003: hcl + o -> oh + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 67 f004: hcl + oh -> h2o + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 68 f005: clo + o -> cl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 69 f006: clo + oh -> cl + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 70 f007: clo + oh -> hcl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 71 f008: cl + h2 -> hcl + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_h2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 72 f009: cl + o3 -> clo + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 73 f010: cl + ho2 -> clo + oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 74 f011: cl + ho2 -> hcl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 75 f012: cl + h2o2 -> hcl + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 76 f013: cl + co + co2 -> clco + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_co)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 77 f015: clco + o2 + m -> clco3 + m
+!===============================
+		rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 78 & 79 f016: clco3 + cl -> cl + clo + co2
+!===============================
+!     decomposee en :
+!     0.5 clco3 + 0.5 cl -> cl + 0.5 co2
+!     0.5 clco3 + 0.5 cl -> clo + 0.5 co2
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+            
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 80 & 81 f017: clco3 + o -> cl + o2 + co2
+!===============================
+!     decomposee en :
+!     0.5 clco3 + 0.5 o -> cl
+!     0.5 clco3 + 0.5 o -> o2 + co2
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+            
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 82 f018: clo + ho2  -> hocl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 83 f019: oh + hocl -> h2o + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_hocl)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 84 f020: o + hocl -> oh + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hocl)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 85 f022: clco + o -> cl + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 86 f023: cl2 + o(1d) -> cl + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_o1d)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 87 f024: cl2 + h  -> hcl + cl
+!==============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 88 f025: cl + clco  -> cl2 + co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 89 f027: cl + so2 + co2  -> clso2 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 90 f028: clso2 + o  -> so2 + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clso2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 91 f029: clso2 + h  -> so2 + hcl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clso2)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 92 f031: cl + o + co2  -> clo + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 93 f032: cl2 + o -> clo + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 94 f033: clco + oh -> hocl + co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 95 f034: cl2 + oh -> cl + hocl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 96 f035: clco + o -> co + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 97 f036: clco + cl2 -> cocl2 + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 98 f037: hcl + h -> h2 + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 99 f038: clco + h -> hcl + co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 100 f039: cl + h + m -> hcl + m
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 101 g001: s + o2 -> so + o
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_o2)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 102 g002: s + o3 -> so + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 103 g003: so + o2 -> so2 + o
+!===============================
+             rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_o2)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 104 g004: so + o3 -> so2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 105 g005: so + oh -> so2 + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 106 g006: s + oh -> so + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 107 g007: so + o + co2 -> so2 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 108 g008: so + ho2 -> so2 + oh 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 109 g009: so2 + o + co2 -> so3 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 110 g010: s + o + co2 -> so + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 111 g011: so3 + h2o -> h2so4
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so3)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 112 g012: so + clo -> so2 + cl 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_clo)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 113 g013: so + so3 -> so2 + so2 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_so3)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 114 g014: so3 + o -> so2 + o2 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 115 & 116 g017: clco3 + so -> cl + so2 + co2
+!===============================
+!     decomposee en :
+!     0.5 clco3 + 0.5 so -> cl
+!     0.5 clco3 + 0.5 so -> so2 + co2
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_so)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+            
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_so)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 117 g018: s + co + co2 -> ocs + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_co)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 118 g019: clco + s -> ocs + cl 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_s)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 119 g020: so2 + oh + co2 -> hso3 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 120 g021: hso3 + o2 -> ho2 + so3 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_hso3)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 121 g024: s2 + o -> so + s 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 122 g025: s + ocs -> s2 +  co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_ocs)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!--- 123 g026: ocs + o -> so + co
+!=============================== 
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_ocs)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 124 g027: s + so3 -> so2 +  so
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_so3)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 125 g028: s + ho2 -> so +  oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 126 g029: s + clo -> so +  cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_clo)*concentration(i_lev)  
+            rate_night(i_lev,i_react) = rate_night(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1   
+           END DO       
+         ELSE
+!===============================         
+!        !!!! JOUR !!!!
+!===============================
+!	PRINT*,'JOUR'
+	
+           DO i_lev=1, n_lev
+           i_react=1
+           i_v=1
+!===============================
+!    1     o2 + hv     -> o + o
+!===============================
+		rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev)
+		rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+		i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    2     o2 + hv     -> o + o(1d)
+!===============================
+		rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev)
+		rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+		i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    3     co2 + hv    -> co + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_co2)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    4     co2 + hv    -> co + o(1d)
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_co2)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    5     o3 + hv     -> o2(Dg) + o(1d)
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    6     o3 + hv     -> o2 + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    7     h2o + hv    -> h + oh
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_h2o)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    8     ho2 + hv    -> oh + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_ho2)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    9     h2o2 + hv   -> oh + oh
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_h2o2)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    10    hcl + hv    -> h + cl
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    11    cl2 + hv    -> cl + cl
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    12    hocl + hv   -> oh + cl
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_hocl)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    13    so2 + hv    -> so + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    14    so + hv     -> s + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    15    so3 + hv    -> so2 + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_so3)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    16    clo + hv    -> cl + o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    17    ocs + hv    -> co + s
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_ocs)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    18    cocl2 + hv  -> cl + cl + co
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_cocl2)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    19    h2so4 + hv  -> so3 + h2o
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_h2so4)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    20     o(1d) + co2 -> o + co2
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    21    o(1d) + o2 -> o + o2
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    22    clco + co2 -> cl + co + co2
+!===============================
+            rate_local = vphot(i_lev,22)*traceur(i_lev,i_clco)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    23    s2o2 + co2 -> 2so + co2
+!===============================
+            rate_local = vphot(i_lev,23)*traceur(i_lev,i_s2o2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    24    s2 + co2 -> 2s + co2
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!    25    ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    26    ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!    27    ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!    28    ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!    29    ICE
+!===============================
+            i_react=i_react+1
+		i_v=i_v+1  
+!===============================
+!    30    o2(Dg) + CO2 -> O2 + CO2 + hv
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2dg)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!    31    o2(Dg) -> O2 + hv
+!===============================
+            rate_local = vphot(i_lev,i_v)*traceur(i_lev,i_o2dg)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt
+            i_react=i_react+1
+		i_v=i_v+1
+		
+! DEBUT DES REACTION V3
+		i_v = i_v - nb_phot_max
+!===============================
+!--- 32 a002: o + o + co2 -> o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 33 c008: ho2 + ho2 -> h2o2 + o2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_ho2)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 34 c013: oh + oh -> h2o + o
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 35 c016: ho2 + ho2 + co2 -> h2o2 + o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_ho2)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 36 c017: oh + oh + co2 -> h2o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 37 c018: h + h + co2 -> h2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 38 f021: cl + cl + co2 -> cl2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 39 f026: clco + clco  -> cocl2 + co
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 40 f030: clso2 + clso2  -> cl2 + so2 + so2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_clso2)*concentration(i_lev) &
+            *traceur(i_lev,i_clso2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 41 g015: so + so + co2 -> s2o2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_so)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 42 g022: s + s + co2 -> s2 + co2
+!===============================
+            rate_local = v3(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_s)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+
+! DEBUT DES REACTION V4
+
+		i_v = i_v - nb_reaction_3_max
+
+!===============================
+!--- 43 a001: o + o2 + co2 -> o3 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 44 a003: o + o3 -> o2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 45 b002: o(1d) + h2o  -> oh + oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 46 b003: o(1d) + h2  -> oh + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_h2)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 47 b005: o(1d) + o3  -> o2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 48 b006: o(1d) + o3  -> o2 + o + o
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o1d)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 49 c001: o + ho2 -> oh + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 50 c002: o + oh -> o2 + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 51 c003: h + o3 -> oh + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 52 c004: h + ho2 -> oh + oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 53 c005: h + ho2 -> h2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 54 c006: h + ho2 -> h2o + o
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_h)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 55 c007: oh + ho2 -> h2o + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 56 c009: oh + h2o2 -> h2o + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 57 c010: oh + h2 -> h2o + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_h2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 58 c011: h + o2 + co2 -> ho2 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 59 c012: o + h2o2 -> oh + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 60 c014: oh + o3 -> ho2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 61 c015: ho2 + o3 -> oh + o2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o3)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 62 e001: oh + co -> co2 + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 63 e002: o + co + m -> co2 + m
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_co)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 64 f001: hcl + o(1d) -> oh + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 65 f002: hcl + o(1d) -> h + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_o1d)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 66 f003: hcl + o -> oh + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 67 f004: hcl + oh -> h2o + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 68 f005: clo + o -> cl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 69 f006: clo + oh -> cl + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 70 f007: clo + oh -> hcl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 71 f008: cl + h2 -> hcl + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_h2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 72 f009: cl + o3 -> clo + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 73 f010: cl + ho2 -> clo + oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 74 f011: cl + ho2 -> hcl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 75 f012: cl + h2o2 -> hcl + ho2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 76 f013: cl + co + co2 -> clco + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_co)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 77 f015: clco + o2 + m -> clco3 + m
+!===============================
+		rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 78 & 79 f016: clco3 + cl -> cl + clo + co2
+!===============================
+!     decomposee en :
+!     0.5 clco3 + 0.5 cl -> cl + 0.5 co2
+!     0.5 clco3 + 0.5 cl -> clo + 0.5 co2
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+            
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 80 & 81 f017: clco3 + o -> cl + o2 + co2
+!===============================
+!     decomposee en :
+!     0.5 clco3 + 0.5 o -> cl
+!     0.5 clco3 + 0.5 o -> o2 + co2
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+            
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 82 f018: clo + ho2  -> hocl + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clo)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 83 f019: oh + hocl -> h2o + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_oh)*concentration(i_lev) &
+            *traceur(i_lev,i_hocl)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 84 f020: o + hocl -> oh + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hocl)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 85 f022: clco + o -> cl + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 86 f023: cl2 + o(1d) -> cl + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_o1d)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 87 f024: cl2 + h  -> hcl + cl
+!==============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 88 f025: cl + clco  -> cl2 + co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 89 f027: cl + so2 + co2  -> clso2 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev) &
+            *traceur(i_lev,i_cl)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 90 f028: clso2 + o  -> so2 + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clso2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 91 f029: clso2 + h  -> so2 + hcl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clso2)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 92 f031: cl + o + co2  -> clo + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 93 f032: cl2 + o -> clo + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 94 f033: clco + oh -> hocl + co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 95 f034: cl2 + oh -> cl + hocl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 96 f035: clco + o -> co + clo
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 97 f036: clco + cl2 -> cocl2 + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl2)*concentration(i_lev) &
+            *traceur(i_lev,i_clco)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 98 f037: hcl + h -> h2 + cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_hcl)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 99 f038: clco + h -> hcl + co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) 
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 100 f039: cl + h + m -> hcl + m
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_cl)*concentration(i_lev) &
+            *traceur(i_lev,i_h)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 101 g001: s + o2 -> so + o
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_o2)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 102 g002: s + o3 -> so + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 103 g003: so + o2 -> so2 + o
+!===============================
+             rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_o2)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 104 g004: so + o3 -> so2 + o2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_o3)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 105 g005: so + oh -> so2 + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 106 g006: s + oh -> so + h
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 107 g007: so + o + co2 -> so2 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 108 g008: so + ho2 -> so2 + oh 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 109 g009: so2 + o + co2 -> so3 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 110 g010: s + o + co2 -> so + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 111 g011: so3 + h2o -> h2so4
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so3)*concentration(i_lev) &
+            *traceur(i_lev,i_h2o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 112 g012: so + clo -> so2 + cl 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_clo)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 113 g013: so + so3 -> so2 + so2 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so)*concentration(i_lev) &
+            *traceur(i_lev,i_so3)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 114 g014: so3 + o -> so2 + o2 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so3)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 115 & 116 g017: clco3 + so -> cl + so2 + co2
+!===============================
+!     decomposee en :
+!     0.5 clco3 + 0.5 so -> cl
+!     0.5 clco3 + 0.5 so -> so2 + co2
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_so)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+            
+            rate_local = v4(i_lev,i_v)*0.25*traceur(i_lev,i_clco3)*concentration(i_lev) &
+            *traceur(i_lev,i_so)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 117 g018: s + co + co2 -> ocs + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_co)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 118 g019: clco + s -> ocs + cl 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_clco)*concentration(i_lev) &
+            *traceur(i_lev,i_s)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 119 g020: so2 + oh + co2 -> hso3 + co2
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_so2)*concentration(i_lev) &
+            *traceur(i_lev,i_oh)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 120 g021: hso3 + o2 -> ho2 + so3 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o2)*concentration(i_lev) &
+            *traceur(i_lev,i_hso3)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 121 g024: s2 + o -> so + s 
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s2)*concentration(i_lev) &
+            *traceur(i_lev,i_o)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 122 g025: s + ocs -> s2 +  co
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_ocs)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+!===============================
+!--- 123 g026: ocs + o -> so + co
+!=============================== 
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_o)*concentration(i_lev) &
+            *traceur(i_lev,i_ocs)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 124 g027: s + so3 -> so2 +  so
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_so3)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 125 g028: s + ho2 -> so +  oh
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_ho2)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1 
+!===============================
+!--- 126 g029: s + clo -> so +  cl
+!===============================
+            rate_local = v4(i_lev,i_v)*traceur(i_lev,i_s)*concentration(i_lev) &
+            *traceur(i_lev,i_clo)*concentration(i_lev)  
+            rate_day(i_lev,i_react) = rate_day(i_lev,i_react) + 2.*rate_local/nbr_pdt 
+            i_react=i_react+1
+		i_v=i_v+1
+           END DO
+         END IF
+         cpt_time_rate = cpt_time_rate + 1
+      
+      END IF
+            
+      IF (cpt_time .EQ. (time_tot+nbr_pdt)) THEN
+               OPEN(100,file='profile_rate_day.csv')
+               DO i_lev=1,n_lev
+               write (100,"(128(e15.8,','))")pres(i_lev), temperature(i_lev), (rate_day(i_lev,i_react),i_react=1,126)
+               END DO
+               
+               OPEN(101,file='profile_rate_night.csv')
+               DO i_lev=1,n_lev
+               write (101,"(128(e15.8,','))") pres(i_lev), temperature(i_lev), (rate_night(i_lev,i_react),i_react=1,126)
+               END DO
+               
+               OPEN(102,file='profile_rate_fullday.csv')
+               rate_day=(rate_day+rate_night)/2.
+               DO i_lev=1,n_lev
+               write (102,"(128(e15.8,','))") pres(i_lev), temperature(i_lev), (rate_day(i_lev,i_react),i_react=1,126)
+               END DO
+               
+               PRINT*,"pression top",pres(n_lev)
+               PRINT*,"temp top",temperature(n_lev)
+               
+      END IF
+      
+      cpt_time = cpt_time + 1
+      
+      END     
Index: trunk/LMDZ.VENUS/libf/phyvenus/physiq.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/physiq.F	(revision 1301)
+++ trunk/LMDZ.VENUS/libf/phyvenus/physiq.F	(revision 1305)
@@ -56,4 +56,5 @@
       USE ioipsl
 !      USE histcom ! not needed; histcom is included in ioipsl
+      USE chemparam_mod
       USE infotrac
       USE control_mod
@@ -65,4 +66,5 @@
       USE iophy
       use cpdet_mod, only: cpdet, t2tpot
+      use ieee_arithmetic
       IMPLICIT none
 c======================================================================
@@ -198,4 +200,5 @@
       REAL uq(klon) ! integr. verticale du transport zonal de l'eau
 c
+      REAL Fsedim(klon,klev+1)  ! Flux de sedimentation (kg.m-2)
 
 c======================================================================
@@ -285,6 +288,11 @@
       REAL u_seri(klon,klev), v_seri(klon,klev)
 c
-      REAL tr_seri(klon,klev,nqmax)
-      REAL d_tr(klon,klev,nqmax)
+      REAL :: tr_seri(klon,klev,nqmax)
+      REAL :: d_tr(klon,klev,nqmax)
+
+c Variables tendance sedimentation
+
+      REAL :: d_tr_sed(klon,klev,2)
+      REAL :: d_tr_ssed(klon)
 c
 c pour ioipsl
@@ -530,5 +538,37 @@
       ENDDO
 
+c---------
+c       Ecriture fichier initialisation
+c       PRINT*,'Ecriture Initial_State.csv'
+c       OPEN(88,file='Trac_Point.csv',
+c     & form='formatted')
+c---------
+     
+c---------
+c       Initialisation des parametres des nuages
+c===============================================
+     
+      if ((nlon .EQ. 1) .AND. ok_cloud) then
+        PRINT*,'Open profile_cloud_parameters.csv'
+        OPEN(66,file='profile_cloud_parameters.csv',
+     &   form='formatted')
+      endif
+
+      if ((nlon .EQ. 1) .AND. ok_sedim) then
+        PRINT*,'Open profile_cloud_sedim.csv'
+        OPEN(77,file='profile_cloud_sedim.csv',
+     &   form='formatted')
+      endif
+           
+      if ((nlon .GT. 1) .AND. ok_chem) then
+c !!! DONC 3D !!!
+        CALL chemparam_ini() 
+      endif
          
+      if ((nlon .GT. 1) .AND. ok_cloud) then
+c !!! DONC 3D !!!
+        CALL cloud_ini(nlon,nlev)
+      endif
+        
       ENDIF ! debut
 c====================================================================
@@ -704,4 +744,5 @@
        if (tr_scheme.eq.1) then
 ! Case 1: pseudo-chemistry with relaxation toward fixed profile
+
          call phytrac_relax (debut,lafin,nqmax,
      I                   nlon,nlev,dtime,pplay,
@@ -713,4 +754,5 @@
 ! However, the variable 'source' could be used in physiq
 ! so the call to phytrac_emiss could be to initialise it.
+
          call phytrac_emiss ( (rjourvrai+gmtime)*RDAY,
      I                   debut,lafin,nqmax,
@@ -718,11 +760,88 @@
      I                   rlatd,rlond,
      O                   tr_seri)
-       elseif (tr_scheme.eq.3) then
-! Case 3: Full chemistry
-!        call phytrac_chem ( ?? )
-         print*,"Chemistry not yet implemented..." 
-         print*,"See Aurelien Stolzenbach" 
-       endif
-      endif
+
+       elseif (tr_scheme.eq.3) then  ! identical to ok_chem.or.ok_cloud
+! Case 3: Full chemistry and/or clouds
+
+         call phytrac_chimie(                  
+     I             debut,
+     I             gmtime,
+     I             nqmax,
+     I             nlon,
+     I             rlatd,
+     I             rlond,
+     I             nlev,
+     I             dtime,
+     I             t_seri,pplay,
+     O             tr_seri,
+     O             NBRTOT,
+     O             WH2SO4,
+     O             rho_droplet)
+
+c        CALL WriteField_phy('Pression',pplay,nlev)
+c        CALL WriteField_phy('PressionBnd',paprs,nlev+1)
+c        CALL WriteField_phy('Temp',t_seri,nlev)
+c        IF (ok_cloud) THEN
+c          CALL WriteField_phy('NBRTOT',NBRTOT,nlev)
+c        ENDIF
+c        CALL WriteField_phy('SAl',tr_seri(:,:,i_h2so4liq),nlev)
+c        CALL WriteField_phy('SAg',tr_seri(:,:,i_h2so4),nlev)
+
+         if (ok_sedim) then 
+
+           CALL new_cloud_sedim(
+     I               klon,
+     I               nlev,
+     I               dtime,
+     I               pplay,
+     I               paprs,
+     I               t_seri, 
+     I               WH2SO4,
+     I               tr_seri,
+     I               nqmax,
+     I               NBRTOT,
+     I               rho_droplet,
+     O               Fsedim,
+     O               d_tr_sed,
+     O               d_tr_ssed)
+
+          DO k = 1, klev
+           DO i = 1, klon
+     
+c        WRITE(88,"(11(e15.8,','))") pplay(5,25),
+c     &  t_seri(5,25),tr_seri(5,25,i_h2oliq),
+c     &  tr_seri(5,25,i_h2o),tr_seri(5,25,i_h2so4liq),
+c     &  tr_seri(5,25,i_h2so4),NBRTOT(5,25),WH2SO4(5,25),
+c     &  Fsedim(5,25),d_tr_sed(5,25,1),d_tr_sed(5,25,2)
+
+c--------------------
+c   Ce test est necessaire pour eviter Xliq=NaN   
+        IF (ieee_is_nan(d_tr_sed(i,k,1)).OR.
+     &  ieee_is_nan(d_tr_sed(i,k,2))) THEN
+        PRINT*,'sedim NaN PROBLEM'
+        PRINT*,'d_tr_sed Nan?',d_tr_sed(i,k,:),'Temp',t_seri(i,k)
+        PRINT*,'lat-lon',i,'level',k,'dtime',dtime
+        PRINT*,'NBRTOT',NBRTOT(i,k),'F_sed',Fsedim(i,k)
+        PRINT*,'==============================================='
+                d_tr_sed(i,k,:)=0.
+        ENDIF
+c--------------------
+
+        tr_seri(i,k,i_h2so4liq) = tr_seri(i,k,i_h2so4liq)+
+     &                            d_tr_sed(i,k,1)
+        tr_seri(i,k,i_h2oliq)   = tr_seri(i,k,i_h2oliq)+
+     &                            d_tr_sed(i,k,2)
+        d_tr_sed(i,k,:) = d_tr_sed(i,k,:) / dtime
+        Fsedim(i,k)     = Fsedim(i,k) / dtime
+     
+           ENDDO
+          ENDDO
+      
+        Fsedim(:,klev+1) = 0.
+
+         endif ! ok_sedim
+
+       endif   ! tr_scheme
+      endif    ! iflag_trac
 
 c
Index: trunk/LMDZ.VENUS/libf/phyvenus/phytrac_chimie.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/phytrac_chimie.F	(revision 1305)
+++ trunk/LMDZ.VENUS/libf/phyvenus/phytrac_chimie.F	(revision 1305)
@@ -0,0 +1,399 @@
+!
+! $Header: /home/cvsroot/LMDZ4/libf/phylmd/phytrac.F,v 1.16 2006/03/24 15:06:23 lmdzadmin Exp $
+!
+c
+c
+      SUBROUTINE  phytrac_chimie (
+     I                    debutphy,
+     I                    gmtime,
+     I                    nqmax,
+     I                    n_lon,
+     I                    lat,
+     I                    lon,
+     I                    n_lev, 
+     I                    pdtphys,
+     I                    temp,
+     I                    pplev,
+     O                    trac,
+     O                    NBRTOT_droplet,
+     O                    W_H2SO4,
+     O                    rho)
+
+c======================================================================
+c Auteur(s) FH
+c Objet: Moniteur general des tendances traceurs
+c
+cAA Remarques en vrac:
+cAA--------------------
+cAA 1/ le call phytrac se fait avec nqmax 
+c======================================================================
+      USE chemparam_mod
+      IMPLICIT none
+      
+#include "clesphys.h" 
+#include "YOMCST.h"
+c======================================================================
+c Arguments:
+c
+c
+c   EN ENTREE:
+c   ==========
+c
+c   divers:
+c   -------
+c
+
+      REAL  sza_local 
+      REAL  gmtime
+c      INTEGER, SAVE :: cpt_cloudIO  !un compteur pour fichier sortie cloud_parameter en 1D
+      INTEGER  iq
+      INTEGER  i
+      INTEGER  ilon, ilev
+      integer  n_lon  ! nombre de points horizontaux
+      INTEGER  n_lev  ! nombre de couches verticales
+      INTEGER  nqmax ! nombre de traceurs auxquels on applique la physique
+c      INTEGER  nbapp_cloud, i_app_cloud
+      real  pdtphys  ! pas d'integration pour la physique (seconde)
+      real  lat(n_lon), lat_local(n_lon)
+      real  lon(n_lon), lon_local(n_lon)
+      real  temp(n_lon,n_lev) ! temp
+      real  trac(n_lon,n_lev,nqmax) ! traceur 
+      real  pplev(n_lon,n_lev)  ! pression pour le mileu de chaque couche (en Pa)
+      real  lon_sun
+      logical debutphy       ! le flag de l'initialisation de la physique
+c      character*7 modname
+
+C
+C----------------------------------------------------------------------------
+C     Model cloud:
+C     Aerosol and PSC variables:
+      real  NBRTOT_droplet(n_lon,n_lev)
+      real  W_H2SO4(n_lon,n_lev)
+      real  W_H2O(n_lon,n_lev)
+      real  rho(n_lon,n_lev)
+C----------------------------------------------------------------------------
+C----------------------------------------------------------------------------
+C     Time variables:
+      REAL, save :: dT_cloud
+C----------------------------------------------------------------------------   
+C----------------------------------------------------------------------------
+C     Auxilary variables:
+ 
+      REAL mrtwv,mrtsa,mrwv,mrsa,
+     +     ppwv, psatwv,
+     +     ps_sa,satps_sa
+C    ps_sa: satur pressure pure SA 
+C    satps_sa: satur pres over mixture in dyne/cm2=Pa/10
+C----------------------------------------------------------------------------
+        
+C Variables liees a l'ecriture de la bande histoire : phytrac.nc
+ 
+      logical ok_sync
+      parameter (ok_sync = .true.)
+
+c      modname = 'phytrac'
+
+c      PRINT*,'DEBUT subroutine PHYTRAC'
+
+c----------------------------------
+c debutphy: Initiation des traceurs
+c----------------------------------
+
+      if (debutphy) then
+         
+      PRINT*,'PRECISION REAL'
+      PRINT*,precision(NBRTOT_droplet(1,1)), range(NBRTOT_droplet(1,1))
+      
+         if (n_lon .EQ. 1) then           
+         PRINT*,'n_lon 1D: ',n_lon
+         end if
+                  
+c         if ((n_lon .GT. 1) .AND. ok_chem) then
+c !!! DONC 3D !!!	
+c           CALL chemparam_ini() 
+c         endif
+         
+c         if ((n_lon .GT. 1) .AND. ok_cloud) then
+c !!! DONC 3D !!!
+c         CALL cloud_ini(n_lon,n_lev)
+c         endif
+           
+         IF (reinit_trac) THEN
+         PRINT*,'REINIT MIXING RATIO TRACEURS'
+
+c	=============================================================
+c					Passage de Rm à Rv
+c	=============================================================
+c     Necessaire si on reprend les start.nc qui sont en MMR
+      DO iq=1,nqmax
+      trac(:,:,iq)=trac(:,:,iq)*RMD/M_tr(iq)
+      END DO
+c	=============================================================
+          
+      
+c=============================================================
+c		Initialisation des profils traceurs en Rv
+c=============================================================
+         trac(:,:,:)=1.0d-30
+      
+         trac(:,:,i_co2)=0.965d0 * RMD / M_tr(i_co2)
+
+         trac(:,:,i_co)=25.0d-6
+
+ 
+      trac(:,:,i_h2so4)=1.0d-21 
+      trac(:,:,i_h2o)=1.0d-21 
+
+c     !!! SANS NUAGE !!!	
+c	 trac(:,1:29,i_ocs)=1.0d-6
+c	 trac(:,29:40,i_ocs)=1.0e-9
+c       trac(:,:,i_so2)=1.d-6
+c       trac(:,:,i_h2o)=1.0d-6
+
+c     !!! AVEC NUAGE !!!
+         trac(:,1:20,i_ocs)=3.d-6
+
+            DO i=21,26
+            trac(:,i,i_ocs)=trac(:,i-1,i_ocs)-0.3d-6
+            END DO
+	
+c	DO i=21,30
+c	trac(:,i,i_ocs)=trac(:,i-1,i_ocs)-0.3d-6
+c	END DO
+	
+         trac(:,1:26,i_hcl)=0.2d-6
+
+c      trac(:,:,i_hcl)=0.2d-6
+
+c	Initialisation SO2 Bertaux et De Bergh 2007 JGR
+c         trac(:,1:26,i_so2)=20.d-6
+c            DO i=2,20
+c            trac(:,i,i_so2)=trac(:,i-1,i_so2)+(100./19.)*0.25d-6
+c            END DO
+c            DO i=21,22
+c            trac(:,i,i_so2)=trac(:,i-1,i_so2)-(100./9.)*0.25d-6
+c            END DO
+
+c	DO i=21,29
+c	trac(:,i,i_so2)=trac(:,i-1,i_so2)-(100./9.)*1d-6
+c	END DO
+
+c      trac(:,1:30,i_so2)= 100.0d-6
+c	trac(:,30,i_so2)=20.0d-6
+c      trac(:,31,i_so2)=10.0d-6
+c      trac(:,32,i_so2)=1.0d-6
+c      trac(:,33,i_so2)=0.1d-6
+c      trac(:,34:42,i_so2)=0.02d-6
+c      trac(:,43:46,i_so2)=0.07d-6
+c      trac(:,47:50,i_so2)=0.05d-6
+
+c      trac(:,1:28,i_h2o)=30.0d-6
+c      trac(:,29:50,i_h2o)=5.0d-6
+      trac(:,15:50,i_h2o)=10.0d-6
+c      trac(:,15:35,i_h2so4)=17.0d-6
+c	DO i=23,35
+c	trac(:,i,i_h2o)=(3.d-6-30.0d-6)/12.0*(-23.0+i)+trac(:,22,i_h2o)
+c	END DO
+c	trac(:,36:50,i_h2o)=3.0d-6
+	
+      trac(:,15:50,i_h2so4)=20.0d-6
+c      trac(:,29:50,i_h2so4)=1.0d-9
+c      trac(:,1:10,i_h2)=1.0d-10
+c      trac(:,11:20,i_h2)=1.0d-9
+c      trac(:,21:35,i_h2)=1.0d-8
+c      trac(:,36:50,i_h2)=1.0d-7     
+   
+c=============================================================
+      
+c	=============================================================
+c					Passage de Rv à Rm
+c	=============================================================
+         DO iq=1,nqmax
+         trac(:,:,iq)=trac(:,:,iq)*M_tr(iq)/RMD
+         END DO
+c	=============================================================
+
+c	Ecriture fichier initialisation
+c	PRINT*,'Ecriture Initial_State.csv'
+c 	OPEN(88,file='Initial_State.csv',
+c     & form='formatted')
+     
+c      DO ilon=1,n_lon
+c        DO ilev=1,n_lev
+c        WRITE(88,"(36(e15.8,','))") R_MEDIAN(ilon,ilev),
+c     &  STDDEV(ilon,ilev),trac(ilon,ilev,1:nqmax)
+c        ENDDO
+c      ENDDO
+c      PRINT*,'FIN Ecriture Initial_State.csv'
+     
+         ENDIF  !FIN REINIT TRAC
+	
+c-------------
+c fin debutphy
+c-------------
+      ENDIF  ! fin debutphy 
+
+c	=============================================================
+c					Passage de Rm à Rv
+c	=============================================================
+      DO iq=1,nqmax
+      trac(:,:,iq)=trac(:,:,iq)*RMD/M_tr(iq)
+      END DO
+c	=============================================================
+
+
+c=============================================================
+c			Boucle sur les lon, lat (n_lon)
+c=============================================================
+c      PRINT*, 'gmtime', gmtime*RDAY
+c      PRINT*, 'RDAY', RDAY
+      
+      lon_sun = (0.5 - gmtime) * 2.0 * RPI
+      lon_local = lon * RPI/180.0d0
+      lat_local = lat * RPI/180.0d0
+       
+      DO ilon=1, n_lon
+
+c     calcul sza_local pour obtenir des sza_local > 90, utile pour la chimie
+      sza_local = acos(cos(lat_local(ilon))*cos(lon_local(ilon))*
+     & cos(lon_sun) + cos(lat_local(ilon))*sin(lon_local(ilon))
+     & *sin(lon_sun))* 180.0d0/RPI 
+      
+c      PRINT*,'sza_local :', sza_local
+
+         IF (ok_cloud) THEN
+c      PRINT*,'DEBUT CLOUD'
+                
+      dT_cloud=pdtphys
+      
+      
+c      nbapp_cloud=NINT(pdtphys/dT_cloud)
+c      PRINT*,'pdtphys',pdtphys
+c      PRINT*,'nbapp_cloud',nbapp_cloud
+c	=============================================================
+c			 Appel Microphysique (sans nucleation)
+c                  Volume Mixing Ratio
+c	=============================================================
+
+c      FIXE un profil de temperature def dans fichier temp
+      if (n_lon .EQ. 1) then
+      OPEN(13,file='temp',status='old',form='formatted')
+      DO ilev=1,n_lev
+        READ (13,*) temp(n_lon,ilev)
+      ENDDO
+      CLOSE(13)
+      endif
+                  
+      DO ilev=1, n_lev
+c      PRINT*,'DEBUT INIT CALL CLOUD'
+c     ppwv et pplev en Pa
+       
+c      PRINT*,'@@@@ IN CLOUD @@@@'      
+      
+c     On remet tout le RM liq dans la partie gaz
+c     !!! On reforme un nuage à chaque fois !!!
+         
+      mrtwv=trac(ilon,ilev,i_h2o) + trac(ilon,ilev,i_h2oliq)
+      mrtsa=trac(ilon,ilev,i_h2so4) + trac(ilon,ilev,i_h2so4liq)
+      mrwv=mrtwv
+      mrsa=mrtsa
+      
+
+c     !!! Remise a zero !!!
+	W_H2SO4(ilon,ilev)=0.0d0
+	W_H2O(ilon,ilev)=0.d0
+	rho(ilon,ilev)=0.0d0
+	NBRTOT_droplet(ilon,ilev)=0.d0
+	satps_sa=0.d0
+	ps_sa=0.d0
+	
+c	pression partielle H2O       
+      ppwv=pplev(ilon,ilev) * mrwv
+
+c     Pression saturante de vapeur d'eau, tirée du code d'Anni
+      psatwv=EXP(77.344913 - 7235.4247/temp(ilon,ilev)
+     & - 8.2*DLOG(temp(ilon,ilev)) + 0.0057113*temp(ilon,ilev))
+     
+c      PRINT*,'DEBUT CALL CLOUD'
+
+c	Ne pas passer par la routine des nuages si on a des valeurs proches de 0 ?
+c	Empeche de foirer en parallèle ?
+
+            
+      CALL new_cloud_venus(dT_cloud,
+     e NBRTOT_droplet(ilon,ilev),
+     e R_MEDIAN(ilon,ilev),STDDEV(ilon,ilev),
+     e temp(ilon,ilev),pplev(ilon,ilev),
+     e ppwv,
+     e mrwv,mrsa,
+     e ilev,
+     e mrtwv,mrtsa,
+     e W_H2SO4(ilon,ilev),
+     e ps_sa,satps_sa,
+     e rho(ilon,ilev))
+           
+c      END DO
+    
+c	=========================================                
+c	Actualisation des mixing ratio liq et gaz
+c	=========================================
+c	Si la routine new_cloud_venus n'a pas actualisé mrwv et mrsa
+c	on a alors bien mr=mrt pour sa et wv, donc les parties liq sont=0 hors du nuage
+c	ou si on ne condense pas
+
+c      PRINT*,'DEBUT ACTUALISATION OUTPUT CLOUD'
+c    si tout se passe bien, mrtwv et mrtsa ne changent pas
+      
+      trac(ilon,ilev,i_h2o) = mrwv
+      trac(ilon,ilev,i_h2oliq) = mrtwv - trac(ilon,ilev,i_h2o)
+     
+      trac(ilon,ilev,i_h2so4) = mrsa
+      trac(ilon,ilev,i_h2so4liq) = mrtsa - trac(ilon,ilev,i_h2so4)
+       
+c      ENDIF
+      
+      
+      IF (n_lon .EQ. 1) THEN	
+      WRITE(66,"(i4,','11(e15.8,','))") ilev,temp(ilon,ilev),
+     & pplev(ilon,ilev),ps_sa,satps_sa,NBRTOT_droplet(ilon,ilev),
+     & W_H2SO4(ilon,ilev),trac(ilon,ilev,i_h2oliq),
+     & trac(ilon,ilev,i_h2so4liq),mrwv,mrsa,trac(ilon,ilev,i_so2)
+      ENDIF 
+
+      END DO
+
+c	=============================================================
+c      PRINT*,'FIN CLOUD'
+      ENDIF
+      
+      IF (ok_chem) THEN
+c      PRINT*,"vmr SO2 ht atmo: ",trac(1,50,i_so2)
+c      PRINT*,'DEBUT CHEMISTRY'
+c	=============================================================
+c					Appel Photochimie
+c	=============================================================
+c     Pression en hPa => pplev/100.
+	
+      CALL new_photochemistry_venus(n_lev, n_lon, pdtphys,
+     e                         pplev(ilon,:)/100.,
+     e                         temp(ilon,:),
+     e                         trac(ilon,:,:),
+     e                         sza_local, nqmax)
+c	=============================================================
+c      PRINT*,'FIN CHEMISTRY'
+c      PRINT*,"vmr SO2 ht atmo: ",trac(1,50,i_so2)
+      
+	END IF
+
+      END DO
+c	=============================================================
+c					Passage de Rv à Rm
+c	=============================================================
+	DO iq=1,nqmax
+		trac(:,:,iq)=trac(:,:,iq)*M_tr(iq)/RMD
+	END DO
+c	=============================================================	
+
+c      PRINT*,'FIN PHYTRAC'
+      RETURN
+      END
Index: trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F	(revision 1301)
+++ trunk/LMDZ.VENUS/libf/phyvenus/phytrac_emiss.F	(revision 1305)
@@ -76,5 +76,5 @@
 
       integer,parameter :: nbsrc=2,nblat=5,nblon=4
-      integer,parameter :: Nemiss=1   ! duree emission (Ed)
+!     integer,parameter :: Nemiss=1   ! duree emission (Ed)
       integer,save :: Nemiss(nbsrc)      ! duration emission (Ed)
       real,save :: source_volcan(nbsrc)  ! flux emission (kg/s)
Index: trunk/LMDZ.VENUS/libf/phyvenus/rcm1d.F
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/rcm1d.F	(revision 1301)
+++ trunk/LMDZ.VENUS/libf/phyvenus/rcm1d.F	(revision 1305)
@@ -5,4 +5,5 @@
       use comgeomphy
       USE phys_state_var_mod
+      use chemparam_mod
       use cpdet_mod, only: ini_cpdet
       use moyzon_mod, only: tmoy
@@ -308,4 +309,8 @@
         ENDDO
       ENDDO
+
+c FULL CHEMISTRY !! AJOUTER INIT AURELIEN...
+C Faudrait lire les cles avant pour mettre ca en option....
+c ou alors mettre ca dans physiq
 
 c    Initialisation des parametres d'oro
Index: trunk/LMDZ.VENUS/libf/phyvenus/write_histins.h
===================================================================
--- trunk/LMDZ.VENUS/libf/phyvenus/write_histins.h	(revision 1301)
+++ trunk/LMDZ.VENUS/libf/phyvenus/write_histins.h	(revision 1305)
@@ -7,5 +7,5 @@
 
 c-------------------------------------------------------
-      IF(lev_histday.GE.1) THEN
+      IF(lev_histins.GE.1) THEN
 
 ccccccccccccc 2D fields, basics
@@ -21,8 +21,8 @@
 c     call histwrite_phy(nid_ins,.false.,"cdragm",itau_w,cdragm)
 
-      ENDIF !lev_histday.GE.1
+      ENDIF !lev_histins.GE.1
 
 c-------------------------------------------------------
-      IF(lev_histday.GE.2) THEN
+      IF(lev_histins.GE.2) THEN
 
 ccccccccccccc 3D fields, basics
@@ -51,8 +51,25 @@
       call histwrite_phy(nid_ins,.false.,"tops",itau_w,topsw)
 
-      ENDIF !lev_histday.GE.2
+      if (ok_cloud) THEN
+       call histwrite_phy(nid_ins,.false.,"NBRTOT",itau_w,NBRTOT)
+       call histwrite_phy(nid_ins,.false.,"WH2SO4",itau_w,WH2SO4)
+       call histwrite_phy(nid_ins,.false.,"R_MEDIAN",itau_w,R_MEDIAN)
+       call histwrite_phy(nid_ins,.false.,"STDDEV",itau_w,STDDEV)
+       call histwrite_phy(nid_ins,.false.,"rho_droplet",
+     &                              itau_w,rho_droplet)
+      endif
+
+      if (ok_sedim) THEN      
+       call histwrite_phy(nid_ins,.false.,"d_tr_sed_H2SO4",
+     &                              itau_w,d_tr_sed(:,:,1))
+       call histwrite_phy(nid_ins,.false.,"d_tr_sed_H2O",
+     &                              itau_w,d_tr_sed(:,:,2))
+       call histwrite_phy(nid_ins,.false.,"F_sedim",itau_w,Fsedim)
+      endif            
+
+      ENDIF !lev_histins.GE.2
 
 c-------------------------------------------------------
-      IF(lev_histday.GE.3) THEN
+      IF(lev_histins.GE.3) THEN
 
 cccccccccccccccccc  Radiative transfer
@@ -73,8 +90,8 @@
 c     call histwrite_phy(nid_ins,.false.,"fluxec",itau_w,flux_ec)
 
-      ENDIF !lev_histday.GE.3
+      ENDIF !lev_histins.GE.3
 
 c-------------------------------------------------------
-      IF(lev_histday.GE.4) THEN
+      IF(lev_histins.GE.4) THEN
 
 c en K/s      
@@ -102,8 +119,8 @@
 c     call histwrite_phy(nid_ins,.false.,"dvvdf",itau_w,-1.*d_v_vdf)
 
-      ENDIF !lev_histday.GE.4
+      ENDIF !lev_histins.GE.4
 
 c-------------------------------------------------------
-      IF(lev_histday.GE.5) THEN
+      IF(lev_histins.GE.5) THEN
 
 c     call histwrite_phy(nid_ins,.false.,"taux_",itau_w,fluxu)
@@ -112,5 +129,5 @@
 c     call histwrite_phy(nid_ins,.false.,"cdrh",itau_w,cdragh)
 
-      ENDIF !lev_histday.GE.5
+      ENDIF !lev_histins.GE.5
 c-------------------------------------------------------
 
