Index: trunk/LMDZ.TITAN/libf/phytitan/calchim.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/calchim.F90	(revision 1902)
+++ trunk/LMDZ.TITAN/libf/phytitan/calchim.F90	(revision 1903)
@@ -1,4 +1,4 @@
-      SUBROUTINE calchim(nlon,ny,qy_c,nomqy_c,declin_rad,ls_rad, &
-                         dtchim,ctemp,cplay,cplev,czlay,czlev,dqyc,NLEV)
+      SUBROUTINE calchim(ngrid,qy_c,declin_rad,ls_rad, &
+                         dtchim,ctemp,cplay,cplev,czlay,czlev,dqyc)
       
 !--------------------------------------------------------------------
@@ -17,8 +17,7 @@
 !
       
+      use comchem_h
       use dimphy
-      
       use datafile_mod, only: datadir
-      
       use comcstfi_mod, only: rad, pi, kbol
       use moyzon_mod, only: tmoy,playmoy,zlaymoy,zlevmoy,klat
@@ -27,39 +26,23 @@
       implicit none
 
-!   Parameters ( dans common_mod in old titan)
-!              + doivent etre en accord avec titan.h
-!   -------------------------------------------------
-
-      INTEGER,PARAMETER ::   NC   = 44     ! Nb de composes dans la chimie
-      INTEGER,PARAMETER ::   ND   = 54     ! Nb de photodissociations
-      INTEGER,PARAMETER ::   NR   = 377    ! Nb de reactions dans la chimie
-      INTEGER,PARAMETER ::   NLRT = 650    ! Pour l'UV 650 niveaux de 2 km 
-      
-!     Dummy parameters without microphysics
-!      + Just here to keep the whole stuff running without modif C sources
-!     ---------------------------------------------------------------------
-
-      INTEGER  :: utilaer(16)
-      INTEGER  :: aerprod = 0
-      INTEGER  :: htoh2   = 0
-
+! ------------------------------------------
+! *********** 0. Declarations *************
+! ------------------------------------------
+      
 !    Arguments
 !    ---------
 
-      INTEGER      nlon                   ! nb of horiz points
-      INTEGER      ny                     ! nb de composes (nqmax-nmicro) 
-      REAL*8         qy_c(nlon,klev,NC)     ! Especes chimiques apres adv.+diss.
-      character*10 nomqy_c(NC+1)          ! Noms des especes chimiques
+      INTEGER      ngrid                   ! nb of horiz points
+      REAL*8         qy_c(ngrid,klev,nkim)     ! Especes chimiques apres adv.+diss.
       REAL*8         declin_rad,ls_rad      ! declinaison et long solaire en radians
       REAL*8         dtchim                 ! pas de temps chimie
-      REAL*8         ctemp(nlon,klev)       ! Temperature
-      REAL*8         cplay(nlon,klev)       ! pression (Pa)
-      REAL*8         cplev(nlon,klev+1)     ! pression intercouches (Pa)
-      REAL*8         czlay(nlon,klev)       ! altitude (m)
-      REAL*8         czlev(nlon,klev+1)     ! altitude intercouches (m)
-      
-      REAL*8         dqyc(nlon,klev,NC)     ! Tendances especes chimiques 
-      
-      INTEGER      NLEV                   ! nbp_lev+70 - a changer si =/ 55 layers ?
+      REAL*8         ctemp(ngrid,klev)       ! Temperature
+      REAL*8         cplay(ngrid,klev)       ! pression (Pa)
+      REAL*8         cplev(ngrid,klev+1)     ! pression intercouches (Pa)
+      REAL*8         czlay(ngrid,klev)       ! altitude (m)
+      REAL*8         czlev(ngrid,klev+1)     ! altitude intercouches (m)
+      
+      REAL*8         dqyc(ngrid,klev,nkim)     ! Tendances especes chimiques
+      
       
 !    Local variables :
@@ -70,20 +53,17 @@
 ! variables envoyees dans la chimie: double precision
 
-      REAL*8  temp_c(NLEV)
-      REAL*8  press_c(NLEV)   ! T,p(mbar) a 1 lat donnee
-      REAL*8  cqy(NLEV,NC)    ! frac mol qui seront modifiees
-      REAL*8  cqy0(NLEV,NC)    ! frac mol avant modif
-      REAL*8  surfhaze(NLEV)
-      REAL*8  cprodaer(NLEV,4),cmaer(NLEV,4)
-      REAL*8  ccsn(NLEV,4),ccsh(NLEV,4)
+      REAL*8  temp_c(nlaykim_tot)
+      REAL*8  press_c(nlaykim_tot)   ! T,p(mbar) a 1 lat donnee
+      REAL*8  cqy(nlaykim_tot,nkim)    ! frac mol qui seront modifiees
+      REAL*8  cqy0(nlaykim_tot,nkim)    ! frac mol avant modif
+      REAL*8  surfhaze(nlaykim_tot)
+      REAL*8  cprodaer(nlaykim_tot,4),cmaer(nlaykim_tot,4)
+      REAL*8  ccsn(nlaykim_tot,4),ccsh(nlaykim_tot,4)
 ! rmil: milieu de couche, grille pour K,D,p,ct,T,y
 ! rinter: intercouche (grille RA dans la chimie)
