Index: /trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90	(revision 2804)
@@ -31,5 +31,5 @@
 !     dust removal, simplification by Robin Wordsworth (2009)
 !     Generic n-layer aerosol - J. Vatant d'Ollone (2020)
-!     Radiative Generic Condensable aerosols - Lucas Teinturier (2022)
+!     Radiative Generic Condensable Species - Lucas Teinturier (2022)
 !
 !     Input
@@ -94,7 +94,8 @@
       integer igen_ice,igen_vap ! to store the index of generic tracer
       logical dummy_bool ! dummy boolean just in case we need one
+      ! integer i_rgcs_ice(aerogeneric)
       ! identify tracers
       IF (firstcall) THEN
-
+        ia =0
         write(*,*) "Tracers found in aeropacity:"
         do iq=1,nq
@@ -662,12 +663,5 @@
           ! Initialization
           aerosol(1:ngrid,1:nlayer,iaer) = 0.D0
-          igen_ice = -1
-          igen_vap = -1
-          ! Get index of the ice tracer (for pq, mol, rho_q)
-          call generic_tracer_index(nq,2*iaer,igen_vap,igen_ice,dummy_bool) 
-          if (igen_ice .eq. -1) then 
-            !if igen_ice not changed by generic_tracer_index, it means it's an ice tracer => igen_ice=2*iaer
-            igen_ice = 2*iaer 
-          endif
+          igen_ice = i_rgcs_ice(ia)
           ! Let's loop on the horizontal and vertical grid
           do ig=1,ngrid
@@ -694,26 +688,26 @@
       end do
 
-      do ig=1,ngrid
-         do l=1,nlayer
-            do iaer = 1, naerkind
-               if(aerosol(ig,l,iaer).gt.1.e3)then
-                  print*,'WARNING: aerosol=',aerosol(ig,l,iaer)
-                  print*,'at ig=',ig,',  l=',l,', iaer=',iaer
-                  print*,'QREFvis3d=',QREFvis3d(ig,l,iaer)
-                  print*,'reffrad=',reffrad(ig,l,iaer)
-               endif
-            end do
-         end do
-      end do
-
-      do ig=1,ngrid
-         if(tau_col(ig).gt.1.e3)then
-            print*,'WARNING: tau_col=',tau_col(ig)
-            print*,'at ig=',ig
-            print*,'aerosol=',aerosol(ig,:,:)
-            print*,'QREFvis3d=',QREFvis3d(ig,:,:)
-            print*,'reffrad=',reffrad(ig,:,:)
-         endif
-      end do
+      ! do ig=1,ngrid
+      !    do l=1,nlayer
+      !       do iaer = 1, naerkind
+      !          if(aerosol(ig,l,iaer).gt.1.e3)then
+      !             print*,'WARNING: aerosol=',aerosol(ig,l,iaer)
+      !             print*,'at ig=',ig,',  l=',l,', iaer=',iaer
+      !             print*,'QREFvis3d=',QREFvis3d(ig,l,iaer)
+      !             print*,'reffrad=',reffrad(ig,l,iaer)
+      !          endif
+      !       end do
+      !    end do
+      ! end do
+
+      ! do ig=1,ngrid
+      !    if(tau_col(ig).gt.1.e3)then
+      !       print*,'WARNING: tau_col=',tau_col(ig)
+      !       print*,'at ig=',ig
+      !       print*,'aerosol=',aerosol(ig,:,:)
+      !       print*,'QREFvis3d=',QREFvis3d(ig,:,:)
+      !       print*,'reffrad=',reffrad(ig,:,:)
+      !    endif
+      ! end do
       return
     end subroutine aeropacity
Index: /trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90	(revision 2804)
@@ -24,5 +24,6 @@
 ! Generic aerosols
       integer, dimension(:),allocatable,save :: iaero_generic
-!$OMP THREADPRIVATE(iaero_co2,iaero_h2o,iaero_dust,iaero_h2so4,noaero,iaero_back2lay,iaero_nh3,iaero_nlay,iaero_aurora,iaero_generic)
+      integer,dimension(:),allocatable,save :: i_rgcs_ice
+!$OMP THREADPRIVATE(iaero_co2,iaero_h2o,iaero_dust,iaero_h2so4,noaero,iaero_back2lay,iaero_nh3,iaero_nlay,iaero_aurora,iaero_generic,i_rgcs_ice)
       
 !==================================================================
