Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 4039)
+++ palm/trunk/SOURCE/Makefile	(revision 4043)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Delete droplet_interactions_ptq
+#
+# 4039 2019-06-18 10:32:41Z suehring
 # add dependency for diagnostic output quantities
 # 
@@ -622,5 +625,4 @@
 	init_slope.f90 \
 	init_vertical_profiles.f90 \
-	interaction_droplets_ptq.f90 \
 	lagrangian_particle_model_mod.f90 \
 	land_surface_model_mod.f90 \
@@ -1121,8 +1123,4 @@
 	modules.o \
 	mod_kinds.o
-interaction_droplets_ptq.o: \
-	basic_constants_and_equations_mod.o \
-	mod_kinds.o \
-	modules.o
 lagrangian_particle_model_mod.o: \
 	basic_constants_and_equations_mod.o \
@@ -1543,5 +1541,5 @@
 	disturb_heatflux.o \
 	indoor_model_mod.o \
-	interaction_droplets_ptq.o \
+	lagrangian_particle_model_mod.o \
 	land_surface_model_mod.o \
 	large_scale_forcing_nudging_mod.o \
Index: palm/trunk/SOURCE/interaction_droplets_ptq.f90
===================================================================
--- palm/trunk/SOURCE/interaction_droplets_ptq.f90	(revision 4039)
+++ 	(revision )
@@ -1,181 +1,0 @@
-!> @file interaction_droplets_ptq.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Modularization of all bulk cloud physics code components
-! 
-! 3040 2018-05-25 10:22:08Z schwenkel
-! Changed the name specific humidity to mixing ratio
-! 
-! 2718 2018-01-02 08:49:38Z maronga
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2233 2017-05-30 18:08:54Z suehring
-!
-! 2232 2017-05-30 17:47:52Z suehring
-! Adjustments to new topography concept
-! 
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1873 2016-04-18 14:50:06Z maronga
-! Module renamed (removed _mod)
-! 
-! 
-! 1850 2016-04-08 13:29:27Z maronga
-! Module renamed
-! 
-! 
-! 1845 2016-04-08 08:29:13Z raasch
-! nzb_2d replaced by nzb_s_inner
-!
-! 1822 2016-04-07 07:49:42Z hoffmann
-! Unused variables removed.
-!
-! 1779 2016-03-03 08:01:28Z raasch
-! bugfix: module procedure names shortened to avoid Intel compiler warnings
-! about too long names
-!
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! ONLY-attribute added to USE-statements,
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 799 2011-12-21 17:48:03Z franke
-! Bugfix: d_exner(k) was missing in calculation of pt_p
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.1  2005/06/26 19:57:47  raasch
-! Initial revision
-!
-!
-! Description:
-! ------------
-!> Release of latent heat and change of mixing ratio due to condensation /
-!> evaporation of droplets.
-!------------------------------------------------------------------------------!
- MODULE interaction_droplets_ptq_mod
- 
-
-    USE arrays_3d,                                                             &
-        ONLY:  pt_p, ql_c, q_p, d_exner
-
-    USE basic_constants_and_equations_mod,                                     &
-        ONLY:  lv_d_cp
-
-    USE indices,                                                               &
-        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
-
-    USE kinds
-
-    USE pegrid
-
-    PRIVATE
-    PUBLIC interaction_droplets_ptq
-
-    INTERFACE interaction_droplets_ptq
-!
-!--    Internal names shortened in order ro avoid Intel compiler messages
-!--    about too long names
-       MODULE PROCEDURE i_droplets_ptq
-       MODULE PROCEDURE i_droplets_ptq_ij
-    END INTERFACE interaction_droplets_ptq
- 
- CONTAINS
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for all grid points
-!------------------------------------------------------------------------------!
-    SUBROUTINE i_droplets_ptq
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i    !< running index x direction
-       INTEGER(iwp) ::  j    !< running index y direction 
-       INTEGER(iwp) ::  k    !< running index z direction
-
-       REAL(wp) ::  flag     !< flag to mask topography grid points
- 
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
-             DO  k = nzb+1, nzt
-!
-!--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
-
-                q_p(k,j,i)  = q_p(k,j,i)  - ql_c(k,j,i) * flag
-                pt_p(k,j,i) = pt_p(k,j,i) + lv_d_cp * ql_c(k,j,i) * d_exner(k) &
-                                                        * flag
-             ENDDO
-          ENDDO
-       ENDDO
-
-    END SUBROUTINE i_droplets_ptq
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for grid point i,j
-!------------------------------------------------------------------------------!
-    SUBROUTINE i_droplets_ptq_ij( i, j )
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i    !< running index x direction
-       INTEGER(iwp) ::  j    !< running index y direction 
-       INTEGER(iwp) ::  k    !< running index z direction
-
-       REAL(wp) ::  flag     !< flag to mask topography grid points
-
-
-       DO  k = nzb+1, nzt
-!
-!--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
-
-          q_p(k,j,i)  = q_p(k,j,i)  - ql_c(k,j,i) * flag
-          pt_p(k,j,i) = pt_p(k,j,i) + lv_d_cp * ql_c(k,j,i) * d_exner(k) * flag
-       ENDDO
-
-    END SUBROUTINE i_droplets_ptq_ij
-
- END MODULE interaction_droplets_ptq_mod
Index: palm/trunk/SOURCE/lagrangian_particle_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4039)
+++ palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4043)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove min_nr_particle, Add lpm_droplet_interactions_ptq into module
+! 
+! 4028 2019-06-13 12:21:37Z schwenkel
 ! Further modularization of particle code components
 ! 