-      REAL*8  rmil(NLEV),rinter(NLEV),nb(NLEV)
+      REAL*8  rmil(nlaykim_tot),rinter(nlaykim_tot),nb(nlaykim_tot)
       REAL*8,save,allocatable :: kedd(:)
 
-      REAL*8  a,b
       character str1*1,str2*2
-      REAL*8  latit
-      character*20 formt1,formt2,formt3
       
 !     variables locales initialisees au premier appel
@@ -97,5 +77,5 @@
       real*8  factalt,factdec,krpddec,krpddecp1,krpddecm1
       real*8  duree
-      REAL*8,save :: mass(NC)
+      REAL*8,save :: mass(nkim)
       REAL*8,save,allocatable :: md(:,:)
       REAL*8,save :: botCH4
@@ -103,10 +83,17 @@
       real*8,save ::  r1d(131),ct1d(131),p1d(131),t1d(131) ! lecture tcp.ver
       REAL*8,save,allocatable :: krpd(:,:,:,:),krate(:,:)
-      integer,save :: reactif(5,NR),nom_prod(NC),nom_perte(NC)
-      integer,save :: prod(200,NC),perte(2,200,NC)
-      character  dummy*30,fich*7,ficdec*15,curdec*15,name*10
+      integer,save :: reactif(5,nr_kim),nom_prod(nkim),nom_perte(nkim)
+      integer,save :: prod(200,nkim),perte(2,200,nkim)
+      character  fich*7,ficdec*15,curdec*15,name*10
       real*8  ficalt,oldq,newq,zalt
       logical okfic
 
+!     Dummy parameters without microphysics
+!      + Just here to keep the whole stuff running without modif C sources
+!     ---------------------------------------------------------------------
+
+      INTEGER  :: utilaer(16)
+      INTEGER  :: aerprod = 0
+      INTEGER  :: htoh2   = 0
 
 !-----------------------------------------------------------------------
@@ -127,15 +114,8 @@
 ! ************************************
 
-	allocate(kedd(NLEV))
-
-        allocate(krpd(15,ND+1,NLRT,nbp_lat),krate(NLEV,NR),md(NLEV,NC))
-
-! Verification du nombre de composes: coherence common_mod et nqmax-nmicro
-! ----------------------------------
-
-        if (ny.ne.NC) then
-	   print*,'PROBLEME de coherence dans le nombre de composes:',ny,NC
-           STOP
-	endif
+	allocate(kedd(nlaykim_tot))
+
+        allocate(krpd(15,nd_kim+1,nlrt_kim,nbp_lat),krate(nlaykim_tot,nr_kim),md(nlaykim_tot,nkim))
+
 
 ! calcul de temp_c, densites et press_c en moyenne planetaire :
@@ -157,11 +137,11 @@
         rinter(klev+1)=(zlevmoy(klev+1)+rad)/1000.
 
-! au-dessus du GCM, dr regulier et rinter(NLEV)=1290+2575 km.
-       do l=klev+2,NLEV
+! au-dessus du GCM, dr regulier et rinter(nlaykim_tot)=1290+2575 km.
+       do l=klev+2,nlaykim_tot
          rinter(l) = rinter(klev+1) &
-               + (l-klev-1)*(3865.-rinter(klev+1))/(NLEV-klev-1)
+               + (l-klev-1)*(3865.-rinter(klev+1))/(nlaykim_tot-klev-1)
          rmil(l-1) = (rinter(l-1)+rinter(l))/2.
        enddo
-       rmil(NLEV) = rinter(NLEV)+(rinter(NLEV)-rinter(NLEV-1))/2.
+       rmil(nlaykim_tot) = rinter(nlaykim_tot)+(rinter(nlaykim_tot)-rinter(nlaykim_tot-1))/2.
 ! rmil et rinter ne servent que pour la diffusion (> plafond-100km) donc ok en moyenne planetaire
 
@@ -169,5 +149,5 @@
 ! remplissage r1d,t1d,ct1d,p1d
         open(11,file=TRIM(datadir)//'/tcp.ver',status='old')
-        read(11,*) dummy
+        read(11,*)
         do i=1,131
           read(11,*) r1d(i),t1d(i),ct1d(i),p1d(i)
@@ -176,8 +156,8 @@
         close(11)
 
-! extension pour klev+1 a NLEV avec tcp.ver
+! extension pour klev+1 a nlaykim_tot avec tcp.ver
 ! la jonction klev/klev+1 est brutale... Tant pis ?
         ialt=1
-        do l=klev+1,NLEV
+        do l=klev+1,nlaykim_tot
            zalt=rmil(l)-rad/1000.
            do i=ialt,130
@@ -200,5 +180,5 @@
         call comp(nomqy_c,nb,temp_c,mass,md)
         print*,'           Mass'
-        do ic=1,NC
+        do ic=1,nkim
           print*,nomqy_c(ic),mass(ic)
 !         if(nomqy_c(ic).eq.'CH4') print*,"MD=",md(:,ic)
@@ -214,9 +194,9 @@
                     nom_perte,nom_prod,perte,prod)
 !        print*,'nom_prod, nom_perte:'
