Index: trunk/NEMO/OPA_SRC/DOM/domwri.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DOM/domwri.F90	(revision 392)
+++ trunk/NEMO/OPA_SRC/DOM/domwri.F90	(revision 454)
@@ -98,18 +98,18 @@
        IF(lwp) WRITE(numout,*) '~~~~~~~'
 
-         clnam0 = 'mesh_mask'  ! filename (mesh and mask informations)
-         clnam1 = 'mesh'       ! filename (mesh informations)
-         clnam2 = 'mask'       ! filename (mask informations)
-         clnam3 = 'mesh_hgr'   ! filename (horizontal mesh informations)
-         clnam4 = 'mesh_zgr'   ! filename (vertical   mesh informations)
+       clnam0 = 'mesh_mask'  ! filename (mesh and mask informations)
+       clnam1 = 'mesh'       ! filename (mesh informations)
+       clnam2 = 'mask'       ! filename (mask informations)
+       clnam3 = 'mesh_hgr'   ! filename (horizontal mesh informations)
+       clnam4 = 'mesh_zgr'   ! filename (vertical   mesh informations)
 
 #if defined key_agrif
-      if ( .NOT. Agrif_Root() ) then
-        clnam0 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam0)
-        clnam1 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam1)
-        clnam2 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam2)
-        clnam3 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam3)
-        clnam4 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam4)
-      endif
+      IF ( .NOT. Agrif_Root() ) THEN
+         clnam0 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam0)
+         clnam1 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam1)
+         clnam2 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam2)
+         clnam3 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam3)
+         clnam4 = TRIM(Agrif_CFixed())//'_'//TRIM(clnam4)
+      ENDIF
 #endif
 
@@ -130,5 +130,5 @@
             IF(lwp) WRITE(numout,*) '          one file in "mesh_mask.nc" '
             CALL restini( 'NONE', jpi   , jpj   , glamt, gphit,  &   ! create 'mesh_mask.nc' file
-            &             jpk   , gdept , trim(clnam0)        ,  &   ! in unit inum0
+            &             jpk   , gdept_0 , trim(clnam0)        ,  &   ! in unit inum0
             &             itime , zdate0, rdt   , inum0 , domain_id=nidom )
             inum2 = inum0                                            ! put all the informations
@@ -143,8 +143,8 @@
             IF(lwp) WRITE(numout,*) '          two files in "mesh.nc" and "mask.nc" '
             CALL restini( 'NONE', jpi   , jpj   , glamt, gphit,  &   ! create 'mesh.nc' file 
-            &             jpk   , gdept , trim(clnam1)        ,  &   ! in unit inum1 
+            &             jpk   , gdept_0 , trim(clnam1)        ,  &   ! in unit inum1 
             &             itime , zdate0, rdt   , inum1, domain_id=nidom )
             CALL restini( 'NONE', jpi   , jpj   , glamt, gphit,  &   ! create 'mask.nc' file 
-            &             jpk   , gdept , trim(clnam2)        ,  &   ! in unit inum2 
+            &             jpk   , gdept_0 , trim(clnam2)        ,  &   ! in unit inum2 
             &             itime , zdate0, rdt   , inum2, domain_id=nidom )
             inum3 = inum1                                            ! put mesh informations 
@@ -159,11 +159,11 @@
             IF(lwp) WRITE(numout,*) '          three files in "mesh_hgr.nc" , mesh_zgr.nc" and "mask.nc" '
             CALL restini( 'NONE', jpi   , jpj   , glamt, gphit,  &   ! create 'mesh_hgr.nc' file
-            &             jpk   , gdept , trim(clnam3)        ,  &   ! in unit inum3
+            &             jpk   , gdept_0 , trim(clnam3)        ,  &   ! in unit inum3
             &             itime , zdate0, rdt   , inum3, domain_id=nidom )
             CALL restini( 'NONE', jpi   , jpj   , glamt, gphit,  &   ! create 'mesh_zgr.nc' file
-            &             jpk   , gdept , trim(clnam4)        ,  &   ! in unit inum4
+            &             jpk   , gdept_0 , trim(clnam4)        ,  &   ! in unit inum4
             &             itime , zdate0, rdt   , inum4, domain_id=nidom )
             CALL restini( 'NONE', jpi   , jpj   , glamt, gphit,  &   ! create 'mask.nc' file
-            &             jpk   , gdept , trim(clnam2)        ,  &   ! in unit inum2
+            &             jpk   , gdept_0 , trim(clnam2)        ,  &   ! in unit inum2
             &             itime , zdate0, rdt   , inum2, domain_id=nidom )
 
@@ -201,39 +201,50 @@
          CALL restput( inum4, 'mbathy', jpi, jpj, 1, 0, zprt )
 