@@ -160,18 +163,19 @@
 !------------------------------------------------------------------------------!
  MODULE lagrangian_particle_model_mod
-        
+
     USE, INTRINSIC ::  ISO_C_BINDING
-        
+
     USE arrays_3d,                                                             &
         ONLY:  de_dx, de_dy, de_dz, dzw, zu, zw,  ql_c, ql_v, ql_vp, hyp,      &
-               pt, q, exner, ql, diss, e, u, v, w, km, ql_1, ql_2     
+               pt, q, exner, ql, diss, e, u, v, w, km, ql_1, ql_2, pt_p, q_p,  &
+               d_exner
  
     USE averaging,                                                             &
         ONLY:  ql_c_av, pr_av, pc_av, ql_vp_av, ql_v_av
-        
+
     USE basic_constants_and_equations_mod,                                     &
         ONLY: molecular_weight_of_solute, molecular_weight_of_water, magnus,   &
-              pi, rd_d_rv, rho_l, r_v, rho_s, vanthoff, l_v, kappa, g                
-        
+              pi, rd_d_rv, rho_l, r_v, rho_s, vanthoff, l_v, kappa, g, lv_d_cp
+
     USE control_parameters,                                                    &
         ONLY:  bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, bc_dirichlet_s, &
@@ -186,15 +190,15 @@
     USE cpulog,                                                                &
         ONLY:  cpu_log, log_point, log_point_s
-        
+
     USE indices,                                                               &
         ONLY:  nx, nxl, nxlg, nxrg, nxr, ny, nyn, nys, nyng, nysg, nz, nzb,    &
-               nzb_max, nzt, wall_flags_0,nbgp, ngp_2dh_outer               
-        
+               nzb_max, nzt, wall_flags_0,nbgp, ngp_2dh_outer
+
     USE kinds
-           
+
     USE pegrid
-    
+
     USE particle_attributes
-    
+
     USE pmc_particle_interface,                                                &
         ONLY: pmcp_c_get_particle_from_parent, pmcp_p_fill_particle_win,       &
@@ -213,15 +217,15 @@
                id_var_dopts, id_var_time_pts, nc_stat,                         &
                netcdf_handle_error
-             
+
     USE random_function_mod,                                                   &
         ONLY:  random_function
-                   
+
     USE statistics,                                                            &
-        ONLY:  hom                    
+        ONLY:  hom
 
     USE surface_mod,                                                           &
         ONLY:  get_topography_top_index_ji, surf_def_h, surf_lsm_h, surf_usm_h,&
                bc_h
-        
+
 #if defined( __parallel )  &&  !defined( __mpifh )
     USE MPI
@@ -236,6 +240,17 @@
 #endif
 
+
+     USE arrays_3d,                                                             &
+        ONLY:
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+
+    USE kinds
+
+    USE pegrid
+
     IMPLICIT NONE
-    
+
     CHARACTER(LEN=15) ::  aero_species = 'nacl'                    !< aerosol species
     CHARACTER(LEN=15) ::  aero_type    = 'maritime'                !< aerosol type
