Index: branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90
===================================================================
--- branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 3489)
+++ branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 3508)
@@ -18,4 +18,5 @@
    USE oce             ! dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE phycst
    USE in_out_manager  ! I/O manager
    USE sbc_oce         ! ocean surface boundary conditions
Index: branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/DOM/phycst.F90
===================================================================
--- branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/DOM/phycst.F90	(revision 3489)
+++ branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/DOM/phycst.F90	(revision 3508)
@@ -187,5 +187,5 @@
          WRITE(numout,*) '          fresh ice specific heat                   = ', cpic    , ' J/kg/K'
          WRITE(numout,*) '          latent heat of fusion of fresh ice / snow = ', lfus    , ' J/kg'
-#if defined key_lim3
+#if defined key_lim3 || defined key_cice
          WRITE(numout,*) '          latent heat of subl.  of fresh ice / snow = ', lsub    , ' J/kg'
 #else
Index: branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 3489)
+++ branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 3508)
@@ -15,5 +15,5 @@
    USE dom_oce         ! ocean space and time domain
    USE domvvl
-   USE phycst, only : rcp, rau0
+   USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! distributed memory computing library
@@ -37,5 +37,5 @@
    USE ice_gather_scatter
    USE ice_calendar, only: dt
-   USE ice_state, only: aice,aicen,uvel,vvel,vsnon,vicen
+   USE ice_state, only: aice,aicen,uvel,vvel,vsno,vsnon,vice,vicen
    USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow,  &
                 sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_gbm,     &
@@ -59,4 +59,7 @@
    PUBLIC cice_sbc_final  ! routine called by sbc_final
    PUBLIC sbc_ice_cice    ! routine called by sbc
+
+   INTEGER , PARAMETER ::   ji_off = INT ( (jpiglo - nx_global) / 2 )
+   INTEGER , PARAMETER ::   jj_off = INT ( (jpjglo - ny_global) / 2 )
 
    INTEGER , PARAMETER ::   jpfld   = 13   ! maximum number of files to read 
@@ -107,5 +110,5 @@
       !! ** Action  : - time evolution of the CICE sea-ice model
       !!              - update all sbc variables below sea-ice:
-      !!                utau, vtau, qns , qsr, emp , sfx 
+      !!                utau, vtau, qns , qsr, emp , sfx
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt      ! ocean time step
@@ -138,5 +141,4 @@
    END SUBROUTINE sbc_ice_cice
 
-
    SUBROUTINE cice_sbc_init (nsbc)
       !!---------------------------------------------------------------------
@@ -144,10 +146,13 @@
       !! ** Purpose: Initialise ice related fields for NEMO and coupling
       !!
-      INTEGER, INTENT( in  ) ::   nsbc ! surface forcing type
-      !!---------------------------------------------------------------------
-
-      INTEGER  ::   ji, jj, jpl                        ! dummy loop indices
+      INTEGER, INTENT( in  ) ::   nsbc                ! surface forcing type
+      REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2
+      REAL(wp) ::   zcoefu, zcoefv, zcoeff            ! local scalar
+      INTEGER  ::   ji, jj, jl                        ! dummy loop indices
+      !!---------------------------------------------------------------------
 
       IF( nn_timing == 1 )  CALL timing_start('cice_sbc_init')
+      !
+      CALL wrk_alloc( jpi,jpj, ztmp1, ztmp2 )
       !
       IF(lwp) WRITE(numout,*)'cice_sbc_init'
@@ -183,6 +188,6 @@
       CALL cice2nemo(aice,fr_i, 'T', 1. )
       IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
-         DO jpl=1,ncat
-            CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
+         DO jl=1,ncat
+            CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. )
          ENDDO
       ENDIF
@@ -199,4 +204,53 @@
       CALL lbc_lnk ( fr_iu , 'U', 1. )
       CALL lbc_lnk ( fr_iv , 'V', 1. )
