Index: trunk/NEMO/TOP_SRC/TRP/trcstp.F90
===================================================================
--- trunk/NEMO/TOP_SRC/TRP/trcstp.F90	(revision 615)
+++ trunk/NEMO/TOP_SRC/TRP/trcstp.F90	(revision 616)
@@ -52,10 +52,11 @@
       IF( MOD( kt , ndttrc ) /= 0 ) RETURN
 
-      ! tracers: sink and source 
+      CALL trc_rst_opn( kt )      ! Open tracer restart file 
+
+       ! tracers: sink and source 
       IF(ln_ctl) THEN
          WRITE(charout,FMT="('kt =', I4,'  d/m/y =',I2,I2,I4)") kt, nday, nmonth, nyear
          CALL prt_ctl_trc_info(charout)
       ENDIF
-
 
       CALL trc_sms( kt )
@@ -76,5 +77,5 @@
       ENDIF
 
-      CALL trc_wri( kt )            ! outputs
+      IF( lrst_trc ) CALL trc_rst_wri( kt )  ! write tracer restart file
 
       CALL trc_dia( kt, kindic )     ! diagnostics
Index: trunk/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- trunk/NEMO/TOP_SRC/trcrst.F90	(revision 615)
+++ trunk/NEMO/TOP_SRC/trcrst.F90	(revision 616)
@@ -20,4 +20,5 @@
    USE trctrp_lec   
    USE lib_mpp
+   USE iom
    
    IMPLICIT NONE
@@ -25,10 +26,12 @@
    
    !! * Accessibility
-   PUBLIC trc_rst
-   PUBLIC trc_wri
+   PUBLIC trc_rst_opn
+   PUBLIC trc_rst_read
+   PUBLIC trc_rst_wri
    
    !! * Module variables
-   CHARACTER (len=48) ::   &
-      trestart = 'initial.trc.nc'   ! restart file name
+   LOGICAL, PUBLIC ::   lrst_trc         !: logical to control the trc restart write 
+   INTEGER, PUBLIC ::   numrtr, numrtw   !: logical unit for trc restart (read and write)
+
 
    !! * Substitutions
@@ -36,18 +39,49 @@
    
 CONTAINS
-
-#if defined key_fdir
-   !!----------------------------------------------------------------------
-   !!   'key_fdir'                                       direct access file
-   !!----------------------------------------------------------------------
-#include "trcrst_fdir.h90"
-   
-#else 
-
-   SUBROUTINE trc_rst 
+   
+   SUBROUTINE trc_rst_opn( kt )
+      !!----------------------------------------------------------------------
+      !!                    ***  trc_rst_opn  ***
+      !!
+      !! ** purpose  :   output of sea-trc variable in a netcdf file
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt       ! number of iteration
+      !
+      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step define as a character
+      CHARACTER(LEN=50)   ::   clname   ! trc output restart file name
+      !!----------------------------------------------------------------------
+      !
+
+      IF( kt == nit000 )  THEN
+         lrst_trc = .FALSE.
+#if defined key_off_tra
+         nitrst = nitend  ! in online version, already done in rst_opn routine defined in restart.F90 module
+#endif
+      ENDIF
+      
+      IF( kt == nitrst - ndttrc .OR. nitend - nit000 + 1 < 2 * ndttrc ) THEN
+         ! beware if model runs less than 2*ndttrc time step
+         ! beware of the format used to write kt (default is i8.8, that should be large enough)
+         IF( nitrst > 1.0e9 ) THEN   
+            WRITE(clkt,*) nitrst
+         ELSE
+            WRITE(clkt,'(i8.8)') nitrst
+         ENDIF
+         ! create the file
+         IF(lwp) WRITE(numout,*)
+         clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_restart_trc"
+         IF(lwp) WRITE(numout,*) '             open trc restart.output NetCDF file: '//clname
+         CALL iom_open( clname, numrtw, ldwrt = .TRUE., kiolib = jprstlib )
+         lrst_trc = .TRUE.
+      ENDIF
+      !
+   END SUBROUTINE trc_rst_opn
+
+
+   SUBROUTINE trc_rst_read 
       !!===========================================================================================
       !!
-      !!                       ROUTINE trc_rst
-      !!                     *******************
+      !!                       ROUTINE trc_rst_read
+      !!                       *******************
       !!
       !!  PURPOSE :
@@ -70,23 +104,12 @@
       !!  05-03 (O. Aumont and A. El Moussaoui) F90           
       !!------------------------------------------------------------------------
