Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr.F90	(revision 3852)
@@ -12,5 +12,5 @@
   USE IOIPSL 
   USE dimphy
-  USE infotrac_phy, ONLY : nbtr,tname
+  USE infotrac_phy, ONLY : nbtr
   IMPLICIT NONE 
 !=====================================================================
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr_scav.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr_scav.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr_scav.F90	(revision 3852)
@@ -13,5 +13,5 @@
   USE IOIPSL 
   USE dimphy
-  USE infotrac_phy, ONLY : nbtr,tname
+  USE infotrac_phy, ONLY : nbtr
   IMPLICIT NONE 
   !=====================================================================
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr_spl.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr_spl.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/cvltr_spl.F90	(revision 3852)
@@ -13,5 +13,5 @@
   USE IOIPSL 
   USE dimphy
-  USE infotrac_phy, ONLY : nbtr,tname
+  USE infotrac_phy, ONLY : nbtr
   IMPLICIT NONE 
 !=====================================================================
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/infotrac_phy.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/infotrac_phy.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/infotrac_phy.F90	(revision 3852)
@@ -1,242 +1,236 @@
-
-! $Id: $
-
 MODULE infotrac_phy
 
-! Infotrac for physics; for now contains the same information as infotrac for
-! the dynamics (could be further cleaned) and is initialized using values
-! provided by the dynamics
-
-! nqtot : total number of tracers and higher order of moment, water vapor and liquid included
-  INTEGER, SAVE :: nqtot
-!$OMP THREADPRIVATE(nqtot)
-
-!CR: on ajoute le nombre de traceurs de l eau
-  INTEGER, SAVE :: nqo
-!$OMP THREADPRIVATE(nqo)
-
-! nbtr : number of tracers not including higher order of moment or water vapor or liquid
-!        number of tracers used in the physics
-  INTEGER, SAVE :: nbtr
-!$OMP THREADPRIVATE(nbtr)
-
+  USE       strings_mod, ONLY: msg, fmsg, test, strIdx, int2str
+
+  USE readTracFiles_mod, ONLY: getKey_init, getKey, indexUpdate
+
+  USE trac_types_mod,    ONLY: tra, iso, kys
+
+  IMPLICIT NONE
+
+  PRIVATE
+
+  !=== FOR TRACERS:
+  PUBLIC :: tra,   tracers,  type_trac                     !--- Derived type, full database, tracers type keyword
+  PUBLIC :: nqtot,   nbtr,   nqo                           !--- Main dimensions
+  PUBLIC :: init_infotrac_phy                              !--- Initialization
+  PUBLIC :: itr_indice                                     !--- Indexes of the tracers passed to phytrac
+  PUBLIC :: niadv                                          !--- Indexes of true tracers (<=nqtot, such that iadv(idx)>0)
+  PUBLIC :: pbl_flg, conv_flg, solsym
+
+  !=== FOR ISOTOPES: General
+  !--- General
+  PUBLIC :: iso, isotopes, nbIso                           !--- Derived type, full isotopes families database + nb of families
+  PUBLIC :: isoSelect , ixIso                              !--- Isotopes family selection tool + selected family index
+  !=== FOR ISOTOPES: Specific to H2O isotopes
+  PUBLIC :: iH2O, tnat, alpha_ideal                        !--- H2O isotopes index, natural abundance, fractionning coeff.
+  !=== FOR ISOTOPES: Depending on selected isotopes family
+  PUBLIC :: isotope, isoKeys                               !--- Selected isotopes database + associated keys (cf. getKey)
+  PUBLIC :: isoName, isoZone, isoPhas                      !--- Isotopes and tagging zones names, phases
+  PUBLIC :: niso, nzon, npha, nitr                         !---  " " numbers + isotopes & tagging tracers number
+  PUBLIC :: iZonIso, iTraPha                               !--- 2D index tables to get "iq" index
+  PUBLIC :: isoCheck                                       !--- Run isotopes checking routines
+
+  !=== FOR BOTH TRACERS AND ISOTOPES
+  PUBLIC :: getKey                                         !--- Get a key from "tracers" or "isotope"
+
+  !=== FOR STRATOSPHERIC AEROSOLS
 #ifdef CPP_StratAer
-! nbtr_bin: number of aerosol bins for StratAer model
-! nbtr_sulgas: number of sulfur gases for StratAer model
-  INTEGER, SAVE :: nbtr_bin, nbtr_sulgas
-!$OMP THREADPRIVATE(nbtr_bin,nbtr_sulgas)
-  INTEGER, SAVE :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat
-!$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat)
+  PUBLIC :: nbtr_bin, nbtr_sulgas, id_OCS_strat, id_H2SO4_strat, id_SO2_strat, id_BIN01_strat, id_TEST_strat
 #endif
 
