Index: src/FLEXPART.f90
===================================================================
--- src/FLEXPART.f90	(revision 0c00f1f8af5469692bfe795d126d70d5205ca6f6)
+++ src/FLEXPART.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -52,7 +52,11 @@
   use com_mod
   use conv_mod
-  use netcdf_output_mod, only: writeheader_netcdf
+
   use random_mod, only: gasdev1
   use class_gribfile
+
+#ifdef USE_NCF
+  use netcdf_output_mod, only: writeheader_netcdf
+#endif
 
   implicit none
@@ -352,4 +356,5 @@
   !******************************************************************
 
+#ifdef USE_NCF
   if (lnetcdfout.eq.1) then 
     call writeheader_netcdf(lnest=.false.)
@@ -365,4 +370,5 @@
     endif
   endif
+#endif
 
   if (verbosity.gt.0) then
Index: src/FLEXPART_MPI.f90
===================================================================
--- src/FLEXPART_MPI.f90	(revision 0c00f1f8af5469692bfe795d126d70d5205ca6f6)
+++ src/FLEXPART_MPI.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -53,7 +53,10 @@
   use conv_mod
   use mpi_mod
-  use netcdf_output_mod, only: writeheader_netcdf
   use random_mod, only: gasdev1
   use class_gribfile
+
+#ifdef USE_NCF
+  use netcdf_output_mod, only: writeheader_netcdf
+#endif
 
   implicit none
@@ -378,21 +381,22 @@
 
   if (mp_measure_time) call mpif_mtime('iotime',0)
+
   if (lroot) then ! MPI: this part root process only
-
-  if (lnetcdfout.eq.1) then 
-    call writeheader_netcdf(lnest=.false.)
-  else 
-    call writeheader
-  end if
-
-  if (nested_output.eq.1) then
-    if (lnetcdfout.eq.1) then
-      call writeheader_netcdf(lnest=.true.)
-    else
-      call writeheader_nest
-    endif
-  endif
-
-!
+#ifdef USE_NCF
+    if (lnetcdfout.eq.1) then 
+      call writeheader_netcdf(lnest=.false.)
+    else 
+      call writeheader
+    end if
+    
+    if (nested_output.eq.1) then
+      if (lnetcdfout.eq.1) then
+        call writeheader_netcdf(lnest=.true.)
+      else
+        call writeheader_nest
+      endif
+    endif
+#endif
+
     if (verbosity.gt.0) then
       print*,'call writeheader'
@@ -402,5 +406,5 @@
 ! FLEXPART 9.2 ticket ?? write header in ASCII format 
     call writeheader_txt
-!if (nested_output.eq.1) call writeheader_nest
+
     if (nested_output.eq.1.and.surf_only.ne.1) call writeheader_nest
     if (nested_output.eq.1.and.surf_only.eq.1) call writeheader_nest_surf
@@ -409,6 +413,4 @@
 
   if (mp_measure_time) call mpif_mtime('iotime',0)