@@ -245,5 +260,5 @@
     CHARACTER(LEN=15) ::  bc_par_t     = 'absorb'                  !< top boundary condition
     CHARACTER(LEN=15) ::  collision_kernel   = 'none'              !< collision kernel    
-    
+
     CHARACTER(LEN=5)  ::  splitting_function = 'gamma'             !< function for calculation critical weighting factor
     CHARACTER(LEN=5)  ::  splitting_mode     = 'const'             !< splitting mode
@@ -260,5 +275,4 @@
     INTEGER(iwp) ::  particles_per_point = 1                      !< namelist parameter (see documentation)
     INTEGER(iwp) ::  radius_classes = 20                          !< namelist parameter (see documentation)
-    
     INTEGER(iwp) ::  splitting_factor = 2                         !< namelist parameter (see documentation)
     INTEGER(iwp) ::  splitting_factor_max = 5                     !< namelist parameter (see documentation)
@@ -272,6 +286,6 @@
     INTEGER(iwp) ::  trsp_count_recv_sum                          !< parameter for particle exchange of PEs
     INTEGER(iwp) ::  trnp_count_sum                               !< parameter for particle exchange of PEs
-    INTEGER(iwp) ::  trnp_count_recv_sum                          !< parameter for particle exchange of PEs   
-    
+    INTEGER(iwp) ::  trnp_count_recv_sum                          !< parameter for particle exchange of PEs
+
     LOGICAL ::  lagrangian_particle_model = .FALSE.       !< namelist parameter (see documentation) 
     LOGICAL ::  curvature_solution_effects = .FALSE.      !< namelist parameter (see documentation)
@@ -285,7 +299,7 @@
     LOGICAL ::  use_kernel_tables = .FALSE.               !< parameter, which turns on the use of precalculated collision kernels
     LOGICAL ::  write_particle_statistics = .FALSE.       !< namelist parameter (see documentation)
-    
+
     LOGICAL, DIMENSION(max_number_of_particle_groups) ::   vertical_particle_advection = .TRUE. !< Switch for vertical particle transport
-    
+
     REAL(wp) ::  aero_weight = 1.0_wp                      !< namelist parameter (see documentation)
     REAL(wp) ::  dt_min_part = 0.0002_wp                   !< minimum particle time step when SGS velocities are used (s)
@@ -306,10 +320,10 @@
     REAL(wp) ::  weight_factor_split = -1.0_wp             !< namelist parameter (see documentation)
     REAL(wp) ::  z0_av_global                              !< horizontal mean value of z0
-    
+
     REAL(wp) ::  rclass_lbound !<
     REAL(wp) ::  rclass_ubound !<
 
     REAL(wp), PARAMETER ::  c_0 = 3.0_wp         !< parameter for lagrangian timescale
-    
+
     REAL(wp), DIMENSION(max_number_of_particle_groups) ::  density_ratio = 9999999.9_wp  !< namelist parameter (see documentation)
     REAL(wp), DIMENSION(max_number_of_particle_groups) ::  pdx = 9999999.9_wp            !< namelist parameter (see documentation)
@@ -325,5 +339,5 @@
 
     REAL(wp), DIMENSION(:), ALLOCATABLE     ::  log_z_z0   !< Precalculate LOG(z/z0)  
-    
+
     INTEGER(iwp), PARAMETER ::  NR_2_direction_move = 10000 !<
     INTEGER(iwp)            ::  nr_move_north               !<
@@ -332,12 +346,12 @@
     TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  move_also_north
     TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  move_also_south
-    
-    REAL(wp) ::  epsilon       !<
-    REAL(wp) ::  urms          !<
+
+    REAL(wp) ::  epsilon_collision !<
+    REAL(wp) ::  urms              !<
 
     REAL(wp), DIMENSION(:),   ALLOCATABLE ::  epsclass  !< dissipation rate class
     REAL(wp), DIMENSION(:),   ALLOCATABLE ::  radclass  !< radius class
     REAL(wp), DIMENSION(:),   ALLOCATABLE ::  winf      !<
-    
+
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ec        !<
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ecf       !<
@@ -345,20 +359,21 @@
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  hkernel   !<
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  hwratio   !<
-        
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ckernel !<        
-        
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ckernel !<
+
     INTEGER(iwp), PARAMETER         :: PHASE_INIT    = 1  !<
     INTEGER(iwp), PARAMETER, PUBLIC :: PHASE_RELEASE = 2  !<
 
     SAVE