-! CRisi: nb traceurs pères= directement advectés par l'air
-  INTEGER, SAVE :: nqperes
-!$OMP THREADPRIVATE(nqperes)
-
-! Name variables
-  CHARACTER(len=20), ALLOCATABLE, DIMENSION(:), SAVE :: tname ! tracer short name for restart and diagnostics
-  CHARACTER(len=23), ALLOCATABLE, DIMENSION(:), SAVE :: ttext ! tracer long name for diagnostics
-!$OMP THREADPRIVATE(tname,ttext)
-
-!! iadv  : index of trasport schema for each tracer
-!  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: iadv
-
-! niadv : vector keeping the coorspondance between all tracers(nqtot) treated in the 
-!         dynamic part of the code and the tracers (nbtr+2) used in the physics part of the code. 
-  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: niadv ! equivalent dyn / physique
-!$OMP THREADPRIVATE(niadv)
-
-! CRisi: tableaux de fils
-  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: nqfils
-  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: nqdesc ! nombres de fils + nombre de tous les petits fils sur toutes les générations
-  INTEGER, SAVE :: nqdesc_tot
-  INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE    :: iqfils
-  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: iqpere
-!$OMP THREADPRIVATE(nqfils,nqdesc,nqdesc_tot,iqfils,iqpere)
-
-! conv_flg(it)=0 : convection desactivated for tracer number it 
-  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE  :: conv_flg
-!$OMP THREADPRIVATE(conv_flg)
-
-! pbl_flg(it)=0  : boundary layer diffusion desactivaded for tracer number it 
-  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE  :: pbl_flg
-!$OMP THREADPRIVATE(pbl_flg)
-
-  CHARACTER(len=4),SAVE :: type_trac
-!$OMP THREADPRIVATE(type_trac)
-  CHARACTER(len=8),DIMENSION(:),ALLOCATABLE, SAVE :: solsym
-!$OMP THREADPRIVATE(solsym)
-   
-    ! CRisi: cas particulier des isotopes
-    LOGICAL,SAVE :: ok_isotopes,ok_iso_verif,ok_isotrac,ok_init_iso
-!$OMP THREADPRIVATE(ok_isotopes,ok_iso_verif,ok_isotrac,ok_init_iso)
-    INTEGER :: niso_possibles   
-    PARAMETER ( niso_possibles=5)
-    real, DIMENSION (niso_possibles),SAVE :: tnat,alpha_ideal
-!$OMP THREADPRIVATE(tnat,alpha_ideal)
-    LOGICAL, DIMENSION(niso_possibles),SAVE ::  use_iso
-!$OMP THREADPRIVATE(use_iso)
-    INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE ::  iqiso ! donne indice iq en fn de (ixt,phase) 
-!$OMP THREADPRIVATE(iqiso)
-    INTEGER, ALLOCATABLE, DIMENSION(:), SAVE ::  iso_num ! donne numéro iso entre 1 et niso_possibles en fn de nqtot
-!$OMP THREADPRIVATE(iso_num)
-    INTEGER, ALLOCATABLE, DIMENSION(:), SAVE ::  iso_indnum ! donne numéro iso entre 1 et niso effectif en fn de nqtot
-!$OMP THREADPRIVATE(iso_indnum)
-    INTEGER, ALLOCATABLE, DIMENSION(:), SAVE ::  zone_num ! donne numéro de la zone de tracage en fn de nqtot
-!$OMP THREADPRIVATE(zone_num)
-    INTEGER, ALLOCATABLE, DIMENSION(:), SAVE ::  phase_num ! donne numéro de la zone de tracage en fn de nqtot
-!$OMP THREADPRIVATE(phase_num)
-    INTEGER, DIMENSION(niso_possibles), SAVE :: indnum_fn_num ! donne indice entre entre 1 et niso en fonction du numéro d isotope entre 1 et niso_possibles
-!$OMP THREADPRIVATE(indnum_fn_num)
-    INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE ::  index_trac ! numéro ixt en fn izone, indnum entre 1 et niso
-!$OMP THREADPRIVATE(index_trac)
-    INTEGER,SAVE :: niso,ntraceurs_zone,ntraciso
-!$OMP THREADPRIVATE(niso,ntraceurs_zone,ntraciso)
- 
+  INTERFACE isoSelect; MODULE PROCEDURE isoSelectByIndex, isoSelectByName; END INTERFACE isoSelect
+
+!=== CONVENTIONS FOR TRACERS NUMBERS:
+!  |--------------------+----------------------+-----------------+---------------+----------------------------|
+!  | water in different |    water tagging     |  water isotopes | other tracers | additional tracers moments |
+!  | phases: H2O-[gls]  |      isotopes        |                 |               |  for higher order schemes  |
+!  |--------------------+----------------------+-----------------+---------------+----------------------------|
+!  |                    |                      |                 |               |                            |
+!  |<--     nqo      -->|<-- nqo*niso* nzon -->|<-- nqo*niso  -->|<--  nbtr   -->|<--        (nmom)        -->|         
+!  |                    |                                        |                                            |
+!  |                    |<-- nqo*niso*(nzon+1)  =   nqo*nitr  -->|<--    nqtottr = nbtr + nmom             -->|
+!  |                                                                             = nqtot - nqo*(nitr+1)       |
+!  |                                                                                                          |
+!  |<--                        nqtrue  =  nbtr + nqo*(nitr+1)                 -->|                            |
+!  |                                                                                                          |
+!  |<--                        nqtot   =  nqtrue + nmom                                                    -->|
+!  |                                                                                                          |
+!  |----------------------------------------------------------------------------------------------------------|
+! NOTES FOR THIS TABLE:
+!  * The used "niso", "nzon" and "nitr" are the H2O components of "isotopes(ip)"  (isotopes(ip)%prnt == 'H2O'),
+!    since water is so far the sole tracers family removed from the main tracers table.
+!  * For water, "nqo" is equal to the more general field "isotopes(ip)%npha".
+!  * "niso", "nzon", "nitr", "npha" are defined for other isotopic tracers families, if any.
+!
+!=== TRACERS DESCRIPTOR: DERIVED TYPE EMBEDDING MOST OF THE USEFUL QUANTITIES (LENGTH: nqtot)
+!    Each entry is accessible using "%" sign.
+!  |------------+-------------------------------------------------+-------------+------------------------+
+!  |  entry     | Meaning                                         | Former name | Possible values        |
+!  |------------+-------------------------------------------------+-------------+------------------------+
+!  | name       | Name (short)                                    | tname       |                        |
+!  | nam1       | Name of the 1st generation ancestor             | /           |                        |
+!  | prnt       | Name of the parent                              | /           |                        |
+!  | lnam       | Long name (with adv. scheme suffix) for outputs | ttext       |                        |
+!  | type       | Type (so far: tracer or tag)                    | /           | tracer,tag             |
+!  | phas       | Phases list ("g"as / "l"iquid / "s"olid)        | /           | [g][l][s]              |
+!  | iadv       | Advection scheme number                         | iadv        | 1-20,30 exc. 3-9,15,19 |
+!  | igen       | Generation (>=1)                                | /           |                        |
+!  | itr        | Index in "tr_seri" (0: absent from physics)     | cf. niadv   | 1:nqtottr              |
+!  | iprnt      | Index of the parent tracer                      | iqpere      | 1:nqtot                |
+!  | idesc      | Indexes of the childs (all generations)         | iqfils      | 1:nqtot                |
+!  | ndesc      | Number of the descendants (all generations)     | nqdesc      | 1:nqtot                |
+!  | nchld      | Number of childs (first generation only)        | nqfils      | 1:nqtot                |
+!  | keys       | key/val pairs accessible with "getKey" routine  | /           |                        |
+!  | iso_num    | Isotope name  index in iso(igr)%name(:)         | iso_indnum  | 1:niso                 |
+!  | iso_zon    | Isotope zone  index in iso(igr)%zone(:)         | zone_num    | 1:nzon                 |
+!  | iso_pha    | Isotope phase index in iso(igr)%phas            | phase_num   | 1:npha                 |
+!  +------------+-------------------------------------------------+-------------+------------------------+
+!
+!=== ISOTOPES DESCRIPTOR: DERIVED TYPE EMBEDDING MOST OF THE USEFUL QUANTITIES (LENGTH: NUMBER OF ISOTOPES FAMILIES USED)
+!    Each entry is accessible using "%" sign.
+!  |------------+-------------------------------------------------+-------------+-----------------------+
+!  |  entry     | Meaning                                         | Former name | Possible values       |
+!  |------------+-------------------------------------------------+-------------+-----------------------+
+!  | prnt       | Parent tracer (isotopes family name)            |             |                       |
+!  | trac, nitr | Isotopes & tagging tracers + number of elements |             |                       |
+!  | zone, nzon | Geographic tagging zones   + number of elements |             |                       |
+!  | phas, npha | Phases list                + number of elements |             | [g][l][s], 1:3        |
+!  | niso       | Number of isotopes, excluding tagging tracers   |             |                       |
+!  | iTraPha    | Index in "xt" = f(iname(niso+1:nitr),iphas)     | iqiso       | 1:niso                |
+!  | iZonIso    | Index in "xt" = f(izone, iname(1:niso))         | index_trac  | 1:nzon                |
+!  |------------+-------------------------------------------------+-------------+-----------------------+
+
+  !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
+  INTEGER,            SAVE :: nqtot, &                     !--- Tracers nb in dynamics (incl. higher moments & water)
+                              nbtr,  &                     !--- Tracers nb in physics  (excl. higher moments & water)
+                              nqo,   &                     !--- Number of water phases
+                              nbIso                        !--- Number of available isotopes family
+  CHARACTER(LEN=256), SAVE :: type_trac                    !--- Keyword for tracers type
+
+  !=== DERIVED TYPES EMBEDDING MOST INFORMATIONS ABOUT TRACERS AND ISOTOPES FAMILIES
+  TYPE(tra), TARGET,  SAVE, ALLOCATABLE ::  tracers(:)     !=== TRACERS DESCRIPTORS VECTOR
+  TYPE(iso), TARGET,  SAVE, ALLOCATABLE :: isotopes(:)     !=== ISOTOPES PARAMETERS VECTOR
+!$OMP THREADPRIVATE(tracers, isotopes)
+
+  !=== ALIASES FOR CURRENTLY SELECTED ISOTOPES FAMILY OF VARIABLES EMBEDDED IN THE VECTOR "isotopes"
+  TYPE(iso),          SAVE, POINTER :: isotope             !--- CURRENTLY SELECTED ISOTOPES FAMILY DESCRIPTOR
+  INTEGER,            SAVE          :: ixIso, iH2O         !--- Index of the selected isotopes family and H2O family
+  LOGICAL,            SAVE, POINTER :: isoCheck            !--- Flag to trigger the checking routines
+  TYPE(kys),          SAVE, POINTER :: isoKeys(:)          !--- ONE SET OF KEYS FOR EACH ISOTOPE (LISTED IN isoName)
+  CHARACTER(LEN=256), SAVE, POINTER :: isoName(:),       & !--- ISOTOPES NAMES FOR THE CURRENTLY SELECTED FAMILY
+                                       isoZone(:),       & !--- TAGGING ZONES  FOR THE CURRENTLY SELECTED FAMILY
+                                       isoPhas             !--- USED PHASES    FOR THE CURRENTLY SELECTED FAMILY
+  INTEGER,            SAVE          :: niso, nzon, npha, & !--- NUMBER OF ISOTOPES, TAGGING ZONES AND PHASES
+                                       nitr                !--- NUMBER OF ISOTOPES + ISOTOPIC TAGGING TRACERS
+  INTEGER,            SAVE, POINTER :: iZonIso(:,:)        !--- INDEX IN "isoTrac" AS f(tagging zone, isotope)
+  INTEGER,            SAVE, POINTER :: iTraPha(:,:)        !=== INDEX IN "isoTrac" AS f(isotopic tracer, phase)
+!$OMP THREADPRIVATE(isotope, ixIso,iH2O, isoCheck, isoKeys, isoName,isoZone,isoPhas, niso,nzon,npha,nitr, iZonIso,iTraPha)
+
+  !=== VARIABLES EMBEDDED IN "tracers", BUT DUPLICATED, AS THEY ARE RATHER FREQUENTLY USED + VARIABLES FOR INCA
+  REAL,               SAVE, ALLOCATABLE ::     tnat(:),  & !--- Natural relative abundance of water isotope        (niso)
+                                        alpha_ideal(:)     !--- Ideal fractionning coefficient (for initial state) (niso)
+  INTEGER,            SAVE, ALLOCATABLE :: conv_flg(:),  & !--- Convection     activation ; needed for INCA        (nbtr)
+                                            pbl_flg(:)     !---  Boundary layer activation ; needed for INCA        (nbtr)
+  INTEGER,            SAVE, ALLOCATABLE ::    niadv(:),  &
+                                         itr_indice(:)     !--- Indexes of the tracers passed to phytrac        (nqtottr)
+  CHARACTER(LEN=256), SAVE, ALLOCATABLE ::   solsym(:)     !--- Names from INCA                                    (nbtr)
+!OMP THREADPRIVATE(tnat, alpha_ideal, conv_flg, pbl_flg, niadv, itr_indice, solsym)
+
+#ifdef CPP_StratAer
+  !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB)
+  INTEGER, SAVE :: nbtr_bin, nbtr_sulgas, id_OCS_strat, id_H2SO4_strat, id_SO2_strat, id_BIN01_strat, id_TEST_strat
+!OMP THREADPRIVATE(nbtr_bin, nbtr_sulgas, id_OCS_strat, id_H2SO4_strat, id_SO2_strat, id_BIN01_strat, id_TEST_strat)
+#endif
+
 CONTAINS
 
