Index: branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_eiv.F90
===================================================================
--- branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_eiv.F90	(revision 8627)
+++ branches/2015/nemo_v3_6_STABLE/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_eiv.F90	(revision 7494)
@@ -165,15 +165,13 @@
          CALL iom_put( "voce_eiv", v_eiv )    ! j-eiv current
          CALL iom_put( "woce_eiv", w_eiv )    ! vert. eiv current
-         !
          IF( iom_use('weiv_masstr') ) THEN   ! vertical mass transport & its square value
-            z2d(:,:) = rau0 * e12t(:,:)
-            DO jk = 1, jpk
-               z3d(:,:,jk) = w_eiv(:,:,jk) * z2d(:,:)
-            END DO
-            CALL iom_put( "weiv_masstr" , z3d )  
-         ENDIF
-         !
+           z2d(:,:) = rau0 * e12t(:,:)
+           DO jk = 1, jpk
+              z3d(:,:,jk) = w_eiv(:,:,jk) * z2d(:,:)
+           END DO
+           CALL iom_put( "weiv_masstr" , z3d )  
+         ENDIF
          IF( iom_use("ueiv_masstr") .OR. iom_use("ueiv_heattr") .OR. iom_use('ueiv_heattr3d')        &
-            &                       .OR. iom_use("ueiv_salttr") .OR. iom_use('ueiv_salttr3d') ) THEN
+                                    .OR. iom_use("ueiv_salttr") .OR. iom_use('ueiv_salttr3d') ) THEN
             z3d(:,:,jpk) = 0.e0
             z2d(:,:) = 0.e0
@@ -184,5 +182,5 @@
             CALL iom_put( "ueiv_masstr", z3d )                  ! mass transport in i-direction
          ENDIF
-         !
+
          IF( iom_use('ueiv_heattr') .OR. iom_use('ueiv_heattr3d') ) THEN
             zztmp = 0.5 * rcp 
@@ -206,5 +204,5 @@
             ENDIF
          ENDIF
-         !
+
          IF( iom_use('ueiv_salttr') .OR. iom_use('ueiv_salttr3d') ) THEN
             zztmp = 0.5 * 0.001
@@ -228,5 +226,5 @@
             ENDIF
          ENDIF
-         !
+
          IF( iom_use("veiv_masstr") .OR. iom_use("veiv_heattr") .OR. iom_use('veiv_heattr3d')       &
                                     .OR. iom_use("veiv_salttr") .OR. iom_use('veiv_salttr3d') ) THEN
@@ -237,5 +235,5 @@
             CALL iom_put( "veiv_masstr", z3d )                  ! mass transport in j-direction
          ENDIF
-         !   
+            
          IF( iom_use('veiv_heattr') .OR. iom_use('veiv_heattr3d') ) THEN
             zztmp = 0.5 * rcp 
@@ -259,5 +257,5 @@
             ENDIF
          ENDIF
-         !
+
          IF( iom_use('veiv_salttr') .OR. iom_use('veiv_salttr3d') ) THEN
             zztmp = 0.5 * 0.001
@@ -281,5 +279,5 @@
             ENDIF
          ENDIF
-         !
+
          IF( iom_use('weiv_masstr') .OR. iom_use('weiv_heattr3d') .OR. iom_use('weiv_salttr3d')) THEN   ! vertical mass transport & its square value
            z2d(:,:) = rau0 * e12t(:,:)
@@ -289,5 +287,5 @@
            CALL iom_put( "weiv_masstr" , z3d )                  ! mass transport in k-direction
          ENDIF
-         !
+
          IF( iom_use('weiv_heattr3d') ) THEN
             zztmp = 0.5 * rcp 
@@ -302,5 +300,5 @@
             CALL iom_put( "weiv_heattr3d", zztmp * z3d_T )                 ! 3D heat transport in k-direction
          ENDIF
-         !
+
          IF( iom_use('weiv_salttr3d') ) THEN
             zztmp = 0.5 * 0.001 
@@ -315,50 +313,31 @@
             CALL iom_put( "weiv_salttr3d", zztmp * z3d_T )                 ! 3D salt transport in k-direction
          ENDIF