-    
+
     PRIVATE
-    
+
     PUBLIC lpm_parin,     &
            lpm_header,    &
-           lpm_init_arrays,&           
+           lpm_init_arrays,&
            lpm_init,      &
            lpm_actions,   &
-           lpm_data_output_ptseries, &           
+           lpm_data_output_ptseries, &
+           lpm_interaction_droplets_ptq, &
            lpm_rrd_local_particles, &
            lpm_wrd_local, &
@@ -368,13 +383,5 @@
            lpm_check_parameters
 
-    PUBLIC lagrangian_particle_model, & 
-           max_number_particles_per_gridbox, &
-           radius_merge, &
-           radius_split, &
-           splitting_factor, &
-           splitting_factor_max, &
-           weight_factor_merge, &
-           weight_factor_split
-           
+    PUBLIC lagrangian_particle_model
 
     INTERFACE lpm_check_parameters
@@ -384,78 +391,83 @@
     INTERFACE lpm_parin
        MODULE PROCEDURE lpm_parin
-    END INTERFACE lpm_parin    
-    
+    END INTERFACE lpm_parin
+
     INTERFACE lpm_header
        MODULE PROCEDURE lpm_header
     END INTERFACE lpm_header
-    
+
     INTERFACE lpm_init_arrays
        MODULE PROCEDURE lpm_init_arrays
-    END INTERFACE lpm_init_arrays             
+    END INTERFACE lpm_init_arrays
  
     INTERFACE lpm_init
        MODULE PROCEDURE lpm_init
-    END INTERFACE lpm_init        
-    
+    END INTERFACE lpm_init
+
     INTERFACE lpm_actions
        MODULE PROCEDURE lpm_actions
     END INTERFACE lpm_actions
-    
+
     INTERFACE lpm_data_output_ptseries
        MODULE PROCEDURE lpm_data_output_ptseries
     END INTERFACE
-        
+
     INTERFACE lpm_rrd_local_particles
        MODULE PROCEDURE lpm_rrd_local_particles
-    END INTERFACE lpm_rrd_local_particles    
-        
+    END INTERFACE lpm_rrd_local_particles
+
     INTERFACE lpm_rrd_global
        MODULE PROCEDURE lpm_rrd_global
     END INTERFACE lpm_rrd_global
-    
+
     INTERFACE lpm_rrd_local
        MODULE PROCEDURE lpm_rrd_local
-    END INTERFACE lpm_rrd_local        
+    END INTERFACE lpm_rrd_local
 
     INTERFACE lpm_wrd_local
        MODULE PROCEDURE lpm_wrd_local
     END INTERFACE lpm_wrd_local
-    
+
     INTERFACE lpm_wrd_global
        MODULE PROCEDURE lpm_wrd_global
-    END INTERFACE lpm_wrd_global    
-        
+    END INTERFACE lpm_wrd_global
+
     INTERFACE lpm_advec
        MODULE PROCEDURE lpm_advec
     END INTERFACE lpm_advec
-    
+
     INTERFACE lpm_calc_liquid_water_content
        MODULE PROCEDURE lpm_calc_liquid_water_content
     END INTERFACE
-    
+
+    INTERFACE lpm_interaction_droplets_ptq
+       MODULE PROCEDURE lpm_interaction_droplets_ptq
+       MODULE PROCEDURE lpm_interaction_droplets_ptq_ij
+    END INTERFACE lpm_interaction_droplets_ptq
+
     INTERFACE lpm_boundary_conds
        MODULE PROCEDURE lpm_boundary_conds
     END INTERFACE lpm_boundary_conds
-    
+
     INTERFACE lpm_droplet_condensation
        MODULE PROCEDURE lpm_droplet_condensation
     END INTERFACE
-    
+
     INTERFACE lpm_droplet_collision
        MODULE PROCEDURE lpm_droplet_collision
     END INTERFACE lpm_droplet_collision
-    
+
     INTERFACE lpm_init_kernels
        MODULE PROCEDURE lpm_init_kernels
     END INTERFACE lpm_init_kernels
-    
+
     INTERFACE lpm_splitting
        MODULE PROCEDURE lpm_splitting
     END INTERFACE lpm_splitting
-    
+
     INTERFACE lpm_merging
        MODULE PROCEDURE lpm_merging
     END INTERFACE lpm_merging