-  SUBROUTINE init_infotrac_phy(nqtot_,nqo_,nbtr_,tname_,ttext_,type_trac_,&
-                               niadv_,conv_flg_,pbl_flg_,solsym_,&
-                               nqfils_,nqdesc_,nqdesc_tot_,iqfils_,iqpere_,&
-                               ok_isotopes_,ok_iso_verif_,ok_isotrac_,&
-                               ok_init_iso_,niso_possibles_,tnat_,&
-                               alpha_ideal_,use_iso_,iqiso_,iso_num_,&
-                               iso_indnum_,zone_num_,phase_num_,&
-                               indnum_fn_num_,index_trac_,&
-                               niso_,ntraceurs_zone_,ntraciso_&
+SUBROUTINE init_infotrac_phy(tracers_, isotopes_, type_trac_, solsym_, nbtr_, niadv_, pbl_flg_, conv_flg_)
+  ! transfer information on tracers from dynamics to physics
+  USE print_control_mod, ONLY: prt_level, lunout
+  IMPLICIT NONE
+  TYPE(tra),        INTENT(IN) ::  tracers_(:)
+  TYPE(iso),        INTENT(IN) :: isotopes_(:)
+  CHARACTER(LEN=*), INTENT(IN) :: type_trac_, solsym_(:)
+  INTEGER,          INTENT(IN) :: nbtr_, niadv_(:), pbl_flg_(:), conv_flg_(:)
+
+  CHARACTER(LEN=256) :: modname="init_infotrac_phy"
+  LOGICAL :: lerr
+
+  tracers   = tracers_
+  isotopes  = isotopes_
+  type_trac = type_trac_
+  solsym    = solsym_
+  nqtot     = SIZE(tracers_)
+  nbtr      = nbtr_
+  niadv     = niadv_
+  nbIso     = SIZE(isotopes_)
+  pbl_flg  = pbl_flg_
+  conv_flg = conv_flg_
+
+  !=== Specific to water
+  CALL getKey_init(tracers, isotopes)
+  IF(.NOT.isoSelect('H2O')) THEN
+    iH2O = ixIso
+    lerr = getKey('tnat' ,tnat,        isoName)
+    lerr = getKey('alpha',alpha_ideal, isoName)
+    nqo  = isotope%npha
+  END IF
+  IF(prt_level > 1) WRITE(lunout,*) TRIM(modname)//": nqtot, nqo, nbtr = ",nqtot, nqo, nbtr
+  itr_indice = PACK(tracers(:)%itr, MASK = tracers(:)%itr/=0)
+print*,'66'
+
+  !? conv_flg, pbl_flg, solsym
+  !? isoInit
+
 #ifdef CPP_StratAer
-                               ,nbtr_bin_,nbtr_sulgas_&
-                               ,id_OCS_strat_,id_SO2_strat_,id_H2SO4_strat_,id_BIN01_strat_&
+  IF (type_trac == 'coag') THEN
+    nbtr_bin=0
+    nbtr_sulgas=0
+    DO iq = 1, nqtrue
+      IF(tracers(iq)%name(1:3)=='BIN') nbtr_bin    = nbtr_bin   +1
+      IF(tracers(iq)%name(1:3)=='GAS') nbtr_sulgas = nbtr_sulgas+1
+      SELECT CASE(tracers(iq)%name)
+        CASE('BIN01');    id_BIN01_strat = iq - nqo; CALL msg('id_BIN01_strat=', id_BIN01_strat)
+        CASE('GASOCS');   id_OCS_strat   = iq - nqo; CALL msg('id_OCS_strat  =', id_OCS_strat)
+        CASE('GASSO2');   id_SO2_strat   = iq - nqo; CALL msg('id_SO2_strat  =', id_SO2_strat)
+        CASE('GASH2SO4'); id_H2SO4_strat = iq - nqo; CALL msg('id_H2SO4_strat=', id_H2SO4_strat)
+        CASE('GASTEST');  id_TEST_strat  = iq - nqo; CALL msg('id_TEST_strat=' , id_TEST_strat)
+      END SELECT
+    END DO
+    CALL msg('nbtr_bin      =',nbtr_bin)
+    CALL msg('nbtr_sulgas   =',nbtr_sulgas)
+  END IF
 #endif
-                               )
-
-    ! transfer information on tracers from dynamics to physics
-    USE print_control_mod, ONLY: prt_level, lunout
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: nqtot_
-    INTEGER,INTENT(IN) :: nqo_
-    INTEGER,INTENT(IN) :: nbtr_
-#ifdef CPP_StratAer
-    INTEGER,INTENT(IN) :: nbtr_bin_
-    INTEGER,INTENT(IN) :: nbtr_sulgas_
-    INTEGER,INTENT(IN) :: id_OCS_strat_
-    INTEGER,INTENT(IN) :: id_SO2_strat_
-    INTEGER,INTENT(IN) :: id_H2SO4_strat_
-    INTEGER,INTENT(IN) :: id_BIN01_strat_
-#endif
-    CHARACTER(len=20),INTENT(IN) :: tname_(nqtot_) ! tracer short name for restart and diagnostics
-    CHARACTER(len=23),INTENT(IN) :: ttext_(nqtot_) ! tracer long name for diagnostics
-    CHARACTER(len=4),INTENT(IN) :: type_trac_
-    INTEGER,INTENT(IN) :: niadv_ (nqtot_) ! equivalent dyn / physique
-    INTEGER,INTENT(IN) :: conv_flg_(nbtr_)
-    INTEGER,INTENT(IN) :: pbl_flg_(nbtr_)
-    CHARACTER(len=8),INTENT(IN) :: solsym_(nbtr_)
-    ! Isotopes:
-    INTEGER,INTENT(IN) :: nqfils_(nqtot_)
-    INTEGER,INTENT(IN) :: nqdesc_(nqtot_)
-    INTEGER,INTENT(IN) :: nqdesc_tot_
-    INTEGER,INTENT(IN) :: iqfils_(nqtot_,nqtot_)
-    INTEGER,INTENT(IN) :: iqpere_(nqtot_)
-    LOGICAL,INTENT(IN) :: ok_isotopes_
-    LOGICAL,INTENT(IN) :: ok_iso_verif_
-    LOGICAL,INTENT(IN) :: ok_isotrac_
-    LOGICAL,INTENT(IN) :: ok_init_iso_
-    INTEGER,INTENT(IN) :: niso_possibles_
-    REAL,INTENT(IN) :: tnat_(niso_possibles_)
-    REAL,INTENT(IN) :: alpha_ideal_(niso_possibles_)
-    LOGICAL,INTENT(IN) :: use_iso_(niso_possibles_)
-    INTEGER,INTENT(IN) :: iqiso_(ntraciso_,nqo_)
-    INTEGER,INTENT(IN) :: iso_num_(nqtot_)
-    INTEGER,INTENT(IN) :: iso_indnum_(nqtot_)
-    INTEGER,INTENT(IN) :: zone_num_(nqtot_)
-    INTEGER,INTENT(IN) :: phase_num_(nqtot_)
-    INTEGER,INTENT(IN) :: indnum_fn_num_(niso_possibles_)
-    INTEGER,INTENT(IN) :: index_trac_(ntraceurs_zone_,niso_)
-    INTEGER,INTENT(IN) :: niso_
-    INTEGER,INTENT(IN) :: ntraceurs_zone_
-    INTEGER,INTENT(IN) :: ntraciso_
-
-    CHARACTER(LEN=30) :: modname="init_infotrac_phy"
-
-    nqtot=nqtot_
-    nqo=nqo_
-    nbtr=nbtr_
-#ifdef CPP_StratAer
-    nbtr_bin=nbtr_bin_
-    nbtr_sulgas=nbtr_sulgas_
-    id_OCS_strat=id_OCS_strat_
-    id_SO2_strat=id_SO2_strat_
-    id_H2SO4_strat=id_H2SO4_strat_
-    id_BIN01_strat=id_BIN01_strat_
-#endif
-    ALLOCATE(tname(nqtot))
-    tname(:) = tname_(:)
-    ALLOCATE(ttext(nqtot))
-    ttext(:) = ttext_(:)
-    type_trac = type_trac_
-    ALLOCATE(niadv(nqtot))
-    niadv(:)=niadv_(:)
-    ALLOCATE(conv_flg(nbtr))
-    conv_flg(:)=conv_flg_(:)
-    ALLOCATE(pbl_flg(nbtr))
-    pbl_flg(:)=pbl_flg_(:)
-    ALLOCATE(solsym(nbtr))
-    solsym(:)=solsym_(:)
-  
-    IF(prt_level.ge.1) THEN
-      write(lunout,*) TRIM(modname)//": nqtot,nqo,nbtr",nqtot,nqo,nbtr
-    ENDIF
-    
-    ! Isotopes:
-    
-    ! First check that the "niso_possibles" has the correct value
-    IF (niso_possibles.ne.niso_possibles_) THEN
-      CALL abort_physic(modname,&
-           "wrong value for parameter niso_possibles in infotrac_phy",1)
-    ENDIF
-    
-    ok_isotopes=ok_isotopes_
-    ok_iso_verif=ok_iso_verif_
-    ok_isotrac=ok_isotrac_
-    ok_init_iso=ok_init_iso_
-    
-    niso=niso_
-    ntraceurs_zone=ntraceurs_zone_
-    ntraciso=ntraciso_
-    
-    IF (ok_isotopes) THEN
-      ALLOCATE(nqfils(nqtot))
-      nqfils(:)=nqfils_(:)
-      ALLOCATE(nqdesc(nqtot))
-      nqdesc(:)=nqdesc_(:)
-      nqdesc_tot=nqdesc_tot_
-      ALLOCATE(iqfils(nqtot,nqtot))
-      iqfils(:,:)=iqfils_(:,:)
-      ALLOCATE(iqpere(nqtot))
-      iqpere(:)=iqpere_(:)
-    
-      tnat(:)=tnat_(:)
-      alpha_ideal(:)=alpha_ideal_(:)
-      use_iso(:)=use_iso_(:)
-    
-      ALLOCATE(iqiso(ntraciso,nqo))
-      iqiso(:,:)=iqiso_(:,:)
-      ALLOCATE(iso_num(nqtot))
-      iso_num(:)=iso_num_(:)
-      ALLOCATE(iso_indnum(nqtot))
-      iso_indnum(:)=iso_indnum_(:)
-      ALLOCATE(zone_num(nqtot))
-      zone_num(:)=zone_num_(:)
-      ALLOCATE(phase_num(nqtot))
-      phase_num(:)=phase_num_(:)
-      
-      indnum_fn_num(:)=indnum_fn_num_(:)
-      
-      ALLOCATE(index_trac(ntraceurs_zone,niso))
-      index_trac(:,:)=index_trac_(:,:)
-    ENDIF ! of IF(ok_isotopes)
-  
-  END SUBROUTINE init_infotrac_phy
+
+END SUBROUTINE init_infotrac_phy
+
+
+!==============================================================================================================================
+!=== THE ROUTINE isoSelect IS USED TO SWITCH FROM AN ISOTOPE FAMILY TO ANOTHER: ISOTOPES DEPENDENT PARAMETERS ARE UPDATED
+!     Singe generic "isoSelect" routine, using the predefined parent index (fast version) or its name (first time).
+!==============================================================================================================================
+LOGICAL FUNCTION isoSelectByName(iName) RESULT(lerr)
+  CHARACTER(LEN=*), INTENT(IN)  :: iName
+  INTEGER :: iIso
+  iIso = strIdx(isotopes(:)%prnt, iName)
+  IF(test(fmsg(iIso == 0,'no isotope family named "'//TRIM(iName)//'"'),lerr)) RETURN
+  IF(isoSelectByIndex(iIso)) RETURN
+END FUNCTION isoSelectByName
+!==============================================================================================================================
+LOGICAL FUNCTION isoSelectByIndex(iIso) RESULT(lerr)
+  INTEGER, INTENT(IN) :: iIso
+  lerr = .FALSE.
+  IF(iIso == ixIso) RETURN                                      !--- Nothing to do if the index is already OK
+  IF(test(fmsg(iIso<=0 .OR. iIso>=nbIso,'Inconsistent isotopes family index '//TRIM(int2str(iIso))),lerr)) RETURN
+  ixIso = iIso                                                  !--- Update currently selected family index
+  isotope => isotopes(ixIso)                                    !--- Select corresponding component
+  !--- VARIOUS ALIASES
+  isoKeys => isotope%keys; niso = isotope%niso
+  isoName => isotope%trac; nitr = isotope%nitr; isoCheck => isotope%check
+  isoZone => isotope%zone; nzon = isotope%nzon; iZonIso  => isotope%iZonIso
+  isoPhas => isotope%phas; npha = isotope%npha; iTraPha  => isotope%iTraPha
+END FUNCTION isoSelectByIndex
+!==============================================================================================================================
 
 END MODULE infotrac_phy
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyetat0.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyetat0.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyetat0.F90	(revision 3852)
@@ -23,5 +23,5 @@
   USE geometry_mod, ONLY : longitude_deg, latitude_deg
   USE iostart, ONLY : close_startphy, get_field, get_var, open_startphy
-  USE infotrac_phy, only: nbtr, nqo, type_trac, tname, niadv
+  USE infotrac_phy, only: nbtr, nqo, type_trac, tracers, niadv
   USE traclmdz_mod,    ONLY : traclmdz_from_restart
   USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl, co2_send
@@ -443,6 +443,6 @@
 !!        iiq=niadv(it+2)                                                           ! jyg
         iiq=niadv(it+nqo)                                                           ! jyg
-        found=phyetat0_get(1,trs(:,it),"trs_"//tname(iiq), &
-              "Surf trac"//tname(iiq),0.)
+        found=phyetat0_get(1,trs(:,it),"trs_"//tracers(iiq)%name, &
+              "Surf trac"//tracers(iiq)%name,0.)
      ENDDO
      CALL traclmdz_from_restart(trs)
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyredem.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyredem.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyredem.F90	(revision 3852)
@@ -33,5 +33,5 @@
   USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var
   USE traclmdz_mod, ONLY : traclmdz_to_restart
-  USE infotrac_phy, ONLY: type_trac, niadv, tname, nbtr, nqo
+  USE infotrac_phy, ONLY: type_trac, niadv, tracers, nbtr, nqo
   USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
   USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra
@@ -311,5 +311,5 @@
 !!        iiq=niadv(it+2)                                                           ! jyg
           iiq=niadv(it+nqo)                                                           ! jyg
-          CALL put_field(pass,"trs_"//tname(iiq), "", trs(:, it))
+          CALL put_field(pass,"trs_"//tracers(iiq)%name, "", trs(:, it))
        END DO
        IF (carbon_cycle_cpl) THEN
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/phys_output_mod.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/phys_output_mod.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/phys_output_mod.F90	(revision 3852)
@@ -35,5 +35,5 @@
     USE iophy 
     USE dimphy
-    USE infotrac_phy, ONLY: nqtot, nqo, niadv, tname, ttext, type_trac
+    USE infotrac_phy, ONLY: nqtot, nqo, niadv, tracers, type_trac
     USE ioipsl
     USE phys_cal_mod, only : hour, calend
@@ -143,5 +143,10 @@
     REAL, DIMENSION(NSW,2)          :: spbnds_sun !bounds of spectband
 
+    CHARACTER(LEN=256), POINTER :: tname(:), ttext(:)
+
     WRITE(lunout,*) 'Debut phys_output_mod.F90'
+    tname => tracers(:)%name
+    ttext => tracers(:)%lnam
+
     ! Initialisations (Valeurs par defaut
 
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/phys_output_write_mod.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/phys_output_write_mod.F90	(revision 3852)
@@ -363,5 +363,5 @@
     USE pbl_surface_mod, ONLY: snow
     USE indice_sol_mod, ONLY: nbsrf
-    USE infotrac_phy, ONLY: nqtot, nqo, type_trac, tname, niadv
+    USE infotrac_phy, ONLY: nqtot, nqo, type_trac, tracers, niadv
     USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
     USE surface_data, ONLY: type_ocean, version_ocean, ok_veget, landice_opt
@@ -449,4 +449,7 @@
     REAL,DIMENSION(klon,klev) :: z, dz
     REAL,DIMENSION(klon)      :: zrho, zt
+    CHARACTER(LEN=256), POINTER :: tname(:)
+
+    tname => tracers(:)%name
 
     ! On calcul le nouveau tau:
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/traclmdz_mod.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/traclmdz_mod.F90	(revision 3851)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/traclmdz_mod.F90	(revision 3852)
@@ -67,5 +67,5 @@
     
     USE dimphy
-    USE infotrac_phy
+    USE infotrac_phy, ONLY: nbtr
     
     ! Input argument
@@ -89,5 +89,5 @@
     ! Initialization of the tracers should be done here only for those not found in the restart file.
     USE dimphy
-    USE infotrac_phy
+    USE infotrac_phy, ONLY: tracers, nqo, nbtr, niadv, pbl_flg, conv_flg
     USE regr_pr_comb_coefoz_m, ONLY: alloc_coefoz
     USE press_coefoz_m, ONLY: press_coefoz
@@ -175,8 +175,10 @@
 !!       iiq=niadv(it+2)                                                            ! jyg
        iiq=niadv(it+nqo)                                                            ! jyg
-       IF ( tname(iiq) == "RN" ) THEN                                               
-          id_rn=it ! radon
-       ELSE IF ( tname(iiq) == "PB") THEN
-          id_pb=it ! plomb
+       !-----------------------------------------------------------------------
+       SELECT CASE(tracers(iiq)%name)
+       !-----------------------------------------------------------------------
+         CASE("RN"); id_rn=it ! radon
+       !-----------------------------------------------------------------------
+         CASE("PB"); id_pb=it ! plomb
 ! RomP >>> profil initial de PB210 
      open (ilesfil2,file='prof.pb210',status='old',iostat=irr2)
@@ -198,7 +200,6 @@
      ENDIF
 ! RomP <<<
-       ELSE IF ( tname(iiq) == "Aga" .OR. tname(iiq) == "AGA" ) THEN
-          ! Age of stratospheric air
-          id_aga=it
+       !-----------------------------------------------------------------------
+         CASE("Aga","AGA");           id_aga   = it ! Age of stratospheric air
           radio(id_aga) = .FALSE.
           aerosol(id_aga) = .FALSE.
@@ -213,8 +214,6 @@
              lev_1p5km=klev/2
           END IF
-       ELSE IF ( tname(iiq) == "BE" .OR. tname(iiq) == "Be" .OR.  &
-            tname(iiq) == "BE7" .OR. tname(iiq) == "Be7" ) THEN  
-          ! Recherche du Beryllium 7
-          id_be=it
+       !-----------------------------------------------------------------------
+         CASE("BE","Be","BE7","Be7"); id_be    = it ! Recherche du Beryllium 7
           ALLOCATE( srcbe(klon,klev) )
           radio(id_be) = .TRUE.
@@ -243,27 +242,30 @@
      ENDIF
 ! RomP <<<
-       ELSE IF (tname(iiq)=="O3" .OR. tname(iiq)=="o3") THEN
-          ! Recherche de l'ozone : parametrization de la chimie par Cariolle
-          id_o3=it
-          CALL alloc_coefoz   ! allocate ozone coefficients
-          CALL press_coefoz   ! read input pressure levels
-       ELSE IF ( tname(iiq) == "pcsat" .OR. tname(iiq) == "Pcsat" ) THEN
-          id_pcsat=it
-       ELSE IF ( tname(iiq) == "pcocsat" .OR. tname(iiq) == "Pcocsat" ) THEN
-          id_pcocsat=it
-       ELSE IF ( tname(iiq) == "pcq" .OR. tname(iiq) == "Pcq" ) THEN
-          id_pcq=it
-       ELSE IF ( tname(iiq) == "pcs0" .OR. tname(iiq) == "Pcs0" ) THEN
-          id_pcs0=it
-          conv_flg(it)=0 ! No transport by convection for this tracer
-       ELSE IF ( tname(iiq) == "pcos0" .OR. tname(iiq) == "Pcos0" ) THEN
-          id_pcos0=it
-          conv_flg(it)=0 ! No transport by convection for this tracer
-       ELSE IF ( tname(iiq) == "pcq0" .OR. tname(iiq) == "Pcq0" ) THEN
-          id_pcq0=it
-          conv_flg(it)=0 ! No transport by convection for this tracer
-       ELSE
-          WRITE(lunout,*) 'This is an unknown tracer in LMDZ : ', trim(tname(iiq))
-       END IF
+       !-----------------------------------------------------------------------
+         CASE("O3","o3");           id_o3      = it
+           ! Recherche de l'ozone : parametrization de la chimie par Cariolle
+           CALL alloc_coefoz   ! allocate ozone coefficients
+           CALL press_coefoz   ! read input pressure levels
+       !-----------------------------------------------------------------------
+         CASE("pcsat"  ,"Pcsat");   id_pcsat   = it
+       !-----------------------------------------------------------------------
+         CASE("pcocsat","Pcocsat"); id_pcocsat = it
+       !-----------------------------------------------------------------------
+         CASE("pcq"    ,"Pcq");     id_pcq     = it
+       !-----------------------------------------------------------------------
+         CASE("pcs0"   ,"Pcs0");    id_pcs0    = it
+           conv_flg(it)=0 ! No transport by convection for this tracer
+       !-----------------------------------------------------------------------
+         CASE("pcos0"  ,"Pcos0");   id_pcos0   = it
+           conv_flg(it)=0 ! No transport by convection for this tracer
+       !-----------------------------------------------------------------------
+         CASE("pcq0"   ,"Pcq0");    id_pcq0    = it
+           conv_flg(it)=0 ! No transport by convection for this tracer
+       !-----------------------------------------------------------------------
+         CASE DEFAULT
+           WRITE(lunout,*) 'This is an unknown tracer in LMDZ : ', trim(tracers(iiq)%name)
+       !-----------------------------------------------------------------------
+       END SELECT
+       !-----------------------------------------------------------------------
     END DO
 
@@ -309,5 +311,5 @@
        IF (zero) THEN
           ! The tracer was not found in restart file or it was equal zero everywhere.
-          WRITE(lunout,*) "The tracer ",trim(tname(iiq))," will be initialized"
+          WRITE(lunout,*) "The tracer ",trim(tracers(iiq)%name)," will be initialized"
           IF (it==id_pcsat .OR. it==id_pcq .OR. &
                it==id_pcs0 .OR. it==id_pcq0) THEN