-
-  !open(unitdates,file=path(2)(1:length(2))//'dates')
 
   if (verbosity.gt.0 .and. lroot) then
Index: src/makefile
===================================================================
--- src/makefile	(revision ccc9ec26732116bd18049809fcb9b319d3148f23)
+++ src/makefile	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -31,4 +31,8 @@
 #      make [-j] mpi-dbg
 #
+#  NETCDF OUTPUT
+#    To add support for output in netCDF format, append `ncf=yes` to the
+#    `make` command
+# 
 ################################################################################
 
@@ -57,6 +61,5 @@
 	INCPATH2  = ${ROOT_DIR}/include
 	LIBPATH1 = ${ROOT_DIR}/lib
-
-else #ifeq ($(gcc), 5.4)
+else 
 # Compiled libraries under user ~flexpart, gfortran v5.4
 	ROOT_DIR = /homevip/flexpart/
@@ -68,14 +71,14 @@
 	INCPATH2  = /usr/include
 	LIBPATH1 = ${ROOT_DIR}/gcc-5.4.0/lib
-
-#else
-# Default: System libraries at NILU, gfortran v4.6
-#	F90       = /usr/bin/gfortran
-#	MPIF90    = /usr/bin/mpif90.openmpi
-
-#	INCPATH1 = /xnilu_wrk/projects/FLEXPART/flex_wrk/bin64/grib_api/include
-#	INCPATH2 = /usr/include
-#	LIBPATH1 = /xnilu_wrk/projects/FLEXPART/flex_wrk/bin64/grib_api/lib
 endif
+
+
+### Enable netCDF output?
+ifeq ($(ncf), yes)
+	NCOPT = -DUSE_NCF -lnetcdff	
+else
+	NCOPT = -UUSE_NCF
+endif
+
 
 
@@ -89,9 +92,10 @@
 
 ## LIBRARIES
-LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff # -fopenmp
-
-FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(FUSER)  #-Warray-bounds -fcheck=all # -march=native
-
-DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) -fbacktrace   -Wall  -fdump-core $(FUSER)  #  -ffpe-trap=invalid,overflow,denormal,underflow,zero  -Warray-bounds -fcheck=all
+#LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff
+LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper $(NCOPT)
+
+FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(NCOPT) $(FUSER)  #-Warray-bounds -fcheck=all # -march=native
+
+DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) $(NCOPT) -fbacktrace   -Wall  -fdump-core $(FUSER)  #  -ffpe-trap=invalid,overflow,denormal,underflow,zero  -Warray-bounds -fcheck=all
 
 LDFLAGS  = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
@@ -139,4 +143,6 @@
 	getfields_mpi.o \
         readwind_ecmwf_mpi.o 
+
+OBJECTS_NCF = netcdf_output_mod.o
 
 OBJECTS = \
@@ -196,5 +202,9 @@
 dynamic_viscosity.o     get_settling.o	\
 initialize_cbl_vel.o	re_initialize_particle.o \
-cbl.o			netcdf_output_mod.o
+cbl.o
+
+ifeq ($(ncf), yes)
+	OBJECTS	:= $(OBJECTS) $(OBJECTS_NCF)
+endif
 
 %.o: %.mod
Index: src/par_mod.f90
===================================================================
--- src/par_mod.f90	(revision 1f55de112203dabf395a482fc839e770d3d09b1d)
+++ src/par_mod.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -148,5 +148,6 @@
   ! ECMWF
 ! integer,parameter :: nxmax=361,nymax=181,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=359 ! 1.0 degree 92 level
-  integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 1.0 degree 138 level
+!  integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 1.0 degree 138 level
+  integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=0 ! 1.0 degree 138 level
 ! integer,parameter :: nxmax=721,nymax=361,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359  ! 0.5 degree 138 level
 !  integer,parameter :: nxmax=181,nymax=91,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=0  ! CERA 2.0 degree 92 level
@@ -209,5 +210,5 @@
   !integer,parameter :: maxxgrid=361,maxygrid=181,maxxgridn=0,maxygridn=0)
 
-  integer,parameter :: maxreceptor=20
+  integer,parameter :: maxreceptor=200
 
   ! maxreceptor             maximum number of receptor points
@@ -218,6 +219,6 @@
   !**************************************************
 
-  integer,parameter :: maxpart=100000
-  integer,parameter :: maxspec=1
+  integer,parameter :: maxpart=3000000						
+  integer,parameter :: maxspec=6
 
   real,parameter :: minmass=0.0001
@@ -262,5 +263,5 @@
   !*********************************
 
-  integer,parameter :: maxrand=1000000
+  integer,parameter :: maxrand=200000000
 
   ! maxrand                 number of random numbers used