-    
+
     INTERFACE lpm_exchange_horiz
        MODULE PROCEDURE lpm_exchange_horiz
@@ -473,5 +485,5 @@
        MODULE PROCEDURE dealloc_particles_array
     END INTERFACE dealloc_particles_array
-    
+
     INTERFACE lpm_sort_in_subboxes
        MODULE PROCEDURE lpm_sort_in_subboxes
@@ -481,11 +493,9 @@
        MODULE PROCEDURE lpm_sort_timeloop_done
     END INTERFACE lpm_sort_timeloop_done
-    
+
     INTERFACE lpm_pack
        MODULE PROCEDURE lpm_pack
     END INTERFACE lpm_pack
-    
-    
-    
+
  CONTAINS
  
@@ -499,9 +509,9 @@
  
     CHARACTER (LEN=80) ::  line  !<
-    
+
     NAMELIST /particles_par/ &
        aero_species, &
        aero_type, &
-       aero_weight, &       
+       aero_weight, &
        alloc_factor, &
        bc_par_b, &
@@ -523,5 +533,4 @@
        max_number_particles_per_gridbox, &
        merging, &
-       min_nr_particle, &
        na, &
        number_concentration, &
@@ -559,9 +568,9 @@
        weight_factor_split, &
        write_particle_statistics
-                                  
-    NAMELIST /particle_parameters/ &
+
+       NAMELIST /particle_parameters/ &
        aero_species, &
        aero_type, &
-       aero_weight, &       
+       aero_weight, &
        alloc_factor, &
        bc_par_b, &
@@ -583,5 +592,4 @@
        max_number_particles_per_gridbox, &
        merging, &
-       min_nr_particle, &
        na, &
        number_concentration, &
@@ -619,5 +627,5 @@
        weight_factor_split, &
        write_particle_statistics
-       
+
 !
 !-- Position the namelist-file at the beginning (it was already opened in
@@ -657,6 +665,5 @@
 !-- Read user-defined namelist
     READ ( 11, particles_par, ERR = 13, END = 14 )
-    
-    
+
     message_string = 'namelist particles_par is deprecated and will be ' //    &
                      'removed in near future. Please use namelist ' //         &
@@ -1390,7 +1397,7 @@
                          alloc_size = MAX( INT( local_count(kp,jp,ip) *        &
                             ( 1.0_wp + alloc_factor / 100.0_wp ) ),            &
-                            min_nr_particle )
+                            1 )
                       ELSE
-                         alloc_size = min_nr_particle
+                         alloc_size = 1
                       ENDIF
                       ALLOCATE(grid_particles(kp,jp,ip)%particles(1:alloc_size))
@@ -1402,5 +1409,5 @@
                          new_size   = local_count(kp,jp,ip) + prt_count(kp,jp,ip)
                          alloc_size = MAX( INT( new_size * ( 1.0_wp +          &
-                            alloc_factor / 100.0_wp ) ), min_nr_particle )
+                            alloc_factor / 100.0_wp ) ), 1 )
                          IF( alloc_size > SIZE( grid_particles(kp,jp,ip)%particles) )  THEN
                             CALL realloc_particles_array(ip,jp,kp,alloc_size)
@@ -2867,5 +2874,5 @@
 !
 !-- If less particles are stored on the restart file than prescribed by
-!-- min_nr_particle, the remainder is initialized by zero_particle to avoid
+!-- 1, the remainder is initialized by zero_particle to avoid
 !-- errors.
     zero_particle = particle_type( 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp,     &
@@ -2894,7 +2901,7 @@
                 alloc_size = MAX( INT( number_of_particles *                   &
                              ( 1.0_wp + alloc_factor / 100.0_wp ) ),           &
-                             min_nr_particle )
+                             1 )
              ELSE
-                alloc_size = min_nr_particle
+                alloc_size = 1
              ENDIF
 
@@ -3080,6 +3087,6 @@
 
  END SUBROUTINE lpm_wrd_local
- 
- 
+
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -3321,5 +3328,5 @@
                 u_int(n) = -usws_int / ( us_int * kappa + 1E-10_wp )           & 
                             * log_z_z0_int - u_gtrans
-                
+
              ENDIF
 !
@@ -3494,8 +3501,8 @@
 !-- velocities
     IF ( use_sgs_for_particles  .AND.  .NOT. cloud_droplets )  THEN
-    
+
        DO  nb = 0,7