Index: /trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90	(revision 2804)
@@ -501,7 +501,5 @@
            reffrad,QREFvis3d,QREFir3d,                             & 
            tau_col,cloudfrac,totcloudfrac,clearsky)                
-          
-
-
+ 
 !-----------------------------------------------------------------------    
       do ig=1,ngrid ! Starting Big Loop over every GCM column
Index: /trunk/LMDZ.GENERIC/libf/phystd/generic_tracer_index_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/generic_tracer_index_mod.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/generic_tracer_index_mod.F90	(revision 2804)
@@ -20,7 +20,7 @@
 
         USE tracer_h, only: noms, is_condensable
-        integer nq,iq, igcm_generic_vap, igcm_generic_ice
+        integer nq,iq, igcm_generic_vap, igcm_generic_ice, i_shortname, ii
         logical call_ice_vap_generic
-
+        character(len=10) :: shortname
         if((is_condensable(iq)==1) .and. (index(noms(iq),"vap") .ne. 0) &
                                                     .and. (index(noms(iq),"h2o") .eq. 0) .and. (index(noms(iq),"co2") .eq. 0)) then
@@ -30,22 +30,42 @@
             igcm_generic_ice = -1
 
-            ! We look for the corresponding ice traceur (before or after in the list of traceurs, maybe could be generalised to the whole list)
-            if (iq .ne. nq) then
-                if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq+1)(1:len(trim(noms(iq+1)))-4)) .and. (index(noms(iq+1),"ice") .ne. 0)) then
-                    igcm_generic_ice = iq+1
-                end if
-            end if
-            if ((iq .gt. 1)) then
-                if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq-1)(1:len(trim(noms(iq-1)))-4)) .and. (index(noms(iq-1),"ice") .ne. 0)) then
-                        igcm_generic_ice = iq-1
-                end if
-            end if
-            if (igcm_generic_ice .eq. -1) then
-                write(*,*) "ERROR : You set a vap traceur but you forgot to set the corresponding ice traceur, &
-                or the pair vap/ice is not written one after another in traceur.def"
+            ! ! ! We look for the corresponding ice traceur (before or after in the list of traceurs, maybe could be generalised to the whole list)
+            ! ! if (iq .ne. nq) then
+            ! !     if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq+1)(1:len(trim(noms(iq+1)))-4)) .and. (index(noms(iq+1),"ice") .ne. 0)) then
+            ! !         igcm_generic_ice = iq+1
+            ! !     end if
+            ! ! end if
+            ! ! if ((iq .gt. 1)) then
+            ! !     if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq-1)(1:len(trim(noms(iq-1)))-4)) .and. (index(noms(iq-1),"ice") .ne. 0)) then
+            ! !             igcm_generic_ice = iq-1
+            ! !     end if
+            ! ! end if
+            ! ! if (igcm_generic_ice .eq. -1) then
+            ! !     write(*,*) "ERROR : You set a vap traceur but you forgot to set the corresponding ice traceur, &
+            ! !     or the pair vap/ice is not written one after another in traceur.def"
+            ! ! endif
+
+            ! ! call_ice_vap_generic = .true.
+            i_shortname = index(noms(iq),'_')-1
+            shortname=noms(iq)(1:i_shortname)
+            ! We look for the corresponding ice traceur, first if it's before the vap traceur in pq
+            if (iq>1 ) then
+                do ii=1,iq-1
+                    if (index(noms(ii),adjustl(trim(shortname))) .ne. 0) then
+                        igcm_generic_ice=ii
+                        exit
+                    endif
+                ENDDO
             endif
-
+            ! if we didn't find it before, we look after the vap tracer in pq
+            if (igcm_generic_ice .eq. -1 .and. (iq<nq)) then 
+                do ii=iq+1,nq
+                    if (index(noms(ii),adjustl(trim(shortname))) .ne. 0) then 
+                        igcm_generic_ice=ii
+                        exit
+                    endif
+                enddo
+            endif
             call_ice_vap_generic = .true.
