Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diadimg.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 6576)
@@ -124,6 +124,7 @@
 
     CASE DEFAULT
-       IF(lwp) WRITE(numout,*) ' E R R O R : bad cd_type in dia_wri_dimg '
-       STOP 'dia_wri_dimg'
+    
+       WRITE(numout,*) 'dia_wri_dimg : E R R O R : bad cd_type in dia_wri_dimg'
+       CALL ctl_stop( 'STOP', 'dia_wri_dimg :bad cd_type in dia_wri_dimg ' )
 
     END SELECT
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 6576)
@@ -1062,4 +1062,8 @@
       ENDIF
 #endif
+
+      IF (cdfile_name == "output.abort") THEN
+         CALL ctl_stop('STOP', 'NEMO abort from dia_wri_state')
+      END IF
        
 !     IF( nn_timing == 1 )   CALL timing_stop('dia_wri_state') ! not sure this works for routines not called in first timestep
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 6576)
@@ -112,5 +112,5 @@
     IF( inbsel >  jpk ) THEN
        IF(lwp) WRITE(numout,*)  ' STOP inbsel =',inbsel,' is larger than jpk=',jpk
-       STOP
+       CALL ctl_stop('STOP', 'NEMO aborted from dia_wri')
     ENDIF
 
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 6576)
@@ -526,5 +526,5 @@
       IF(lwp) WRITE(numout,*) 'dom_msk_nsa : noslip accurate boundary condition'
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   using Schchepetkin and O Brian scheme'
-      IF( lk_mpp )   CALL ctl_stop( ' mpp version is not yet implemented' )
+      IF( lk_mpp )   CALL ctl_stop('STOP', ' mpp version is not yet implemented' )
 
       ! mask for second order calculation of vorticity
@@ -548,5 +548,5 @@
          WRITE(numout,*) ' symetric boundary conditions need special'
          WRITE(numout,*) ' treatment not implemented. we stop.'
-         STOP
+         CALL ctl_stop('STOP', 'NEMO abort from dom_msk_nsa')
       ENDIF
       
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90	(revision 6576)
@@ -465,7 +465,9 @@
             END DO
          ELSE
-            IF(lwp)WRITE(numout,*) ' ldfguv: kahm= 1 or 2, here =', kahm
-            IF(lwp)WRITE(numout,*) '         We stop'
-            STOP 'ldfguv'
+            
+            WRITE(numout,*) ' ldfguv: kahm= 1 or 2, here =', kahm
+            WRITE(numout,*) '         We stop'
+            CALL ctl_stop('STOP', 'ldfguv: Unexpected kahm value')
+
          ENDIF
          !                                             ! ===============
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 6576)
@@ -62,4 +62,5 @@
    USE lbcnfd         ! north fold treatment
    USE in_out_manager ! I/O manager
+   USE mod_oasis      ! coupling routines
 
    IMPLICIT NONE
@@ -2006,4 +2007,6 @@
 
    SUBROUTINE mppstop
+   
+
       !!----------------------------------------------------------------------
       !!                  ***  routine mppstop  ***
@@ -2015,6 +2018,19 @@
       !!----------------------------------------------------------------------
       !
+      
+#if defined key_oasis3
+      ! If we're trying to shut down cleanly then we need to consider the fact
+      ! that this could be part of an MPMD configuration - we don't want to
+      ! leave other components deadlocked.
+
+      CALL oasis_abort(nproc,"mppstop","NEMO initiated abort")
+
+
+#else
+      
       CALL mppsync
       CALL mpi_finalize( info )
+#endif
+
       !
    END SUBROUTINE mppstop
@@ -3784,5 +3800,5 @@
             WRITE(kout,*)
          ENDIF
-         STOP 'ctl_opn bad opening'
+         CALL ctl_stop ('STOP', 'NEMO abort ctl_opn bad opening')
       ENDIF
 
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 6576)
@@ -31,5 +31,5 @@
    USE in_out_manager               ! I/O manager
    USE lbclnk                       ! ocean lateral boundary conditions (or mpp link)
-
+   
    IMPLICIT NONE
    PRIVATE
@@ -41,4 +41,15 @@
    PUBLIC   cpl_freq
    PUBLIC   cpl_finalize