+
+      !                                      ! embedded sea ice
+      IF( nn_ice_embd /= 0 ) THEN            ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass
+         CALL cice2nemo(vsno(:,:,:),ztmp1,'T', 1. )
+         CALL cice2nemo(vice(:,:,:),ztmp2,'T', 1. )
+         snwice_mass  (:,:) = ( rhosn * ztmp1(:,:) + rhoic * ztmp2(:,:)  )
+         snwice_mass_b(:,:) = snwice_mass(:,:)
+      ELSE
+         snwice_mass  (:,:) = 0.0_wp         ! no mass exchanges
+         snwice_mass_b(:,:) = 0.0_wp         ! no mass exchanges
+      ENDIF
+      IF( nn_ice_embd == 2 .AND.          &  ! full embedment (case 2) & no restart : 
+         &   .NOT.ln_rstart ) THEN           ! deplete the initial ssh belew sea-ice area
+         sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0
+         sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0
+         !
+         ! Note: Changed the initial values of sshb and sshn=>  need to recompute ssh[u,v,f]_[b,n] 
+         !       which were previously set in domvvl
+         IF ( lk_vvl ) THEN            ! Is this necessary? embd 2 should be restricted to vvl only???
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1                    ! caution: use of Vector Opt. not possible
+                  zcoefu = 0.5  * umask(ji,jj,1) / ( e1u(ji,jj) * e2u(ji,jj) )
+                  zcoefv = 0.5  * vmask(ji,jj,1) / ( e1v(ji,jj) * e2v(ji,jj) )
+                  zcoeff = 0.25 * umask(ji,jj,1) * umask(ji,jj+1,1)
+                  sshu_b(ji,jj) = zcoefu * ( e1t(ji  ,jj) * e2t(ji  ,jj) * sshb(ji  ,jj)     &
+                     &                     + e1t(ji+1,jj) * e2t(ji+1,jj) * sshb(ji+1,jj) )
+                  sshv_b(ji,jj) = zcoefv * ( e1t(ji,jj  ) * e2t(ji,jj  ) * sshb(ji,jj  )     &
+                     &                     + e1t(ji,jj+1) * e2t(ji,jj+1) * sshb(ji,jj+1) )
+                  sshu_n(ji,jj) = zcoefu * ( e1t(ji  ,jj) * e2t(ji  ,jj) * sshn(ji  ,jj)     &
+                     &                     + e1t(ji+1,jj) * e2t(ji+1,jj) * sshn(ji+1,jj) )
+                  sshv_n(ji,jj) = zcoefv * ( e1t(ji,jj  ) * e2t(ji,jj  ) * sshn(ji,jj  )     &
+                     &                     + e1t(ji,jj+1) * e2t(ji,jj+1) * sshn(ji,jj+1) )
+               END DO
+            END DO
+            CALL lbc_lnk( sshu_b, 'U', 1. )   ;   CALL lbc_lnk( sshu_n, 'U', 1. )
+            CALL lbc_lnk( sshv_b, 'V', 1. )   ;   CALL lbc_lnk( sshv_n, 'V', 1. )
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1      ! NO Vector Opt.
+                  sshf_n(ji,jj) = 0.5  * umask(ji,jj,1) * umask(ji,jj+1,1)                   &
+                       &               / ( e1f(ji,jj  ) * e2f(ji,jj  ) )                     &
+                       &               * ( e1u(ji,jj  ) * e2u(ji,jj  ) * sshu_n(ji,jj  )     &
+                       &                 + e1u(ji,jj+1) * e2u(ji,jj+1) * sshu_n(ji,jj+1) )
+               END DO
+            END DO
+            CALL lbc_lnk( sshf_n, 'F', 1. )
+          ENDIF
+      ENDIF
+ 
+      CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 )
       !
       IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_init')
@@ -213,12 +267,13 @@
       INTEGER, INTENT(in   ) ::   nsbc ! surface forcing type
 
-      INTEGER  ::   ji, jj, jpl                   ! dummy loop indices      
-      REAL(wp), DIMENSION(:,:), POINTER :: ztmp
+      INTEGER  ::   ji, jj, jl                   ! dummy loop indices      
+      REAL(wp), DIMENSION(:,:), POINTER :: ztmp, zpice
       REAL(wp), DIMENSION(:,:,:), POINTER :: ztmpn
