Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 275)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 276)
@@ -40,4 +40,7 @@
 user_parin, user_read_restart_data, user_spectra )
 
+Maximum number of tails is calculated from maximum number of particles and
+skip_particles_for_tail (init_particles)
+
 First constant in array den also defined as type double. (eqn_state_seawater)
 
Index: palm/trunk/SOURCE/advec_particles.f90
===================================================================
--- palm/trunk/SOURCE/advec_particles.f90	(revision 275)
+++ palm/trunk/SOURCE/advec_particles.f90	(revision 276)
@@ -322,5 +322,5 @@
                           ' ql_c=',ql_c(k,j,i), ' &part(',n,')%wf=', &
                           particles(n)%weight_factor,' delta_r=',delta_r
-             CALL message( 'advec_particles', 'PA0143', 2, 2, 0, 6, 1 )
+             CALL message( 'advec_particles', 'PA0143', 2, 2, -1, 6, 1 )
           ENDIF
 
@@ -333,5 +333,5 @@
                           ' &d_radius=',d_radius,' delta_r=',delta_r,&
                           ' particle_radius=',particles(n)%radius
-             CALL message( 'advec_particles', 'PA0144', 2, 2, 0, 6, 1 )
+             CALL message( 'advec_particles', 'PA0144', 2, 2, -1, 6, 1 )
           ENDIF
           particles(n)%radius = new_r
@@ -426,5 +426,5 @@
                          WRITE( message_string, * )  'collision_efficiency ' , &
                                    'out of range:' ,effective_coll_efficiency
-                         CALL message( 'advec_particles', 'PA0145', 2, 2, 0,   &
+                         CALL message( 'advec_particles', 'PA0145', 2, 2, -1,  &
                                        6, 1 )
                       END IF
@@ -1925,5 +1925,5 @@
                                  '&but this is not allowed with ' // &
                                  'NetCDF output switched on'
-                CALL message( 'advec_particles', 'PA0146', 2, 2, 0, 6, 1 )
+                CALL message( 'advec_particles', 'PA0146', 2, 2, -1, 6, 1 )
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory dt_prel'
@@ -1945,5 +1945,5 @@
                                     '&but this is not allowed wi' // &
                                     'th NetCDF output switched on'
-                   CALL message( 'advec_particles', 'PA0147', 2, 2, 0, 6, 1 )
+                   CALL message( 'advec_particles', 'PA0147', 2, 2, -1, 6, 1 )
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory dt_prel'
@@ -2330,5 +2330,5 @@
                                   '&but this is not allowed with ' //  &
                                   'NetCDF output switched on'
-                CALL message( 'advec_particles', 'PA0146', 2, 2, 0, 6, 1 )
+                CALL message( 'advec_particles', 'PA0146', 2, 2, -1, 6, 1 )
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trrp'
@@ -2358,5 +2358,5 @@
                                     '&but this is not allowed wi'// &
                                     'th NetCDF output switched on'
-                CALL message( 'advec_particles', 'PA0147', 2, 2, 0, 6, 1 )
+                   CALL message( 'advec_particles', 'PA0147', 2, 2, -1, 6, 1 )
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trrpt'
@@ -2407,5 +2407,5 @@
                                  '&but this is not allowed with '// &
                                  'NetCDF output switched on'
-                CALL message( 'advec_particles', 'PA0146', 2, 2, 0, 6, 1 )
+                CALL message( 'advec_particles', 'PA0146', 2, 2, -1, 6, 1 )
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trlp'
@@ -2435,5 +2435,5 @@
                                     '&but this is not allowed wi'// &
                                     'th NetCDF output switched on'
-                   CALL message( 'advec_particles', 'PA0147', 2, 2, 0, 6, 1 ) 
+                   CALL message( 'advec_particles', 'PA0147', 2, 2, -1, 6, 1 ) 
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trlpt'
@@ -2771,5 +2771,5 @@
                                  '&but this is not allowed with '// &
                                  'NetCDF output switched on'
-                CALL message( 'advec_particles', 'PA0146', 2, 2, 0, 6, 1 ) 
+                CALL message( 'advec_particles', 'PA0146', 2, 2, -1, 6, 1 ) 
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trnp'
@@ -2799,5 +2799,5 @@
                                     '&but this is not allowed wi' // &
                                     'th NetCDF output switched on'
-                   CALL message( 'advec_particles', 'PA0147', 2, 2, 0, 6, 1 ) 
+                   CALL message( 'advec_particles', 'PA0147', 2, 2, -1, 6, 1 ) 
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trnpt'
@@ -2814,4 +2814,5 @@
                                 trnpt_count_recv*tlength, MPI_REAL, pnorth, 1, &
                                 comm2d, status, ierr )
+
 !
 !--          Update the tail ids for the transferred particles
@@ -2848,5 +2849,5 @@
                                  '&but this is not allowed with ' // &
                                  'NetCDF output switched on'
-               CALL message( 'advec_particles', 'PA0146', 2, 2, 0, 6, 1 )  
+               CALL message( 'advec_particles', 'PA0146', 2, 2, -1, 6, 1 )  
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trsp'
@@ -2876,5 +2877,5 @@
                                     '&but this is not allowed wi'// &
                                     'th NetCDF output switched on'
-                   CALL message( 'advec_particles', 'PA0147', 2, 2, 0, 6, 1 )
+                   CALL message( 'advec_particles', 'PA0147', 2, 2, -1, 6, 1 )
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trspt'
@@ -3079,5 +3080,5 @@
 
                   WRITE( message_string, * )  'particle too fast.  n = ',  n 
-                  CALL message( 'advec_particles', 'PA0148', 2, 2, 0, 6, 1 )
+                  CALL message( 'advec_particles', 'PA0148', 2, 2, -1, 6, 1 )
              ENDIF
           ENDIF
Index: palm/trunk/SOURCE/init_particles.f90
===================================================================
--- palm/trunk/SOURCE/init_particles.f90	(revision 275)
+++ palm/trunk/SOURCE/init_particles.f90	(revision 276)
@@ -4,5 +4,7 @@
 ! Current revisions:
 ! -----------------
-! Output of messages replaced by message handling routine
+! Maximum number of tails is calculated from maximum number of particles and
+! skip_particles_for_tail,
+! output of messages replaced by message handling routine
 ! Bugfix: arrays for tails are allocated with a minimum size of 10 tails if
 ! there is no tail initially
@@ -442,13 +444,9 @@
        IF ( use_particle_tails )  THEN
 !
-!--       Choose the maximum number of tails significantly larger than the
-!--       one initially required
-          factor = 10.0
-          value  = number_of_tails
-          DO WHILE ( value / 10.0 >= 1.0 )
-             factor = factor * 10.0
-             value  = value / 10.0
-          ENDDO
-          maximum_number_of_tails = factor * INT( value )
+!--       Choose the maximum number of tails with respect to the maximum number
+!--       of particles and skip_particles_for_tail
+          maximum_number_of_tails = maximum_number_of_particles / &
+                                    skip_particles_for_tail
+
 !
 !--       Create a minimum number of tails in case that there is no tail
