Index: trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/comchem_newstart_h.F90
===================================================================
--- trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/comchem_newstart_h.F90	(revision 1892)
+++ trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/comchem_newstart_h.F90	(revision 1894)
@@ -25,759 +25,3 @@
   REAL,ALLOCATABLE :: ykim_upoldS(:,:,:,:)
   
-  
-  CONTAINS
-  
-  
-  SUBROUTINE read_startarch_kim(nid,start,count)
-  
-    ! Purpose : * Read by ther names, upper chemsitry fields present
-    !             in start_archive.nc as physical variables
-    !           * H_up field is read before, as the 1st one  
-    !             we perform sanity check on it
-    !           * We assume a given order of the 44 tracers (cf comchem_h)
-  
-    IMPLICIT NONE
-    
-    include "netcdf.inc"
-    
-    INTEGER, INTENT(IN)               :: nid ! "start_archive.nc" NetCDF file ID
-    INTEGER, DIMENSION(4), INTENT(IN) :: start, count
-    
-    INTEGER :: varid, nvarid, ierr
-    
-    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-    
-    ierr=NF_INQ_VARID(nid,"H2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <H2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(2,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(2,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <H2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(3,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(3,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH2s_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH2s_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(4,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(4,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH2s_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(5,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(5,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH3_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH3_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(6,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(6,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH3_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH4_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH4_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(7,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(7,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH4_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(8,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(8,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C2H_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C2H_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(9,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(9,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C2H_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C2H2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C2H2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(10,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(10,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C2H2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C2H3_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C2H3_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(11,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(11,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C2H3_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C2H4_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C2H4_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(12,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(12,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C2H4_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C2H5_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C2H5_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(13,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(13,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C2H5_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C2H6_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C2H6_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(14,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(14,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C2H6_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C3H3_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C3H3_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(15,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(15,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C3H3_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C3H5_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C3H5_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(16,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(16,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C3H5_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C3H6_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C3H6_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(17,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(17,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C3H6_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C3H7_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C3H7_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(18,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(18,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C3H7_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(19,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(19,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H3_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H3_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(20,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(20,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H3_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H4_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H4_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(21,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(21,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H4_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H2s_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H2s_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(22,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(22,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H2s_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH2CCH2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH2CCH2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(23,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(23,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH2CCH2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH3CCH_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH3CCH_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(24,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(24,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH3CCH_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C3H8_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C3H8_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(25,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(25,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C3H8_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(26,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(26,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H6_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H6_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(27,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(27,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H6_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H10_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H10_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(28,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(28,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H10_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"AC6H6_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <AC6H6_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(29,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(29,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <AC6H6_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C3H2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C3H2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(30,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(30,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C3H2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4H5_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4H5_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(31,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(31,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4H5_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"AC6H5_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <AC6H5_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(32,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(32,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <AC6H5_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"N2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <N2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(33,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(33,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <N2_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"N4S_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <N4S_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(34,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(34,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <N4S_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CN_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CN_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(35,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(35,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CN_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"HCN_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <HCN_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(36,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(36,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <HCN_up>"
-       CALL abort
-    ENDIF
-    
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"H2CN_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <H2CN_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(37,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(37,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <H2CN_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CHCN_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CHCN_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(38,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(38,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CHCN_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH2CN_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH2CN_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(39,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(39,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH2CN_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"CH3CN_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <CH3CN_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(40,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(40,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <CH3CN_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C3N_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C3N_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(41,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(41,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C3N_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"HC3N_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <HC3N_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(42,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(42,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <HC3N_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"NCCN_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <NCCN_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(43,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(43,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <NCCN_up>"
-       CALL abort
-    ENDIF
-      
-    ! --------------------------------
-    
-    ierr=NF_INQ_VARID(nid,"C4N2_up",nvarid)
-    IF (ierr .NE. NF_NOERR) THEN
-      PRINT*, "lect_start_archive: Le champ <C4N2_up> est absent..."
-      CALL abort
-    ENDIF
-#ifdef NC_DOUBLE
-    ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,ykim_upoldS(44,:,:,:))
-#else
-    ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,ykim_upoldS(44,:,:,:))
-#endif
-    IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "lect_start_archive: Lecture echouee pour <C4N2_up>"
-       CALL abort
-    ENDIF
-      
-    WRITE(*,*)
-
-  END SUBROUTINE read_startarch_kim
-  
 END MODULE comchem_newstart_h
Index: trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/lect_start_archive.F
===================================================================
--- trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/lect_start_archive.F	(revision 1892)
+++ trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/lect_start_archive.F	(revision 1894)
@@ -5,4 +5,5 @@
 
 !      USE surfdat_h
+      USE comchem_h, only : cnames
       USE comchem_newstart_h
       USE comsoil_h, ONLY: nsoilmx, layer, mlayer, volcapa, inertiedat
@@ -843,5 +844,5 @@
       ierr=NF_INQ_VARID(nid,"H_up",nvarid)
       
-      IF (ierr .NE. NF_NOERR) THEN
+      IF (ierr .NE. NF_NOERR) THEN ! H_up not found
       
          PRINT*, "lect_start_archive: Le champ <H_up> est absent..."        
@@ -856,5 +857,5 @@
          ENDIF
          
-      ELSE
+      ELSE ! H_up found
       
         IF (.not.callchim) THEN
@@ -874,8 +875,31 @@
              PRINT*, "lect_start_archive: Lecture echouee pour <H_up>"
              CALL abort
-          ENDIF          
+          ENDIF
+                   
           ! Then read all the others by their name if needed
-          CALL read_startarch_kim(nid,start,count)              
-         ENDIF
+          DO iq=2,44
+            ierr=NF_INQ_VARID(nid,trim(cnames(iq))//"_up",nvarid)
+            IF (ierr .NE. NF_NOERR) THEN
+              PRINT*, "lect_start_archive: Le champ <"
+     &//trim(cnames(iq))//"_up> est absent..."
+              CALL abort
+            ENDIF
+#ifdef NC_DOUBLE
+            ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,
+     &                                ykim_upoldS(iq,:,:,:))
+#else
+            ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,
+     &                              ykim_upoldS(iq,:,:,:))
+#endif
+            IF (ierr .NE. NF_NOERR) THEN
+               PRINT*, "lect_start_archive: Lecture echouee pour <"
+     &//trim(cnames(iq))//"_up>"
+               CALL abort
+            ENDIF 
+          ENDDO
+      
+         WRITE(*,*)     
+         
+         ENDIF ! if callchim
          
       ENDIF  ! if ierr.ne.nf_no_err
Index: trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/newstart.F
===================================================================
--- trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/newstart.F	(revision 1892)
+++ trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/newstart.F	(revision 1894)
@@ -1085,14 +1085,22 @@
         WRITE(*,*) " Number of upper chemistry layers =", nlaykim_up
         
-        ! Regriding is then done, if needed
-        
-        IF (callchim .and. nlaykimold.ne.nlaykim_up) THEN
-
-          WRITE(*,*) " Warning, nlaykimold=", nlaykimold
-          WRITE(*,*) ' which implies that a vertical regriding on upper  
+        IF (callchim) THEN
+            
+          IF (.NOT.allocated(ykim_up)) THEN
+            ALLOCATE(ykim_up(44,ngridmx,nlaykim_up))
+          ENDIF
+          
+          ! Regriding if needed
+          
+          IF (nlaykimold.ne.nlaykim_up) THEN
+
+            WRITE(*,*) " Warning, nlaykimold=", nlaykimold
+            WRITE(*,*) ' which implies that a vertical regriding on upper  
      &chemistry fields will be performed.'
-          WRITE(*,*)
+            WRITE(*,*)
           
-!          CALL vert_regrid_kim(ngridmx)
+!            CALL vert_regrid_kim(ngridmx)
+
+          ENDIF
           
         ENDIF
Index: trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/start2archive.F
===================================================================
--- trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/start2archive.F	(revision 1892)
+++ trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/start2archive.F	(revision 1894)
@@ -21,5 +21,5 @@
       use infotrac, only: infotrac_init, nqtot, tname
       USE comsoil_h
-      USE comchem_h, only : nlaykim_up, preskim
+      USE comchem_h, only : cnames, nlaykim_up, preskim, ykim_up
 !      USE comgeomfi_h, ONLY: lati, long, area
 !      use control_mod
@@ -83,6 +83,4 @@
 c     Added by JVO for Titan specifities
       REAL tankCH4(ngridmx) ! Depth of surface methane tank
-      
-      REAL,ALLOCATABLE :: ykim_up(:,:,:)  ! Upper chemistry fields
 
 c Variable naturelle / grille scalaire
@@ -221,7 +219,7 @@
       
       ! Allocate other arrays of nlaykim_up size, only if they're present
-      ! The test is on HCN but could be on any as we assume we can't do incomplete chemistry
-
-      ierr = NF_INQ_VARID(nid1,'HCN_up',varid)
+      ! The test is on H but could be on any as we assume we can't do incomplete chemistry
+
+      ierr = NF_INQ_VARID(nid1,'H_up',varid)
       IF (ierr .NE. NF_NOERR) THEN
         PRINT*, "start2archive: Missing field(s) for upper chemistry ...
@@ -268,5 +266,4 @@
 
 
-
 ! load 'controle' array from physics start file
 
@@ -292,21 +289,4 @@
        ENDIF
 
-! load upper chemistry pressure grid from physics start file
-
-      ierr = NF_INQ_VARID (nid1, "preskim", varid)
-      IF (ierr .NE. NF_NOERR) THEN
-       PRINT*, "start2archive: Le champ <preskim> est absent"
-       CALL abort
-      ENDIF
-#ifdef NC_DOUBLE
-       ierr = NF_GET_VAR_DOUBLE(nid1, varid, preskim)
-#else
-      ierr = NF_GET_VAR_REAL(nid1, varid, preskim)
-#endif
-       IF (ierr .NE. NF_NOERR) THEN
-          PRINT*, "start2archive: Lecture echoue pour <preskim>"
-          CALL abort
-       ENDIF
-
       ierr = NF_CLOSE(nid1)
 
@@ -374,5 +354,5 @@
 c qsurf --> qsurfS
 c tankCH4 --> tankCH4S
-c + all 44 chemistry fields
+c ykim_up --> ykim_upS ( 44 upper chemistry fields )
 c
 c-----------------------------------------------------------------------
@@ -388,7 +368,7 @@
 
       IF (kim) THEN ! NB : fields are in comchem_startarch_h
-         DO i=1,44
-           call gr_fi_dyn(nlaykim_up,ngridmx,iip1,jjp1,ykim_up(i,:,:),
-     &                                                 ykim_upS(i,:,:))
+         DO iq=1,44
+           call gr_fi_dyn(nlaykim_up,ngridmx,iip1,jjp1,ykim_up(iq,:,:),
+     &                                                 ykim_upS(iq,:,:))
          ENDDO
       ENDIF
@@ -539,97 +519,14 @@
 c-----------------------------------------------------------------
 c Ecriture des champs upper_chemistry
-c NB : We assume a given order of the 44 chemistry tracers !!
-c ( H=1, H2=2 ..., C4N2=44)
+c NB : We assume a given order of the 44 chemistry tracers !
+c ( H=1, H2=2 ..., C4N2=44) -> hardcoded in comchem_h.
 c-----------------------------------------------------------------
 
       IF (kim) THEN
-         call write_archive(nid,ntime,'H_up',
-     .         'H in upper atmosphere','kg/kg',4,ykim_upS(1,:,:))
-         call write_archive(nid,ntime,'H2_up',
-     .         'H2 in upper atmosphere','kg/kg',4,ykim_upS(2,:,:))
-         call write_archive(nid,ntime,'CH_up',
-     .         'CH in upper atmosphere','kg/kg',4,ykim_upS(3,:,:))
-         call write_archive(nid,ntime,'CH2s_up',
-     .         'CH2s in upper atmosphere','kg/kg',4,ykim_upS(4,:,:))
-         call write_archive(nid,ntime,'CH2_up',
-     .         'CH2 in upper atmosphere','kg/kg',4,ykim_upS(5,:,:))
-         call write_archive(nid,ntime,'CH3_up',
-     .         'CH3 in upper atmosphere','kg/kg',4,ykim_upS(6,:,:))
-         call write_archive(nid,ntime,'CH4_up',
-     .         'CH4 in upper atmosphere','kg/kg',4,ykim_upS(7,:,:))
-         call write_archive(nid,ntime,'C2_up',
-     .         'C2 in upper atmosphere','kg/kg',4,ykim_upS(8,:,:))
-         call write_archive(nid,ntime,'C2H_up',
-     .         'C2H in upper atmosphere','kg/kg',4,ykim_upS(9,:,:))
-         call write_archive(nid,ntime,'C2H2_up',
-     .         'C2H2 in upper atmosphere','kg/kg',4,ykim_upS(10,:,:))
-         call write_archive(nid,ntime,'C2H3_up',
-     .         'C2H3 in upper atmosphere','kg/kg',4,ykim_upS(11,:,:))
-         call write_archive(nid,ntime,'C2H4_up',
-     .         'C2H4 in upper atmosphere','kg/kg',4,ykim_upS(12,:,:))
-         call write_archive(nid,ntime,'C2H5_up',
-     .         'C2H5 in upper atmosphere','kg/kg',4,ykim_upS(13,:,:))
-         call write_archive(nid,ntime,'C2H6_up',
-     .         'C2H6 in upper atmosphere','kg/kg',4,ykim_upS(14,:,:))
-         call write_archive(nid,ntime,'C3H3_up',
-     .         'C3H3 in upper atmosphere','kg/kg',4,ykim_upS(15,:,:))
-         call write_archive(nid,ntime,'C3H5_up',
-     .         'C3H5 in upper atmosphere','kg/kg',4,ykim_upS(16,:,:))
-         call write_archive(nid,ntime,'C3H6_up',
-     .         'C3H6 in upper atmosphere','kg/kg',4,ykim_upS(17,:,:))
-         call write_archive(nid,ntime,'C3H7_up',
-     .         'C3H7 in upper atmosphere','kg/kg',4,ykim_upS(18,:,:))
-         call write_archive(nid,ntime,'C4H_up',
-     .         'C4H in upper atmosphere','kg/kg',4,ykim_upS(19,:,:))
-         call write_archive(nid,ntime,'C4H3_up',
-     .         'C4H3 in upper atmosphere','kg/kg',4,ykim_upS(20,:,:))
-         call write_archive(nid,ntime,'C4H4_up',
-     .         'C4H4 in upper atmosphere','kg/kg',4,ykim_upS(21,:,:))
-         call write_archive(nid,ntime,'C4H2s_up',
-     .         'C4H2s in upper atmosphere','kg/kg',4,ykim_upS(22,:,:))
-         call write_archive(nid,ntime,'CH2CCH2_up',
-     .         'CH2CCH2 in upper atmosphere','kg/kg',4,ykim_upS(23,:,:))
-         call write_archive(nid,ntime,'CH3CCH_up',
-     .         'CH3CCH in upper atmosphere','kg/kg',4,ykim_upS(24,:,:))
-         call write_archive(nid,ntime,'C3H8_up',
-     .         'C3H8 in upper atmosphere','kg/kg',4,ykim_upS(25,:,:))
-         call write_archive(nid,ntime,'C4H2_up',
-     .         'C4H2 in upper atmosphere','kg/kg',4,ykim_upS(26,:,:))
-         call write_archive(nid,ntime,'C4H6_up',
-     .         'C4H6 in upper atmosphere','kg/kg',4,ykim_upS(27,:,:))
-         call write_archive(nid,ntime,'C4H10_up',
-     .         'C4H10 in upper atmosphere','kg/kg',4,ykim_upS(28,:,:))
-         call write_archive(nid,ntime,'AC6H6_up',
-     .         'AC6H6 in upper atmosphere','kg/kg',4,ykim_upS(29,:,:))
-         call write_archive(nid,ntime,'C3H2_up',
-     .         'C3H2 in upper atmosphere','kg/kg',4,ykim_upS(30,:,:))
-         call write_archive(nid,ntime,'C4H5_up',
-     .         'C4H5 in upper atmosphere','kg/kg',4,ykim_upS(31,:,:))
-         call write_archive(nid,ntime,'AC6H5_up',
-     .         'AC6H5 in upper atmosphere','kg/kg',4,ykim_upS(32,:,:))
-         call write_archive(nid,ntime,'N2_up',
-     .         'N2 in upper atmosphere','kg/kg',4,ykim_upS(33,:,:))
-         call write_archive(nid,ntime,'N4S_up',
-     .         'N4S in upper atmosphere','kg/kg',4,ykim_upS(34,:,:))
-         call write_archive(nid,ntime,'CN_up',
-     .         'CN in upper atmosphere','kg/kg',4,ykim_upS(35,:,:))
-         call write_archive(nid,ntime,'HCN_up',
-     .         'HCN in upper atmosphere','kg/kg',4,ykim_upS(36,:,:))
-         call write_archive(nid,ntime,'H2CN_up',
-     .         'H2CN in upper atmosphere','kg/kg',4,ykim_upS(37,:,:))
-         call write_archive(nid,ntime,'CHCN_up',
-     .         'CHCN in upper atmosphere','kg/kg',4,ykim_upS(38,:,:))
-         call write_archive(nid,ntime,'CH2CN_up',
-     .         'CH2CN in upper atmosphere','kg/kg',4,ykim_upS(39,:,:))
-         call write_archive(nid,ntime,'CH3CN_up',
-     .         'CH3CN in upper atmosphere','kg/kg',4,ykim_upS(40,:,:))
-         call write_archive(nid,ntime,'C3N_up',
-     .         'C3N in upper atmosphere','kg/kg',4,ykim_upS(41,:,:))
-         call write_archive(nid,ntime,'HC3N_up',
-     .         'HC3N in upper atmosphere','kg/kg',4,ykim_upS(42,:,:))
-         call write_archive(nid,ntime,'NCCN_up',
-     .         'NCCN in upper atmosphere','kg/kg',4,ykim_upS(43,:,:))
-         call write_archive(nid,ntime,'C4N2_up',
-     .         'C4N2 in upper atmosphere','kg/kg',4,ykim_upS(44,:,:))
+        DO iq=1,44
+          call write_archive(nid,ntime,trim(cnames(iq))//'_up',
+     .                trim(cnames(iq))//' in upper atmosphere',
+     .                'kg/kg',4,ykim_upS(iq,:,:))
+        ENDDO
       ENDIF
 