+      REAL(wp) ::   zintb, zintn  ! dummy argument
       !!---------------------------------------------------------------------
 
       IF( nn_timing == 1 )  CALL timing_start('cice_sbc_in')
       !
-      CALL wrk_alloc( jpi,jpj, ztmp )
+      CALL wrk_alloc( jpi,jpj, ztmp, zpice )
       CALL wrk_alloc( jpi,jpj,ncat, ztmpn )
 
@@ -260,6 +315,6 @@
 ! Surface downward latent heat flux (CI_5)
          IF (nsbc == 2) THEN
-            DO jpl=1,ncat
-               ztmpn(:,:,jpl)=qla_ice(:,:,1)*a_i(:,:,jpl)
+            DO jl=1,ncat
+               ztmpn(:,:,jl)=qla_ice(:,:,1)*a_i(:,:,jl)
             ENDDO
          ELSE
@@ -270,12 +325,12 @@
                DO ji=1,jpi
                   IF (fr_i(ji,jj).eq.0.0) THEN
-                     DO jpl=1,ncat
-                        ztmpn(ji,jj,jpl)=0.0
+                     DO jl=1,ncat
+                        ztmpn(ji,jj,jl)=0.0
                      ENDDO
                      ! This will then be conserved in CICE
                      ztmpn(ji,jj,1)=qla_ice(ji,jj,1)
                   ELSE
-                     DO jpl=1,ncat
-                        ztmpn(ji,jj,jpl)=qla_ice(ji,jj,1)*a_i(ji,jj,jpl)/fr_i(ji,jj)
+                     DO jl=1,ncat
+                        ztmpn(ji,jj,jl)=qla_ice(ji,jj,1)*a_i(ji,jj,jl)/fr_i(ji,jj)
                      ENDDO
                   ENDIF
@@ -283,24 +338,24 @@
             ENDDO
          ENDIF
-         DO jpl=1,ncat
-            CALL nemo2cice(ztmpn(:,:,jpl),flatn_f(:,:,jpl,:),'T', 1. )
+         DO jl=1,ncat
+            CALL nemo2cice(ztmpn(:,:,jl),flatn_f(:,:,jl,:),'T', 1. )
 
 ! GBM conductive flux through ice (CI_6)
 !  Convert to GBM
             IF (nsbc == 2) THEN
-               ztmp(:,:) = botmelt(:,:,jpl)*a_i(:,:,jpl)
+               ztmp(:,:) = botmelt(:,:,jl)*a_i(:,:,jl)
             ELSE
-               ztmp(:,:) = botmelt(:,:,jpl)
+               ztmp(:,:) = botmelt(:,:,jl)
             ENDIF
-            CALL nemo2cice(ztmp,fcondtopn_f(:,:,jpl,:),'T', 1. )
+            CALL nemo2cice(ztmp,fcondtopn_f(:,:,jl,:),'T', 1. )
 
 ! GBM surface heat flux (CI_7)
 !  Convert to GBM
             IF (nsbc == 2) THEN
-               ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))*a_i(:,:,jpl) 
+               ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))*a_i(:,:,jl) 
             ELSE
-               ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))
+               ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))
             ENDIF
-            CALL nemo2cice(ztmp,fsurfn_f(:,:,jpl,:),'T', 1. )
+            CALL nemo2cice(ztmp,fsurfn_f(:,:,jl,:),'T', 1. )
          ENDDO
 
@@ -384,10 +439,27 @@
       CALL nemo2cice(ztmp,vocn,'F', -1. )
 