-        
         else
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/iniaerosol.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/iniaerosol.F	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/iniaerosol.F	(revision 2804)
@@ -4,4 +4,5 @@
       use radinc_h, only: naerkind
       use aerosol_mod
+      use tracer_h, only: n_rgcs, nqtot, is_rgcs
       use callkeys_mod, only: aeroco2,aeroh2o,dusttau,aeroh2so4,
      &		aeroback2lay,aeronh3, nlayaero, aeronlay, aeroaurora,
@@ -20,12 +21,33 @@
 c=======================================================================
 
-      integer i, ia
+      integer i, ia, iq
 
       ! Special case, dyn. allocation for n-layer depending on callphys.def
       IF(.NOT.ALLOCATED(iaero_nlay)) ALLOCATE(iaero_nlay(nlayaero))
       iaero_nlay(:) = 0
-      ! Do the same for iaero_generic
+      ! Do the same for iaero_generic and i_rgcs_ice
       IF (.not. allocated(iaero_generic)) 
      &  allocate(iaero_generic(aerogeneric))
+      if (.not. allocated(i_rgcs_ice))
+     & allocate(i_rgcs_ice(aerogeneric)) 
+      ! Init of i_rgcs_ice
+      i_rgcs_ice(:) =0.0
+      ia = 1
+      do iq=1,nqtot
+         if (is_rgcs(iq) .eq. 1) then 
+            i_rgcs_ice(ia)=iq
+            ia = ia+1
+         endif
+      enddo
+      ! We check that we have the right number
+      ! for aerogeneric (coherent between
+      ! callphys and traceur.def)
+   !    if (aerogeneric .ne. n_rgcs) then 
+   !       print*,'iniaerosol: aerogeneric is not' 
+   !   & 'equal to the number of RGCS in traceur.def'
+   !       print*,'iniaerosol: check your' 
+   !   &'callphys.def and your traceur.def'
+   !       call abort_physics("inaerosol: Aborting")
+   !    endif
       iaero_generic(:)=0
       ia=0
@@ -86,5 +108,6 @@
          enddo
       endif 
-      write(*,*)'--- Generic Condensable Aerosols',iaero_generic
+      write(*,*)'--- Radiative Generic Condensable Species = '
+     &,iaero_generic
       write(*,*) '=== Number of aerosols= ', ia
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/initracer.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/initracer.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/initracer.F90	(revision 2804)
@@ -120,4 +120,5 @@
        ENDIF
        IF (.NOT. allocated(is_condensable)) allocate(is_condensable(nq)) !LT
+       IF (.NOT. allocated(is_rgcs)) allocate(is_rgcs(nq)) !LT
        IF (.NOT. allocated(constants_mass)) allocate(constants_mass(nq))
        IF (.NOT. allocated(constants_delta_vapH)) allocate(constants_delta_vapH(nq))
@@ -148,5 +149,5 @@
 
        is_condensable(:)= 0
-
+       is_rgcs(:) = 0
        constants_mass(:)=0
        constants_delta_vapH(:)=0
@@ -489,4 +490,14 @@
       ngt = sum(is_condensable)
       write(*,*) 'Number of generic tracer is  ngt = ',ngt
+
+      ! Calculate number of radiative generic condensable species
+      n_rgcs = sum(is_rgcs)
+      write(*,*)'Number of Radiative Generic Condensable Species is n_rgcs = ',n_rgcs
+      if (n_rgcs> ngt/2) then 
+        write(*,*) 'You have more Radiative Generic Condensable Species than Generic Condensable Species'
+        write(*,*)'This is not possible: check your Modern traceur.def'
+        call abort_physic("initracer, issue with # of RGCS and GCS")
+      endif
+
 !     Processing modern traceur options
       if(moderntracdef) then
@@ -693,4 +704,14 @@
               ' rho=', rho_q(iq)       
           endif