-      !! * Modules used
-      USE iom
-
-
-      !! local declarations
-      !! ==================
-
-      INTEGER :: &
-         ji, jj, jk, jn  
-      INTEGER  ::   &
-         inum, iarak0                 ! temporary logical unit
-      REAL(wp), DIMENSION(1, 1, 3)  ::   zinfo
-
-      CHARACTER (len=32) :: clname1,clname2,clname
-      REAL(wp) :: caralk,bicarb
+      INTEGER ::  ji, jj, jk, jn  
+      INTEGER ::  iarak0    
+      REAL(wp) :: zkt, zarak0
+      REAL(wp) :: caralk, bicarb, co3
 
 #if defined key_trc_pisces 
 #   if ! defined key_cfg_1d && ( defined key_orca_r4 || defined key_orca_r2 || defined key_orca_r05 || defined key_orca_r025 )
-      REAL(wp) ::   zareatot, ztrasum
+      REAL(wp) ::  ztrasum
 #   endif
 #endif
@@ -110,5 +133,4 @@
       IF(lwp) WRITE(numout,*) ' passive tracer'
       IF(lwp) WRITE(numout,*) ' the present run :'
-      IF(lwp) WRITE(numout,*) '   number job is  : ',no
       IF(lwp) WRITE(numout,*) '   with the time nit000 : ',nit000
       IF(lwp) THEN
@@ -137,15 +159,13 @@
       END SELECT
 
-
-
-      CALL iom_open ( 'restart.trc', inum )
-
-      CALL iom_get ( inum, jpdom_unknown, 'info', zinfo )
+      CALL iom_open ( 'restart.trc', numrtr, kiolib = jprstlib )
+
+      CALL iom_get( numrtr, 'kt'   , zkt    )
+      CALL iom_get( numrtr, 'arak0', zarak0 )
 
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' Info on the restart file read : '
-      IF(lwp) WRITE(numout,*) '   job number          : ', NINT( zinfo(1, 1, 1) )
-      IF(lwp) WRITE(numout,*) '   time-step           : ', NINT( zinfo(1, 1, 2) )
-      IF(lwp) WRITE(numout,*) '   arakawa option      : ', NINT( zinfo(1, 1, 3) )
+      IF(lwp) WRITE(numout,*) '   time-step           : ', NINT( zkt    )
+      IF(lwp) WRITE(numout,*) '   arakawa option      : ', NINT( zarak0 )
       IF(lwp) WRITE(numout,*)
 
@@ -154,5 +174,5 @@
       !! -------------------
 
-      IF( nittrc000 - NINT( zinfo( 1, 1, 2 ) ) /= 1 .AND. nrsttr /= 0 )  &
+      IF( nittrc000 - NINT( zkt ) /= 1 .AND. nrsttr /= 0 )  &
            & CALL ctl_stop( ' ===>>>> : problem with nit000 for the restart', &
            & ' verify the restart file or rerun with nrstdt = 0 (namelist)' )
@@ -161,5 +181,5 @@
       !! ------------------------
 
