Index: codes/icosagcm/trunk/bld.cfg
===================================================================
--- codes/icosagcm/trunk/bld.cfg	(revision 900)
+++ codes/icosagcm/trunk/bld.cfg	(revision 901)
@@ -52,5 +52,5 @@
 bld::excl_dep        use::netcdf
 bld::excl_dep        use::omp_lib
-bld::excl_dep        inc::mpif.h
+bld::excl_dep        use::mpi
 bld::excl_dep        use::xios
 bld::excl_dep        %USE_IOIPSL
Index: codes/icosagcm/trunk/src/base/abort.F90
===================================================================
--- codes/icosagcm/trunk/src/base/abort.F90	(revision 901)
+++ codes/icosagcm/trunk/src/base/abort.F90	(revision 901)
@@ -0,0 +1,19 @@
+module abort_mod
+  implicit none
+
+  contains
+  
+  !!!Abort execution
+  subroutine dynamico_abort( message )
+    use mpi_mod
+    implicit none
+    character(len=*), optional :: message
+    integer :: ierr
+    
+    !$omp single
+    print *, "Abort !"
+    if(present(message)) print *, message
+    call MPI_Abort(MPI_COMM_WORLD, -1, ierr)
+    !$omp end single
+  end subroutine
+end module
Index: codes/icosagcm/trunk/src/dcmip/dcmip2016_kessler_physic.f90
===================================================================
--- codes/icosagcm/trunk/src/dcmip/dcmip2016_kessler_physic.f90	(revision 900)
+++ codes/icosagcm/trunk/src/dcmip/dcmip2016_kessler_physic.f90	(revision 901)
@@ -73,5 +73,5 @@
   !   Input / output parameters
   !------------------------------------------------
-
+  INTEGER, INTENT(IN) :: nz ! Number of thermodynamic levels in the column
   REAL(8), DIMENSION(nz), INTENT(INOUT) :: &
             theta   ,     & ! Potential temperature (K)
@@ -92,6 +92,4 @@
   REAL(8), INTENT(IN) :: & 
             dt              ! Time step (s)
-
-  INTEGER, INTENT(IN) :: nz ! Number of thermodynamic levels in the column
 
   !------------------------------------------------
Index: codes/icosagcm/trunk/src/initial/etat0_heldsz.f90
===================================================================
--- codes/icosagcm/trunk/src/initial/etat0_heldsz.f90	(revision 900)
+++ codes/icosagcm/trunk/src/initial/etat0_heldsz.f90	(revision 901)
@@ -100,4 +100,5 @@
 
   SUBROUTINE init_Teq
+    USE abort_mod
     USE disvert_mod, ONLY : ap,bp
     REAL(rstd),POINTER :: theta_eq(:,:) 
@@ -150,6 +151,5 @@
 
     ELSE
-       PRINT *, 'Init_Teq called twice'
-       CALL ABORT
+       CALL dynamico_abort( "Init_Teq called twice" )
     END IF
 
Index: codes/icosagcm/trunk/src/initial/etat0_temperature.f90
===================================================================
--- codes/icosagcm/trunk/src/initial/etat0_temperature.f90	(revision 900)
+++ codes/icosagcm/trunk/src/initial/etat0_temperature.f90	(revision 901)
@@ -18,4 +18,5 @@
     USE transfert_omp_mod, ONLY: bcast_omp
     USE free_unit_mod, ONLY : free_unit
+    USE abort_mod
     INTEGER :: unit,ok
     INTEGER :: l
@@ -34,5 +35,5 @@
     IF (ok/=0) THEN
       WRITE(*,*) "getin_etat0 error: input file ",trim(temperature_file)," not found!"
-      CALL ABORT
+      CALL dynamico_abort( "Could not open temperature file." )
     ENDIF
     ! read in t_profile() line by line, starting from first atmospheric
@@ -42,5 +43,5 @@
       IF (ok/=0) THEN
         WRITE(*,*) "getin_etat0 error: failed reading t_profile(l) for l=",l
-        CALL ABORT
+        CALL dynamico_abort( "Could not read temperature file. " )
       ENDIF
     ENDDO
Index: codes/icosagcm/trunk/src/initial/etat0_venus.f90
===================================================================
--- codes/icosagcm/trunk/src/initial/etat0_venus.f90	(revision 900)
+++ codes/icosagcm/trunk/src/initial/etat0_venus.f90	(revision 901)
@@ -150,13 +150,4 @@
                       3.070e-5, 1.525e-5, 7.950e-6,4.500e-6,2.925e-6,  &
                       2.265e-6/
-
-    DO j=jj_begin-1,jj_end+1
-       DO i=ii_begin-1,ii_end+1
-          ij=(j-1)*iim+i
-          CALL xyz2lonlat(xyz_i(ij,:),lon,lat)
-          clat(ij)=cos(lat) 
-       ENDDO
-    ENDDO
-
     data   tempCLee/ 728.187, 715.129, 697.876, 677.284, 654.078, 628.885, &
                      602.225, 574.542, 546.104, 517.339, 488.560, 459.932, &
@@ -171,4 +162,12 @@
                      14.001 , 9.599 , 6.504 , 4.439 , 3.126 , 2.370 ,  &
                      2.000/