Index: src/readOHfield.f90
===================================================================
--- src/readOHfield.f90	(revision b1e0742119e850a6661e6803fa50a653d506e564)
+++ src/readOHfield.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -95,5 +95,4 @@
   read(unitOH) ((((OH_field(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,12)
   read(unitOH) ((((OH_hourly(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,2)
-  write(*,*) 'nzOH: ',nzOH,(altOH(i),i=1,nzOH) 
 
 end subroutine readOHfield
Index: src/readcommand.f90
===================================================================
--- src/readcommand.f90	(revision 01e60525c4830ea98f0acaa4ca0894f3845020a9)
+++ src/readcommand.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -392,13 +392,14 @@
   endif
 
-!  check for netcdf output switch (use for non-namelist input only!)
+! Check for netcdf output switch
+!*******************************
   if (iout.ge.8) then
      lnetcdfout = 1
      iout = iout - 8
-! #ifndef NETCDF_OUTPUT
-!      print*,'ERROR: netcdf output not activated during compile time but used in COMMAND file!'
-!      print*,'Please recompile with netcdf library or use standard output format.'
-!      stop
-! #endif
+#ifndef USE_NCF
+     write(*,*) 'ERROR: netcdf output not activated during compile time but used in COMMAND file!'
+     write(*,*) 'Please recompile with netcdf library (`make [...] ncf=yes`) or use standard output format.'
+     stop
+#endif
   endif
 
Index: src/timemanager.f90
===================================================================
--- src/timemanager.f90	(revision fe32dca5c7e5a54238ac82b1dab620991c979f5c)
+++ src/timemanager.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -101,6 +101,8 @@
   use par_mod
   use com_mod
+#ifdef USE_NCF
   use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,&
        &concoutput_surf_netcdf,concoutput_surf_nest_netcdf
+#endif
 
   implicit none
@@ -389,5 +391,7 @@
           if (surf_only.ne.1) then 
             if (lnetcdfout.eq.1) then 
+#ifdef USE_NCF
               call concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
+#endif
             else 
               call concoutput(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
@@ -399,6 +403,8 @@
              write(*,*) 'system clock',count_clock - count_clock0   
             endif
-            if (lnetcdfout.eq.1) then 
+            if (lnetcdfout.eq.1) then
+#ifdef USE_NCF
               call concoutput_surf_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
+#endif
             else
               call concoutput_surf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
@@ -419,4 +425,5 @@
               endif
             else
+#ifdef USE_NCF
               if (surf_only.ne.1) then
                 call concoutput_nest_netcdf(itime,outnum)
@@ -424,4 +431,5 @@
                 call concoutput_surf_nest_netcdf(itime,outnum)
               endif
+#endif
             endif
           endif
Index: src/timemanager_mpi.f90
===================================================================
--- src/timemanager_mpi.f90	(revision b1e0742119e850a6661e6803fa50a653d506e564)
+++ src/timemanager_mpi.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
@@ -102,6 +102,8 @@
   use com_mod
   use mpi_mod
+#ifdef USE_NCF
   use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,&
        &concoutput_surf_netcdf,concoutput_surf_nest_netcdf
+#endif
 
   implicit none
@@ -481,6 +483,8 @@
             if (lroot) then
               if (lnetcdfout.eq.1) then 
+#ifdef USE_NCF
                 call concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,&
                      &drygridtotalunc)
+#endif
               else 
                 call concoutput(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
@@ -494,6 +498,8 @@
             if (lroot) then
               if (lnetcdfout.eq.1) then
+#ifdef USE_NCF
                 call concoutput_surf_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,&
                      &drygridtotalunc)
+#endif
               else
                 call concoutput_surf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
@@ -513,5 +519,5 @@
             call mpif_tm_reduce_grid_nest
  
-           if (mp_measure_time) call mpif_mtime('iotime',0)
+            if (mp_measure_time) call mpif_mtime('iotime',0)
 
             if (lnetcdfout.eq.0) then
@@ -526,9 +532,7 @@
               else  ! :TODO: check for zeroing in the netcdf module
                 call concoutput_surf_nest(itime,outnum)
-
               end if
-
             else
-
+#ifdef USE_NCF
               if (surf_only.ne.1) then
                 if (lroot) then              
@@ -544,10 +548,7 @@
                 end if
               endif
-
-
+#endif
             end if
           end if
-          
-
           outnum=0.
         endif