-      IF( iarak0 /= NINT( zinfo(1, 1, 3 ) ) ) &
+      IF( iarak0 /= NINT( zarak0 ) ) &
            & CALL ctl_stop( ' ===>>>> : problem with advection scheme', &
            & ' it must be the same type for both restart and previous run', &
@@ -171,62 +191,36 @@
 
       DO jn = 1, jptra
-         clname = 'TRN'//ctrcnm(jn)
-         CALL iom_get( inum, jpdom_local, clname, trn(:,:,:,jn)   ) 
+         CALL iom_get( numrtr, jpdom_local, 'TRN'//ctrcnm(jn), trn(:,:,:,jn)   ) 
       END DO
 
       DO jn = 1, jptra
-         clname = 'TRB'//ctrcnm(jn)
-         CALL iom_get( inum, jpdom_local, clname, trb(:,:,:,jn)   ) 
+         CALL iom_get( numrtr, jpdom_local, 'TRB'//ctrcnm(jn), trb(:,:,:,jn)   ) 
       END DO
 
 #if defined key_trc_lobster1
-      clname  = 'SEDB'//ctrcnm(jpdet)
-      clname1 = 'SEDN'//ctrcnm(jpdet)
-      CALL iom_get( inum, jpdom_local, clname , sedpocb(:,:) ) 
-      CALL iom_get( inum, jpdom_local, clname1, sedpocn(:,:) ) 
+      CALL iom_get( numrtr, jpdom_local, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) ) 
+      CALL iom_get( numrtr, jpdom_local, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) ) 
 
 #elif defined key_trc_pisces
-      clname = 'Silicalim'
-      CALL iom_get( inum, jpdom_local, clname, xksi(:,:) ) 
+      CALL iom_get( numrtr, jpdom_local, 'Silicalim', xksi(:,:) ) 
       xksimax = xksi
 
-      clname  = 'SED'//ctrcnm(jppoc)
-      clname1 = 'SED'//ctrcnm(jpcal)
-      clname2 = 'SED'//ctrcnm(jpsil)
-
-      CALL iom_get( inum, jpdom_local, clname , sedpoc(:,:) ) 
-      CALL iom_get( inum, jpdom_local, clname1, sedcal(:,:) ) 
-      CALL iom_get( inum, jpdom_local, clname2, sedsil(:,:) ) 
+      CALL iom_get( numrtr, jpdom_local, 'SED'//ctrcnm(jppoc), sedpoc(:,:) ) 
+      CALL iom_get( numrtr, jpdom_local, 'SED'//ctrcnm(jpcal), sedcal(:,:) ) 
+      CALL iom_get( numrtr, jpdom_local, 'SED'//ctrcnm(jpsil), sedsil(:,:) ) 
 
 #elif defined key_cfc
-      clname  = 'qint'
-      clname1 = 'qtr'
       DO jn = 1, jptra
-         CALL iom_get( inum, jpdom_unknown, clname,  qint(:,:,jn), jn )
-         CALL iom_get( inum, jpdom_unknown, clname1, qtr (:,:,jn), jn )
-      ENDDO
-#endif
+         CALL iom_get( numrtr, jpdom_local, 'qint'//ctrcnm(jn),qint(:,:,jn)) 
+      END DO
+      DO jn = 1, jptra
+         CALL iom_get( numrtr, jpdom_local, 'qtr'//ctrcnm(jn) ,qtr( :,:,jn)) 
+      END DO
+#endif
+
 
 #if defined key_trc_pisces 
 
 #if ! defined key_cfg_1d && ( defined key_orca_r4 || defined key_orca_r2 || defined key_orca_r05 || defined key_orca_r025 ) 
-
-      zareatot = 0.
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zareatot = zareatot + tmask(ji,jj,jk) * tmask_i(ji,jj)  &
-#if defined key_off_degrad
-                  &                * facvol(ji,jj,jk)    &
-#endif
-
-                  &                * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) 
-            END DO
-         END DO
-      END DO
-
-      IF( lk_mpp ) THEN 
-         CALL mpp_sum( zareatot )     ! sum over the global domain  
-      END IF
 
       ztrasum = 0.
@@ -234,5 +228,5 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               ztrasum = ztrasum + trn(ji,jj,jk,jptal) * tmask(ji,jj,jk) * tmask_i(ji,jj)    &
+               ztrasum = ztrasum + trn(ji,jj,jk,jptal) * tmask(ji,jj,jk) * tmask_i(ji,jj)  &
 #if defined key_off_degrad
                   &              * facvol(ji,jj,jk)   &
@@ -248,6 +242,6 @@
       END IF
 
-      WRITE(0,*) 'TALK moyen ', ztrasum/zareatot*1E6
-      ztrasum = ztrasum/zareatot*1E6
+      WRITE(0,*) 'TALK moyen ', ztrasum/areatot*1E6
+      ztrasum = ztrasum/areatot*1E6
       trn(:,:,:,jptal) = trn(:,:,:,jptal)*2391./ztrasum
 
@@ -271,6 +265,6 @@
 
 
-      WRITE(0,*) 'PO4 moyen ', ztrasum/zareatot*1E6/122.
-      ztrasum = ztrasum/zareatot*1E6/122.
+      WRITE(0,*) 'PO4 moyen ', ztrasum/areatot*1E6/122.
+      ztrasum = ztrasum/areatot*1E6/122.
       trn(:,:,:,jppo4) = trn(:,:,:,jppo4)*2.165/ztrasum
 
@@ -294,6 +288,6 @@
 
 
-      WRITE(0,*) 'NO3 moyen ', ztrasum/zareatot*1E6/7.6
-      ztrasum = ztrasum/zareatot*1E6/7.6
+      WRITE(0,*) 'NO3 moyen ', ztrasum/areatot*1E6/7.6
+      ztrasum = ztrasum/areatot*1E6/7.6
       trn(:,:,:,jpno3) = trn(:,:,:,jpno3)*30.9/ztrasum
 
@@ -316,9 +310,17 @@
       END IF
 
-      WRITE(0,*) 'SiO3 moyen ', ztrasum/zareatot*1E6
-      ztrasum = ztrasum/zareatot*1E6
+      WRITE(0,*) 'SiO3 moyen ', ztrasum/areatot*1E6
+      ztrasum = ztrasum/areatot*1E6
       trn(:,:,:,jpsil) = MIN( 400E-6,trn(:,:,:,jpsil)*91.51/ztrasum) 
 
 #endif
+
+!#if defined key_trc_kriest
+!      !! Initialize number of particles from a standart restart file
+!      !! The name of big organic particles jpgoc has been only change
+!      !! and replace by jpnum but the values here are concentration
+!      trn(:,:,:,jppoc) = trn(:,:,:,jppoc) + trn(:,:,:,jpnum)
+!      trn(:,:,:,jpnum) = trn(:,:,:,jppoc) / ( 6. * xkr_massp )
+!#endif
       !!  Initialization of chemical variables of the carbon cycle
       !!  --------------------------------------------------------
@@ -328,10 +330,9 @@
                caralk = trn(ji,jj,jk,jptal)-       &
                   &        borat(ji,jj,jk)/(1.+1.E-8/(rtrn+akb3(ji,jj,jk)))
-               co3(ji,jj,jk)=(caralk-trn(ji,jj,jk,jpdic))*tmask(ji,jj,jk)   &
+               co3 = (caralk-trn(ji,jj,jk,jpdic))*tmask(ji,jj,jk)   &
                   &        +(1.-tmask(ji,jj,jk))*.5e-3
                bicarb = (2.*trn(ji,jj,jk,jpdic)-caralk)
-               hi(ji,jj,jk) = (ak23(ji,jj,jk)*bicarb/co3(ji,jj,jk))     &
+               hi(ji,jj,jk) = (ak23(ji,jj,jk)*bicarb/co3)     &
                   &  *tmask(ji,jj,jk)+(1.-tmask(ji,jj,jk))*1.e-9
-               h2co3(ji,jj) = 1.e-5
             ENDDO
          ENDDO
@@ -340,14 +341,14 @@
       trb(:,:,:,:) = trn(:,:,:,:)
 
-      CALL iom_close( inum )
-
-
-   END SUBROUTINE trc_rst
-
-   SUBROUTINE trc_wri(kt)
+      CALL iom_close( numrtr )
+
+
+   END SUBROUTINE trc_rst_read
+
+   SUBROUTINE trc_rst_wri(kt)
       !! ==================================================================================
       !!
-      !!                       ROUTINE trc_wri
-      !!                     ******************
+      !!                       ROUTINE trc_rst_wri
+      !!                       ******************
       !!
       !!  PURPOSE :
@@ -377,5 +378,5 @@
       !!   WORKSPACE :
       !!   ---------
-      !!      ji,jj,jk,jl,ino0,it0,iarak0
+      !!      ji,jj,jk,jn
       !!
       !!   History:
@@ -392,6 +393,4 @@
       !!   05-03 (O. Aumont and A. El Moussaoui) F90
       !!========================================================================================!
-      !! * Modules used
-      USE ioipsl
 
       !! * Arguments
@@ -402,58 +401,11 @@
       !! ====================
 
-      LOGICAL :: clbon         !!!
-      CHARACTER (len=50) :: clname,clname1,clname2,cln
-
-      INTEGER :: jn,   &
-         ino0,it0,iarak0,     &
-         ic,jc,ji,jj,jk,      &
-         itime
-
-      REAL(wp) :: zdate0, zinfo(3),zdiag_var,    &
-         zdiag_varmin, zdiag_varmax, zdiag_tot, zder
+      INTEGER  :: ji,jj,jk,jn
+      REAL(wp) :: zdiag_var, zdiag_varmin, zdiag_varmax, zdiag_tot
+      REAL(wp) :: zder
 
 
       !! 1. OUTPUT of restart fields (nutwrs)
       !! ---------------------------
-
-      IF( kt == nittrc000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'trc_wri : write passive tracers restart.output NetCDF file'
-         IF(lwp) WRITE(numout,*) '~~~~~~~'
-       
-
-         areatot = 0.
-         DO jk = 1, jpk
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  areatot = areatot + tmask(ji,jj,jk)*tmask_i(ji,jj)*e1t(ji,jj)*e2t(ji,jj)*fse3t(ji,jj,jk) 
-               END DO
-            END DO
-         END DO
-
-         IF( lk_mpp ) THEN 
-             CALL mpp_sum(areatot)     ! sum over the global domain  
-         END IF
-
-         trai = 0.
-         DO jn = 1, jptra
-            DO jk = 1,jpk
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     trai=trai+tmask(ji,jj,jk)*trn(ji,jj,jk,jn)*     &
-                        &    tmask_i(ji,jj)* e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) 
-                  END DO
-               END DO
-            END DO
-         END DO
-
-         IF( lk_mpp ) THEN 
-             CALL mpp_sum(trai)         ! sum over the global domain  
-         END IF
-
-         IF (lwp) WRITE(numout,*) 'Integral of all tracers over the full domain at NIT000 =',trai
-
-      ENDIF
-
 
       IF( MOD(kt,nstock) == 0 .OR. kt == nitend ) THEN
@@ -468,53 +420,47 @@
 
 
-         ino0 =no
-         it0  =kt
+         CALL iom_rstput( kt, nitrst, numrtw, 'kt'   ,  REAL( kt, wp )  )
+
          IF( ln_trcadv_cen2 .OR. ln_trcadv_tvd ) THEN
-            iarak0 = 1
+            CALL iom_rstput( kt, nitrst, numrtw, 'arak0', 1. )
          ELSE
-            iarak0=0
+            CALL iom_rstput( kt, nitrst, numrtw, 'arak0', 0. )
          ENDIF
 
-         zinfo(1)=FLOAT(ino0)
-         zinfo(2)=FLOAT(it0)
-         zinfo(3)=FLOAT(iarak0)
-
-         !! 1. WRITE in nutwrs
-         !! ------------------
-         !!... first information
-
-         INQUIRE (FILE=trestart,EXIST=clbon)
-         IF(clbon) THEN
-            OPEN(UNIT=nutwrs,FILE=trestart,STATUS='old')
-            CLOSE(nutwrs,STATUS='delete')
-         ENDIF
-
-         ic=1
-         DO jc=1,16
-            IF(cexper(jc:jc) /= ' ') ic = jc
-         END DO
-         WRITE(cln,'("_",i4.4,i2.2,i2.2,"_restart.trc")') nyear, nmonth, nday
-         clname=cexper(1:ic)//cln
-         ic=1
-         DO jc=1,48
-            IF(clname(jc:jc) /= ' ') ic=jc
-         END DO
-         trestart=clname(1:ic)//".nc"
-         itime=0
-         CALL ymds2ju(nyear,nmonth,nday,0.0,zdate0)
-         CALL restini('NONE',jpi,jpj,glamt,gphit,jpk,gdept_0,clname           &
-            &        ,itime,zdate0,rdt*nstock,nutwrs,domain_id=nidom)
-
-         CALL restput(nutwrs,'info',1,1,3,0,zinfo)
 
          ! prognostic variables
          ! --------------------
 
+         DO jn=1,jptra
+            CALL iom_rstput( kt, nitrst, numrtw, 'TRN'//ctrcnm(jn), trn(:,:,:,jn) )
+         ENDDO
+
+         DO jn=1,jptra
+            CALL iom_rstput( kt, nitrst, numrtw, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) )
+         END DO
+
+#if defined key_trc_lobster1
+         CALL iom_rstput( kt, nitrst, numrtw, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) )
+#elif defined key_trc_pisces
+         CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:) )
+
+         CALL iom_rstput( kt, nitrst, numrtw, 'SED'//ctrcnm(jppoc), sedpoc(:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'SED'//ctrcnm(jpcal), sedcal(:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'SED'//ctrcnm(jpsil), sedsil(:,:) )
+         
+#elif defined key_cfc
+         DO jn=1,jptra
+            CALL iom_rstput( kt, nitrst, numrtw, 'qint'//ctrcnm(jn), qint(:,:,jn) )
+         END DO
+         DO jn=1,jptra
+            CALL iom_rstput( kt, nitrst, numrtw, 'qtr'//ctrcnm(jn) , qtr( :,:,jn) )
+         END DO
+#endif
+
          IF (lwp) WRITE(numout,*) '----TRACER STAT----'
+
          zdiag_tot=0.
          DO jn=1,jptra
-            clname='TRN'//ctrcnm(jn)
-            CALL restput(nutwrs,clname,jpi,jpj,jpk,0,trn(:,:,:,jn))
-
             zdiag_var=0.
             zdiag_varmin=0.
@@ -524,6 +470,9 @@
                DO jj=1, jpj
                   DO jk=1,jpk
-                    zdiag_var=zdiag_var+tmask(ji,jj,jk)*trn(ji,jj,jk,jn)*     &
-                               tmask_i(ji,jj)* e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) 
+                     zdiag_var=zdiag_var+trn(ji,jj,jk,jn)*tmask(ji,jj,jk)*tmask_i(ji,jj)  &
+#if defined key_off_degrad
+                        &   * facvol(ji,jj,jk)   &
+#endif
+                        &   * e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk)
 
                   END DO
@@ -534,8 +483,8 @@
             zdiag_varmax=MAXVAL(trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)))
 
-            IF( lk_mpp ) THEN 
-               CALL mpp_min(zdiag_varmin)      ! min over the global domain  
-               CALL mpp_max(zdiag_varmax)      ! max over the global domain  
-               CALL mpp_sum(zdiag_var)         ! sum over the global domain  
+            IF( lk_mpp ) THEN
+               CALL mpp_min(zdiag_varmin)      ! min over the global domain
+               CALL mpp_max(zdiag_varmax)      ! max over the global domain
+               CALL mpp_sum(zdiag_var)         ! sum over the global domain
             END IF
 
@@ -550,42 +499,13 @@
          zdiag_tot=zdiag_tot
          zder=((zdiag_tot-trai)/trai)*100._wp
-         IF (lwp) WRITE(numout,*) 'Integral of all tracers over the full domain  =',zdiag_tot  
-         IF (lwp) WRITE(numout,*) 'Drift of the sum of all tracers =',zder, '%'  
-
-         DO jn=1,jptra
-            clname='TRB'//ctrcnm(jn)
-            CALL restput(nutwrs,clname,jpi,jpj,jpk,0,trb(:,:,:,jn))
-         END DO
-
-#if defined key_trc_lobster1
-         clname='SEDB'//ctrcnm(jpdet)
-         clname1='SEDN'//ctrcnm(jpdet)
-         CALL restput(nutwrs,clname,jpi,jpj,1,0,sedpocb(:,:))
-         CALL restput(nutwrs,clname1,jpi,jpj,1,0,sedpocn(:,:))
-#elif defined key_trc_pisces
-         clname='SED'//ctrcnm(jppoc)
-         clname1='SED'//ctrcnm(jpcal)
-         clname2='SED'//ctrcnm(jpsil)
-         CALL restput(nutwrs,clname1,jpi,jpj,1,0,sedcal(:,:))
-         CALL restput(nutwrs,clname2,jpi,jpj,1,0,sedsil(:,:))
-         CALL restput(nutwrs,clname,jpi,jpj,1,0,sedpoc(:,:))
-
-         clname='Silicalim'
-         CALL restput(nutwrs,clname,jpi,jpj,1,0,xksi(:,:))
-#elif defined key_cfc
-         clname='qint'
-         CALL restput(nutwrs,clname,jpi,jpj,jptra,0,qint(:,:,:))
-         clname1='qtr'
-         CALL restput(nutwrs,clname1,jpi,jpj,jptra,0,qtr(:,:,:))
-#endif
-
-
-         CALL restclo(nutwrs)
+         IF (lwp) WRITE(numout,*) 'Integral of all tracers over the full domain  =',zdiag_tot
+         IF (lwp) WRITE(numout,*) 'Drift of the sum of all tracers =',zder, '%'
+
+         CALL iom_close(numrtw)
 
       ENDIF
 
-   END SUBROUTINE trc_wri
-
-#endif
+   END SUBROUTINE trc_rst_wri
+
 
 #else
@@ -595,13 +515,13 @@
 CONTAINS
 
-   SUBROUTINE trc_rst
+   SUBROUTINE trc_rst_read
       !! no passive tracers
-   END SUBROUTINE trc_rst
-
-   SUBROUTINE trc_wri(kt)
+   END SUBROUTINE trc_rst_read
+
+   SUBROUTINE trc_rst_wri(kt)
       !! no passive tracers
       INTEGER, INTENT ( in ) :: kt
-      WRITE(*,*) 'trc_wri: You should not have seen this print! error?', kt
-   END SUBROUTINE trc_wri
+      WRITE(*,*) 'trc_rst_wri: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_rst_wri
    
 #endif