+#if defined key_mpp_mpi
+   INCLUDE 'mpif.h'
+#endif
+   
+   INTEGER, PARAMETER         :: localRoot  = 0
+   LOGICAL                    :: commRank            ! true for ranks doing OASIS communication
+#if defined key_cpl_rootexchg
+   LOGICAL                    :: rootexchg =.true.   ! logical switch 
+#else
+   LOGICAL                    :: rootexchg =.false.  ! logical switch 
+#endif 
 
    INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
@@ -82,5 +93,6 @@
 
    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   exfld   ! Temporary buffer for receiving
-
+   INTEGER, PUBLIC :: localComm 
+      
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
@@ -120,4 +132,5 @@
       IF ( nerror /= OASIS_Ok ) &
          CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' )
+      localComm = kl_comm 
       !
    END SUBROUTINE cpl_init
@@ -177,10 +190,10 @@
       IF( nerror > 0 ) THEN
          CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld')   ;   RETURN
-      ENDIF
+      ENDIF      
       !
       ! -----------------------------------------------------------------
       ! ... Define the partition 
       ! -----------------------------------------------------------------
-      
+            
       paral(1) = 2                                              ! box partitioning
       paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1)   ! NEMO lower left corner global offset    
@@ -241,5 +254,5 @@
             END DO
          ENDIF
-      END DO
+      END DO      
       !
       ! ... Announce received variables. 
@@ -373,5 +386,5 @@
             IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN
 
-               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )         
+               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )   
                
                llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
@@ -384,5 +397,5 @@
                   kinfo = OASIS_Rcv
                   IF( llfisrt ) THEN 
-                     pdata(nldi:nlei,nldj:nlej,jc) =                                 exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
+                     pdata(nldi:nlei,nldj:nlej,jc) =                                 exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm) 
                      llfisrt = .FALSE.
                   ELSE
@@ -463,7 +476,7 @@
          CALL oasis_get_freqs(id, mop, 1, itmp, info)
 #else
-         CALL oasis_get_freqs(id,      1, itmp, info)
-#endif
-         cpl_freq = itmp(1)
+!         CALL oasis_get_freqs(id,      1, itmp, info)
+         cpl_freq = namflddti( id )
+#endif
       ENDIF
       !
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90	(revision 6576)
@@ -330,7 +330,7 @@
                END DO
             ELSE
-               IF(lwp) WRITE(numout,*) ' ldfght: kaht= 1 or 2, here =', kaht
-               IF(lwp) WRITE(numout,*) '         We stop'
-               STOP 'ldfght'
+               WRITE(numout,*) ' ldfght: kaht= 1 or 2, here =', kaht
+               WRITE(numout,*) '         We stop'
+               CALL ctl_stop( 'STOP', 'ldfght : unexpected kaht value')
             ENDIF
             !                                             ! ===============
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 6576)
@@ -461,4 +461,9 @@
       IF( lk_asminc     )   CALL asm_inc_init   ! Initialize assimilation increments
       IF(lwp) WRITE(numout,*) 'Euler time step switch is ', neuler
+      
+      IF (nstop > 0) THEN
+        CALL CTL_STOP('STOP','Critical errors in NEMO initialisation')
+      END IF
+
       !
    END SUBROUTINE nemo_init
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 6576)
@@ -346,4 +346,5 @@
                                CALL ctl_stop( 'step: indic < 0' )
                                CALL dia_wri_state( 'output.abort', kstp )
+                               CALL ctl_stop('STOP','NEMO failure in stp')
       ENDIF
       IF( kstp == nit000   )   THEN
Index: branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90
===================================================================
--- branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90	(revision 6575)
+++ branches/UKMO/dev_r5518_GC3_couple_pkg/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90	(revision 6576)
@@ -72,4 +72,5 @@
    !!----------------------------------------------------------------------
    USE par_oce        ! ocean parameters
+   USE lib_mpp
 
    IMPLICIT NONE
@@ -483,5 +484,6 @@
          &      .AND. SUM( tree(ii)%ishape ) /= 0 )
          ii = ii + 1
-         IF (ii > jparray) STOP   ! increase the value of jparray (should not be needed as already very big!)
+         IF (ii > jparray) CALL ctl_stop('STOP', 'NEMO aborted wrk_allocbase')
+                           ! increase the value of jparray (should not be needed as already very big!)
       END DO
       