+          !option is_rgcs 
+          if (index(tracline,'is_rgcs') .ne. 0) then 
+            read(tracline(index(tracline,'is_rgcs=') &
+              +len('is_rgcs='):),*) is_rgcs(iq)
+            write(*,*)'Parameter value (traceur.def) :'// &
+              'is_rgcs=',is_rgcs(iq)
+          else
+            write(*,*)'Parameter value (default) : '// &
+              'is_rgcs = ',is_rgcs(iq)
+          endif
       end subroutine get_tracdat
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90	(revision 2804)
@@ -30,5 +30,5 @@
 !     Jeremy Leconte (2012)
 !     Extended to dust, CO2, NH3, 2-lay,Nlay,auroral aerosols by ??
-!     Added Radiative Generic Condensable Aerosols effective radii
+!     Added Radiative Generic Condensable Species effective radii
 !     calculations  (Lucas Teinturier 2022)
 !
@@ -42,7 +42,7 @@
       use aerosol_mod, only: iaero_back2lay, iaero_co2, iaero_dust, &
                              iaero_h2o, iaero_h2so4, iaero_nh3, iaero_nlay, iaero_aurora, &
-                             iaero_generic
+                             iaero_generic, i_rgcs_ice
       use callkeys_mod, only: size_nh3_cloud, nlayaero, aeronlay_size, aeronlay_nueff,aerogeneric
-
+      use tracer_h, only: radius, nqtot, is_rgcs
       Implicit none
 
@@ -55,6 +55,6 @@
       logical, save :: firstcall=.true.
 !$OMP THREADPRIVATE(firstcall)
-      integer :: iaer, ia   
-      real :: temprad !temporary variable for radius when we have Radiative Generic Condensable aerosols
+      integer :: iaer, ia , iq, i_rad  
+
       do iaer=1,naerkind
 !     these values will change once the microphysics gets to work
@@ -107,12 +107,12 @@
          endif
 
-         do ia=1,aerogeneric     ! Radiative Generic Condensable aerosols
+         do ia=1,aerogeneric     ! Radiative Generic Condensable Species
             if (iaer .eq. iaero_generic(ia)) then 
-               call generic_get_traceur_radius(iaer,temprad)
-               reffrad(1:ngrid,1:nlayer,iaer)=temprad
+               i_rad = i_rgcs_ice(ia)
+               reffrad(1:ngrid,1:nlayer,iaer)=radius(i_rad)
                nueffrad(1:ngrid,1:nlayer,iaer) = 0.1
             endif 
          enddo  ! generic radiative condensable aerosols
-
+         
          if(iaer.gt.5)then ! I think this could be commented out by this needs testing. It works with 5 aerosols (LT 2022)
             print*,'Error in callcorrk, naerkind is too high (>5).'
@@ -122,5 +122,5 @@
          endif
       enddo ! iaer=1,naerkind
-
+      
 
       if (radfixed) then
@@ -390,36 +390,4 @@
 !==================================================================
 
-!==================================================================
-   subroutine generic_get_traceur_radius(iaer,radii)
-!==================================================================
-!     Purpose
-!     -------
-!     Get the generic traceur radius inputted in modern_traceur.def
-!      for the specie "specie"
-!
-!     Authors
-!     -------
-!     Lucas Teinturier (2022)
-!
-!==================================================================
-      Use tracer_h, only: radius, noms, nqtot
-      Implicit none
-      
-      integer, intent(in) :: iaer !index of aerosol which radius we're looking for
-      real, intent(out) :: radii !radii(ngrid,nlayer,naerkind) ! Particle radii (m)
-      integer :: iq !just a loop index 
-
-      if (index(noms(1),'ice') .ne. 0) then !traceur.def is organized with _ice then _vap
-         radii=radius(2*iaer-1)
-      elseif (index(noms(1),'vap') .ne. 0) then !traceur.def is organized with _vap then _ice
-         radii = radius(2*iaer)
-      else
-         print*,"radii_mod: tracer is neither ice or vap :",noms(1)
-         print*,"Aborting"
-         call abort 
-      endif
-      
-   end subroutine generic_get_traceur_radius
-
 end module radii_mod
 !==================================================================
Index: /trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90	(revision 2804)
@@ -233,7 +233,7 @@
        endif
 ! the following was added by LT
-       do ia=1,aerogeneric ! Read Radiative Generic Condensable Aerosols data
+       do ia=1,aerogeneric ! Read Radiative Generic Condensable Species data
          if (iaer .eq. iaero_generic(ia)) then 
