Index: /trunk/NEMO/TOP_SRC/LOBSTER/par_lobster.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/LOBSTER/par_lobster.F90	(revision 1175)
+++ /trunk/NEMO/TOP_SRC/LOBSTER/par_lobster.F90	(revision 1176)
@@ -22,5 +22,5 @@
    INTEGER, PUBLIC, PARAMETER ::   jp_lobster_2d  = 19        !: additional 2d output arrays ('key_trc_diaadd')
    INTEGER, PUBLIC, PARAMETER ::   jp_lobster_3d  =  3        !: additional 3d output arrays ('key_trc_diaadd')
-   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_trd = 15        !: number of sms trends for LOBSTER
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_trd = 17       !: number of sms trends for LOBSTER
 
    ! assign an index in trc arrays for each LOBSTER prognostic variables
Index: /trunk/NEMO/TOP_SRC/LOBSTER/trcbio.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 1175)
+++ /trunk/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 1176)
@@ -20,4 +20,6 @@
    USE lbclnk          ! 
    USE prtctl_trc      ! Print control for debbuging
+   USE trdmld_trc
+   USE trdmld_trc_oce
    
    IMPLICIT NONE
@@ -59,5 +61,5 @@
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
-      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   ji, jj, jk, jn, jl
       REAL(wp) ::   zdet, zzoo, zphy, zno3, znh4, zdom      ! now concentrations
       REAL(wp) ::   zlno3, zlnh4, zle, zlt                  ! limitation terms for phyto
@@ -71,4 +73,5 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze3t
 #endif
+      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::   ztrbio
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -90,9 +93,14 @@
       fbod(:,:) = 0.e0
 #if defined key_trc_diaadd
-      DO ji = 1, jp_lobster_2d
-         trc2d(:,:,ji) = 0.e0
+      DO jl = 1, jp_lobster_2d
+         trc2d(:,:,jl) = 0.e0
       END DO 
 #endif
 
+      IF( l_trdtrc )THEN
+         ALLOCATE( ztrbio(jpi,jpj,jpk,jp_lobster_trd) )
+!CDIR COLLAPSE
+         ztrbio(:,:,:,:) = 0.
+      ENDIF
 
       !                                      ! -------------------------- !
@@ -226,4 +234,24 @@
                trc3d(ji,jj,jk,3) = znh4no3 * 86400     
 #endif
+               IF( l_trdtrc ) THEN
+                  ztrbio(ji,jj,jk,1) = zno3phy
+                  ztrbio(ji,jj,jk,2) = znh4phy
+                  ztrbio(ji,jj,jk,3) = zphynh4
+                  ztrbio(ji,jj,jk,4) = zphydom
+                  ztrbio(ji,jj,jk,5) = zphyzoo
+                  ztrbio(ji,jj,jk,6) = zphydet
+                  ztrbio(ji,jj,jk,7) = zdetzoo
+                  !  trend number 8 in trcsed
+                  ztrbio(ji,jj,jk,9) = zzoodet
+                  ztrbio(ji,jj,jk,10) = zzoobod
+                  ztrbio(ji,jj,jk,11) = zzoonh4
+                  ztrbio(ji,jj,jk,12) = zzoodom
+                  ztrbio(ji,jj,jk,13) = znh4no3
+                  ztrbio(ji,jj,jk,14) = zdomnh4
+                  ztrbio(ji,jj,jk,15) = zdetnh4
+                  ztrbio(ji,jj,jk,16) = zdetdom
+                  !  trend number 17 in trcexp
+                ENDIF
+
 
                ! tracer flux at totox-point added to the general trend
@@ -351,4 +379,24 @@
                trc3d(ji,jj,jk,3) =  znh4no3 * 86400     
 #endif
+               IF( l_trdtrc ) THEN
+                  ztrbio(ji,jj,jk,1) = zno3phy
+                  ztrbio(ji,jj,jk,2) = znh4phy
+                  ztrbio(ji,jj,jk,3) = zphynh4
+                  ztrbio(ji,jj,jk,4) = zphydom
+                  ztrbio(ji,jj,jk,5) = zphyzoo
+                  ztrbio(ji,jj,jk,6) = zphydet
+                  ztrbio(ji,jj,jk,7) = zdetzoo
+                  !  trend number 8 in trcsed
+                  ztrbio(ji,jj,jk,9) = zzoodet
+                  ztrbio(ji,jj,jk,10) = zzoobod
+                  ztrbio(ji,jj,jk,11) = zzoonh4
+                  ztrbio(ji,jj,jk,12) = zzoodom
+                  ztrbio(ji,jj,jk,13) = znh4no3
+                  ztrbio(ji,jj,jk,14) = zdomnh4
+                  ztrbio(ji,jj,jk,15) = zdetnh4
+                  ztrbio(ji,jj,jk,16) = zdetdom
+                  !  trend number 17 in trcexp
+                ENDIF
+
 
                ! tracer flux at totox-point added to the general trend