+      IF( nn_ice_embd == 2 ) THEN             !== embedded sea ice: compute representative ice top surface ==!
+          !
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * {SUM[n], n=0,nn_fsbc-1}
+         zintn = REAL( nn_fsbc - 1 ) / REAL( nn_fsbc ) * 0.5_wp
+          !
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[1-n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * (nn_fsbc^2 - {SUM[n], n=0,nn_fsbc-1})
+         zintb = REAL( nn_fsbc + 1 ) / REAL( nn_fsbc ) * 0.5_wp
+          !
+         zpice(:,:) = ssh_m(:,:) + (  zintn * snwice_mass(:,:) +  zintb * snwice_mass_b(:,:)  ) * r1_rau0
+          !
+         !
+      ELSE                                    !== non-embedded sea ice: use ocean surface for slope calculation ==!
+         zpice(:,:) = ssh_m(:,:)
+      ENDIF
+
 ! x comp and y comp of sea surface slope (on F points)
 ! T point to F point
       DO jj=1,jpjm1
          DO ji=1,jpim1
-            ztmp(ji,jj)=0.5 * (  (ssh_m(ji+1,jj  )-ssh_m(ji,jj  ))/e1u(ji,jj  )   &
-                               + (ssh_m(ji+1,jj+1)-ssh_m(ji,jj+1))/e1u(ji,jj+1) ) & 
+            ztmp(ji,jj)=0.5 * (  (zpice(ji+1,jj  )-zpice(ji,jj  ))/e1u(ji,jj  )   &
+                               + (zpice(ji+1,jj+1)-zpice(ji,jj+1))/e1u(ji,jj+1) ) & 
                             *  fmask(ji,jj,1)
          ENDDO
@@ -398,6 +470,6 @@
       DO jj=1,jpjm1
          DO ji=1,jpim1
-            ztmp(ji,jj)=0.5 * (  (ssh_m(ji  ,jj+1)-ssh_m(ji  ,jj))/e2v(ji  ,jj)   &
-                               + (ssh_m(ji+1,jj+1)-ssh_m(ji+1,jj))/e2v(ji+1,jj) ) &
+            ztmp(ji,jj)=0.5 * (  (zpice(ji  ,jj+1)-zpice(ji  ,jj))/e2v(ji  ,jj)   &
+                               + (zpice(ji+1,jj+1)-zpice(ji+1,jj))/e2v(ji+1,jj) ) &
                             *  fmask(ji,jj,1)
          ENDDO
@@ -421,11 +493,11 @@
       INTEGER, INTENT( in  ) ::   nsbc ! surface forcing type
       
-      INTEGER  ::   ji, jj, jpl                 ! dummy loop indices
-      REAL(wp), DIMENSION(:,:), POINTER :: ztmp
+      INTEGER  ::   ji, jj, jl                 ! dummy loop indices
+      REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2
       !!---------------------------------------------------------------------
 
       IF( nn_timing == 1 )  CALL timing_start('cice_sbc_out')
       !
-      CALL wrk_alloc( jpi,jpj, ztmp )
+      CALL wrk_alloc( jpi,jpj, ztmp1, ztmp2 )
       
       IF( kt == nit000 )  THEN
@@ -434,10 +506,10 @@
       
 ! x comp of ocean-ice stress 
-      CALL cice2nemo(strocnx,ztmp,'F', -1. )
+      CALL cice2nemo(strocnx,ztmp1,'F', -1. )
       ss_iou(:,:)=0.0
 ! F point to U point
       DO jj=2,jpjm1
          DO ji=2,jpim1
-            ss_iou(ji,jj) = 0.5 * ( ztmp(ji,jj-1) + ztmp(ji,jj) ) * umask(ji,jj,1)
+            ss_iou(ji,jj) = 0.5 * ( ztmp1(ji,jj-1) + ztmp1(ji,jj) ) * umask(ji,jj,1)
          ENDDO
       ENDDO
@@ -445,5 +517,5 @@
 
 ! y comp of ocean-ice stress 
-      CALL cice2nemo(strocny,ztmp,'F', -1. )
+      CALL cice2nemo(strocny,ztmp1,'F', -1. )
       ss_iov(:,:)=0.0
 ! F point to V point
@@ -451,5 +523,5 @@
       DO jj=1,jpjm1
          DO ji=2,jpim1
-            ss_iov(ji,jj) = 0.5 * ( ztmp(ji-1,jj) + ztmp(ji,jj) ) * vmask(ji,jj,1)
+            ss_iov(ji,jj) = 0.5 * ( ztmp1(ji-1,jj) + ztmp1(ji,jj) ) * vmask(ji,jj,1)
          ENDDO
       ENDDO
@@ -474,76 +546,24 @@
          emp(:,:)  = (1.0-fr_i(:,:))*emp(:,:)        
       ELSE IF (nsbc ==5) THEN
-! emp_tot is set in sbc_cpl_ice_flx (call from cice_sbc_in above) 
+! emp_tot is set in sbc_cpl_ice_flx (called from cice_sbc_in above) 
+! This is currently as required with the coupling fields from the UM atmosphere
          emp(:,:) = emp_tot(:,:)+tprecip(:,:)*fr_i(:,:) 
       ENDIF
 
-!! ACC this block needs attention. sfx has replaced emps but its meaning is now
-!! different. Need the equivalent of this block:
-!     SELECT CASE( nn_ice_embd )                 ! levitating or embedded sea-ice option
-!       CASE( 0    )   ;   zswitch = 1           ! (0) standard levitating sea-ice : salt exchange only
-!       CASE( 1, 2 )   ;   zswitch = 0           ! (1) levitating sea-ice: salt and volume exchange but no pressure effect
-!                                                ! (2) embedded sea-ice : salt and volume fluxes and pressure
-!     END SELECT
-!
-!     sfx (ji,jj) = zfsalt +                  zswitch  * zcd   ! salt flux (+ C/D if no ice/ocean mass exchange)
-!     emp (ji,jj) = zemp   + zemp_snw + ( 1.- zswitch) * zfmm  ! mass flux (- F/M mass flux if no ice/ocean mass exchange)
-!
-! Here zfsalt is salt flux between ice and ocean due to freezing and melting (PSU/m2/s)
-!      zcd    is the virtual salt flux that appears in the standard levitating case only (0 otherwise)
-!             it generates a change in SSS equivalent to that which would occur if a true mass exchange happened
-!      zemp   is: 
-!              in coupled mode:  net mass flux over the grid cell (ice+ocean area) minus the mass flux intercepted by sea-ice
-!              in forced  mode:  mass flux budget (emp) over open ocean fraction minus liquid precip. over the ice 
-!                                (assumed to instantaneous drain into the ocean).
-!    zemp_snw is the snow melt that enters the ocean as pure water (no associated salt flux) 
-!    zfmm     is freezing minus melting
-!
-! with zswitch = 1 ( nn_ice_embd = 0 ) the results should be equivalent to the original CICE code. 
-
-!!
-! Subtract fluxes from CICE to get freshwater equivalent flux used in 
-! salinity calculation
-      CALL cice2nemo(fresh_gbm,ztmp,'T', 1. )
-      sfx (:,:)=emp(:,:)-ztmp(:,:)
-! Note the 1000.0 is to convert from kg salt to g salt (needed for PSU)
-      CALL cice2nemo(fsalt_gbm,ztmp,'T', 1. )
-      DO jj=1,jpj
-         DO ji=1,jpi
-            IF (sss_m(ji,jj).gt.0.0) THEN
-               sfx (ji,jj)=sfx (ji,jj)+ztmp(ji,jj)*1000.0/sss_m(ji,jj)
-            ENDIF
-         ENDDO
-      ENDDO
-
-! No longer remove precip over ice from free surface calculation on basis that the
-! weight of the precip will affect the free surface even if it falls on the ice
-! (same to the argument that freezing / melting of ice doesn't change the free surface) 
-! Sublimation from the ice is treated in a similar way (included in emp but not sfx )  
-!
-! This should not be done in the variable volume case
-
-
-      IF (.NOT. lk_vvl) THEN
-
-         emp(:,:)  = emp(:,:) - tprecip(:,:)*fr_i(:,:)
-
-! Take sublimation into account
-         IF (nsbc == 5 ) THEN 
-            emp(:,:) = emp(:,:) + ( emp_ice(:,:) + sprecip(:,:) )
-         ELSE IF (nsbc == 2 ) THEN
-            emp(:,:) = emp(:,:) - qla_ice(:,:,1) / Lsub
-         ENDIF
-
-      ENDIF
-!! ACC end of questionable code
-
+      CALL cice2nemo(fresh_gbm,ztmp1,'T', 1. )
+      CALL cice2nemo(fsalt_gbm,ztmp2,'T', 1. )
+
+! Check to avoid unphysical expression when ice is forming (ztmp1 negative)
+! Otherwise we are effectively allowing ice of higher salinity than the ocean to form
+! which has to be compensated for by the ocean salinity potentially going negative
+! This check breaks conservation but seems reasonable until we have prognostic ice salinity
+! Note the 1000.0 below is to convert from kg salt to g salt (needed for PSU)
+      WHERE (ztmp1(:,:).lt.0.0) ztmp2(:,:)=MAX(ztmp2(:,:),ztmp1(:,:)*sss_m(:,:)/1000.0)
+      sfx(:,:)=ztmp2(:,:)*1000.0
+      emp(:,:)=emp(:,:)-ztmp1(:,:)
+ 
       CALL lbc_lnk( emp , 'T', 1. )
-      CALL lbc_lnk( sfx  , 'T', 1. )
-
-!! ACC Now the latent heat for snow melting is already accounted for in the bulk formulea and coupled interfaces.
-!!     For the non-solar heat flux, in LIM2, code changes were needed to account for the heat content of the mass exchanged 
-!      between ice and ocean. It was not necessary to make changes for LIM3 since all mass exchanges are referenced to 
-!      zero degrees; this is most likely to be the case in CICE too??
-!! 
+      CALL lbc_lnk( sfx , 'T', 1. )
+
 ! Solar penetrative radiation and non solar surface heat flux
 
@@ -564,6 +584,6 @@
 ! Now add in ice / snow related terms
 ! [fswthru will be zero unless running with calc_Tsfc=T in CICE]
-      CALL cice2nemo(fswthru_gbm,ztmp,'T', 1. )
-      qsr(:,:)=qsr(:,:)+ztmp(:,:)
+      CALL cice2nemo(fswthru_gbm,ztmp1,'T', 1. )
+      qsr(:,:)=qsr(:,:)+ztmp1(:,:)
       CALL lbc_lnk( qsr , 'T', 1. )
 
@@ -574,6 +594,6 @@
       ENDDO
 
-      CALL cice2nemo(fhocn_gbm,ztmp,'T', 1. )
-      qns(:,:)=qns(:,:)+nfrzmlt(:,:)+ztmp(:,:)
+      CALL cice2nemo(fhocn_gbm,ztmp1,'T', 1. )
+      qns(:,:)=qns(:,:)+nfrzmlt(:,:)+ztmp1(:,:)
 
       CALL lbc_lnk( qns , 'T', 1. )
@@ -583,6 +603,6 @@
       CALL cice2nemo(aice,fr_i,'T', 1. )
       IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
-         DO jpl=1,ncat
-            CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
+         DO jl=1,ncat
+            CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. )
          ENDDO
       ENDIF
@@ -600,7 +620,16 @@
       CALL lbc_lnk ( fr_iv , 'V', 1. )
 
+      !                                      ! embedded sea ice
+      IF( nn_ice_embd /= 0 ) THEN            ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass
+         CALL cice2nemo(vsno(:,:,:),ztmp1,'T', 1. )
+         CALL cice2nemo(vice(:,:,:),ztmp2,'T', 1. )
+         snwice_mass  (:,:) = ( rhosn * ztmp1(:,:) + rhoic * ztmp2(:,:)  )
+         snwice_mass_b(:,:) = snwice_mass(:,:)
+         snwice_fmass (:,:) = ( snwice_mass(:,:) - snwice_mass_b(:,:) ) / dt
+      ENDIF
+
 ! Release work space
 
-      CALL wrk_dealloc( jpi,jpj, ztmp )
+      CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 )
       !
       IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_out')