-            if (index(noms(2*iaer),'Fe') .ne. 0) then 
+            if (index(noms(i_rgcs_ice(ia)),'Fe') .ne. 0) then 
                print*,"Reading Fe file"
                file_id(iaer,1)='Fe.ocst.txt'
@@ -241,5 +241,5 @@
                lamrefvis(iaer) = 1.0E-6 !random pick
                lamrefir(iaer) = 1.0E-6 !dummy but random pick
-            else if (index(noms(2*iaer),'Mn') .ne. 0) then 
+            else if (index(noms(i_rgcs_ice(ia)),'Mn') .ne. 0) then 
                print*,"Reading MnS file"
                file_id(iaer,1)='MnS.ocst.txt'
@@ -247,5 +247,5 @@
                lamrefvis(iaer) = 1.0E-6 !random pick
                lamrefir(iaer) = 1.0E-6 !dummy but random pick   
-            else if (index(noms(2*iaer),'Mg') .ne. 0) then  
+            else if (index(noms(i_rgcs_ice(ia)),'Mg') .ne. 0) then  
                print*,"Reading Mg2SiO4 file" 
                file_id(iaer,1)='Mg2SiO4.ocst.txt'
@@ -253,5 +253,5 @@
                lamrefvis(iaer) = 1.0E-6 !random pick
                lamrefir(iaer) = 1.0E-6 !dummy but random pick  
-            else if (index(noms(2*iaer),'Cr') .ne. 0) then
+            else if (index(noms(i_rgcs_ice(ia)),'Cr') .ne. 0) then
                print*,"Reading Cr file"
                file_id(iaer,1)='Cr.ocst.txt'
@@ -261,10 +261,10 @@
             else
 ! If you want to add another specie, copy,paste & adapt the elseif block up here to your new specie (LT 2022)
-               call abort_physic("suaer_corrk", "Unknown specie in generic condensable aerosols",1)
+               call abort_physic("suaer_corrk", "Unknown specie in radiative generic condensable species",1)
             endif
          endif
        enddo ! ia=1,aerogeneric
       enddo
-
+      
 !------------------------------------------------------------------
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/tracer_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/tracer_h.F90	(revision 2803)
+++ /trunk/LMDZ.GENERIC/libf/phystd/tracer_h.F90	(revision 2804)
@@ -7,5 +7,10 @@
        integer, save :: nesp  ! number of species in the chemistry
        integer, save :: ngt   ! number of generic tracers
+<<<<<<< HEAD
 !$OMP THREADPRIVATE(nqtot,nesp,ngt)
+=======
+       integer, save :: n_rgcs ! number of Radiative Generic Condensable Species
+!$OMP THREADPRIVATE(nqtot,nesp,ngt,n_rgcs)
+>>>>>>> d67f7c1... This is the RGCS scheme
 
        logical :: moderntracdef=.false. ! Standard or modern traceur.def
@@ -41,6 +46,10 @@
 !$OMP THREADPRIVATE(is_recomb,is_recomb_qset,is_recomb_qotf)
        integer, save, allocatable :: is_condensable(:)      ! 1 if tracer is generic, else 0 (added LT)
+<<<<<<< HEAD
 !$OMP THREADPRIVATE(is_condensable)   !also added by LT
 
+=======
+       integer,save,allocatable :: is_rgcs(:)               ! 1 if tracer is a radiative generic condensable specie, else 0 (added LT 2022)
+>>>>>>> d67f7c1... This is the RGCS scheme
        ! Lists of constants for condensable tracers
        integer, save, allocatable :: constants_mass(:)                    ! molecular mass of the specie (g/mol)
@@ -55,4 +64,8 @@
 !$OMP THREADPRIVATE(constants_RLVTT_generic,constants_metallicity_coeff)
 
+<<<<<<< HEAD
+=======
+!$OMP THREADPRIVATE(is_condensable,is_rgcs)   !also added by LT
+>>>>>>> d67f7c1... This is the RGCS scheme
 ! tracer indexes: these are initialized in initracer and should be 0 if the
 !                 corresponding tracer does not exist