-!        do ic=1,NC
+!        do ic=1,nkim
 !          print*,nom_prod(ic),nom_perte(ic)
 !        enddo
 !        print*,'premieres prod, perte(1:reaction,2:compagnon):'
-!        do ic=1,NC
+!        do ic=1,nkim
 !          print*,prod(1,ic),perte(1,1,ic),perte(2,1,ic)
 !        enddo
@@ -224,5 +204,5 @@
 !       l = klev-3
 !       print*,'krate a p=',press_c(l),' reactifs et produits:'
-!       do ic=1,ND+1
+!       do ic=1,nd_kim+1
 !         print*,ic,krpd(7,ic,l,4)*nb(l),"  ",
 !    .     nomqy_c(reactif(1,ic)+1),
@@ -230,5 +210,5 @@
 !    .     nomqy_c(reactif(4,ic)+1),nomqy_c(reactif(5,ic)+1)
 !       enddo
-!       do ic=ND+2,NR
+!       do ic=nd_kim+2,nr_kim
 !         print*,ic,krate(l,ic),"  ",
 !    .     nomqy_c(reactif(1,ic)+1),
@@ -245,5 +225,5 @@
       kedd(:) = 5e2 ! valeur mise par defaut  
                ! UNITE ? doit etre ok pour gptitan
-      do l=1,NLEV
+      do l=1,nlaykim_tot
        zalt=rmil(l)-rad/1000.  ! z en km
        if     ((zalt.ge.250.).and.(zalt.le.400.)) then 
@@ -280,5 +260,5 @@
 !                * Permet de faire le calcul une seule fois par lat
 !
-      DO j=1,nlon 
+      DO j=1,ngrid 
       
       if (j.eq.1) then 
@@ -305,11 +285,11 @@
        rinter(klev+1)=(rad+czlev(j,klev+1))/1000.
 
-! au-dessus du GCM, dr regulier et rinter(NLEV)=1290+2575 km.
-       do l=klev+2,NLEV
+! au-dessus du GCM, dr regulier et rinter(nlaykim_tot)=1290+2575 km.
+       do l=klev+2,nlaykim_tot
          rinter(l) = rinter(klev+1)  &
-               + (l-klev-1)*(3865.-rinter(klev+1))/(NLEV-klev-1)
+               + (l-klev-1)*(3865.-rinter(klev+1))/(nlaykim_tot-klev-1)
          rmil(l-1) = (rinter(l-1)+rinter(l))/2.
        enddo
-       rmil(NLEV) = rinter(NLEV)+(rinter(NLEV)-rinter(NLEV-1))/2.
+       rmil(nlaykim_tot) = rinter(nlaykim_tot)+(rinter(nlaykim_tot)-rinter(nlaykim_tot-1))/2.
 
 !-----------------------------------------------------------------------
@@ -326,7 +306,7 @@
                nb(l) = 1.e-4*press_c(l) / (kbol*temp_c(l))
        ENDDO
-! extension pour klev+1 a NLEV avec tcp.ver
+! extension pour klev+1 a nlaykim_tot avec tcp.ver
        ialt=1
-       do l=klev+1,NLEV
+       do l=klev+1,nlaykim_tot
            zalt=rmil(l)-rad/1000.
            do i=ialt,130
@@ -371,5 +351,5 @@
       endif
 
-      do l=1,NLEV
+      do l=1,nlaykim_tot
 
 ! INTERPOL EN ALT POUR k (krpd tous les deux km)
@@ -377,5 +357,5 @@
         factalt = (rmil(l)-rad/1000.)/2.-(ialt-1)
 
-        do i=1,ND+1
+        do i=1,nd_kim+1
           krpddecm1 = krpd(declinint  ,i,ialt  ,klat(j)) * (1-factalt) &
                    + krpd(declinint  ,i,ialt+1,klat(j)) * factalt
@@ -385,5 +365,5 @@
                    + krpd(declinint+2,i,ialt+1,klat(j)) * factalt
 
-                    ! ND+1 correspond a la dissociation de N2 par les GCR
+                    ! nd_kim+1 correspond a la dissociation de N2 par les GCR
           if ( factdec.lt.0. ) then 
         krate(l,i) = krpddecm1 * abs(factdec)  &
@@ -403,5 +383,5 @@
 !   ------------
 
-       do ic=1,NC
+       do ic=1,nkim
         do l=1,klev
           cqy(l,ic)  = qy_c(j,l,ic) 
@@ -410,5 +390,5 @@
        enddo
 
-! lecture du fichier compo_klat(j) (01 à 49) pour klev+1 a NLEV
+! lecture du fichier compo_klat(j) (01 à 49) pour klev+1 a nlaykim_tot
 
       WRITE(str2,'(i2.2)') klat(j)
