Index: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90
===================================================================
--- branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90	(revision 3432)
+++ branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90	(revision 4402)
@@ -172,7 +172,7 @@
       DO jj = 1, jpjm1           !==   i- & j-gradient of density   ==!
          DO ji = 1, jpim1
-            DO jk = 1, jpk
-#else
-      DO jk = 1, jpk             !==   i- & j-gradient of density   ==!
+            DO jk = 1, jpkf
+#else
+      DO jk = 1, jpkf            !==   i- & j-gradient of density   ==!
          DO jj = 1, jpjm1
             DO ji = 1, fs_jpim1   ! vector opt.
@@ -202,5 +202,5 @@
          DO ji = 1, jpi
             zdzr(ji,jj,1) = 0._wp   !==   Local vertical density gradient at T-point   == !   (evaluated from N^2)
-            DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
                zdzr(ji,jj,jk) = zm1_g * ( prd(ji,jj,jk) + 1._wp )              &
                   &                   * ( pn2(ji,jj,jk) + pn2(ji,jj,jk+1) ) * ( 1._wp - 0.5_wp * tmask(ji,jj,jk+1) )
@@ -210,5 +210,5 @@
 #else
       zdzr(:,:,1) = 0._wp        !==   Local vertical density gradient at T-point   == !   (evaluated from N^2)
-      DO jk = 2, jpkm1
+      DO jk = 2, jpkfm1
          !                                ! zdzr = d/dz(prd)= - ( prd ) / grav * mk(pn2) -- at t point
          !                                !   trick: tmask(ik  )  = 0   =>   all pn2   = 0   =>   zdzr = 0
@@ -231,7 +231,7 @@
       DO jj = 2, jpjm1               !* Slopes at u and v points
          DO ji = 2, jpim1
-            DO jk = 2, jpkm1
-#else
-      DO jk = 2, jpkm1                            !* Slopes at u and v points
+            DO jk = 2, jpkfm1
+#else
+      DO jk = 2, jpkfm1                            !* Slopes at u and v points
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
@@ -275,7 +275,7 @@
       DO jj = 2, jpjm1, MAX(1, jpj-3)                        ! rows jj=2 and =jpjm1 only
          DO ji = 2, jpim1  
-            DO jk = 2, jpkm1
-#else
-      DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
+#else
+      DO jk = 2, jpkfm1
          DO jj = 2, jpjm1, MAX(1, jpj-3)                        ! rows jj=2 and =jpjm1 only
             DO ji = 2, jpim1  
@@ -297,5 +297,5 @@
       DO jj = 3, jpj-2                               ! other rows
          DO ji = 2, jpim1
-            DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
 #else
          DO jj = 3, jpj-2                               ! other rows
@@ -319,5 +319,5 @@
       DO jj = 2, jpjm1
          DO ji = 2, jpim1
-            DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
 #else
          !                                        !* decrease along coastal boundaries
@@ -340,7 +340,7 @@
       DO jj = 2, jpjm1
          DO ji = 2, jpim1
-            DO jk = 2, jpkm1
-#else
-      DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
+#else
+      DO jk = 2, jpkfm1
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
@@ -384,7 +384,7 @@
       DO jj = 2, jpjm1, MAX(1, jpj-3)                           ! rows jj=2 and =jpjm1 only
          DO ji = 2, jpim1
-            DO jk = 2, jpkm1
-#else
-      DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
+#else
+      DO jk = 2, jpkfm1
          DO jj = 2, jpjm1, MAX(1, jpj-3)                        ! rows jj=2 and =jpjm1 only
             DO ji = 2, jpim1
@@ -407,5 +407,5 @@
       DO jj = 3, jpj-2                                  ! other rows
          DO ji = 2, jpim1
-            DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
 #else
          DO jj = 3, jpj-2                               ! other rows
@@ -430,5 +430,5 @@
       DO jj = 2, jpjm1
          DO ji = 2, jpim1
-            DO jk = 2, jpkm1
+            DO jk = 2, jpkfm1
 #else
          !                                        !* decrease along coastal boundaries
@@ -450,17 +450,17 @@
          !                                                    ! Gibraltar Strait
          ij0 =  50   ;   ij1 =  53
-         ii0 =  69   ;   ii1 =  71   ;   uslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
+         ii0 =  69   ;   ii1 =  71   ;   uslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
          ij0 =  51   ;   ij1 =  53