-         
-          subbox_at_wall = .FALSE.         
+
+          subbox_at_wall = .FALSE.
 !
 !--       In case of topography check if subbox is adjacent to a wall
@@ -3519,5 +3526,5 @@
 !
 !--          Set flag for stochastic equation.
-             term_1_2(start_index(nb):end_index(nb)) = 0.0_wp             
+             term_1_2(start_index(nb):end_index(nb)) = 0.0_wp
           ELSE
              i = ip + block_offset(nb)%i_off
@@ -4897,6 +4904,64 @@
 
  END SUBROUTINE lpm_droplet_condensation
- 
- 
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Release of latent heat and change of mixing ratio due to condensation /
+!> evaporation of droplets.
+!------------------------------------------------------------------------------!
+ SUBROUTINE lpm_interaction_droplets_ptq
+
+    INTEGER(iwp) ::  i    !< running index x direction
+    INTEGER(iwp) ::  j    !< running index y direction
+    INTEGER(iwp) ::  k    !< running index z direction
+
+    REAL(wp) ::  flag     !< flag to mask topography grid points
+
+    DO  i = nxl, nxr
+       DO  j = nys, nyn
+          DO  k = nzb+1, nzt
+!
+!--          Predetermine flag to mask topography
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+
+             q_p(k,j,i)  = q_p(k,j,i)  - ql_c(k,j,i) * flag
+             pt_p(k,j,i) = pt_p(k,j,i) + lv_d_cp * ql_c(k,j,i) * d_exner(k) &
+                                                     * flag
+          ENDDO
+       ENDDO
+    ENDDO
+
+ END SUBROUTINE lpm_interaction_droplets_ptq
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Release of latent heat and change of mixing ratio due to condensation /
+!> evaporation of droplets. Call for grid point i,j
+!------------------------------------------------------------------------------!
+ SUBROUTINE lpm_interaction_droplets_ptq_ij( i, j )
+
+    INTEGER(iwp) ::  i    !< running index x direction
+    INTEGER(iwp) ::  j    !< running index y direction
+    INTEGER(iwp) ::  k    !< running index z direction
+
+    REAL(wp) ::  flag     !< flag to mask topography grid points
+
+
+    DO  k = nzb+1, nzt
+!
+!--    Predetermine flag to mask topography
+       flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+
+       q_p(k,j,i)  = q_p(k,j,i)  - ql_c(k,j,i) * flag
+       pt_p(k,j,i) = pt_p(k,j,i) + lv_d_cp * ql_c(k,j,i) * d_exner(k) * flag
+    ENDDO
+
+ END SUBROUTINE lpm_interaction_droplets_ptq_ij
+
+
 !------------------------------------------------------------------------------! 
 ! Description:
@@ -4956,5 +5021,5 @@
  END SUBROUTINE lpm_calc_liquid_water_content
 
- 
+
 !------------------------------------------------------------------------------! 
 ! Description:
@@ -4975,5 +5040,5 @@
 !------------------------------------------------------------------------------! 
  SUBROUTINE lpm_droplet_collision (i,j,k)
-    
+
     INTEGER(iwp), INTENT(IN) ::  i        !<
     INTEGER(iwp), INTENT(IN) ::  j        !<
@@ -4988,5 +5053,5 @@
     REAL(wp) ::  collection_probability  !< probability for collection
     REAL(wp) ::  ddV                     !< inverse grid box volume
-    REAL(wp) ::  epsilon                 !< dissipation rate
+    REAL(wp) ::  epsilon_collision       !< dissipation rate
     REAL(wp) ::  factor_volume_to_mass   !< 4.0 / 3.0 * pi * rho_l
     REAL(wp) ::  xm                      !< droplet mass of super-droplet m
@@ -5015,10 +5080,10 @@
              eclass = INT( diss(k,j,i) * 1.0E4_wp / 600.0_wp * &
                            dissipation_classes ) + 1
-             epsilon = diss(k,j,i)
+             epsilon_collision = diss(k,j,i)
           ELSE
-             epsilon = 0.0_wp
+             epsilon_collision = 0.0_wp
           ENDIF
 
-          IF ( hall_kernel  .OR.  epsilon * 1.0E4_wp < 0.001_wp )  THEN
+          IF ( hall_kernel  .OR.  epsilon_collision * 1.0E4_wp < 0.001_wp )  THEN
              eclass = 0   ! Hall kernel is used
           ELSE