@@ -423,5 +403,5 @@
 ! on lit la colonne t-1 au lieu de la colonne t
 ! (cas d une bande de latitude partagee par 2 procs)
-       do ic=1,NC
+       do ic=1,nkim
         read(11,'(A10)') name
         if (name.ne.nomqy_c(ic)) then
@@ -431,9 +411,9 @@
         endif
         if (ficdec.eq.curdec) then
-          do l=klev+1,NLEV
+          do l=klev+1,nlaykim_tot
             read(11,*) ficalt,cqy(l,ic),newq
           enddo
         else
-          do l=klev+1,NLEV
+          do l=klev+1,nlaykim_tot
             read(11,*) ficalt,oldq,cqy(l,ic)
           enddo
@@ -442,6 +422,6 @@
        close(11)
       else       ! le fichier n'est pas la
-       do ic=1,NC
-        do l=klev+1,NLEV
+       do ic=1,nkim
+        do l=klev+1,nlaykim_tot
           cqy(l,ic)=cqy(klev,ic)
         enddo
@@ -466,5 +446,5 @@
 !   ---------------------
      
-       do ic=1,NC
+       do ic=1,nkim
         do l=1,klev
           dqyc(j,l,ic) = (cqy(l,ic) - cqy0(l,ic))/dtchim  ! en /s
@@ -475,5 +455,5 @@
 !-----------------------------------------------------------------------
 !
-!   sauvegarde compo sur NLEV 
+!   sauvegarde compo sur nlaykim_tot 
 !   -------------------------
 
@@ -483,7 +463,7 @@
 ! premiere ligne=declin
       write(11,'(E15.5)') declin_c
-      do ic=1,NC
+      do ic=1,nkim
        write(11,'(A10)') nomqy_c(ic)
-       do l=klev+1,NLEV
+       do l=klev+1,nlaykim_tot
         write(11,'(E15.5,1X,E15.5,1X,E15.5)') rmil(l)-rad/1000.,cqy0(l,ic),cqy(l,ic)
        enddo
Index: trunk/LMDZ.TITAN/libf/phytitan/chem_settings.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/chem_settings.F90	(revision 1902)
+++ trunk/LMDZ.TITAN/libf/phytitan/chem_settings.F90	(revision 1903)
@@ -83,5 +83,5 @@
     ! ( H=1, H2=2 ..., C4N2=44) -> cf comchem_h
     
