Index: branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diadimg.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 5675)
@@ -124,6 +124,6 @@
 
     CASE DEFAULT
-       IF(lwp) WRITE(numout,*) ' E R R O R : bad cd_type in dia_wri_dimg '
-       STOP 'dia_wri_dimg'
+       IF(lwp) WRITE(numout,*) ' E R R O R : bad cd_type in dia_wri_dimg ',cd_type
+       CALL ctl_stop('STOP', 'NEMO aborted from dia_wri_dimg')
 
     END SELECT
Index: branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 5675)
@@ -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_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 5675)
@@ -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_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 5675)
@@ -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_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90	(revision 5675)
@@ -467,5 +467,5 @@
             IF(lwp)WRITE(numout,*) ' ldfguv: kahm= 1 or 2, here =', kahm
             IF(lwp)WRITE(numout,*) '         We stop'
-            STOP 'ldfguv'
+            CALL ctl_stop( 'STOP', 'NEMO abort ldfguv')
          ENDIF
          !                                             ! ===============
Index: branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 5675)
@@ -2006,4 +2006,12 @@
 
    SUBROUTINE mppstop
+   
+#if defined key_oasis3 || defined key_oasis3mct
+
+#if defined key_oasis3mct
+   USE mod_oasis
+#endif
+
+#endif
       !!----------------------------------------------------------------------
       !!                  ***  routine mppstop  ***
@@ -2015,7 +2023,17 @@
       !!----------------------------------------------------------------------
       !
+#if defined key_oasis3 || defined key_oasis3mct
+      ! 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 +3802,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_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90	(revision 5675)
@@ -332,5 +332,5 @@
                IF(lwp) WRITE(numout,*) ' ldfght: kaht= 1 or 2, here =', kaht
                IF(lwp) WRITE(numout,*) '         We stop'
-               STOP 'ldfght'
+               CALL ctl_stop ('STOP', 'NEMO abort ldfght')
             ENDIF
             !                                             ! ===============
Index: branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 5675)
@@ -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_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90
===================================================================
--- branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90	(revision 5674)
+++ branches/UKMO/dev_r5518_clean_shutdown/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90	(revision 5675)
@@ -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
       