@@ -5242,6 +5307,6 @@
        DO  k = 1, dissipation_classes
 
-          epsilon = epsclass(k)
-          urms    = 2.02_wp * ( epsilon / 0.04_wp )**( 1.0_wp / 3.0_wp )
+          epsilon_collision = epsclass(k)
+          urms    = 2.02_wp * ( epsilon_collision / 0.04_wp )**( 1.0_wp / 3.0_wp )
 
           CALL turbsd
@@ -5339,11 +5404,11 @@
 
     IF ( wang_kernel )  THEN
-       epsilon = diss(k1,j1,i1)   ! dissipation rate in m**2/s**3
+       epsilon_collision = diss(k1,j1,i1)   ! dissipation rate in m**2/s**3
     ELSE
-       epsilon = 0.0_wp
+       epsilon_collision = 0.0_wp
     ENDIF
-    urms    = 2.02_wp * ( epsilon / 0.04_wp )**( 0.33333333333_wp )
-
-    IF ( wang_kernel  .AND.  epsilon > 1.0E-7_wp )  THEN
+    urms    = 2.02_wp * ( epsilon_collision / 0.04_wp )**( 0.33333333333_wp )
+
+    IF ( wang_kernel  .AND.  epsilon_collision > 1.0E-7_wp )  THEN
 !
 !--    Call routines to calculate efficiencies for the Wang kernel
@@ -5444,10 +5509,10 @@
     REAL(wp), DIMENSION(1:radius_classes) ::  tau !< inertial time scale
 
-    lambda    = urms * SQRT( 15.0_wp * molecular_viscosity / epsilon )
-    lambda_re = urms**2 * SQRT( 15.0_wp / epsilon / molecular_viscosity )
-    tl        = urms**2 / epsilon
-    lf        = 0.5_wp * urms**3 / epsilon
-    tauk      = SQRT( molecular_viscosity / epsilon )
-    eta       = ( molecular_viscosity**3 / epsilon )**0.25_wp
+    lambda    = urms * SQRT( 15.0_wp * molecular_viscosity / epsilon_collision )
+    lambda_re = urms**2 * SQRT( 15.0_wp / epsilon_collision / molecular_viscosity )
+    tl        = urms**2 / epsilon_collision
+    lf        = 0.5_wp * urms**3 / epsilon_collision
+    tauk      = SQRT( molecular_viscosity / epsilon_collision )
+    eta       = ( molecular_viscosity**3 / epsilon_collision )**0.25_wp
     vk        = eta / tauk
 
@@ -5961,10 +6026,10 @@
 !
 !--       Linear interpolation of turbulent enhancement factor
-          IF ( epsilon <= 0.01_wp )  THEN
-             ecf(j,i) = ( epsilon - 0.01_wp ) / ( 0.0_wp  - 0.01_wp ) * y1 &
-                      + ( epsilon - 0.0_wp  ) / ( 0.01_wp - 0.0_wp  ) * y2
-          ELSEIF ( epsilon <= 0.06_wp )  THEN
-             ecf(j,i) = ( epsilon - 0.04_wp ) / ( 0.01_wp - 0.04_wp ) * y2 &
-                      + ( epsilon - 0.01_wp ) / ( 0.04_wp - 0.01_wp ) * y3
+          IF ( epsilon_collision <= 0.01_wp )  THEN
+             ecf(j,i) = ( epsilon_collision - 0.01_wp ) / ( 0.0_wp  - 0.01_wp ) * y1 &
+                      + ( epsilon_collision - 0.0_wp  ) / ( 0.01_wp - 0.0_wp  ) * y2
+          ELSEIF ( epsilon_collision <= 0.06_wp )  THEN
+             ecf(j,i) = ( epsilon_collision - 0.04_wp ) / ( 0.01_wp - 0.04_wp ) * y2 &
+                      + ( epsilon_collision - 0.01_wp ) / ( 0.04_wp - 0.01_wp ) * y3
           ELSE
              ecf(j,i) = ( 0.06_wp - 0.04_wp ) / ( 0.01_wp - 0.04_wp ) * y2 &
@@ -6120,5 +6185,5 @@
                    ENDIF
                 ENDDO
-                
+
              ENDDO
           ENDDO
@@ -7569,5 +7634,5 @@
     ENDIF
 