-    DO iq=2,44
+    DO iq=2,nkim
       CALL get_field(trim(cnames(iq))//"_up",ykim_up(iq,:,:),found,indextime)
       IF (.NOT.found) THEN
Index: trunk/LMDZ.TITAN/libf/phytitan/comchem_h.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/comchem_h.F90	(revision 1902)
+++ trunk/LMDZ.TITAN/libf/phytitan/comchem_h.F90	(revision 1903)
@@ -21,6 +21,9 @@
 IMPLICIT NONE  
 
+   !! Hard-coded number of chemical species for Titan chemistry
+   INTEGER, PARAMETER :: nkim = 44
+
    !! Hard-coded chemical species for Titan chemistry
-   CHARACTER(len=10), DIMENSION(44), PARAMETER  :: cnames = &
+   CHARACTER(len=10), DIMENSION(nkim), PARAMETER  :: cnames = &
      (/"H         ", "H2        ", "CH        ", "CH2s      ", "CH2       ", "CH3       ", &
        "CH4       ", "C2        ", "C2H       ", "C2H2      ", "C2H3      ", "C2H4      ", &
@@ -31,6 +34,16 @@
        "H2CN      ", "CHCN      ", "CH2CN     ", "CH3CN     ", "C3N       ", "HC3N      ", &
        "NCCN      ", "C4N2      "/)
+   !! Hard-coded chemical species for Titan chemistry + "HV" specie for the photochem module.
+   CHARACTER(len=10), DIMENSION(nkim+1), PARAMETER  :: nomqy_c = &
+     (/"H         ", "H2        ", "CH        ", "CH2s      ", "CH2       ", "CH3       ", &
+       "CH4       ", "C2        ", "C2H       ", "C2H2      ", "C2H3      ", "C2H4      ", &
+       "C2H5      ", "C2H6      ", "C3H3      ", "C3H5      ", "C3H6      ", "C3H7      ", & 
+       "C4H       ", "C4H3      ", "C4H4      ", "C4H2s     ", "CH2CCH2   ", "CH3CCH    ", &
+       "C3H8      ", "C4H2      ", "C4H6      ", "C4H10     ", "AC6H6     ", "C3H2      ", &
+       "C4H5      ", "AC6H5     ", "N2        ", "N4S       ", "CN        ", "HCN       ", &
+       "H2CN      ", "CHCN      ", "CH2CN     ", "CH3CN     ", "C3N       ", "HC3N      ", &
+       "NCCN      ", "C4N2      ", "HV        "/)
    !! Hard-coded chemical species molar mass (g.mol-1), shares the same indexing than cnames.
-   REAL, DIMENSION(44), PARAMETER               :: cmmol = (/ &
+   REAL, DIMENSION(nkim), PARAMETER               :: cmmol = (/ &
        1.01   , 2.0158, 13.02, 14.03, 14.03, 15.03, 16.04  , 24.02, 25.03, 26.04  , 27.05  , &
        28.05  , 29.06 , 30.07, 39.06, 41.07, 42.08, 43.09  , 49.05, 51.07, 52.08  , 50.06  , &
@@ -38,7 +51,14 @@
        14.01  , 26.02 , 27.04, 28.05, 39.05, 40.04, 41.05  , 50.04, 51.05, 52.04  , 76.1   /)
    
-   ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   ! !!!!!!!!!!!!!!!!!!!!
    !  Upper chemistry 
-   ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   ! !!!!!!!!!!!!!!!!!!!!
+   
+   ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   ! These parameters as well as nkim above, MUST match titan.h in chimtitan
+   INTEGER, PARAMETER :: nd_kim   = 54     ! Number of photodissociations
+   INTEGER, PARAMETER :: nr_kim   = 377    ! Number of reactions in chemistry scheme
+   INTEGER, PARAMETER :: nlrt_kim = 650    ! For the UV rad. transf., 650 levels of 2 km
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
    INTEGER, SAVE :: nlaykim_up   ! Number of upper atm. layers for chemistry from GCM top to 4.5E-5 Pa (1300km)
@@ -71,5 +91,5 @@
     IF (.NOT.allocated(preskim)) ALLOCATE(preskim(nlaykim_up))
     IF (.NOT.allocated(zlay_kim)) ALLOCATE(zlay_kim(ngrid,nlaykim_tot))
-    IF (.NOT.allocated(ykim_up)) ALLOCATE(ykim_up(44,ngrid,nlaykim_up))
+    IF (.NOT.allocated(ykim_up)) ALLOCATE(ykim_up(nkim,ngrid,nlaykim_up))
   
   END SUBROUTINE ini_comchem_h
Index: trunk/LMDZ.TITAN/libf/phytitan/inicondens.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/inicondens.F90	(revision 1902)
+++ trunk/LMDZ.TITAN/libf/phytitan/inicondens.F90	(revision 1903)
@@ -1,8 +1,8 @@
-      SUBROUTINE inicondens(ny,press,temp,nomy,yc)
+      SUBROUTINE inicondens(press,temp,yc)
 
 !==================================================================================
 !        Purpose
 !        -------
-!        Initialisation des profils de saturation des traceurs
+!        Initialisation des profils de saturation des traceurs chimiques
 !
 !        Authors
@@ -17,4 +17,5 @@
 !   -------------
 
+      use comchem_h, only: nkim, cnames
       use dimphy
       use mod_grid_phy_lmdz, only: nbp_lev
@@ -23,8 +24,6 @@
 !    Arguments :
 !    -----------
-      INTEGER, INTENT(IN)     :: ny
-      CHARACTER*10,INTENT(IN) :: nomy(ny+1)
-      REAL, INTENT(IN)        :: press(nbp_lev),temp(nbp_lev)  ! pressure in mbar !
-      REAL, INTENT(OUT)       :: yc(nbp_lev,ny)
+      REAL, INTENT(IN)        :: press(nbp_lev),temp(nbp_lev)  ! Pressure (mbar)
+      REAL, INTENT(OUT)       :: yc(nbp_lev,nkim) ! Saturation profiles (mol/mol)
       
 !    Local variables :
@@ -33,6 +32,6 @@
       REAL                    ::  sy,x
        
-      do ic=1,ny
-       print*, 'traceur CH(', ic, ')=', nomy(ic),'------------'
+      do ic=1,nkim
+       print*, 'traceur CH(', ic, ')=', trim(cnames(ic)),'------------'
            do l=1,nbp_lev
 
@@ -40,5 +39,5 @@
               yc(l,ic)=1.
 
-              if(nomy(ic).eq."CH4") then
+              if(trim(cnames(ic)).eq."CH4") then
                  if (temp(l).lt.90.65) then
                    yc(l,ic)= 10.0**(4.42507e0 - ( ( ( 1165560.7e0 / TEMP(l) - &
@@ -54,10 +53,10 @@
               endif
 
-              if(nomy(ic).eq."C2H2") then
+              if(trim(cnames(ic)).eq."C2H2") then
                  yc(l,ic)= 10.0**(6.09748e0-1644.1e0/TEMP(l)+7.42346e0     &
                       * alog10(1.0e3/TEMP(l)) ) / PRESS(l)*1013.25e0/760.0
               endif
 
-              if(nomy(ic).eq."C2H4") then
+              if(trim(cnames(ic)).eq."C2H4") then
                  if (temp(l).lt.89.0) then
                    yc(l,ic)= 10.0**(1.5477e0 + (1.0e0/TEMP(l) - 0.011e0)     &
@@ -76,5 +75,5 @@
               endif
 
-              if(nomy(ic).eq."C2H6") then
+              if(trim(cnames(ic)).eq."C2H6") then
                  if (temp(l).lt.90.) then
                    yc(l,ic)= 10.0**(10.01e0-1085.0e0/(TEMP(l)-0.561e0) )  &
@@ -86,46 +85,46 @@
               endif
 
-              if((nomy(ic).eq."CH3CCH").or.(nomy(ic).eq."CH2CCH2")) then
+              if((trim(cnames(ic)).eq."CH3CCH").or.(trim(cnames(ic)).eq."CH2CCH2")) then
                  yc(l,ic)= 10.0**(2.8808e0 - 4.5e0*(249.9e0 - TEMP(l))   &
                       /(1.15e0*TEMP(l) - 37.485e0) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C3H6")  then
+              if(trim(cnames(ic)).eq."C3H6")  then
                  yc(l,ic)= 10.0**(7.4463e0 - 1028.5654e0/TEMP(l) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C3H8")  then
+              if(trim(cnames(ic)).eq."C3H8")  then
                  yc(l,ic)= 10.0**(7.217e0 - 994.30251e0/TEMP(l) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if((nomy(ic).eq."C4H2").or.(nomy(ic).eq."C4H2s")) then
+              if((trim(cnames(ic)).eq."C4H2").or.(trim(cnames(ic)).eq."C4H2s")) then
                  yc(l,ic)= 10.0**(96.26781e0 - 4651.872e0/TEMP(l) - 31.68595e0 &
                       *alog10(TEMP(l)) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C4H4")  then
+              if(trim(cnames(ic)).eq."C4H4")  then
                  yc(l,ic)= 1.0e3 * exp(9.3898e0 - 2203.57/(TEMP(l)-43.15e0) ) / PRESS(l)
               endif
 
-              if(nomy(ic).eq."C4H6")  then
+              if(trim(cnames(ic)).eq."C4H6")  then
                  yc(l,ic)= 10.0**(2.8808e0 - 4.6e0*(262.3e0 - TEMP(l)) &
                       /(1.15e0*TEMP(l) - 39.345e0) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C4H10")  then
+              if(trim(cnames(ic)).eq."C4H10")  then
                  yc(l,ic)= 10.0**(8.446e0 - 1461.2e0/TEMP(l) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C6H2")  then
+              if(trim(cnames(ic)).eq."C6H2")  then
                  yc(l,ic)= 10.0**(4.666e0 - 4956e0/TEMP(l) + 25.845e0 * &
                       alog10(1.0e3/TEMP(l)) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C8H2")  then
+              if(trim(cnames(ic)).eq."C8H2")  then
                  yc(l,ic)= 10.0**(3.95e0 - 6613e0/TEMP(l) + 35.055e0 * &
                       alog10(1.0e3/TEMP(l)) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."AC6H6")  then
+              if(trim(cnames(ic)).eq."AC6H6")  then
                  x = 1.0e0 - TEMP(l) / 562.2e0
                  yc(l,ic)= 48.9e3 * exp( ( 1.33213 * x**1.5 - 6.98273 * x &
@@ -133,25 +132,25 @@
               endif
 
-              if(nomy(ic).eq."HCN")  then
+              if(trim(cnames(ic)).eq."HCN")  then
                  yc(l,ic)= 10.0**(8.6165e0 - 1516.5e0/(TEMP(l) - 26.2e0) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."CH3CN")  then
+              if(trim(cnames(ic)).eq."CH3CN")  then
                  yc(l,ic)= 10.0**(8.458e0 - 1911.7e0/TEMP(l) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C2H3CN")  then
+              if(trim(cnames(ic)).eq."C2H3CN")  then
                  yc(l,ic)= 10.0**(9.3051e0 - 2782.21/(TEMP(l) - 51.15e0) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."NCCN")  then
+              if(trim(cnames(ic)).eq."NCCN")  then
                  yc(l,ic)=  10.0**(7.454e0 - 1832e0/TEMP(l) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."HC3N")  then
+              if(trim(cnames(ic)).eq."HC3N")  then
                  yc(l,ic)= 10.0**(7.7446e0 - 1453.5609e0/TEMP(l) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
 
-              if(nomy(ic).eq."C4N2")  then
+              if(trim(cnames(ic)).eq."C4N2")  then
                  yc(l,ic)= 10.0**(8.269e0 - 2155.0e0/TEMP(l) ) / PRESS(l) * 1013.25e0 / 760.0e0
               endif
Index: trunk/LMDZ.TITAN/libf/phytitan/phyredem.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/phyredem.F90	(revision 1902)
+++ trunk/LMDZ.TITAN/libf/phytitan/phyredem.F90	(revision 1903)
@@ -143,5 +143,5 @@
   use iostart, only : open_restartphy, close_restartphy, & 
                       put_var, put_field
-  use comchem_h, only: cnames, ykim_up
+  use comchem_h, only: nkim, cnames, ykim_up
   use tracer_h, only: noms
   use callkeys_mod, only: callchim
@@ -196,5 +196,5 @@
   ! Upper chemistry
   if (callchim) then
-    do iq=1,44
+    do iq=1,nkim
       call put_field(trim(cnames(iq))//"_up",trim(cnames(iq))//" in upper atmosphere",ykim_up(iq,:,:))
     enddo
Index: trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90	(revision 1902)
+++ trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90	(revision 1903)
@@ -19,4 +19,5 @@
       use radcommon_h, only: sigma, glat, grav, BWNV
       use surfdat_h, only: phisfi, zmea, zstd, zsig, zgam, zthe
+      use comchem_h, only: nkim
       use comdiurn_h, only: coslat, sinlat, coslon, sinlon
       use comsaison_h, only: mu0, fract, dist_star, declin, right_ascen
@@ -363,26 +364,25 @@
       character(len=10) :: tmp2
 
-! Local variables for Titan chemistry and microphysics (JVO 2017)
-! ----------------------------------------------------------------------------
-     
-      character*10,dimension(:),allocatable,save :: nomqy
-
-!$OMP THREADPRIVATE(nomqy)
-
+! Local variables for Titan chemistry and microphysics
+! ----------------------------------------------------
+ 
       real ctimestep ! Chemistry timestep (s)
  
-      real temp_eq(nlayer), press_eq(nlayer) ! Moyennes planétaires
-      
-      real , allocatable, dimension(:,:,:),save :: ychim
-
-      ! 2D vmr tendencies ( chemistry and condensation ) for chem. tracers
-      real,dimension(:,:,:),allocatable,save :: dycchi ! Saved since chemistry is not called every step
-      real dyccond(ngrid,nlayer,nq)       
-         
-      real,dimension(:,:),allocatable,save   :: qysat
-      
-!$OMP THREADPRIVATE(ychim,dycchi,qysat)
-
-      real,dimension(:),allocatable,save :: tankCH4 ! Depth of surface methane tank
+      ! Chemical tracers in molar fraction 
+      real, dimension(:,:,:), allocatable, save   :: ychim ! (mol/mol)
+!$OMP THREADPRIVATE(ychim)
+
+      ! Molar fraction tendencies ( chemistry and condensation ) for tracers (mol/mol/s)
+      real, dimension(ngrid,nlayer,nq)            :: dyccond ! All tracers, we want to use indx on it.
+      real, dimension(:,:,:), allocatable, save   :: dycchi  ! Only for chem tracers. Saved since chemistry is not called every step.
+!$OMP THREADPRIVATE(dycchi)
+
+      ! Saturation profiles
+      real, dimension(:,:), allocatable, save     :: qysat ! (mol/mol)
+!$OMP THREADPRIVATE(qysat)
+      real temp_eq(nlayer), press_eq(nlayer) ! Planetary averages for the init. of saturation profiles.
+
+      ! Surface methane tank
+      real,dimension(:),allocatable,save :: tankCH4 ! Depth of surface methane tank (m)
 !$OMP THREADPRIVATE(tankCH4)
 
@@ -429,6 +429,6 @@
 
         ! Initialisation of nmicro as well as tracers names, indexes ...
-        if (ngrid.ne.1) then
-           call initracer2(nq,nametrac) ! Already done in rcm1d
+        if (ngrid.ne.1) then ! Already done in rcm1d
+           call initracer2(nq,nametrac)
         endif
 
@@ -463,8 +463,5 @@
         ALLOCATE(zdtlw(ngrid,nlayer))
         ALLOCATE(zdtsw(ngrid,nlayer))
-        ALLOCATE(dycchi(ngrid,nlayer,nq-nmicro))
-        ALLOCATE(qysat(nlayer,nq-nmicro))
-        ALLOCATE(nomqy(nq-nmicro+1)) ! +1 because of hv
-        
+ 
         ! This is defined in comsaison_h
         ALLOCATE(mu0(ngrid))
@@ -506,21 +503,18 @@
 !        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-         if ( callchim .and. (nq.gt.nmicro) ) then
-
-            allocate(ychim(ngrid,nlayer,nq-nmicro))
-
+         if ( callchim ) then
+
+            allocate(ychim(ngrid,nlayer,nkim))
+            allocate(dycchi(ngrid,nlayer,nkim)) ! only for chemical tracers
+            allocate(qysat(nlayer,nkim))
+            
+            ! Chemistry timestep
             ctimestep = ptimestep*REAL(ichim)
 
-            do iq=nmicro+1,nq
-               nomqy(iq-nmicro) = nametrac(iq)
-            enddo
-
-            nomqy(nq-nmicro+1) = "HV"
-            
-            ! qysat is taken at the equator ( small variations of t,p)
+            ! qysat is taken at the equator ( small variations of t,p )
             temp_eq(:)  = tmoy(:)
-            press_eq(:) = playmoy(:)/100. ! en mbar
-            
-            call inicondens(nq-nmicro,press_eq,temp_eq,nomqy,qysat)
+            press_eq(:) = playmoy(:)/100. ! in mbar
+            
+            call inicondens(press_eq,temp_eq,qysat)
           
             zdqchi(:,:,:)  = 0.0
@@ -1084,16 +1078,14 @@
          if (callchim) then
 
-            if (nq.gt.nmicro) then
-               do iq = nmicro+1,nq
-                  ychim(:,:,iq-nmicro) = pq(:,:,iq) * rat_mmol(iq) ! convert to molar fraction
-               enddo
-            endif
+            do iq = 1,nkim
+               ychim(:,:,iq) = pq(:,:,iq+nmicro) * rat_mmol(iq+nmicro) ! convert to molar fraction
+            enddo
 
             ! Condensation tendency after the transport
-            do iq=nmicro+1,nq
+            do iq=1,nkim
                do l=1,nlayer
                   do ig=1,ngrid
-                     if ( ychim(ig,l,iq-nmicro).gt.qysat(l,iq-nmicro) ) then
-                        dyccond(ig,l,iq)= ( -ychim(ig,l,iq-nmicro)+qysat(l,iq-nmicro) ) / ptimestep
+                     if ( ychim(ig,l,iq).gt.qysat(l,iq) ) then
+                        dyccond(ig,l,iq+nmicro)= ( -ychim(ig,l,iq)+qysat(l,iq) ) / ptimestep
                      endif
                   enddo
@@ -1108,10 +1100,9 @@
 
                if (ngrid.eq.1) then ! We obviously don't have access to (and don't need) zonal means in 1D
-                 call calchim(ngrid,nq-nmicro,ychim,nomqy,declin,zls,ctimestep, &
-                           pt,pplay,pplev,zzlay,zzlev,dycchi,nlayer+70)
+                 call calchim(ngrid,ychim,declin,zls,ctimestep, &
+                           pt,pplay,pplev,zzlay,zzlev,dycchi)
                else
-                 call calchim(ngrid,nq-nmicro,ychim,nomqy,declin,zls,ctimestep, &
-                           ztfibar,zplaybar,zplevbar,zzlaybar,zzlevbar,dycchi,nlayer+70)
-                 ! JVO 2017 : NLEV = nlayer+70, en accord avec le C. Quid si nlay=/ 55 ?
+                 call calchim(ngrid,ychim,declin,zls,ctimestep, &
+                           ztfibar,zplaybar,zplevbar,zzlaybar,zzlevbar,dycchi)
                endif
 
@@ -1122,15 +1113,13 @@
             ! ( GCM-friendly tracers and tendencies -> format for photochem and microphys ) 
 
-            if (nq.gt.nmicro) then
-               ! We convert tendencies to mass mixing ratio
-               do iq=nmicro+1,nq
-                  zdqchi(:,:,iq)  = dycchi(:,:,iq-nmicro)  / rat_mmol(iq)
-                  zdqcond(:,:,iq) = dyccond(:,:,iq) / rat_mmol(iq)
-               enddo
-
-               pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + &
-                    zdqchi(1:ngrid,1:nlayer,1:nq) + zdqcond(1:ngrid,1:nlayer,1:nq)
+            ! We convert tendencies to mass mixing ratio
+            do iq=1,nkim
+               zdqchi(:,:,iq+nmicro)  = dycchi(:,:,iq)  / rat_mmol(iq+nmicro)
+               zdqcond(:,:,iq+nmicro) = dyccond(:,:,iq+nmicro) / rat_mmol(iq+nmicro)
+            enddo
+
+            pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + &
+                 zdqchi(1:ngrid,1:nlayer,1:nq) + zdqcond(1:ngrid,1:nlayer,1:nq)
                
-            endif
             
          endif ! end of 'callchim'
Index: trunk/LMDZ.TITAN/libf/phytitan/tracer_h.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/phytitan/tracer_h.F90	(revision 1902)
+++ trunk/LMDZ.TITAN/libf/phytitan/tracer_h.F90	(revision 1903)
@@ -68,5 +68,5 @@
     USE callkeys_mod
     USE comcstfi_mod, only: mugaz
-    USE comchem_h, only: cnames, cmmol
+    USE comchem_h, only: nkim, cnames, cmmol
     IMPLICIT NONE
 
@@ -146,11 +146,11 @@
 
     IF (callchim) THEN
-      IF (nchimi < SIZE(cnames)) THEN
-        WRITE(*,*) "initracer2:error: Inconsistent number of chemical species given (",SIZE(cnames)," expected)"
+      IF (nchimi .NE. nkim) THEN
+        WRITE(*,*) "initracer2:error: Inconsistent number of chemical species given (",nkim," expected)"
         CALL abort_gcm("initracer2", "inconsistent number of tracers", 42)
       ENDIF
       IF (.NOT.ALLOCATED(chimi_indx)) ALLOCATE(chimi_indx(nchimi))
       n = 0 ! counter on chimi_indx 
-      DO j=1,SIZE(cnames)
+      DO j=1,nkim
         found = .false.
         DO i=1,nq
@@ -168,6 +168,6 @@
         ENDIF
       ENDDO
-      IF (n < SIZE(cnames)) THEN
-        WRITE(*,*) "initracer2:error: Inconsistent number of chemical species given (",SIZE(cnames)," expected)"
+      IF (n .NE. nkim) THEN
+        WRITE(*,*) "initracer2:error: Inconsistent number of chemical species given (",nkim," expected)"
         CALL abort_gcm("initracer2", "inconsistent number of tracers", 42)
       ENDIF