@@ -619,5 +648,5 @@
       !!---------------------------------------------------------------------
 
-      INTEGER  ::   jpl                        ! dummy loop index
+      INTEGER  ::   jl                        ! dummy loop index
       INTEGER  ::   ierror
 
@@ -642,7 +671,7 @@
 ! Snow and ice thicknesses (CO_2 and CO_3)
 
-      DO jpl = 1,ncat
-         CALL cice2nemo(vsnon(:,:,jpl,:),ht_s(:,:,jpl),'T', 1. )
-         CALL cice2nemo(vicen(:,:,jpl,:),ht_i(:,:,jpl),'T', 1. )
+      DO jl = 1,ncat
+         CALL cice2nemo(vsnon(:,:,jl,:),ht_s(:,:,jl),'T', 1. )
+         CALL cice2nemo(vicen(:,:,jl,:),ht_i(:,:,jl),'T', 1. )
       ENDDO
       !
@@ -812,4 +841,5 @@
       REAL(wp), DIMENSION(jpi,jpj) :: pn
 #if !defined key_nemocice_decomp
+      REAL(wp), DIMENSION(jpiglo,jpjglo) :: png2
       REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg
 #endif
@@ -830,7 +860,7 @@
       ! Copy local domain data from NEMO to CICE field
       pc(:,:,1)=0.0