-# if defined key_s_coord
-         !                                                         ! s-coordinate
-         CALL restput( inum4, 'hbatt', jpi, jpj, 1, 0, hbatt )      !    ! depth
-         CALL restput( inum4, 'hbatu', jpi, jpj, 1, 0, hbatu ) 
-         CALL restput( inum4, 'hbatv', jpi, jpj, 1, 0, hbatv )
-         CALL restput( inum4, 'hbatf', jpi, jpj, 1, 0, hbatf )
-
-         CALL restput( inum4, 'gsigt', 1, 1, jpk, 0, gsigt )        !    ! scaling coef.
-         CALL restput( inum4, 'gsigw', 1, 1, jpk, 0, gsigw )  
-         CALL restput( inum4, 'gsi3w', 1, 1, jpk, 0, gsi3w )
-         CALL restput( inum4, 'esigt', 1, 1, jpk, 0, esigt )
-         CALL restput( inum4, 'esigw', 1, 1, jpk, 0, esigw )
-
-# elif defined key_partial_steps
-         !                                                          ! z-coordinate with partial steps
-         CALL restput( inum4, 'hdept' , jpi, jpj, 1, 0, hdept  )    !    ! depth
-         CALL restput( inum4, 'hdepw' , jpi, jpj, 1, 0, hdepw  ) 
-
-         CALL restput( inum4, 'e3t_ps', jpi, jpj, jpk, 0, e3t_ps )  !    ! scale factors
-         CALL restput( inum4, 'e3u_ps', jpi, jpj, jpk, 0, e3u_ps )
-         CALL restput( inum4, 'e3v_ps', jpi, jpj, jpk, 0, e3v_ps )
-         CALL restput( inum4, 'e3w_ps', jpi, jpj, jpk, 0, e3w_ps )
-
-         CALL restput( inum4, 'gdept' , 1, 1, jpk, 0, gdept )       !    ! reference z-coord.
-         CALL restput( inum4, 'gdepw' , 1, 1, jpk, 0, gdepw )
-         CALL restput( inum4, 'e3t'   , 1, 1, jpk, 0, e3t   )
-         CALL restput( inum4, 'e3w'   , 1, 1, jpk, 0, e3w   )
-
-# else
-         !                                                          ! z-coordinate 
-         CALL restput( inum4, 'gdept', 1, 1, jpk, 0, gdept )        !    ! depth
-         CALL restput( inum4, 'gdepw', 1, 1, jpk, 0, gdepw )
-         CALL restput( inum4, 'e3t'  , 1, 1, jpk, 0, e3t   )        !    ! scale factors
-         CALL restput( inum4, 'e3w'  , 1, 1, jpk, 0, e3w   )
-# endif
+#if ! defined key_zco
+         IF( ln_sco ) THEN                                         ! s-coordinate
+            CALL restput( inum4, 'hbatt', jpi, jpj, 1, 0, hbatt )      !    ! depth
+            CALL restput( inum4, 'hbatu', jpi, jpj, 1, 0, hbatu ) 
+            CALL restput( inum4, 'hbatv', jpi, jpj, 1, 0, hbatv )
+            CALL restput( inum4, 'hbatf', jpi, jpj, 1, 0, hbatf )
+   
+            CALL restput( inum4, 'gsigt', 1, 1, jpk, 0, gsigt )        !    ! scaling coef.
+            CALL restput( inum4, 'gsigw', 1, 1, jpk, 0, gsigw )  
+            CALL restput( inum4, 'gsi3w', 1, 1, jpk, 0, gsi3w )
+            CALL restput( inum4, 'esigt', 1, 1, jpk, 0, esigt )
+            CALL restput( inum4, 'esigw', 1, 1, jpk, 0, esigw )
+
+            CALL restput( inum4, 'e3t', jpi, jpj, jpk, 0, e3t )       !    ! scale factors
+            CALL restput( inum4, 'e3u', jpi, jpj, jpk, 0, e3u )
+            CALL restput( inum4, 'e3v', jpi, jpj, jpk, 0, e3v )
+            CALL restput( inum4, 'e3w', jpi, jpj, jpk, 0, e3w )
+
+            CALL restput( inum4, 'gdept_0' , jpi, jpj, jpk, 0, gdept_0 )  !    ! stretched system
+            CALL restput( inum4, 'gdepw_0' , jpi, jpj, jpk, 0, gdepw_0 )
+         ENDIF
+
+         IF( ln_zps ) THEN                                         ! z-coordinate - partial steps
+            CALL restput( inum4, 'hdept' , jpi, jpj, 1, 0, hdept  )    !    ! depth
+            CALL restput( inum4, 'hdepw' , jpi, jpj, 1, 0, hdepw  ) 
+
+            CALL restput( inum4, 'e3t' , jpi, jpj, jpk, 0, e3t )      !    ! scale factors
+            CALL restput( inum4, 'e3u' , jpi, jpj, jpk, 0, e3u )
+            CALL restput( inum4, 'e3v' , jpi, jpj, jpk, 0, e3v )
+            CALL restput( inum4, 'e3w' , jpi, jpj, jpk, 0, e3w )
+
+            CALL restput( inum4, 'gdept_0', 1, 1, jpk, 0, gdept_0 )   !    ! reference z-coord.
+            CALL restput( inum4, 'gdepw_0', 1, 1, jpk, 0, gdepw_0 )
+            CALL restput( inum4, 'e3t_0'  , 1, 1, jpk, 0, e3t_0   )
+            CALL restput( inum4, 'e3w_0'  , 1, 1, jpk, 0, e3w_0   )
+         ENDIF
+
+#endif
+
+         IF( ln_zco ) THEN
+         !                                                         ! z-coordinate - full steps
+            CALL restput( inum4, 'gdept_0', 1, 1, jpk, 0, gdept_0 )   !    ! depth
+            CALL restput( inum4, 'gdepw_0', 1, 1, jpk, 0, gdepw_0 )
+            CALL restput( inum4, 'e3t_0'  , 1, 1, jpk, 0, e3t_0   )   !    ! scale factors
+            CALL restput( inum4, 'e3w_0'  , 1, 1, jpk, 0, e3w_0   )
+         ENDIF
 
          !                                     ! ============================