-    new_size = MAX( new_size, min_nr_particle, old_size + 1 )
+    new_size = MAX( new_size, 1, old_size + 1 )
 
     IF ( old_size <= 500 )  THEN
@@ -7632,14 +7697,13 @@
 !
 !--          Check for large unused memory
-             dealloc = ( ( number_of_particles < min_nr_particle .AND.         &
-                           old_size            > min_nr_particle )  .OR.       &
-                         ( number_of_particles > min_nr_particle .AND.         &
+             dealloc = ( ( number_of_particles < 1 .AND.         &
+                           old_size            > 1 )  .OR.       &
+                         ( number_of_particles > 1 .AND.         &
                            old_size - number_of_particles *                    &
                               ( 1.0_wp + 0.01_wp * alloc_factor ) > 0.0_wp ) )
-                         
 
              IF ( dealloc )  THEN
-                IF ( number_of_particles < min_nr_particle )  THEN
-                   new_size = min_nr_particle
+                IF ( number_of_particles < 1 )  THEN
+                   new_size = 1
                 ELSE 
                    new_size = INT( number_of_particles * ( 1.0_wp + 0.01_wp * alloc_factor ) )
Index: palm/trunk/SOURCE/mod_particle_attributes.f90
===================================================================
--- palm/trunk/SOURCE/mod_particle_attributes.f90	(revision 4039)
+++ palm/trunk/SOURCE/mod_particle_attributes.f90	(revision 4043)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove min_nr_particle
+! 
+! 4017 2019-06-06 12:16:46Z schwenkel
 ! interoperable C datatypes introduced in particle type to avoid compiler warnings
 ! 
@@ -120,5 +123,4 @@
     INTEGER(iwp) ::  ibc_par_ns                                   !< particle north/south boundary condition dummy
     INTEGER(iwp) ::  ibc_par_t                                    !< particle top boundary condition dummy
-    INTEGER(iwp) ::  min_nr_particle = 50                         !< namelist parameter (see documentation)
     INTEGER(iwp) ::  number_of_particles = 0                      !< number of particles for each grid box (3d array is saved on prt_count)
     INTEGER(iwp) ::  number_of_particle_groups = 1                !< namelist parameter (see documentation)
Index: palm/trunk/SOURCE/pmc_particle_interface.f90
===================================================================
--- palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 4039)
+++ palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 4043)
@@ -26,4 +26,7 @@
 ! -----------------! 
 ! $Id$
+! Remove min_nr_particle
+! 
+! 4017 2019-06-06 12:16:46Z schwenkel
 ! coarse bound renamed as parent_bound and icl, icr, jcs, jcn as ipl, ipr, jps, jpn.
 ! 
@@ -90,5 +93,5 @@
        ONLY:  prt_count, particles, grid_particles,                            &
               particle_type, number_of_particles, zero_particle,               &
-              ibc_par_t, ibc_par_lr, ibc_par_ns, alloc_factor, min_nr_particle
+              ibc_par_t, ibc_par_lr, ibc_par_ns, alloc_factor
 
 !    USE lpm_pack_and_sort_mod
@@ -1180,5 +1183,5 @@
     ENDIF
 
-    new_size = MAX( new_size, min_nr_particle, old_size + 1 )
+    new_size = MAX( new_size, 1, old_size + 1 )
 
     IF ( old_size <= 500 )  THEN
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 4039)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 4043)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Further LPM modularization
+!
+! 4039 2019-06-18 10:32:41Z suehring
 ! Rename subroutines in module for diagnostic quantities
 ! 
@@ -593,7 +596,4 @@
         ONLY:  dt_indoor, im_main_heatcool, time_indoor
 
-    USE interaction_droplets_ptq_mod,                                                              &
-        ONLY:  interaction_droplets_ptq
-
     USE interfaces
 
@@ -604,5 +604,5 @@
 
     USE lagrangian_particle_model_mod,                                                             &
-        ONLY:  lpm_data_output_ptseries
+        ONLY:  lpm_data_output_ptseries, lpm_interaction_droplets_ptq
 
     USE lsf_nudging_mod,                                                                           &
@@ -1019,5 +1019,5 @@
           IF ( cloud_droplets  .AND.  intermediate_timestep_count == intermediate_timestep_count_max ) &
           THEN
-             CALL interaction_droplets_ptq
+             CALL lpm_interaction_droplets_ptq
           ENDIF
 