-         ii0 =  68   ;   ii1 =  71   ;   vslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
-         ii0 =  69   ;   ii1 =  71   ;   wslpi( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
-         ii0 =  69   ;   ii1 =  71   ;   wslpj( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
+         ii0 =  68   ;   ii1 =  71   ;   vslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
+         ii0 =  69   ;   ii1 =  71   ;   wslpi( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
+         ii0 =  69   ;   ii1 =  71   ;   wslpj( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
          !
-         !                                                    ! Mediterrannean Sea
+         !                                                    ! Mediterranean Sea
          ij0 =  49   ;   ij1 =  56
-         ii0 =  71   ;   ii1 =  90   ;   uslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
+         ii0 =  71   ;   ii1 =  90   ;   uslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
          ij0 =  50   ;   ij1 =  56
-         ii0 =  70   ;   ii1 =  90   ;   vslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
-         ii0 =  71   ;   ii1 =  90   ;   wslpi( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
-         ii0 =  71   ;   ii1 =  90   ;   wslpj( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , : ) = 0._wp
+         ii0 =  70   ;   ii1 =  90   ;   vslp ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
+         ii0 =  71   ;   ii1 =  90   ;   wslpi( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
+         ii0 =  71   ;   ii1 =  90   ;   wslpj( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , :jpkf ) = 0._wp
       ENDIF
 
@@ -547,7 +547,7 @@
       DO jj = 1, jpjm1
          DO ji = 1, jpim1
-            DO jk = 1, jpkm1                    !==  before lateral T & S gradients at T-level jk  ==!
-#else
-      DO jk = 1, jpkm1                          !==  before lateral T & S gradients at T-level jk  ==!
+            DO jk = 1, jpkfm1                    !==  before lateral T & S gradients at T-level jk  ==!
+#else
+      DO jk = 1, jpkfm1                          !==  before lateral T & S gradients at T-level jk  ==!
          DO jj = 1, jpjm1
             DO ji = 1, fs_jpim1   ! vector opt.
@@ -581,5 +581,5 @@
             zdkt(ji,jj,1) = 0._wp            !==  before vertical T & S gradient at w-level  ==!
             zdks(ji,jj,1) = 0._wp
-            DO jk = 2, jpk
+            DO jk = 2, jpkf
                zdkt(ji,jj,jk) = ( tb(ji,jj,jk-1) - tb(ji,jj,jk) ) * tmask(ji,jj,jk)
                zdks(ji,jj,jk) = ( sb(ji,jj,jk-1) - sb(ji,jj,jk) ) * tmask(ji,jj,jk)
@@ -590,5 +590,5 @@
       zdkt(:,:,1) = 0._wp                    !==  before vertical T & S gradient at w-level  ==!
       zdks(:,:,1) = 0._wp
-      DO jk = 2, jpk
+      DO jk = 2, jpkf
          zdkt(:,:,jk) = ( tb(:,:,jk-1) - tb(:,:,jk) ) * tmask(:,:,jk)
          zdks(:,:,jk) = ( sb(:,:,jk-1) - sb(:,:,jk) ) * tmask(:,:,jk)
@@ -602,7 +602,7 @@
          DO jj = 1, jpjm1                          ! NB: not masked due to the minimum value set
             DO ji = 1, jpim1
-               DO jk = 1, jpkm1                    ! done each pair of triad
-#else
-         DO jk = 1, jpkm1                          ! done each pair of triad
+               DO jk = 1, jpkfm1                    ! done each pair of triad
+#else
+         DO jk = 1, jpkfm1                          ! done each pair of triad
             DO jj = 1, jpjm1                       ! NB: not masked due to the minimum value set
                DO ji = 1, fs_jpim1   ! vector opt. 
@@ -620,7 +620,7 @@
          DO jj = 1, jpj                         ! NB: not masked due to the minimum value set
             DO ji = 1, jpi
-               DO jk = 1, jpkm1                    ! done each pair of triad
-#else
-         DO jk = 1, jpkm1                          ! done each pair of triad
+               DO jk = 1, jpkfm1                    ! done each pair of triad
+#else
+         DO jk = 1, jpkfm1                          ! done each pair of triad
             DO jj = 1, jpj                       ! NB: not masked due to the minimum value set
                DO ji = 1, jpi   ! vector opt. 
@@ -682,7 +682,7 @@
             DO jj = 1, jpjm1
                DO ji = 1, jpim1
-                  DO jk = 1, jpkm1
-#else
-            DO jk = 1, jpkm1
+                  DO jk = 1, jpkfm1
+#else
+            DO jk = 1, jpkfm1
                DO jj = 1, jpjm1
                   DO ji = 1, fs_jpim1   ! vector opt.
@@ -815,5 +815,5 @@
       !
       !                          !==   surface mixed layer mask   !
-      DO jk = 1, jpk                      ! =1 inside the mixed layer, =0 otherwise
+      DO jk = 1, jpkf                ! =1 inside the mixed layer, =0 otherwise
 # if ( defined key_vectopt_loop ) && ! ( defined key_z_first )
          DO jj = 1, 1
@@ -869,5 +869,5 @@
             !                    !==   i- & j-slopes at w-points just below the Mixed Layer   ==!
             !
-            ik   = MIN( nmln(ji,jj) + 1, jpk )
+            ik   = MIN( nmln(ji,jj) + 1, jpkf )
             ikm1 = MAX( 1, ik-1 )
             !                          !- vertical density gradient for w-slope (from N^2)
@@ -963,7 +963,7 @@
             DO jj = 2, jpjm1
                DO ji = 2, jpim1
-                  DO jk = 1, jpk
-#else
-            DO jk = 1, jpk
+                  DO jk = 1, jpkf
+#else
+            DO jk = 1, jpkf
                DO jj = 2, jpjm1
                   DO ji = fs_2, fs_jpim1   ! vector opt.
