Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4511)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4517)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO
+! 
+! 4511 2020-04-30 12:20:40Z raasch
 ! decycling replaced by explicit setting of lateral boundary conditions
 !
@@ -312,4 +315,5 @@
                 max_pr_user,                                                                       &
                 monotonic_limiter_z,                                                               &
+                restart_data_format_output,                                                        &
                 scalar_advec,                                                                      &
                 timestep_scheme, use_prescribed_profile_data, ws_scheme_sca, air_chemistry
@@ -329,4 +333,7 @@
     USE cpulog,                                                                                    &
         ONLY:  cpu_log, log_point_s
+
+    USE restart_data_mpi_io_mod,                                                                   &
+        ONLY:  rrd_mpi_io, wrd_mpi_io
 
     USE statistics
@@ -501,5 +508,6 @@
 
     INTERFACE chem_rrd_local
-       MODULE PROCEDURE chem_rrd_local
+       MODULE PROCEDURE chem_rrd_local_ftn
+       MODULE PROCEDURE chem_rrd_local_mpi
     END INTERFACE chem_rrd_local
 
@@ -3042,9 +3050,9 @@
 ! Description:
 ! ------------
-!> Subroutine to read restart data of chemical species
-!------------------------------------------------------------------------------!
- SUBROUTINE chem_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,             &
-                            nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,   &
-                            nys_on_file, tmp_3d, found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE chem_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,             &
+                                nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,   &
+                                nys_on_file, tmp_3d, found )
 
     USE control_parameters
@@ -3076,5 +3084,5 @@
 
 
-    IF ( ALLOCATED(chem_species) )  THEN
+    IF ( ALLOCATED( chem_species ) )  THEN
 
        DO  lsp = 1, nspec
@@ -3105,5 +3113,30 @@
 
 
- END SUBROUTINE chem_rrd_local
+ END SUBROUTINE chem_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE chem_rrd_local_mpi
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  lsp !<
+
+    IF ( ALLOCATED( chem_species ) )  THEN
+
+       DO  lsp = 1, nspec
+
+          CALL rrd_mpi_io( TRIM( chem_species(lsp)%name ), chem_species(lsp)%conc )
+          CALL rrd_mpi_io( TRIM( chem_species(lsp)%name )//'_av', chem_species(lsp)%conc_av )
+
+       ENDDO
+
+    ENDIF
+
+ END SUBROUTINE chem_rrd_local_mpi
 
 
@@ -3208,10 +3241,21 @@
     INTEGER(iwp) ::  lsp  !< running index for chem spcs. 
 
-    DO  lsp = 1, nspec
-       CALL wrd_write_string( TRIM( chem_species(lsp)%name ) )
-       WRITE ( 14 )  chem_species(lsp)%conc
-       CALL wrd_write_string( TRIM( chem_species(lsp)%name )//'_av' )
-       WRITE ( 14 )  chem_species(lsp)%conc_av
-    ENDDO
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+       DO  lsp = 1, nspec
+          CALL wrd_write_string( TRIM( chem_species(lsp)%name ) )
+          WRITE ( 14 )  chem_species(lsp)%conc
+          CALL wrd_write_string( TRIM( chem_species(lsp)%name )//'_av' )
+          WRITE ( 14 )  chem_species(lsp)%conc_av
+       ENDDO
+
+    ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' )  THEN
+
+       DO  lsp = 1, nspec
+          CALL wrd_mpi_io( TRIM( chem_species(lsp)%name ), chem_species(lsp)%conc )
+          CALL wrd_mpi_io( TRIM( chem_species(lsp)%name ) // '_av', chem_species(lsp)%conc_av )
+       ENDDO
+
+    ENDIF
 
  END SUBROUTINE chem_wrd_local