-      DO jj=2,ny_block
-         DO ji=2,nx_block
-            pc(ji,jj,1)=pn(ji,jj-1)
+      DO jj=2,ny_block-1
+         DO ji=2,nx_block-1
+            pc(ji,jj,1)=pn(ji-1+ji_off,jj-1+jj_off)
          ENDDO
       ENDDO
@@ -856,8 +886,13 @@
 !        pcg(:,:)=0.0
          DO jn=1,jpnij
-            DO jj=1,nlcjt(jn)-1
-               DO ji=2,nlcit(jn)-1
-                  pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)=png(ji,jj,jn)       
+            DO jj=nldjt(jn),nlejt(jn)
+               DO ji=nldit(jn),nleit(jn)
+                  png2(ji+nimppt(jn)-1,jj+njmppt(jn)-1)=png(ji,jj,jn)
                ENDDO
+            ENDDO
+         ENDDO
+         DO jj=1,ny_global
+            DO ji=1,nx_global
+               pcg(ji,jj)=png2(ji+ji_off,jj+jj_off)
             ENDDO
          ENDDO
@@ -954,5 +989,5 @@
       DO jj=1,jpjm1
          DO ji=1,jpim1
-            pn(ji,jj)=pc(ji,jj+1,1)
+            pn(ji,jj)=pc(ji+1-ji_off,jj+1-jj_off,1)
          ENDDO
       ENDDO