+
+    DO j=jj_begin-1,jj_end+1
+       DO i=ii_begin-1,ii_end+1
+          ij=(j-1)*iim+i
+          CALL xyz2lonlat(xyz_i(ij,:),lon,lat)
+          clat(ij)=cos(lat) 
+       ENDDO
+    ENDDO    
       
     pressCLee = etaCLee*9.2e6
Index: codes/icosagcm/trunk/src/parallel/mpi_mod.F90
===================================================================
--- codes/icosagcm/trunk/src/parallel/mpi_mod.F90	(revision 900)
+++ codes/icosagcm/trunk/src/parallel/mpi_mod.F90	(revision 901)
@@ -2,5 +2,6 @@
 
 #ifdef CPP_USING_MPI
-  INCLUDE 'mpif.h'
+  !INCLUDE 'mpif.h'
+  use mpi
 #else
   INTEGER :: MPI_COMM_WORLD
@@ -86,3 +87,8 @@
  SUBROUTINE MPI_GATHER
  END
+ 
+ SUBROUTINE MPI_ABORT(comm, err, ierr)
+   INTEGER :: comm, err, ierr
+   STOP err
+ END
 #endif
Index: codes/icosagcm/trunk/src/parallel/transfert_mpi.f90
===================================================================
--- codes/icosagcm/trunk/src/parallel/transfert_mpi.f90	(revision 900)
+++ codes/icosagcm/trunk/src/parallel/transfert_mpi.f90	(revision 901)
@@ -1121,4 +1121,5 @@
 
   SUBROUTINE send_message_mpi(field,message)
+  USE abort_mod
   USE profiling_mod
   USE field_mod
@@ -1159,5 +1160,5 @@
        PRINT *, 'send_message_mpi : message ' // TRIM(message%name) // &
             ' is still open, no call to wait_message_mpi after last send_message_mpi'
-       CALL ABORT
+       CALL dynamico_abort( "send_message_mpi : message still open" )
     END IF
     message%open=.TRUE. ! will be set to .FALSE. by wait_message_mpi
@@ -2130,8 +2131,7 @@
     USE mpipara
     IMPLICIT NONE
-    
+    INTEGER,INTENT(IN) :: nb
     INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
-
+    
     IF (.NOT. using_mpi) RETURN
 
@@ -2147,7 +2147,6 @@
     USE mpipara
     IMPLICIT NONE
-    
+    INTEGER,INTENT(IN) :: nb
     REAL,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
 
     IF (.NOT. using_mpi) RETURN
@@ -2164,7 +2163,6 @@
     USE mpipara
     IMPLICIT NONE
-    
+    INTEGER,INTENT(IN) :: nb
     LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
 
     IF (.NOT. using_mpi) RETURN
Index: codes/icosagcm/trunk/src/parallel/transfert_omp.f90
===================================================================
--- codes/icosagcm/trunk/src/parallel/transfert_omp.f90	(revision 900)
+++ codes/icosagcm/trunk/src/parallel/transfert_omp.f90	(revision 901)
@@ -827,8 +827,7 @@
   SUBROUTINE bcast_omp_igen(Var,Nb,Buff)
   IMPLICIT NONE
-    
+    INTEGER,INTENT(IN) :: Nb
     INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
-    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
+    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff 
 
     INTEGER :: i
@@ -851,8 +850,7 @@
   SUBROUTINE bcast_omp_rgen(Var,Nb,Buff)
   IMPLICIT NONE
-    
+    INTEGER,INTENT(IN) :: Nb
     REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
-    REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
+    REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff 
 
     INTEGER :: i
@@ -874,9 +872,8 @@
   SUBROUTINE bcast_omp_lgen(Var,Nb,Buff)
   IMPLICIT NONE
-    
+    INTEGER,INTENT(IN) :: Nb
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
     LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
-  
+
     INTEGER :: i
     
Index: codes/icosagcm/trunk/src/vertical/disvert_apbp.f90
===================================================================
--- codes/icosagcm/trunk/src/vertical/disvert_apbp.f90	(revision 900)
+++ codes/icosagcm/trunk/src/vertical/disvert_apbp.f90	(revision 901)
@@ -25,4 +25,5 @@
   SUBROUTINE disvert(ap,bp,presnivs)
 !  USE icosa
+  USE abort_mod
   USE mpipara, ONLY: is_mpi_root
   USE omp_para, ONLY: omp_in_parallel
@@ -46,5 +47,5 @@
     IF (ok/=0) THEN
       WRITE(*,*) "disvert_ap_bp error: input file ",trim(filename)," not found!"
-      CALL ABORT
+      CALL dynamico_abort( "disvert_ap_bp : could not open input file" )
     ENDIF
     ! read in ap() and b() line by line, starting from surface up
@@ -54,5 +55,5 @@
       IF (ok/=0) THEN
         WRITE(*,*) "disvert_ap_bp error: failed reading ap(l) and bp(l) for l=",l
-        CALL ABORT
+        CALL dynamico_abort( "disvert_ap_bp : could not read input file" )
       ENDIF
     ENDDO