-         !
-         IF( ln_diaptr ) THEN
-            z3d(:,:,:) = 0._wp
-            DO jk = 1, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     z3d(ji,jj,jk) = v_eiv(ji,jj,jk) * 0.5 * (tsn(ji,jj,jk,jp_tem)+tsn(ji,jj+1,jk,jp_tem)) &
-                        &             * e1v(ji,jj) * fse3v(ji,jj,jk)
-                  END DO
-               END DO
-            END DO
-            CALL dia_ptr_ohst_components( jp_tem, 'eiv', z3d )
-            z3d(:,:,:) = 0._wp
-            DO jk = 1, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     z3d(ji,jj,jk) = v_eiv(ji,jj,jk) * 0.5 * (tsn(ji,jj,jk,jp_sal)+tsn(ji,jj+1,jk,jp_sal)) &
-                     &             * e1v(ji,jj) * fse3v(ji,jj,jk)
-                  END DO
-               END DO
-            END DO
-            CALL dia_ptr_ohst_components( jp_sal, 'eiv', z3d )
-         ENDIF
-         !
-!!gm add CMIP6 diag here instead of been done in trdken.F90
-         !
-         IF( iom_use('eketrd_eiv') ) THEN     ! tendency of EKE from parameterized eddy advection
-            ! CMIP6 diagnostic tknebto = tendency of EKE from parameterized mesoscale eddy advection
-            ! = vertical_integral( k (N S)^2 ) rho dz   where rho = rau0 and S = isoneutral slope.
-            z2d(:,:) = 0._wp
-            DO jk = 1, jpkm1
-               DO ji = 1, jpi
-                  DO jj = 1,jpj
-                     z2d(ji,jj) = z2d(ji,jj) + rau0 * fsaeiw(ji,jj,jk)                 &
-                        &                    * rn2b(ji,jj,jk) * fse3w(ji,jj,jk)        &
-                        &                    * (  wslpi(ji,jj,jk) * wslpi(ji,jj,jk)    &
-                        &                       + wslpj(ji,jj,jk) * wslpj(ji,jj,jk)  ) * wmask(ji,jj,jk)
-                  END DO
-               END DO
-            END DO
-            CALL iom_put( "eketrd_eiv", z2d )
-         ENDIF
-         !
-!!gm  removed from trdken.F90    IF( ln_KE_trd )   CALL trd_dyn(u_eiv, v_eiv, jpdyn_eivke, kt )
-         !
-      ENDIF
+
+    END IF
+!
+    IF( ln_diaptr .AND. cdtype == 'TRA' ) THEN
+       z3d(:,:,:) = 0._wp
+       DO jk = 1, jpkm1
+          DO jj = 2, jpjm1
+             DO ji = fs_2, fs_jpim1   ! vector opt.
+                z3d(ji,jj,jk) = v_eiv(ji,jj,jk) * 0.5 * (tsn(ji,jj,jk,jp_tem)+tsn(ji,jj+1,jk,jp_tem)) &
+                &             * e1v(ji,jj) * fse3v(ji,jj,jk)
+             END DO
+          END DO
+       END DO
+       CALL dia_ptr_ohst_components( jp_tem, 'eiv', z3d )
+       z3d(:,:,:) = 0._wp
+       DO jk = 1, jpkm1
+          DO jj = 2, jpjm1
+             DO ji = fs_2, fs_jpim1   ! vector opt.
+                z3d(ji,jj,jk) = v_eiv(ji,jj,jk) * 0.5 * (tsn(ji,jj,jk,jp_sal)+tsn(ji,jj+1,jk,jp_sal)) &
+                &             * e1v(ji,jj) * fse3v(ji,jj,jk)
+             END DO
+          END DO
+       END DO
+       CALL dia_ptr_ohst_components( jp_sal, 'eiv', z3d )
+    ENDIF
+
+    IF( ln_KE_trd ) CALL trd_dyn(u_eiv, v_eiv, jpdyn_eivke, kt )
 # endif  
 