@@ -968,11 +1003,13 @@
 ! Need to make sure this is robust to changes in NEMO halo rows....
 ! (may be OK but not spent much time thinking about it)
+! Note that non-existent pcg elements may be used below, but
+! the lbclnk call on pn will replace these with sensible values
 
       IF (nproc==0) THEN
          png(:,:,:)=0.0
          DO jn=1,jpnij
-            DO jj=1,nlcjt(jn)-1
-               DO ji=2,nlcit(jn)-1
-                  png(ji,jj,jn)=pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)      
+            DO jj=nldjt(jn),nlejt(jn)
+               DO ji=nldit(jn),nleit(jn)
+                  png(ji,jj,jn)=pcg(ji+nimppt(jn)-1-ji_off,jj+njmppt(jn)-1-jj_off)
                ENDDO
             ENDDO
Index: branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3489)
+++ branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3508)
@@ -163,6 +163,6 @@
       IF( nn_ice == 4 .AND. ( .NOT. ( cp_cfg == 'orca' ) .OR. lk_agrif ) )   &
          &   CALL ctl_stop( 'CICE sea-ice model currently only available in a global ORCA configuration without AGRIF' )
-      IF( nn_ice == 3 .AND. nn_ice_embd == 0 )   &
-         &   CALL ctl_stop( 'LIM3 sea-ice model requires nn_ice_embd = 2 or 3' )
+      IF( ( nn_ice == 3 .OR. nn_ice == 4 ) .AND. nn_ice_embd == 0 )   &
+         &   CALL ctl_stop( 'LIM3 and CICE sea-ice models require nn_ice_embd = 2 or 3' )
       
       IF( ln_dm2dc )   nday_qsr = -1   ! initialisation flag