@@ -366,9 +414,9 @@
 #if defined key_trc_diaadd
       ! Lateral boundary conditions on trc2d and trc3d
-      DO ji = 1, jp_lobster_2d
-          CALL lbc_lnk( trc2d(:,:,ji),'T', 1. )
+      DO jl = 1, jp_lobster_2d
+          CALL lbc_lnk( trc2d(:,:,jl),'T', 1. )
       END DO 
-      DO ji = 1, jp_lobster_3d
-          CALL lbc_lnk( trc3d(:,:,1,ji),'T', 1. )
+      DO jl = 1, jp_lobster_3d
+          CALL lbc_lnk( trc3d(:,:,1,jl),'T', 1. )
       END DO 
 #endif
@@ -376,9 +424,16 @@
 #if defined key_trc_diabio
       ! Lateral boundary conditions on trcbio
-      DO ji = 1, jp_lobster_trd
-          CALL lbc_lnk( trbio(:,:,1,ji),'T', 1. )
+      DO jl = 1, jp_lobster_trd
+          CALL lbc_lnk( trbio(:,:,1,jl),'T', 1. )
       END DO 
 #endif
       !
+      IF( l_trdtrc ) THEN
+!CDIRR COLLAPSE
+         DO jl = 1, jp_lobster_trd
+            CALL trd_mod_trc( ztrbio(:,:,:,jl), jl, kt )   ! handle the trend
+         END DO
+      ENDIF
+
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
          WRITE(charout, FMT="('bio')")
Index: /trunk/NEMO/TOP_SRC/LOBSTER/trcexp.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 1175)
+++ /trunk/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 1176)
@@ -21,4 +21,6 @@
    USE trctrp_lec
    USE prtctl_trc      ! Print control for debbuging
+   USE trdmld_trc
+   USE trdmld_trc_oce
 
    IMPLICIT NONE
@@ -52,9 +54,9 @@
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
-      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   ji, jj, jk, jl
       REAL(wp) ::   zgeolpoc, zfact
       INTEGER , DIMENSION(jpi,jpj) ::   ikbot
       REAL(wp), DIMENSION(jpi,jpj) ::   zwork
-
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrbio
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -66,9 +68,15 @@
       ENDIF
 
-! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC
-! POC IN THE WATER COLUMN
-! (PARTS OF NEWLY FORMED MATTER REMAINING IN THE DIFFERENT
-! LAYERS IS DETERMINED BY DMIN3 DEFINED IN common.passivetrc.*.h
-! ----------------------------------------------------------------------
+      ! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC
+      ! POC IN THE WATER COLUMN
+      ! (PARTS OF NEWLY FORMED MATTER REMAINING IN THE DIFFERENT
+      ! LAYERS IS DETERMINED BY DMIN3 DEFINED IN sms_lobster.F90
+      ! ----------------------------------------------------------------------
+
+      IF( l_trdtrc )THEN
+         ALLOCATE( ztrbio(jpi,jpj,jpk) )
+!CDIR COLLAPSE
+         ztrbio(:,:,:) = tra(:,:,:,jpno3)
+      ENDIF
 
       DO jk = 1, jpkm1
@@ -166,4 +174,10 @@
       ENDIF
       !
+      IF( l_trdtrc ) THEN
+!CDIRR COLLAPSE
+         ztrbio(:,:,:) = tra(:,:,:,jpno3) - ztrbio(:,:,:)
+         jl = 17
+         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
+      ENDIF
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
Index: /trunk/NEMO/TOP_SRC/LOBSTER/trcopt.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/LOBSTER/trcopt.F90	(revision 1175)
+++ /trunk/NEMO/TOP_SRC/LOBSTER/trcopt.F90	(revision 1176)
@@ -48,6 +48,4 @@
       INTEGER, INTENT( in ) ::   kt   ! index of the time stepping
       INTEGER  ::   ji, jj, jk
-      INTEGER , DIMENSION(jpi,jpj)     ::   itabe           ! euphotic layer last k index
-      INTEGER , DIMENSION(jpi,jpj,jpk) ::   imaske          ! euphotic layer mask
       REAL(wp) ::   zpig                                    ! total pigment
       REAL(wp) ::   zkr                                     ! total absorption coefficient in red
@@ -103,33 +101,26 @@
       END DO
 
-      ! determination of euphotic layer depth (xze)
-      ! -------------------------------------
+      ! 3. Determination of euphotic layer depth
+      ! ----------------------------------------
 
-      DO jk = 1, jpk                   ! imaske equal 1 in the euphotic layer, and 0 without
+      ! Euphotic layer bottom level
+      neln(:,:) = 1                                           ! initialisation of EL level
+      DO jk = 1, jpk
          DO jj = 1, jpj
-            DO ji = 1,jpi
-               IF( xpar(ji,jj,jk) >= zpar100(ji,jj) ) THEN
-                  imaske(ji,jj,jk) = 1
-               ELSE
-                  imaske(ji,jj,jk) = 0
-               ENDIF
-            END DO
+           DO ji = 1, jpi
+              IF( xpar(ji,jj,jk) >= zpar100(ji,jj) )   neln(ji,jj) = jk+1 ! 1rst T-level strictly below EL bottom
+              !                                                  ! nb. this is to ensure compatibility with
+              !                                                  ! nmld_trc definition in trd_mld_trc_zint
+           END DO
          END DO
-      END DO
-      !                                ! sum of imaske Cover the vertical with a minimim value of 1 
-      itabe(:,:) = 1                   !   surface value setto 1 <=> set a ninimum value to 1
-      DO jk = 2, jpk
-         DO jj = 1, jpj
-            DO ji = 1,jpi
-               itabe(ji,jj) = itabe(ji,jj) + imaske(ji,jj,jk)
-            END DO
+      ENDDO
+
+      ! Euphotic layer depth
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            xze(ji,jj) = fsdepw( ji, jj, neln(ji,jj) )            ! exact EL depth
          END DO
-      END DO
-      DO jj = 1, jpj                  ! converte the number of level into depth
-         DO ji = 1,jpi
-            xze(ji,jj) = fsdepw(ji,jj,itabe(ji,jj)+1)
-         END DO
-      END DO
-      !
+      ENDDO 
+
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
Index: /trunk/NEMO/TOP_SRC/LOBSTER/trcsed.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 1175)
+++ /trunk/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 1176)
@@ -18,4 +18,6 @@
    USE sms_lobster
    USE lbclnk
+   USE trdmld_trc
+   USE trdmld_trc_oce
 
    USE prtctl_trc      ! Print control for debbuging
@@ -56,8 +58,8 @@
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
-      INTEGER  ::   ji, jj, jk
+      INTEGER  ::   ji, jj, jk, jl
       REAL(wp) ::   ztra
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwork
-
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrbio
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -76,4 +78,10 @@
       zwork(:,:,1  ) = 0.e0      ! surface value set to zero
       zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
+
+      IF( l_trdtrc )THEN
+         ALLOCATE( ztrbio(jpi,jpj,jpk) )
+!CDIR COLLAPSE
+         ztrbio(:,:,:) = tra(:,:,:,jpdet)
+      ENDIF
 
       ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
@@ -108,4 +116,11 @@
       !
 
+      IF( l_trdtrc ) THEN
+!CDIRR COLLAPSE
+         ztrbio(:,:,:) = tra(:,:,:,jpdet) - ztrbio(:,:,:)
+         jl = 8
+         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
+      ENDIF
+
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
          WRITE(charout, FMT="('sed')")
Index: /trunk/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 1175)
+++ /trunk/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 1176)
@@ -13,8 +13,12 @@
    !!   trcsms_lobster        :  Time loop of passive tracers sms
    !!----------------------------------------------------------------------
+   USE oce_trc         !
+   USE trc
    USE trcbio
    USE trcopt
    USE trcsed
    USE trcexp
+   USE trdmld_trc_oce
+   USE trdmld_trc
 
    IMPLICIT NONE
@@ -41,4 +45,6 @@
       !! -------------------------------------------------------------------------------------
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      INTEGER :: jn
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrlob   ! used for lobster sms trends
       !!
 
@@ -50,4 +56,13 @@
 
       CALL trc_exp( kt )      ! export
+
+      IF( l_trdtrc ) THEN
+          DO jn = 1, jptra
+            ztrlob(:,:,:) = tra(:,:,:,jn)
+            CALL trd_mod_trc( ztrlob, jn, jptrc_trd_sms, kt )   ! save trends
+          END DO
+      END IF
+
+      IF( lk_trdmld_trc )  CALL trd_mld_bio( kt )   ! trends: Mixed-layer
 
    END SUBROUTINE trc_sms_lobster
