Index: lm/trunk/EXAMPLES/test_salsa/test_salsa.txt
===================================================================
--- /palm/trunk/EXAMPLES/test_salsa/test_salsa.txt	(revision 3863)
+++ 	(revision )
@@ -1,30 +1,0 @@
-salsa_test_urban
-
-1. Purpose
-Simple urban test set-up applying a sectional aerosol module SALSA. 
-
-2. PALM-Version / SVN Revision
-Version 5.0, revision 3096
-
-3. Required user code
-none
-
-4. Input
-salsa_test_urban p3d, salsa_test_urban_static (PIDS_STATIC) & salsa_test_urban_aero (PIDS_AERO)
-
-
-5. Preprocessing
-salsa_test_urban_static and salsa_test_urban_aero have to be prepared. 
-
-
-6. Program start - mrun call
-
-        
-7. Monitoring: 
-
-
-8. Postprocessing
-none
-
-9. Miscellaneous
-
Index: /palm/trunk/EXAMPLES/test_salsa/test_salsa_p3d
===================================================================
--- /palm/trunk/EXAMPLES/test_salsa/test_salsa_p3d	(revision 3863)
+++ /palm/trunk/EXAMPLES/test_salsa/test_salsa_p3d	(revision 3864)
@@ -10,5 +10,5 @@
     nx                   = 19,
     ny                   = 19,
-    nz                   = 22,
+    nz                   = 60,
 
     dx                   = 2.0,
@@ -43,5 +43,5 @@
     
     day_of_year_init     =  65,          ! March 06, to avoid extreme temperatures
-    time_utc_init        = 0.0,
+    time_utc_init        = 71700.0,      !(19:55, UTC in seconds)
 
 !
@@ -100,6 +100,5 @@
                             '#v',  'v*2',  'wv',  'w*v*',  'w"v"',
                             'w',   'w*2',
-                            '#pt', 'pt*2', 'wpt', 'w*pt*', 'w"pt"',
-                            'e', 'e*', '#km', '#l',
+
 !
 !-- 2D/3D output settings
@@ -115,6 +114,5 @@
                   's_SO4', 's_OC', 's_BC', 's_NH', 's_NO',
                   'g_H2SO4','g_HNO3','g_NH3','g_OCNV','g_OCSV',
-                  'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 
-                  'N_bin6', 'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10',
+                  'N_bin3', 'm_bin4', 
 
  / ! end of d3par namelist
@@ -150,7 +148,7 @@
 !
 !-- If isdtyp = 0, define the initial aerosol size distribution by dpg, sigmag and n_lognorm
- !   dpg       = 0.01347865, 0.05400739, 0.86411863, ! mean diameter per mode (micrometres)
- !   sigmag    =        1.8,       2.16,       2.21, ! standard deviation per mode 
- !   n_lognorm =     1434.0,      445.9,      0.07,  ! number concentration per mode (#/cm3)
+ !   dpg       = 13.5E-9, 54.0E-9, 864.1E-9, ! mean diameter per mode (in metres)
+ !   sigmag    =     1.8,    2.16,     2.21, ! standard deviation per mode 
+ !   n_lognorm =  1.43E9,  4.45E8,    7.0E4, ! number concentration per mode (#/m3)
 
 !
@@ -176,6 +174,6 @@
 !
 !-- Sectional presentation of the particle size distribution
-    reglim = 3.0E-9, 5.0E-8, 2.5E-6, ! limits of the subranges (m)
-    nbin   = 3, 7,                   ! number of bins per subrange 
+    reglim = 3.0E-9, 1.0E-8, 2.5E-6, ! limits of the subranges (m)
+    nbin   = 1, 7,                   ! number of bins per subrange 
 !-- NOTE! Subrange 1 consists only of H2SO4 and/or OC
     nf2a   = 1.0,	             ! Number fraction allocated to subrange 2a (b-bins will get 1-nf2a) 
@@ -183,6 +181,15 @@
 !
 !-- Aerosol emissions:
-    salsa_source_mode = 'read_from_file', 
-!-- NOTE! chemical components of the source have to be activated in 'listspec'
+    salsa_emission_mode = 'read_from_file', ! 'no_emission','uniform' or 'read_from_file'
+
+!-- If salsa_source_mode = 'uniform', set emissions based on the variables below:
+ !   aerosol_flux_dpg     = 8.0E-9, 60.0E-9, 1000.0E-9,  ! mean diameter per mode (metres)
+ !   aerosol_flux_sigmag  =    1.8,    2.16,      2.21,  ! standard deviation per mode 
+ !   surface_aerosol_flux = 1.0E8,  1.0E9,       1.0E5,  ! number concentration per mode (#/m3)
+ !   aerosol_flux_mass_fracs_a = 0.3, 0.0, 0.6, 0.0, 0.0, 0.0, 0.0,  ! order: listspec
+ !   aerosol_flux_mass_fracs_b = 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,  ! order: listspec
+
+!-- NOTE! chemical components of the source have to be activated in 'listspec' 
+!--       and have to be in the same order
 
 !
@@ -201,17 +208,20 @@
 !
 !-- Switches for aerosol processes:
-    nldistupdate = .T.,
+    nldistupdate = .T., ! update aerosol size distribution
     nldepo       = .T., ! Deposition master switch
-    nldepo_vege  = .T., ! Deposition on vegetation
-    nldepo_topo  = .T., ! Deposition on walls
-    nlcnd        = .T., ! Condensation master switch
-    nlcndgas     = .T., ! Condensation of precursor gases
+    nldepo_pcm   = .T., ! Deposition on vegetation
+    nldepo_surf  = .T., ! Deposition on walls
+    nlcnd        = .F., ! Condensation master switch
+    nlcndgas     = .F., ! Condensation of precursor gases
     nlcndh2oae   = .F., ! Condensation of H2O on aerosols                          
-    nlcoag       = .T., ! Coagulation master switch
-    nsnucl       =  1,  ! Nucleation scheme (0 = off)
+    nlcoag       = .F., ! Coagulation master switch
+    nsnucl       =  0,  ! Nucleation scheme (0 = off)
     nj3          =  1,  ! J3 parametrization for nucleation 
-
-    depo_vege_type = 'zhang2001',
-    depo_topo_type = 'zhang2001',
+!
+!-- Deposition on vegetation (pcm = plant canopy model)
+    depo_pcm_par = 'zhang2001',  ! or 'petroff2010'
+!
+!-- Deposition on on ground, walls and roofs
+    depo_surf_par = 'zhang2001', ! or 'petroff2010'
 
 !
@@ -219,4 +229,5 @@
     advect_particle_water   = .T.,   ! particle water: advect or calculate at each dt_salsa 
     feedback_to_palm        = .F.,   ! feedback to flow due to condensation of water
+    nest_salsa              = .F.,   ! apply nesting for salsa
     read_restart_data_salsa = .F.,   ! skip reading restart data even if it's done for the flow
     write_binary_salsa      = .F.,   ! skip writing restart data even if it's done for the flow
Index: /palm/trunk/SOURCE/Makefile
===================================================================
--- /palm/trunk/SOURCE/Makefile	(revision 3863)
+++ /palm/trunk/SOURCE/Makefile	(revision 3864)
@@ -1581,5 +1581,6 @@
 	advec_s_pw.o \
 	advec_s_up.o \
-        chemistry_model_mod.o \
+	chem_gasphase_mod.o \
+	chemistry_model_mod.o \
 	diffusion_s.o \
 	netcdf_data_input_mod.o \
Index: /palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- /palm/trunk/SOURCE/advec_ws.f90	(revision 3863)
+++ /palm/trunk/SOURCE/advec_ws.f90	(revision 3864)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove tailing white spaces
+! 
+! 3696 2019-01-24 16:37:35Z suehring
 ! Bugfix in degradation height
 ! 
@@ -349,6 +352,6 @@
 
        USE salsa_util_mod,                                                     &
-           ONLY:  sums_salsa_ws_l   
-       
+           ONLY:  sums_salsa_ws_l
+
        USE statistics,                                                         &
            ONLY:  sums_us2_ws_l, sums_vs2_ws_l, sums_ws2_ws_l, sums_wsncs_ws_l,& 
@@ -357,5 +360,5 @@
                   sums_wssas_ws_l,  sums_wsss_ws_l, sums_wsus_ws_l,            &
                   sums_wsvs_ws_l
-  
+
 
 !
@@ -418,8 +421,8 @@
              sums_wssas_ws_l = 0.0_wp
           ENDIF        
-          
+
           IF ( salsa )  THEN
              ALLOCATE( sums_salsa_ws_l(nzb:nzt+1,0:threads_per_task-1) )
-             sums_salsa_ws_l = 0.0_wp   
+             sums_salsa_ws_l = 0.0_wp
           ENDIF
 
@@ -1143,6 +1146,6 @@
 
        USE salsa_util_mod,                                                     &
-           ONLY:  sums_salsa_ws_l            
-           
+           ONLY:  sums_salsa_ws_l
+
        USE statistics,                                                         &
            ONLY:  sums_us2_ws_l, sums_vs2_ws_l, sums_ws2_ws_l, sums_wsncs_ws_l,&
@@ -1221,5 +1224,5 @@
 
        USE salsa_util_mod,                                                     &
-           ONLY:  sums_salsa_ws_l   
+           ONLY:  sums_salsa_ws_l
 
        USE statistics,                                                         &
@@ -1824,7 +1827,7 @@
                     ) * weight_substep(intermediate_timestep_count)
              ENDDO
-             
+
           CASE ( 's' )
-          
+
              DO  k = nzb, nzt
                 sums_wsss_ws_l(k,tn)  = sums_wsss_ws_l(k,tn) +                 &
@@ -1835,7 +1838,7 @@
                     ) * weight_substep(intermediate_timestep_count)
              ENDDO
-                  
+
          CASE ( 'aerosol_mass', 'aerosol_number', 'salsa_gas' )
-         
+
              DO  k = nzb, nzt
                 sums_salsa_ws_l(k,tn)  = sums_salsa_ws_l(k,tn) +               &
@@ -1845,5 +1848,5 @@
                                 *   ABS( w(k,j,i) - hom(k,1,3,0)            )  &
                     ) * weight_substep(intermediate_timestep_count)
-             ENDDO             
+             ENDDO
 
 !          CASE ( 'kc' )
@@ -1852,5 +1855,5 @@
 
          END SELECT
-         
+
     END SUBROUTINE advec_s_ws_ij
 
@@ -3595,15 +3598,15 @@
            ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_max,    &
                   nzt, advc_flags_1
-           
+
        USE kinds
-       
+
        USE salsa_util_mod,                                                     &
-           ONLY:  sums_salsa_ws_l      
-       
+           ONLY:  sums_salsa_ws_l
+
        USE statistics,                                                         &
            ONLY:  hom, sums_wspts_ws_l, sums_wsqs_ws_l, sums_wssas_ws_l,       &
                   sums_wsqcs_ws_l, sums_wsqrs_ws_l, sums_wsncs_ws_l,           &
                   sums_wsnrs_ws_l, sums_wsss_ws_l, weight_substep  
-                  
+
 
 
Index: /palm/trunk/SOURCE/boundary_conds.f90
===================================================================
--- /palm/trunk/SOURCE/boundary_conds.f90	(revision 3863)
+++ /palm/trunk/SOURCE/boundary_conds.f90	(revision 3864)
@@ -1409,8 +1409,8 @@
 
     ENDIF
-    
+
     IF ( salsa )  THEN
        CALL salsa_boundary_conds
-    ENDIF 
+    ENDIF
 
  END SUBROUTINE boundary_conds
Index: /palm/trunk/SOURCE/module_interface.f90
===================================================================
--- /palm/trunk/SOURCE/module_interface.f90	(revision 3863)
+++ /palm/trunk/SOURCE/module_interface.f90	(revision 3864)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Add a call for salsa_prognostic_equations
+! 
+! 3840 2019-03-29 10:35:52Z knoop
 ! bugfix: intent of dummy arguments changed to inout
 ! 
@@ -280,4 +283,5 @@
                salsa_init,                                                     &
                salsa_header,                                                   &
+               salsa_prognostic_equations,                                     &
                salsa_swap_timelevel,                                           &
                salsa_3d_data_averaging,                                        &
@@ -909,4 +913,5 @@
     IF ( gust_module_enabled )  CALL gust_prognostic_equations()
     IF ( ocean_mode          )  CALL ocean_prognostic_equations()
+    IF ( salsa               )  CALL salsa_prognostic_equations()
 
 
@@ -930,4 +935,5 @@
     IF ( gust_module_enabled )  CALL gust_prognostic_equations( i, j, i_omp_start, tn )
     IF ( ocean_mode          )  CALL ocean_prognostic_equations( i, j, i_omp_start, tn )
+    IF ( salsa               )  CALL salsa_prognostic_equations( i, j, i_omp_start, tn )
 
 
Index: /palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3863)
+++ /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3864)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! get_variable_4d_to_3d_real modified to enable read in data of type
+! data(t,y,x,n) one timestep at a time + some routines made public
+! 
+! 3855 2019-04-03 10:00:59Z suehring
 ! Typo removed
 ! 
@@ -913,5 +917,6 @@
            netcdf_data_input_interpolate, netcdf_data_input_offline_nesting,   &
            netcdf_data_input_surface_data, netcdf_data_input_topo,             &
-           netcdf_data_input_var, get_attribute, get_variable, open_read_file
+           netcdf_data_input_var, get_attribute, get_variable, open_read_file, &
+           check_existence, inquire_num_variables, inquire_variable_names
 
 
@@ -5557,5 +5562,5 @@
        INTEGER(iwp)                  ::  ke              !< start index of 3rd dimension
        INTEGER(iwp)                  ::  ks              !< end index of 3rd dimension
-       
+
        INTEGER(KIND=1), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp  !< temporary variable to read data from file according 
                                                                  !< to its reverse memory access
@@ -5566,5 +5571,5 @@
 !
 !--    Inquire variable id
-       nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var )   
+       nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var )
 !
 !--    Check for collective read-operation and set respective NetCDF flags if
@@ -5573,5 +5578,5 @@
 #if defined( __netcdf4_parallel )
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
-#endif          
+#endif
        ENDIF
 !
@@ -5582,7 +5587,7 @@
        nc_stat = NF90_GET_VAR( id, id_var, tmp,                                &
                                start = (/ is+1,    js+1,    ks+1 /),           &
-                               count = (/ ie-is+1, je-js+1, ke-ks+1 /) )                              
-
-       CALL handle_error( 'get_variable_3d_int8', 533, variable_name )                               
+                               count = (/ ie-is+1, je-js+1, ke-ks+1 /) )
+
+       CALL handle_error( 'get_variable_3d_int8', 533, variable_name )
 !
 !--    Resort data. Please note, dimension subscripts of var all start at 1. 
@@ -5594,5 +5599,5 @@
           ENDDO
        ENDDO
-       
+
        DEALLOCATE( tmp )
 
@@ -5627,5 +5632,5 @@
        INTEGER(iwp)                  ::  ke              !< start index of 3rd dimension
        INTEGER(iwp)                  ::  ks              !< end index of 3rd dimension
-       
+
        REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp !< temporary variable to read data from file according 
                                                          !< to its reverse memory access
@@ -5641,5 +5646,5 @@
 !--    required. 
        IF ( collective_read )  THEN
-#if defined( __netcdf4_parallel )       
+#if defined( __netcdf4_parallel )
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
 #endif
@@ -5653,5 +5658,5 @@
                                start = (/ is+1,    js+1,    ks+1 /),           &
                                count = (/ ie-is+1, je-js+1, ke-ks+1 /) )   
-                               
+
        CALL handle_error( 'get_variable_3d_real', 534, variable_name )
 !
@@ -5664,5 +5669,5 @@
           ENDDO
        ENDDO
-       
+
        DEALLOCATE( tmp )
 
@@ -5737,9 +5742,9 @@
        ELSE
 !
-!--    Allocate temporary variable according to memory access on file. 
-       ALLOCATE( tmp(is:ie,js:je,k1s:k1e,k2s:k2e) )
-!
-!--    Get variable
-          nc_stat = NF90_GET_VAR( id, id_var, tmp,                                &
+!--       Allocate temporary variable according to memory access on file. 
+          ALLOCATE( tmp(is:ie,js:je,k1s:k1e,k2s:k2e) )
+!
+!--       Get variable
+          nc_stat = NF90_GET_VAR( id, id_var, tmp,                             &
                                start = (/ is+1,    js+1,   k1s+1, k2s+1 /),    &
                                count = (/ ie-is+1, je-js+1,                    &
@@ -5748,5 +5753,5 @@
           CALL handle_error( 'get_variable_4d_real', 535, variable_name )
 !
-!--    Resort data. Please note, dimension subscripts of var all start at 1. 
+!--       Resort data. Please note, dimension subscripts of var all start at 1. 
           DO  i = is, ie 
              DO  j = js, je
@@ -5758,5 +5763,5 @@
              ENDDO
           ENDDO
-       
+
           DEALLOCATE( tmp )
        ENDIF
@@ -5828,16 +5833,16 @@
        ELSE
 !
-!--    Allocate temporary variable according to memory access on file. 
+!--       Allocate temporary variable according to memory access on file. 
           ALLOCATE( tmp(is:ie,js:je,ks:ke) )
 !
-!--    Get variable
-          nc_stat = NF90_GET_VAR( id, id_var, tmp,                                &
-                                  start = (/ ns+1, is+1,    js+1,    ks+1 /),           &
-                                  count = (/ 1, ie-is+1, je-js+1, ke-ks+1 /) )   
-                               
+!--       Get variable
+          nc_stat = NF90_GET_VAR( id, id_var, tmp,                             &
+                                  start = (/ is+1,    js+1,    ks+1,   ns+1 /),&
+                                  count = (/ ie-is+1, je-js+1, ke-ks+1, 1   /) )
+
           CALL handle_error( 'get_variable_4d_to_3d_real', 536, variable_name )
 !
-!--    Resort data. Please note, dimension subscripts of var all start at 1. 
-          DO  i = is, ie 
+!--       Resort data. Please note, dimension subscripts of var all start at 1.
+          DO  i = is, ie
              DO  j = js, je
                 DO  k = ks, ke
@@ -5846,5 +5851,5 @@
              ENDDO
           ENDDO
-       
+
          DEALLOCATE( tmp )
 
@@ -5962,5 +5967,7 @@
        CHARACTER(LEN=*)              ::  variable_name   !< variable name
 
-       INTEGER(iwp)                  ::  ns              !< start index for subdomain input along n dimension: ns coincides here with ne, since, we select only one value along the 1st dimension n
+       INTEGER(iwp)                  ::  ns              !< start index for subdomain input along n dimension: 
+                                                         !< ns coincides here with ne, since, we select only one 
+                                                         !< value along the 1st dimension n
 
        INTEGER(iwp)                  ::  t               !< index along t direction
@@ -5986,8 +5993,8 @@
 !
 !--    Inquire variable id
-       nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var )  
+       nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var )
 !
 !--    Check for collective read-operation and set respective NetCDF flags if
-!--    required. 
+!--    required.
        IF ( collective_read )  THEN
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
@@ -6036,5 +6043,5 @@
           ENDDO 
 
-         DEALLOCATE( tmp )
+          DEALLOCATE( tmp )
 
        ENDIF
Index: /palm/trunk/SOURCE/plant_canopy_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 3863)
+++ /palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 3864)
@@ -22,5 +22,5 @@
 ! Current revisions:
 ! ------------------
-! 
+!
 ! 
 ! Former revisions:
@@ -1055,6 +1055,6 @@
                    DO  j = nys, nyn
                       DO  k = 0, leaf_area_density_f%nz - 1
-                      IF ( leaf_area_density_f%var(k,j,i) /=                   &
-                           leaf_area_density_f%fill )                          &
+                         IF ( leaf_area_density_f%var(k,j,i) /=                &
+                              leaf_area_density_f%fill )                       &
                          lad_s(k,j,i) = leaf_area_density_f%var(k,j,i)
                       ENDDO
Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 3863)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 3864)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implemented nesting for salsa variables.
+! 
+! 3833 2019-03-28 15:04:04Z forkel
 ! replaced USE chem_modules by USE chem_gasphase_mod 
 ! 
@@ -398,5 +401,5 @@
                coupling_char, dt_3d, dz, humidity, message_string,             &
                neutral, passive_scalar, rans_mode, rans_tke_e,                 &
-               roughness_length, topography, volume_flow
+               roughness_length, salsa, topography, volume_flow
 
     USE chem_gasphase_mod,                                                          &
@@ -457,4 +460,9 @@
 
 #endif
+   
+    USE salsa_mod,                                                             &
+        ONLY:  aerosol_mass, aerosol_number, gconc_2, mconc_2, nbins_aerosol,  &
+               ncomponents_mass, nconc_2, nest_salsa, ngases_salsa, salsa_gas, &
+               salsa_gases_from_chem
 
     USE surface_mod,                                                           &
@@ -518,5 +526,9 @@
     INTEGER(idp), SAVE, DIMENSION(:,:), ALLOCATABLE, TARGET, PUBLIC ::  part_adrc   !<
 
-    REAL(wp), SAVE, DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  chem_spec_c !< Parent-grid array on child domain - chemical species
+    REAL(wp), SAVE, DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  chem_spec_c !< coarse grid array on child domain - chemical species
+
+    REAL(wp), SAVE, DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  aerosol_mass_c   !< aerosol mass
+    REAL(wp), SAVE, DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  aerosol_number_c !< aerosol number 
+    REAL(wp), SAVE, DIMENSION(:,:,:,:), ALLOCATABLE, TARGET ::  salsa_gas_c      !<  salsa gases
 !
 !-- Grid-spacing ratios.
@@ -817,18 +829,22 @@
 
     CHARACTER(LEN=32) ::  myname
-    
-    INTEGER(iwp) ::  child_id           !<
-    INTEGER(iwp) ::  ierr               !<
-    INTEGER(iwp) ::  k                  !<
-    INTEGER(iwp) ::  m                  !<
-    INTEGER(iwp) ::  mid                !<
-    INTEGER(iwp) ::  mm                 !<
-    INTEGER(iwp) ::  n = 1              !< Running index for chemical species
-    INTEGER(iwp) ::  nest_overlap       !<
-    INTEGER(iwp) ::  nomatch            !<
-    INTEGER(iwp) ::  nx_cl              !<
-    INTEGER(iwp) ::  ny_cl              !<
-    INTEGER(iwp) ::  nz_cl              !<
-    INTEGER(iwp), DIMENSION(3) ::  val  !< Array for receiving the child-grid dimensions
+    INTEGER(iwp) ::  child_id         !<
+    INTEGER(iwp) ::  ib = 1           !< running index for aerosol size bins
+    INTEGER(iwp) ::  ic = 1           !< running index for aerosol mass bins
+    INTEGER(iwp) ::  ig = 1           !< running index for salsa gases
+    INTEGER(iwp) ::  ierr             !<
+    INTEGER(iwp) ::  k                !<
+    INTEGER(iwp) ::  m                !<
+    INTEGER(iwp) ::  mid              !<
+    INTEGER(iwp) ::  mm               !<
+    INTEGER(iwp) ::  n = 1            !< running index for chemical species
+    INTEGER(iwp) ::  nest_overlap     !<
+    INTEGER(iwp) ::  nomatch          !<
+    INTEGER(iwp) ::  nx_cl            !<
+    INTEGER(iwp) ::  ny_cl            !<
+    INTEGER(iwp) ::  nz_cl            !<
+
+    INTEGER(iwp), DIMENSION(5) ::  val    !<
+
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  ch_xl   !<
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  ch_xr   !<    
@@ -1032,5 +1048,19 @@
              CALL pmci_set_array_pointer( myname, child_id = child_id,         &
                                           nz_cl = nz_cl, n = n )
-             n = n + 1
+             n = n + 1  
+          ELSEIF ( INDEX( TRIM( myname ), 'an_' ) /= 0 )  THEN
+             CALL pmci_set_array_pointer( myname, child_id = child_id,         &
+                                          nz_cl = nz_cl, n = ib )
+             ib = ib + 1 
+          ELSEIF ( INDEX( TRIM( myname ), 'am_' ) /= 0 )  THEN
+             CALL pmci_set_array_pointer( myname, child_id = child_id,         &
+                                          nz_cl = nz_cl, n = ic )
+             ic = ic + 1 
+          ELSEIF ( INDEX( TRIM( myname ), 'sg_' ) /= 0  .AND.                  &
+             .NOT. salsa_gases_from_chem )                                     &
+          THEN
+             CALL pmci_set_array_pointer( myname, child_id = child_id,         &
+                                          nz_cl = nz_cl, n = ig )
+             ig = ig + 1
           ELSE
              CALL pmci_set_array_pointer( myname, child_id = child_id,         &
@@ -1193,6 +1223,10 @@
     IMPLICIT NONE
 
-    CHARACTER(LEN=da_namelen) ::  myname     !< 
-    INTEGER(iwp) ::  ierr       !< MPI error code
+
+    CHARACTER(LEN=da_namelen) ::  myname     !<
+    CHARACTER(LEN=5) ::  salsa_char          !<
+    INTEGER(iwp) ::  ib         !< running index for aerosol size bins
+    INTEGER(iwp) ::  ic         !< running index for aerosol mass bins
+    INTEGER(iwp) ::  ierr       !<
     INTEGER(iwp) ::  icl        !< Left index limit for children's parent-grid arrays
     INTEGER(iwp) ::  icla       !< Left index limit for allocation of index-mapping and other auxiliary arrays
@@ -1201,4 +1235,5 @@
     INTEGER(iwp) ::  icra       !< Right index limit for allocation of index-mapping and other auxiliary arrays
     INTEGER(iwp) ::  icrw       !< Right index limit for children's parent-grid work arrays
+    INTEGER(iwp) ::  ig         !< running index for salsa gases
     INTEGER(iwp) ::  jcn        !< North index limit for children's parent-grid arrays
     INTEGER(iwp) ::  jcna       !< North index limit for allocation of index-mapping and other auxiliary arrays
@@ -1281,9 +1316,44 @@
                                           'chem_' //                           &
                                           TRIM( chem_species(n)%name ),        &
-                                         'fine',                               &
+                                          'fine',                              &
                                           'chem_' //                           &
                                           TRIM( chem_species(n)%name ),        &
                                           ierr )
           ENDDO 
+       ENDIF
+
+       IF ( salsa  .AND.  nest_salsa )  THEN
+          DO  ib = 1, nbins_aerosol
+             WRITE(salsa_char,'(i0)') ib
+             CALL pmc_set_dataarray_name( 'coarse',                            &
+                                          'an_' //                             &
+                                          TRIM( salsa_char ),                  &
+                                          'fine',                              &
+                                          'an_' //                             &
+                                          TRIM( salsa_char ),                  &
+                                          ierr )
+          ENDDO
+          DO  ic = 1, nbins_aerosol * ncomponents_mass
+             WRITE(salsa_char,'(i0)') ic
+             CALL pmc_set_dataarray_name( 'coarse',                            &
+                                          'am_' //                             &
+                                          TRIM( salsa_char ),                  &
+                                          'fine',                              &
+                                          'am_' //                             &
+                                          TRIM( salsa_char ),                  &
+                                          ierr )
+          ENDDO
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                WRITE(salsa_char,'(i0)') ig
+                CALL pmc_set_dataarray_name( 'coarse',                         &
+                                             'sg_' //                          &
+                                             TRIM( salsa_char ),               &
+                                             'fine',                           &
+                                             'sg_' //                          &
+                                             TRIM( salsa_char ),               &
+                                             ierr )
+             ENDDO
+          ENDIF
        ENDIF
 
@@ -1364,5 +1434,9 @@
        CALL  pmc_c_clear_next_array_list
 
-       n = 1
+       ib = 1
+       ic = 1
+       ig = 1
+       n  = 1
+
        DO  WHILE ( pmc_c_getnextarray( myname ) )
 !--       Note that cg%nz is not the original nz of parent, but the highest
@@ -1375,5 +1449,19 @@
           IF ( INDEX( TRIM( myname ), 'chem_' ) /= 0 )  THEN             
              CALL pmci_create_child_arrays ( myname, icl, icr, jcs, jcn, cg%nz, n )
-             n = n + 1
+             n = n + 1    
+          ELSEIF ( INDEX( TRIM( myname ), 'an_' ) /= 0 )  THEN
+             CALL pmci_create_child_arrays ( myname, icl, icr, jcs, jcn, cg%nz,&
+                                             ib )
+             ib = ib + 1
+          ELSEIF ( INDEX( TRIM( myname ), 'am_' ) /= 0 )  THEN
+             CALL pmci_create_child_arrays ( myname, icl, icr, jcs, jcn, cg%nz,&
+                                             ic )
+             ic = ic + 1
+          ELSEIF ( INDEX( TRIM( myname ), 'sg_' ) /= 0  .AND.                  &
+             .NOT. salsa_gases_from_chem )                                     &
+          THEN
+             CALL pmci_create_child_arrays ( myname, icl, icr, jcs, jcn, cg%nz,&
+                                             ig )
+             ig = ig + 1
           ELSE
              CALL pmci_create_child_arrays ( myname, icl, icr, jcs, jcn, cg%nz )
@@ -2114,4 +2202,14 @@
     IF ( air_chemistry  .AND.  nest_chemistry )                                &
        pmc_max_array = pmc_max_array + nspec
+!
+!-- Salsa, depens on the number aerosol size bins and chemical components + 
+!-- the number of default gases
+    IF ( salsa  .AND.  nest_salsa )                                            &
+       pmc_max_array = pmc_max_array + nbins_aerosol + nbins_aerosol *         &
+                       ncomponents_mass
+       IF ( .NOT. salsa_gases_from_chem )  pmc_max_array = pmc_max_array +     &
+                                                           ngases_salsa
+
+
 #endif
     
@@ -2126,5 +2224,6 @@
     INTEGER(iwp), INTENT(IN)          ::  child_id    !<
     INTEGER(iwp), INTENT(IN)          ::  nz_cl       !<
-    INTEGER(iwp), INTENT(IN),OPTIONAL ::  n           !< index of chemical species
+    INTEGER(iwp), INTENT(IN),OPTIONAL ::  n           !< index of chemical 
+                                                      !< species / salsa variables
 
     CHARACTER(LEN=*), INTENT(IN) ::  name             !<
@@ -2159,5 +2258,9 @@
     IF ( TRIM(name) == "nr_part"    )  i_2d => nr_part
     IF ( TRIM(name) == "part_adr"   )  i_2d => part_adr
-    IF ( INDEX( TRIM(name), "chem_" ) /= 0 )  p_3d => chem_species(n)%conc
+    IF ( INDEX( TRIM(name), "chem_" ) /= 0      )  p_3d => chem_species(n)%conc
+    IF ( INDEX( TRIM(name), "an_" ) /= 0  )  p_3d => aerosol_number(n)%conc
+    IF ( INDEX( TRIM(name), "am_" ) /= 0 )  p_3d => aerosol_mass(n)%conc
+    IF ( INDEX( TRIM(name), "sg_" ) /= 0  .AND.  .NOT. salsa_gases_from_chem ) &
+       p_3d => salsa_gas(n)%conc
 !
 !-- Next line is just an example for a 2D array (not active for coupling!)
@@ -2176,5 +2279,9 @@
     IF ( TRIM(name) == "s"    )  p_3d_sec => s_2
     IF ( TRIM(name) == "diss" )  p_3d_sec => diss_2
-    IF ( INDEX( TRIM(name), "chem_" ) /= 0 )  p_3d_sec => spec_conc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "chem_" ) /= 0      )  p_3d_sec => spec_conc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "an_" ) /= 0  )  p_3d_sec => nconc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "am_" ) /= 0 )  p_3d_sec => mconc_2(:,:,:,n)
+    IF ( INDEX( TRIM(name), "sg_" ) /= 0  .AND.  .NOT. salsa_gases_from_chem ) &
+       p_3d_sec => gconc_2(:,:,:,n)
 
     IF ( ASSOCIATED( p_3d ) )  THEN
@@ -2295,5 +2402,6 @@
     INTEGER(iwp), INTENT(IN) ::  nzc     !<  nzc is cg%nz, but note that cg%nz is not the original nz of parent, but the highest parent-grid level needed for nesting.
 
-    INTEGER(iwp), INTENT(IN), OPTIONAL ::  n  !< number of chemical species
+    INTEGER(iwp), INTENT(IN), OPTIONAL ::  n  !< number of chemical species /
+                                              !< salsa variables
 
 #if defined( __parallel )
@@ -2356,4 +2464,17 @@
           ALLOCATE( chem_spec_c(0:nzc+1,js:je,is:ie,1:nspec) )
        p_3d => chem_spec_c(:,:,:,n)
+    ELSEIF ( TRIM( name(1:3) ) == "an_" )  THEN
+       IF ( .NOT. ALLOCATED( aerosol_number_c ) )                              &
+          ALLOCATE( aerosol_number_c(0:nzc+1,js:je,is:ie,1:nbins_aerosol) )
+       p_3d => aerosol_number_c(:,:,:,n)
+    ELSEIF ( TRIM( name(1:3) ) == "am_" )  THEN
+       IF ( .NOT. ALLOCATED( aerosol_mass_c ) )                                &
+          ALLOCATE( aerosol_mass_c(0:nzc+1,js:je,is:ie,1:(nbins_aerosol*ncomponents_mass) ) )
+       p_3d => aerosol_mass_c(:,:,:,n)
+    ELSEIF ( TRIM( name(1:3) ) == "sg_"  .AND.  .NOT. salsa_gases_from_chem )  &
+    THEN
+       IF ( .NOT. ALLOCATED( salsa_gas_c ) )                                   &
+          ALLOCATE( salsa_gas_c(0:nzc+1,js:je,is:ie,1:ngases_salsa) )
+       p_3d => salsa_gas_c(:,:,:,n)
     !ELSEIF (trim(name) == "z0") then
        !IF (.not.allocated(z0c))  allocate(z0c(js:je, is:ie))
@@ -2419,4 +2540,6 @@
 
     INTEGER(iwp) ::  i          !<
+    INTEGER(iwp) ::  ib         !< running index for aerosol size bins
+    INTEGER(iwp) ::  ic         !< running index for aerosol mass bins
     INTEGER(iwp) ::  icl        !<
     INTEGER(iwp) ::  icla       !<
@@ -2425,4 +2548,5 @@
     INTEGER(iwp) ::  icra       !<
     INTEGER(iwp) ::  icrw       !<
+    INTEGER(iwp) ::  ig         !< running index for salsa gases
     INTEGER(iwp) ::  j          !<
     INTEGER(iwp) ::  jcn        !<
@@ -2434,4 +2558,5 @@
     INTEGER(iwp) ::  k          !< 
     INTEGER(iwp) ::  n          !< running index for chemical species
+
     REAL(wp) ::  waittime       !<
 
@@ -2502,4 +2627,21 @@
                                          kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, 's' )
           ENDDO
+       ENDIF
+
+       IF ( salsa  .AND.  nest_salsa )  THEN
+          DO  ib = 1, nbins_aerosol
+             CALL pmci_interp_1sto_all ( aerosol_number(ib)%conc, aerosol_number_c(:,:,:,ib),        &
+                                         kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, 's' )
+          ENDDO
+          DO  ic = 1, nbins_aerosol * ncomponents_mass
+             CALL pmci_interp_1sto_all ( aerosol_mass(ic)%conc, aerosol_mass_c(:,:,:,ic),            &
+                                         kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, 's' )
+          ENDDO
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                CALL pmci_interp_1sto_all ( salsa_gas(ig)%conc, salsa_gas_c(:,:,:,ig),             &
+                                            kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, 's' )
+             ENDDO
+          ENDIF
        ENDIF
 
@@ -3080,4 +3222,7 @@
        INTEGER(iwp) ::  ibgp       !< index running over the nbgp boundary ghost points in i-direction
        INTEGER(iwp) ::  jbgp       !< index running over the nbgp boundary ghost points in j-direction
+       INTEGER(iwp) ::  ib         !< running index for aerosol size bins
+       INTEGER(iwp) ::  ic         !< running index for aerosol mass bins
+       INTEGER(iwp) ::  ig         !< running index for salsa gases
        INTEGER(iwp) ::  n          !< running index for number of chemical species
       
@@ -3141,4 +3286,21 @@
              ENDIF
 
+             IF ( salsa  .AND.  nest_salsa )  THEN
+                DO  ib = 1, nbins_aerosol
+                   CALL pmci_interp_1sto_lr( aerosol_number(ib)%conc, aerosol_number_c(:,:,:,ib),    &
+                                             kcto, jflo, jfuo, kflo, kfuo, 'l', 's')
+                ENDDO
+                DO  ic = 1, nbins_aerosol * ncomponents_mass
+                   CALL pmci_interp_1sto_lr( aerosol_mass(ic)%conc, aerosol_mass_c(:,:,:,ic),        &
+                                             kcto, jflo, jfuo, kflo, kfuo, 'l', 's')
+                ENDDO
+                IF ( .NOT. salsa_gases_from_chem )  THEN
+                   DO  ig = 1, ngases_salsa
+                      CALL pmci_interp_1sto_lr( salsa_gas(ig)%conc, salsa_gas_c(:,:,:,ig),         &
+                                                kcto, jflo, jfuo, kflo, kfuo, 'l', 's')
+                   ENDDO
+                ENDIF
+             ENDIF
+
           ENDIF
 !
@@ -3195,4 +3357,22 @@
                 ENDDO
              ENDIF
+
+             IF ( salsa  .AND.  nest_salsa )  THEN
+                DO  ib = 1, nbins_aerosol
+                   CALL pmci_interp_1sto_lr( aerosol_number(ib)%conc, aerosol_number_c(:,:,:,ib),    &
+                                             kcto, jflo, jfuo, kflo, kfuo, 'r', 's' )
+                ENDDO
+                DO  ic = 1, nbins_aerosol * ncomponents_mass
+                   CALL pmci_interp_1sto_lr( aerosol_mass(ic)%conc, aerosol_mass_c(:,:,:,ic),        &
+                                             kcto, jflo, jfuo, kflo, kfuo, 'r', 's' )
+                ENDDO
+                IF ( .NOT. salsa_gases_from_chem )  THEN
+                   DO  ig = 1, ngases_salsa
+                      CALL pmci_interp_1sto_lr( salsa_gas(ig)%conc, salsa_gas_c(:,:,:,ig),         &
+                                                kcto, jflo, jfuo, kflo, kfuo, 'r', 's' )
+                   ENDDO
+                ENDIF
+             ENDIF
+
           ENDIF
 !
@@ -3248,4 +3428,22 @@
                 ENDDO
              ENDIF
+             
+             IF ( salsa  .AND.  nest_salsa )  THEN
+                DO  ib = 1, nbins_aerosol
+                   CALL pmci_interp_1sto_sn( aerosol_number(ib)%conc, aerosol_number_c(:,:,:,ib),    &
+                                             kcto, iflo, ifuo, kflo, kfuo, 's', 's' )
+                ENDDO
+                DO  ic = 1, nbins_aerosol * ncomponents_mass
+                   CALL pmci_interp_1sto_sn( aerosol_mass(ic)%conc, aerosol_mass_c(:,:,:,ic),        &
+                                             kcto, iflo, ifuo, kflo, kfuo, 's', 's' )
+                ENDDO
+                IF ( .NOT. salsa_gases_from_chem )  THEN
+                   DO  ig = 1, ngases_salsa
+                      CALL pmci_interp_1sto_sn( salsa_gas(ig)%conc, salsa_gas_c(:,:,:,ig),         &
+                                                kcto, iflo, ifuo, kflo, kfuo, 's', 's' )
+                   ENDDO
+                ENDIF
+             ENDIF
+                       
           ENDIF
 !
@@ -3301,4 +3499,22 @@
                 ENDDO
              ENDIF
+             
+             IF ( salsa  .AND.  nest_salsa )  THEN
+                DO  ib = 1, nbins_aerosol
+                   CALL pmci_interp_1sto_sn( aerosol_number(ib)%conc, aerosol_number_c(:,:,:,ib),    &
+                                             kcto, iflo, ifuo, kflo, kfuo, 'n', 's' )
+                ENDDO
+                DO  ic = 1, nbins_aerosol * ncomponents_mass
+                   CALL pmci_interp_1sto_sn( aerosol_mass(ic)%conc, aerosol_mass_c(:,:,:,ic),        &
+                                             kcto, iflo, ifuo, kflo, kfuo, 'n', 's' )
+                ENDDO
+                IF ( .NOT. salsa_gases_from_chem )  THEN
+                   DO  ig = 1, ngases_salsa
+                      CALL pmci_interp_1sto_sn( salsa_gas(ig)%conc, salsa_gas_c(:,:,:,ig),         &
+                                                kcto, iflo, ifuo, kflo, kfuo, 'n', 's' )
+                   ENDDO
+                ENDIF
+             ENDIF
+                          
           ENDIF
 
@@ -3348,4 +3564,21 @@
                                       kcto, iflo, ifuo, jflo, jfuo, 's' )
           ENDDO
+       ENDIF 
+       
+       IF ( salsa  .AND.  nest_salsa )  THEN
+          DO  ib = 1, nbins_aerosol
+             CALL pmci_interp_1sto_t( aerosol_number(ib)%conc, aerosol_number_c(:,:,:,ib),           &
+                                      kcto, iflo, ifuo, jflo, jfuo, 's' )
+          ENDDO
+          DO  ic = 1, nbins_aerosol * ncomponents_mass
+             CALL pmci_interp_1sto_t( aerosol_mass(ic)%conc, aerosol_mass_c(:,:,:,ic),               &
+                                      kcto, iflo, ifuo, jflo, jfuo, 's' )
+          ENDDO
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                CALL pmci_interp_1sto_t( salsa_gas(ig)%conc, salsa_gas_c(:,:,:,ig),                &
+                                         kcto, iflo, ifuo, jflo, jfuo, 's' )
+             ENDDO
+          ENDIF
        ENDIF
 
@@ -3360,7 +3593,10 @@
 !--   Note that TKE is not anterpolated.
       IMPLICIT NONE
+      INTEGER(iwp) ::  ib         !< running index for aerosol size bins
+      INTEGER(iwp) ::  ic         !< running index for aerosol mass bins
       INTEGER(iwp) ::  n          !< running index for number of chemical species
-
-      
+      INTEGER(iwp) ::  ig         !< running index for salsa gases
+
+
       CALL pmci_anterp_tophat( u,  uc,  kcto, iflu, ifuu, jflo, jfuo, kflo, kfuo, ijkfc_u, 'u' )
       CALL pmci_anterp_tophat( v,  vc,  kcto, iflo, ifuo, jflv, jfuv, kflo, kfuo, ijkfc_v, 'v' )
@@ -3419,4 +3655,21 @@
                                      kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, ijkfc_s, 's' )
          ENDDO
+      ENDIF
+      
+      IF ( salsa  .AND.  nest_salsa )  THEN
+         DO  ib = 1, nbins_aerosol
+            CALL pmci_anterp_tophat( aerosol_number(ib)%conc, aerosol_number_c(:,:,:,ib),            &
+                                     kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, ijkfc_s, 's' )
+         ENDDO
+         DO  ic = 1, nbins_aerosol * ncomponents_mass
+            CALL pmci_anterp_tophat( aerosol_mass(ic)%conc, aerosol_mass_c(:,:,:,ic),                &
+                                     kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, ijkfc_s, 's' )
+         ENDDO
+         IF ( .NOT. salsa_gases_from_chem )  THEN
+            DO  ig = 1, ngases_salsa
+               CALL pmci_anterp_tophat( salsa_gas(ig)%conc, salsa_gas_c(:,:,:,ig),                 &
+                                        kcto, iflo, ifuo, jflo, jfuo, kflo, kfuo, ijkfc_s, 's' )
+            ENDDO
+         ENDIF
       ENDIF
 
@@ -4275,4 +4528,7 @@
         ONLY:  ibc_pt_b, ibc_q_b, ibc_s_b, ibc_uv_b
 
+    USE salsa_mod,                                                             &
+        ONLY:  ibc_salsa_b
+
     USE surface_mod,                                                           &
         ONLY:  bc_h
@@ -4280,10 +4536,13 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  i  !< Index along x-direction
-    INTEGER(iwp) ::  j  !< Index along y-direction
-    INTEGER(iwp) ::  k  !< Index along z-direction
-    INTEGER(iwp) ::  m  !< Running index for surface type
-    INTEGER(iwp) ::  n  !< running index for number of chemical species
-    
+    INTEGER(iwp) ::  i   !< Index along x-direction
+    INTEGER(iwp) ::  ib  !< running index for aerosol size bins
+    INTEGER(iwp) ::  ic  !< running index for aerosol mass bins
+    INTEGER(iwp) ::  ig  !< running index for salsa gases
+    INTEGER(iwp) ::  j   !< Index along y-direction
+    INTEGER(iwp) ::  k   !< Index along z-direction
+    INTEGER(iwp) ::  m   !< Running index for surface type
+    INTEGER(iwp) ::  n   !< running index for number of chemical species
+
 !
 !-- Set Dirichlet boundary conditions for horizontal velocity components
@@ -4433,5 +4692,43 @@
           ENDDO
        ENDIF
-    ENDIF
+    ENDIF 
+!
+!-- Set Neumann boundary conditions for aerosols and salsa gases
+    IF ( salsa  .AND.  nest_salsa )  THEN
+       IF ( ibc_salsa_b == 1 )  THEN
+          DO  m = 1, bc_h(0)%ns
+             i = bc_h(0)%i(m)
+             j = bc_h(0)%j(m)
+             k = bc_h(0)%k(m)
+             DO  ib = 1, nbins_aerosol
+                aerosol_number(ib)%conc(k-1,j,i) = aerosol_number(ib)%conc(k,j,i)
+             ENDDO
+             DO  ic = 1, nbins_aerosol * ncomponents_mass
+                aerosol_mass(ic)%conc(k-1,j,i) = aerosol_mass(ic)%conc(k,j,i)
+             ENDDO
+             IF ( .NOT. salsa_gases_from_chem )  THEN
+                DO  ig = 1, ngases_salsa
+                   salsa_gas(ig)%conc(k-1,j,i) = salsa_gas(ig)%conc(k,j,i)
+                ENDDO
+             ENDIF
+          ENDDO
+          DO  m = 1, bc_h(1)%ns
+             i = bc_h(1)%i(m)
+             j = bc_h(1)%j(m)
+             k = bc_h(1)%k(m)
+             DO  ib = 1, nbins_aerosol
+                aerosol_number(ib)%conc(k+1,j,i) = aerosol_number(ib)%conc(k,j,i)
+             ENDDO
+             DO  ic = 1, nbins_aerosol * ncomponents_mass
+                aerosol_mass(ic)%conc(k+1,j,i) = aerosol_mass(ic)%conc(k,j,i)
+             ENDDO
+             IF ( .NOT. salsa_gases_from_chem )  THEN
+                DO  ig = 1, ngases_salsa
+                   salsa_gas(ig)%conc(k+1,j,i) = salsa_gas(ig)%conc(k,j,i)
+                ENDDO
+             ENDIF
+          ENDDO
+       ENDIF
+    ENDIF    
 
  END SUBROUTINE pmci_boundary_conds
Index: /palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- /palm/trunk/SOURCE/prognostic_equations.f90	(revision 3863)
+++ /palm/trunk/SOURCE/prognostic_equations.f90	(revision 3864)
@@ -25,4 +25,11 @@
 ! -----------------
 ! $Id$
+! Modifications made for salsa:
+! - salsa_prognostic_equations moved to salsa_mod (and the call to 
+!   module_interface_mod)
+! - Renamed nbins --> nbins_aerosol, ncc_tot --> ncomponents_mass and 
+!   ngast --> ngases_salsa and loop indices b, c and sg to ib, ic and ig
+! 
+! 3840 2019-03-29 10:35:52Z knoop
 ! added USE chem_gasphase_mod for nvar, nspec and spc_names
 ! 
@@ -376,5 +383,5 @@
     USE buoyancy_mod,                                                          &
         ONLY:  buoyancy
-           
+
     USE chem_modules,                                                          &
         ONLY:  call_chem_at_all_substeps, chem_gasphase_on, cs_name,           &
@@ -447,14 +454,14 @@
                skip_time_do_radiation
 #endif
-                          
+
     USE salsa_mod,                                                             &
-        ONLY:  aerosol_mass, aerosol_number, dt_salsa, last_salsa_time, nbins, &
-               ncc_tot, ngast, salsa_boundary_conds, salsa_diagnostics,        &
-               salsa_driver, salsa_gas, salsa_gases_from_chem, salsa_tendency, &
-               skip_time_do_salsa
-               
+        ONLY:  aerosol_mass, aerosol_number, dt_salsa, last_salsa_time,        &
+               nbins_aerosol, ncomponents_mass, ngases_salsa,                  &
+               salsa_boundary_conds, salsa_diagnostics, salsa_driver,          &
+               salsa_gas, salsa_gases_from_chem, skip_time_do_salsa
+
     USE salsa_util_mod,                                                        &
-        ONLY:  sums_salsa_ws_l                              
-    
+        ONLY:  sums_salsa_ws_l
+
     USE statistics,                                                            &
         ONLY:  hom
@@ -506,10 +513,11 @@
 
     IMPLICIT NONE
-    
-    INTEGER(iwp) ::  b                   !< index for aerosol size bins (salsa)
-    INTEGER(iwp) ::  c                   !< index for chemical compounds (salsa)
-    INTEGER(iwp) ::  g                   !< index for gaseous compounds (salsa)
+
     INTEGER(iwp) ::  i                   !<
     INTEGER(iwp) ::  i_omp_start         !<
+    INTEGER(iwp) ::  ib                  !< index for aerosol size bins (salsa)
+    INTEGER(iwp) ::  ic                  !< index for chemical compounds (salsa)
+    INTEGER(iwp) ::  icc                 !< additional index for chemical compounds (salsa)
+    INTEGER(iwp) ::  ig                  !< index for gaseous compounds (salsa)
     INTEGER(iwp) ::  j                   !<
     INTEGER(iwp) ::  k                   !<
@@ -587,5 +595,5 @@
        CALL cpu_log( log_point_s(84), 'chem.exch-horiz', 'stop' )
 
-    ENDIF       
+    ENDIF
 !
 !-- Run SALSA and aerosol dynamic processes. SALSA is run with a longer time 
@@ -593,10 +601,10 @@
 !-- concentrations of aerosol number and mass 
     IF ( salsa )  THEN
-       
-       IF ( time_since_reference_point >= skip_time_do_salsa )  THEN                 
+
+       IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
           IF ( ( time_since_reference_point - last_salsa_time ) >= dt_salsa )  &
           THEN
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'start' )
-             !$OMP PARALLEL PRIVATE (i,j,b,c,g)
+             !$OMP PARALLEL PRIVATE (i,j,ib,ic,icc,ig)
              !$OMP DO
 !
@@ -609,5 +617,5 @@
                 ENDDO
              ENDDO
-             
+
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'stop' )
              
@@ -615,21 +623,21 @@
 !
 !--          Exchange ghost points and decycle if needed.
-             DO  b = 1, nbins
-                CALL exchange_horiz( aerosol_number(b)%conc, nbgp )
-                CALL salsa_boundary_conds( aerosol_number(b)%conc_p,           &
-                                           aerosol_number(b)%init )
-                DO  c = 1, ncc_tot
-                   CALL exchange_horiz( aerosol_mass((c-1)*nbins+b)%conc, nbgp )
-                   CALL salsa_boundary_conds(                                  &
-                                           aerosol_mass((c-1)*nbins+b)%conc_p, &
-                                           aerosol_mass((c-1)*nbins+b)%init )
-                ENDDO
-             ENDDO
-             
+             DO  ib = 1, nbins_aerosol
+                CALL exchange_horiz( aerosol_number(ib)%conc, nbgp )
+                CALL salsa_boundary_conds( aerosol_number(ib)%conc,            &
+                                           aerosol_number(ib)%init )
+                DO  ic = 1, ncomponents_mass
+                   icc = ( ic - 1 ) * nbins_aerosol + ib
+                   CALL exchange_horiz( aerosol_mass(icc)%conc, nbgp )
+                   CALL salsa_boundary_conds( aerosol_mass(icc)%conc,          &
+                                              aerosol_mass(icc)%init )
+                ENDDO
+             ENDDO
+
              IF ( .NOT. salsa_gases_from_chem )  THEN
-                DO  g = 1, ngast
-                   CALL exchange_horiz( salsa_gas(g)%conc, nbgp )
-                   CALL salsa_boundary_conds( salsa_gas(g)%conc_p,             &
-                                              salsa_gas(g)%init )
+                DO  ig = 1, ngases_salsa
+                   CALL exchange_horiz( salsa_gas(ig)%conc, nbgp )
+                   CALL salsa_boundary_conds( salsa_gas(ig)%conc,              &
+                                              salsa_gas(ig)%init )
                 ENDDO
              ENDIF
@@ -638,9 +646,9 @@
              !$OMP END PARALLEL
              last_salsa_time = time_since_reference_point
-             
-          ENDIF
-          
-       ENDIF
-       
+
+          ENDIF
+
+       ENDIF
+
     ENDIF 
 
@@ -1442,56 +1450,6 @@
                                      chem_species(lsp)%diss_l_cs )       
              ENDDO
-          
+
           ENDIF   ! Chemical equations
-       
-          IF ( salsa )  THEN 
-!
-!--          Loop over aerosol size bins: number and mass bins
-             IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
-             
-                DO  b = 1, nbins                
-                   sums_salsa_ws_l = aerosol_number(b)%sums_ws_l
-                   CALL salsa_tendency( 'aerosol_number',                      &
-                                         aerosol_number(b)%conc_p,             &
-                                         aerosol_number(b)%conc,               &
-                                         aerosol_number(b)%tconc_m,            &
-                                         i, j, i_omp_start, tn, b, b,          &
-                                         aerosol_number(b)%flux_s,             &
-                                         aerosol_number(b)%diss_s,             &
-                                         aerosol_number(b)%flux_l,             &
-                                         aerosol_number(b)%diss_l,             &
-                                         aerosol_number(b)%init )
-                   aerosol_number(b)%sums_ws_l = sums_salsa_ws_l
-                   DO  c = 1, ncc_tot
-                      sums_salsa_ws_l = aerosol_mass((c-1)*nbins+b)%sums_ws_l 
-                      CALL salsa_tendency( 'aerosol_mass',                     &
-                                            aerosol_mass((c-1)*nbins+b)%conc_p,&
-                                            aerosol_mass((c-1)*nbins+b)%conc,  &
-                                            aerosol_mass((c-1)*nbins+b)%tconc_m,&
-                                            i, j, i_omp_start, tn, b, c,       &
-                                            aerosol_mass((c-1)*nbins+b)%flux_s,&
-                                            aerosol_mass((c-1)*nbins+b)%diss_s,&
-                                            aerosol_mass((c-1)*nbins+b)%flux_l,&
-                                            aerosol_mass((c-1)*nbins+b)%diss_l,&
-                                            aerosol_mass((c-1)*nbins+b)%init )
-                      aerosol_mass((c-1)*nbins+b)%sums_ws_l = sums_salsa_ws_l
-                   ENDDO
-                ENDDO
-                IF ( .NOT. salsa_gases_from_chem )  THEN
-                   DO  g = 1, ngast
-                      sums_salsa_ws_l = salsa_gas(g)%sums_ws_l
-                      CALL salsa_tendency( 'salsa_gas', salsa_gas(g)%conc_p,   &
-                                      salsa_gas(g)%conc, salsa_gas(g)%tconc_m, &
-                                      i, j, i_omp_start, tn, g, g,             &
-                                      salsa_gas(g)%flux_s, salsa_gas(g)%diss_s,&
-                                      salsa_gas(g)%flux_l, salsa_gas(g)%diss_l,&
-                                      salsa_gas(g)%init )
-                      salsa_gas(g)%sums_ws_l = sums_salsa_ws_l
-                   ENDDO
-                ENDIF
-             
-             ENDIF
-             
-          ENDIF        
 
        ENDDO  ! loop over j
@@ -1517,8 +1475,9 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  b     !< index for aerosol size bins (salsa)
-    INTEGER(iwp) ::  c     !< index for chemical compounds (salsa)
-    INTEGER(iwp) ::  g     !< index for gaseous compounds (salsa)
     INTEGER(iwp) ::  i     !<
+    INTEGER(iwp) ::  ib    !< index for aerosol size bins (salsa)
+    INTEGER(iwp) ::  ic    !< index for chemical compounds (salsa)
+    INTEGER(iwp) ::  icc   !< additional index for chemical compounds (salsa)
+    INTEGER(iwp) ::  ig    !< index for gaseous compounds (salsa)
     INTEGER(iwp) ::  j     !<
     INTEGER(iwp) ::  k     !<
@@ -1532,12 +1491,9 @@
 !-- concentrations of aerosol number and mass 
     IF ( salsa )  THEN
-       
        IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
-       
           IF ( ( time_since_reference_point - last_salsa_time ) >= dt_salsa )  &
           THEN
-          
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'start' )
-             !$OMP PARALLEL PRIVATE (i,j,b,c,g)
+             !$OMP PARALLEL PRIVATE (i,j,ib,ic,icc,ig)
              !$OMP DO
 !
@@ -1550,38 +1506,32 @@
                 ENDDO
              ENDDO
-             
+
              CALL cpu_log( log_point_s(90), 'salsa processes ', 'stop' )
-             
              CALL cpu_log( log_point_s(91), 'salsa exch-horiz ', 'start' )
 !
 !--          Exchange ghost points and decycle if needed.
-             DO  b = 1, nbins
-                CALL exchange_horiz( aerosol_number(b)%conc, nbgp )
-                CALL salsa_boundary_conds( aerosol_number(b)%conc_p,           &
-                                           aerosol_number(b)%init )
-                DO  c = 1, ncc_tot
-                   CALL exchange_horiz( aerosol_mass((c-1)*nbins+b)%conc, nbgp )
-                   CALL salsa_boundary_conds(                                  &
-                                           aerosol_mass((c-1)*nbins+b)%conc_p, &
-                                           aerosol_mass((c-1)*nbins+b)%init )
-                ENDDO
-             ENDDO
-             
+             DO  ib = 1, nbins_aerosol
+                CALL exchange_horiz( aerosol_number(ib)%conc, nbgp )
+                CALL salsa_boundary_conds( aerosol_number(ib)%conc,            &
+                                           aerosol_number(ib)%init )
+                DO  ic = 1, ncomponents_mass
+                   icc = ( ic - 1 ) * nbins_aerosol + ib
+                   CALL exchange_horiz( aerosol_mass(icc)%conc, nbgp )
+                   CALL salsa_boundary_conds( aerosol_mass(icc)%conc,          &
+                                              aerosol_mass(icc)%init )
+                ENDDO
+             ENDDO
              IF ( .NOT. salsa_gases_from_chem )  THEN
-                DO  g = 1, ngast
-                   CALL exchange_horiz( salsa_gas(g)%conc, nbgp )
-                   CALL salsa_boundary_conds( salsa_gas(g)%conc_p,             &
-                                              salsa_gas(g)%init )
+                DO  ig = 1, ngases_salsa
+                   CALL exchange_horiz( salsa_gas(ig)%conc, nbgp )
+                   CALL salsa_boundary_conds( salsa_gas(ig)%conc,              &
+                                              salsa_gas(ig)%init )
                 ENDDO
              ENDIF
              CALL cpu_log( log_point_s(91), 'salsa exch-horiz ', 'stop' )
-             
              !$OMP END PARALLEL
              last_salsa_time = time_since_reference_point
-             
-          ENDIF
-          
-       ENDIF
-       
+          ENDIF
+       ENDIF
     ENDIF 
 
@@ -2661,43 +2611,4 @@
        CALL cpu_log( log_point_s(25), 'chem.advec+diff+prog', 'stop' )             
     ENDIF   ! Chemicals equations
-        
-    IF ( salsa )  THEN 
-       CALL cpu_log( log_point_s(92), 'salsa advec+diff+prog ', 'start' )
-!
-!--          Loop over aerosol size bins: number and mass bins
-       IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
-       
-          DO  b = 1, nbins                
-             sums_salsa_ws_l = aerosol_number(b)%sums_ws_l
-             CALL salsa_tendency( 'aerosol_number', aerosol_number(b)%conc_p,  &
-                                   aerosol_number(b)%conc,                     &
-                                   aerosol_number(b)%tconc_m,                  &
-                                   b, b, aerosol_number(b)%init )
-             aerosol_number(b)%sums_ws_l = sums_salsa_ws_l
-             DO  c = 1, ncc_tot
-                sums_salsa_ws_l = aerosol_mass((c-1)*nbins+b)%sums_ws_l 
-                CALL salsa_tendency( 'aerosol_mass',                           &
-                                      aerosol_mass((c-1)*nbins+b)%conc_p,      &
-                                      aerosol_mass((c-1)*nbins+b)%conc,        &
-                                      aerosol_mass((c-1)*nbins+b)%tconc_m,     &
-                                      b, c, aerosol_mass((c-1)*nbins+b)%init )
-                aerosol_mass((c-1)*nbins+b)%sums_ws_l = sums_salsa_ws_l
-             ENDDO
-          ENDDO
-          IF ( .NOT. salsa_gases_from_chem )  THEN
-             DO  g = 1, ngast
-                sums_salsa_ws_l = salsa_gas(g)%sums_ws_l
-                CALL salsa_tendency( 'salsa_gas', salsa_gas(g)%conc_p,         &
-                                      salsa_gas(g)%conc, salsa_gas(g)%tconc_m, &
-                                      g, g, salsa_gas(g)%init )
-                salsa_gas(g)%sums_ws_l = sums_salsa_ws_l
-             ENDDO
-          ENDIF
-       
-       ENDIF
-       
-       CALL cpu_log( log_point_s(92), 'salsa advec+diff+prog ', 'stop' )
-    ENDIF
-
 
  END SUBROUTINE prognostic_equations_vector
Index: /palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- /palm/trunk/SOURCE/salsa_mod.f90	(revision 3863)
+++ /palm/trunk/SOURCE/salsa_mod.f90	(revision 3864)
@@ -26,4 +26,40 @@
 ! -----------------
 ! $Id$
+! Major changes in formatting, performance and data input structure (see branch
+! the history for details)
+! - Time-dependent emissions enabled: lod=1 for yearly PM emissions that are
+!   normalised depending on the time, and lod=2 for preprocessed emissions
+!   (similar to the chemistry module).
+! - Additionally, 'uniform' emissions allowed. This emission is set constant on
+!   all horisontal upward facing surfaces and it is created based on parameters
+!   surface_aerosol_flux, aerosol_flux_dpg/sigmag/mass_fracs_a/mass_fracs_b.
+! - All emissions are now implemented as surface fluxes! No 3D sources anymore.
+! - Update the emission information by calling salsa_emission_update if 
+!   skip_time_do_salsa >= time_since_reference_point and
+!   next_aero_emission_update <= time_since_reference_point
+! - Aerosol background concentrations read from PIDS_DYNAMIC. The vertical grid
+!   must match the one applied in the model.
+! - Gas emissions and background concentrations can be also read in in salsa_mod
+!   if the chemistry module is not applied.
+! - In deposition, information on the land use type can be now imported from
+!   the land use model
+! - Use SI units in PARIN, i.e. n_lognorm given in #/m3 and dpg in metres.
+! - Apply 100 character line limit
+! - Change all variable names from capital to lowercase letter
+! - Change real exponents to integer if possible. If not, precalculate the value
+!   value of exponent
+! - Rename in1a to start_subrange_1a, fn2a to end_subrange_1a etc.
+! - Rename nbins --> nbins_aerosol, ncc_tot --> ncomponents_mass and ngast -->
+!   ngases_salsa
+! - Rename ibc to index_bc, idu to index_du etc.
+! - Renamed loop indices b, c and sg to ib, ic and ig
+! - run_salsa subroutine removed
+! - Corrected a bud in salsa_driver: falsely applied ino instead of inh
+! - Call salsa_tendency within salsa_prognostic_equations which is called in
+!   module_interface_mod instead of prognostic_equations_mod
+! - Removed tailing white spaces and unused variables
+! - Change error message to start by PA instead of SA
+! 
+! 3833 2019-03-28 15:04:04Z forkel
 ! added USE chem_gasphase_mod for nvar, nspec and spc_names 
 ! 
@@ -71,26 +107,20 @@
 ! --------
 ! @author Mona Kurppa (University of Helsinki)
-! 
+!
 !
 ! Description:
 ! ------------
-!> Sectional aerosol module for large scale applications SALSA 
+!> Sectional aerosol module for large scale applications SALSA
 !> (Kokkola et al., 2008, ACP 8, 2469-2483). Solves the aerosol number and mass
-!> concentration as well as chemical composition. Includes aerosol dynamic 
+!> concentration as well as chemical composition. Includes aerosol dynamic
 !> processes: nucleation, condensation/evaporation of vapours, coagulation and
-!> deposition on tree leaves, ground and roofs. 
+!> deposition on tree leaves, ground and roofs.
 !> Implementation is based on formulations implemented in UCLALES-SALSA except
-!> for deposition which is based on parametrisations by Zhang et al. (2001, 
-!> Atmos. Environ. 35, 549-560) or Petroff&Zhang (2010, Geosci. Model Dev. 3, 
+!> for deposition which is based on parametrisations by Zhang et al. (2001,
+!> Atmos. Environ. 35, 549-560) or Petroff&Zhang (2010, Geosci. Model Dev. 3,
 !> 753-769)
 !>
-!> @todo Implement turbulent inflow of aerosols in inflow_turbulence.
-!> @todo Deposition on subgrid scale vegetation 
-!> @todo Deposition on vegetation calculated by default for deciduous broadleaf 
-!>       trees
-!> @todo Revise masked data output. There is a potential bug in case of 
-!>       terrain-following masked output, according to data_output_mask. 
-!> @todo There are now improved interfaces for NetCDF data input which can be
-!>       used instead of get variable etc.
+!> @todo Apply information from emission_stack_height to lift emission sources
+!> @todo emission mode "parameterized", i.e. based on street type
 !------------------------------------------------------------------------------!
  MODULE salsa_mod
@@ -98,5 +128,5 @@
     USE basic_constants_and_equations_mod,                                     &
         ONLY:  c_p, g, p_0, pi, r_d
- 
+
     USE chem_gasphase_mod,                                                     &
         ONLY:  nspec, nvar, spc_names
@@ -113,9 +143,9 @@
         ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,  &
                nzb_s_inner, nz, nzt, wall_flags_0
-     
+
     USE kinds
-    
+
     USE pegrid
-    
+
     USE salsa_util_mod
 
@@ -125,46 +155,43 @@
 !
 !-- Local constants:
-    INTEGER(iwp), PARAMETER ::  ngast   = 5 !< total number of gaseous tracers:
-                                            !< 1 = H2SO4, 2 = HNO3, 3 = NH3, 
-                                            !< 4 = OCNV (non-volatile OC), 
-                                            !< 5 = OCSV (semi-volatile)  
-    INTEGER(iwp), PARAMETER ::  nmod    = 7 !< number of modes for initialising 
-                                            !< the aerosol size distribution                                              
-    INTEGER(iwp), PARAMETER ::  nreg    = 2 !< Number of main size subranges 
-    INTEGER(iwp), PARAMETER ::  maxspec = 7 !< Max. number of aerosol species
-!    
+    INTEGER(iwp), PARAMETER ::  luc_urban = 8      !< default landuse type for urban: use desert!
+    INTEGER(iwp), PARAMETER ::  ngases_salsa   = 5 !< total number of gaseous tracers:
+                                                   !< 1 = H2SO4, 2 = HNO3, 3 = NH3, 4 = OCNV
+                                                   !< (non-volatile OC), 5 = OCSV (semi-volatile)
+    INTEGER(iwp), PARAMETER ::  nmod    = 7  !< number of modes for initialising the aerosol size
+                                             !< distribution
+    INTEGER(iwp), PARAMETER ::  nreg    = 2  !< Number of main size subranges
+    INTEGER(iwp), PARAMETER ::  maxspec = 7  !< Max. number of aerosol species
+    INTEGER(iwp), PARAMETER ::  season = 1   !< For dry depostion by Zhang et al.: 1 = summer,
+                                             !< 2 = autumn (no harvest yet), 3 = late autumn
+                                             !< (already frost), 4 = winter, 5 = transitional spring
+!
 !-- Universal constants
-    REAL(wp), PARAMETER ::  abo    = 1.380662E-23_wp  !< Boltzmann constant (J/K)
-    REAL(wp), PARAMETER ::  alv    = 2.260E+6_wp      !< latent heat for H2O 
-                                                      !< vaporisation (J/kg)
-    REAL(wp), PARAMETER ::  alv_d_rv  = 4896.96865_wp !< alv / rv
-    REAL(wp), PARAMETER ::  am_airmol = 4.8096E-26_wp !< Average mass of one air
-                                                      !< molecule (Jacobson, 
-                                                      !< 2005, Eq. 2.3)                                                   
-    REAL(wp), PARAMETER ::  api6   = 0.5235988_wp     !< pi / 6   
-    REAL(wp), PARAMETER ::  argas  = 8.314409_wp      !< Gas constant (J/(mol K))
-    REAL(wp), PARAMETER ::  argas_d_cpd = 8.281283865E-3_wp !< argas per cpd
-    REAL(wp), PARAMETER ::  avo    = 6.02214E+23_wp   !< Avogadro constant (1/mol)
-    REAL(wp), PARAMETER ::  d_sa   = 5.539376964394570E-10_wp !< diameter of 
-                                                      !< condensing sulphuric 
-                                                      !< acid molecule (m)  
-    REAL(wp), PARAMETER ::  for_ppm_to_nconc =  7.243016311E+16_wp !< 
-                                                 !< ppm * avo / R (K/(Pa*m3))
+    REAL(wp), PARAMETER ::  abo    = 1.380662E-23_wp   !< Boltzmann constant (J/K)
+    REAL(wp), PARAMETER ::  alv    = 2.260E+6_wp       !< latent heat for H2O
+                                                       !< vaporisation (J/kg)
+    REAL(wp), PARAMETER ::  alv_d_rv  = 4896.96865_wp  !< alv / rv
+    REAL(wp), PARAMETER ::  am_airmol = 4.8096E-26_wp  !< Average mass of one air
+                                                       !< molecule (Jacobson,
+                                                       !< 2005, Eq. 2.3)
+    REAL(wp), PARAMETER ::  api6   = 0.5235988_wp      !< pi / 6
+    REAL(wp), PARAMETER ::  argas  = 8.314409_wp       !< Gas constant (J/(mol K))
+    REAL(wp), PARAMETER ::  argas_d_cpd = 8.281283865E-3_wp  !< argas per cpd
+    REAL(wp), PARAMETER ::  avo    = 6.02214E+23_wp    !< Avogadro constant (1/mol)
+    REAL(wp), PARAMETER ::  d_sa   = 5.539376964394570E-10_wp  !< diameter of condensing sulphuric
+                                                               !< acid molecule (m)
+    REAL(wp), PARAMETER ::  for_ppm_to_nconc =  7.243016311E+16_wp !< ppm * avo / R (K/(Pa*m3))
     REAL(wp), PARAMETER ::  epsoc  = 0.15_wp          !< water uptake of organic
-                                                      !< material     
-    REAL(wp), PARAMETER ::  mclim  = 1.0E-23_wp    !< mass concentration min 
-                                                   !< limit for aerosols (kg/m3)                                                   
-    REAL(wp), PARAMETER ::  n3     = 158.79_wp !< Number of H2SO4 molecules in
-                                               !< 3 nm cluster if d_sa=5.54e-10m
-    REAL(wp), PARAMETER ::  nclim  = 1.0_wp    !< number concentration min limit 
-                                               !< for aerosols and gases (#/m3)
-    REAL(wp), PARAMETER ::  surfw0 = 0.073_wp  !< surface tension of pure water 
-                                               !< at ~ 293 K (J/m2)   
-    REAL(wp), PARAMETER ::  vclim  = 1.0E-24_wp    !< volume concentration min 
-                                                   !< limit for aerosols (m3/m3)                                           
+                                                      !< material
+    REAL(wp), PARAMETER ::  mclim  = 1.0E-23_wp       !< mass concentration min limit (kg/m3)
+    REAL(wp), PARAMETER ::  n3     = 158.79_wp        !< Number of H2SO4 molecules in 3 nm cluster
+                                                      !< if d_sa=5.54e-10m
+    REAL(wp), PARAMETER ::  nclim  = 1.0_wp           !< number concentration min limit (#/m3)
+    REAL(wp), PARAMETER ::  surfw0 = 0.073_wp         !< surface tension of water at 293 K (J/m2)
+!
 !-- Molar masses in kg/mol
     REAL(wp), PARAMETER ::  ambc   = 12.0E-3_wp     !< black carbon (BC)
     REAL(wp), PARAMETER ::  amdair = 28.970E-3_wp   !< dry air
-    REAL(wp), PARAMETER ::  amdu   = 100.E-3_wp     !< mineral dust 
+    REAL(wp), PARAMETER ::  amdu   = 100.E-3_wp     !< mineral dust
     REAL(wp), PARAMETER ::  amh2o  = 18.0154E-3_wp  !< H2O
     REAL(wp), PARAMETER ::  amh2so4  = 98.06E-3_wp  !< H2SO4
@@ -176,294 +203,445 @@
     REAL(wp), PARAMETER ::  amoc   = 150.E-3_wp     !< organic carbon (OC)
     REAL(wp), PARAMETER ::  amss   = 58.44E-3_wp    !< sea salt (NaCl)
+!
 !-- Densities in kg/m3
-    REAL(wp), PARAMETER ::  arhobc     = 2000.0_wp !< black carbon
-    REAL(wp), PARAMETER ::  arhodu     = 2650.0_wp !< mineral dust
-    REAL(wp), PARAMETER ::  arhoh2o    = 1000.0_wp !< H2O
-    REAL(wp), PARAMETER ::  arhoh2so4  = 1830.0_wp !< SO4 
-    REAL(wp), PARAMETER ::  arhohno3   = 1479.0_wp !< HNO3
-    REAL(wp), PARAMETER ::  arhonh3    = 1530.0_wp !< NH3 
-    REAL(wp), PARAMETER ::  arhooc     = 2000.0_wp !< organic carbon
-    REAL(wp), PARAMETER ::  arhoss     = 2165.0_wp !< sea salt (NaCl)
+    REAL(wp), PARAMETER ::  arhobc     = 2000.0_wp  !< black carbon
+    REAL(wp), PARAMETER ::  arhodu     = 2650.0_wp  !< mineral dust
+    REAL(wp), PARAMETER ::  arhoh2o    = 1000.0_wp  !< H2O
+    REAL(wp), PARAMETER ::  arhoh2so4  = 1830.0_wp  !< SO4
+    REAL(wp), PARAMETER ::  arhohno3   = 1479.0_wp  !< HNO3
+    REAL(wp), PARAMETER ::  arhonh3    = 1530.0_wp  !< NH3
+    REAL(wp), PARAMETER ::  arhooc     = 2000.0_wp  !< organic carbon
+    REAL(wp), PARAMETER ::  arhoss     = 2165.0_wp  !< sea salt (NaCl)
+!
 !-- Volume of molecule in m3/#
     REAL(wp), PARAMETER ::  amvh2o   = amh2o /avo / arhoh2o      !< H2O
     REAL(wp), PARAMETER ::  amvh2so4 = amh2so4 / avo / arhoh2so4 !< SO4
-    REAL(wp), PARAMETER ::  amvhno3  = amhno3 / avo / arhohno3   !< HNO3 
-    REAL(wp), PARAMETER ::  amvnh3   = amnh3 / avo / arhonh3     !< NH3  
+    REAL(wp), PARAMETER ::  amvhno3  = amhno3 / avo / arhohno3   !< HNO3
+    REAL(wp), PARAMETER ::  amvnh3   = amnh3 / avo / arhonh3     !< NH3
     REAL(wp), PARAMETER ::  amvoc    = amoc / avo / arhooc       !< OC
     REAL(wp), PARAMETER ::  amvss    = amss / avo / arhoss       !< sea salt
-    
+!
+!-- Constants for the dry deposition model by Petroff and Zhang (2010):
+!-- obstacle characteristic dimension "L" (cm) (plane obstacle by default) and empirical constants
+!-- C_B, C_IN, C_IM, beta_IM and C_IT for each land use category (15, as in Zhang et al. (2001))
+    REAL(wp), DIMENSION(1:15), PARAMETER :: l_p10 = &
+        (/0.15, 4.0, 0.15, 3.0, 3.0, 0.5, 3.0, -99., 0.5, 2.0, 1.0, -99., -99., -99., 3.0/)
+    REAL(wp), DIMENSION(1:15), PARAMETER :: c_b_p10 = &
+        (/0.887, 1.262, 0.887, 1.262, 1.262, 0.996, 0.996, -99., 0.7, 0.93, 0.996, -99., -99., -99., 1.262/)
+    REAL(wp), DIMENSION(1:15), PARAMETER :: c_in_p10 = &
+        (/0.81, 0.216, 0.81, 0.216, 0.216, 0.191, 0.162, -99., 0.7, 0.14, 0.162, -99., -99., -99., 0.216/)
+    REAL(wp), DIMENSION(1:15), PARAMETER :: c_im_p10 = &
+        (/0.162, 0.13, 0.162, 0.13, 0.13, 0.191, 0.081, -99., 0.191, 0.086, 0.081, -99., -99., -99., 0.13/)
+    REAL(wp), DIMENSION(1:15), PARAMETER :: beta_im_p10 = &
+        (/0.6, 0.47, 0.6, 0.47, 0.47, 0.47, 0.47, -99., 0.6, 0.47, 0.47, -99., -99., -99., 0.47/)
+    REAL(wp), DIMENSION(1:15), PARAMETER :: c_it_p10 = &
+        (/0.0, 0.056, 0.0, 0.056, 0.056, 0.042, 0.056, -99., 0.042, 0.014, 0.056, -99., -99., -99., 0.056/)
+!
+!-- Constants for the dry deposition model by Zhang et al. (2001): 
+!-- empirical constants "alpha" and "gamma" and characteristic radius "A" for 
+!-- each land use category (15) and season (5)
+    REAL(wp), DIMENSION(1:15), PARAMETER :: alpha_z01 = &
+        (/1.0, 0.6, 1.1, 0.8, 0.8, 1.2, 1.2, 50.0, 50.0, 1.3, 2.0, 50.0, 100.0, 100.0, 1.5/)
+    REAL(wp), DIMENSION(1:15), PARAMETER :: gamma_z01 = &
+        (/0.56, 0.58, 0.56, 0.56, 0.56, 0.54, 0.54, 0.54, 0.54, 0.54, 0.54, 0.54, 0.50, 0.50, 0.56/)
+    REAL(wp), DIMENSION(1:15,1:5), PARAMETER :: A_z01 =  RESHAPE( (/& 
+         2.0, 5.0, 2.0,  5.0, 5.0, 2.0, 2.0, -99., -99., 10.0, 10.0, -99., -99., -99., 10.0,&  ! SC1
+         2.0, 5.0, 2.0,  5.0, 5.0, 2.0, 2.0, -99., -99., 10.0, 10.0, -99., -99., -99., 10.0,&  ! SC2
+         2.0, 5.0, 5.0, 10.0, 5.0, 5.0, 5.0, -99., -99., 10.0, 10.0, -99., -99., -99., 10.0,&  ! SC3
+         2.0, 5.0, 5.0, 10.0, 5.0, 5.0, 5.0, -99., -99., 10.0, 10.0, -99., -99., -99., 10.0,&  ! SC4
+         2.0, 5.0, 2.0,  5.0, 5.0, 2.0, 2.0, -99., -99., 10.0, 10.0, -99., -99., -99., 10.0 &  ! SC5
+                                                           /), (/ 15, 5 /) )
+!-- Land use categories (based on Z01 but the same applies here also for P10):
+!-- 1 = evergreen needleleaf trees,
+!-- 2 = evergreen broadleaf trees,
+!-- 3 = deciduous needleleaf trees,
+!-- 4 = deciduous broadleaf trees,
+!-- 5 = mixed broadleaf and needleleaf trees (deciduous broadleaf trees for P10),
+!-- 6 = grass (short grass for P10),
+!-- 7 = crops, mixed farming,
+!-- 8 = desert,
+!-- 9 = tundra,
+!-- 10 = shrubs and interrupted woodlands (thorn shrubs for P10),
+!-- 11 = wetland with plants (long grass for P10)
+!-- 12 = ice cap and glacier,
+!-- 13 = inland water (inland lake for P10)
+!-- 14 = ocean (water for P10),
+!-- 15 = urban
+!
+!-- SALSA variables:
+    CHARACTER(LEN=20)  ::  bc_salsa_b = 'neumann'                 !< bottom boundary condition
+    CHARACTER(LEN=20)  ::  bc_salsa_t = 'neumann'                 !< top boundary condition
+    CHARACTER(LEN=20)  ::  depo_pcm_par = 'zhang2001'             !< or 'petroff2010'
+    CHARACTER(LEN=20)  ::  depo_pcm_type = 'deciduous_broadleaf'  !< leaf type
+    CHARACTER(LEN=20)  ::  depo_surf_par = 'zhang2001'            !< or 'petroff2010'
+    CHARACTER(LEN=100) ::  input_file_dynamic = 'PIDS_DYNAMIC'    !< file name for dynamic input
+    CHARACTER(LEN=100) ::  input_file_salsa   = 'PIDS_SALSA'      !< file name for emission data
+    CHARACTER(LEN=20)  ::  salsa_emission_mode = 'no_emission'    !< 'no_emission', 'uniform',
+                                                                  !< 'parameterized', 'read_from_file'
+
+    CHARACTER(LEN=20), DIMENSION(4) ::  decycle_method =                                           &
+                                                 (/'dirichlet','dirichlet','dirichlet','dirichlet'/)
+                                     !< Decycling method at horizontal boundaries
+                                     !< 1=left, 2=right, 3=south, 4=north
+                                     !< dirichlet = initial profiles for the ghost and first 3 layers
+                                     !< neumann = zero gradient
+
+    CHARACTER(LEN=3), DIMENSION(maxspec) ::  listspec = &  !< Active aerosols
+                                   (/'SO4','   ','   ','   ','   ','   ','   '/)
+
+    INTEGER(iwp) ::  depo_pcm_type_num = 0  !< index for the dry deposition type on the plant canopy
+    INTEGER(iwp) ::  dots_salsa = 0         !< starting index for salsa-timeseries
+    INTEGER(iwp) ::  end_subrange_1a = 1    !< last index for bin subrange 1a
+    INTEGER(iwp) ::  end_subrange_2a = 1    !< last index for bin subrange 2a
+    INTEGER(iwp) ::  end_subrange_2b = 1    !< last index for bin subrange 2b
+    INTEGER(iwp) ::  ibc_salsa_b            !< index for the bottom boundary condition
+    INTEGER(iwp) ::  ibc_salsa_t            !< index for the top boundary condition
+    INTEGER(iwp) ::  index_bc  = -1         !< index for black carbon (BC)
+    INTEGER(iwp) ::  index_du  = -1         !< index for dust
+    INTEGER(iwp) ::  igctyp = 0             !< Initial gas concentration type
+                                            !< 0 = uniform (read from PARIN)
+                                            !< 1 = read vertical profile from an input file
+    INTEGER(iwp) ::  index_nh  = -1         !< index for NH3
+    INTEGER(iwp) ::  index_no  = -1         !< index for HNO3
+    INTEGER(iwp) ::  index_oc  = -1         !< index for organic carbon (OC)
+    INTEGER(iwp) ::  isdtyp = 0             !< Initial size distribution type
+                                            !< 0 = uniform (read from PARIN)
+                                            !< 1 = read vertical profile of the mode number
+                                            !<     concentration from an input file
+    INTEGER(iwp) ::  index_so4 = -1         !< index for SO4 or H2SO4
+    INTEGER(iwp) ::  index_ss  = -1         !< index for sea salt
+    INTEGER(iwp) ::  lod_gas_emissions = 0  !< level of detail of the gaseous emission data
+    INTEGER(iwp) ::  nbins_aerosol = 1      !< total number of size bins
+    INTEGER(iwp) ::  ncc   = 1              !< number of chemical components used
+    INTEGER(iwp) ::  ncomponents_mass = 1   !< total number of chemical compounds (ncc+1)
+                                            !< if particle water is advected)
+    INTEGER(iwp) ::  nj3 = 1                !< J3 parametrization (nucleation)
+                                            !< 1 = condensational sink (Kerminen&Kulmala, 2002)
+                                            !< 2 = coagulational sink (Lehtinen et al. 2007)
+                                            !< 3 = coagS+self-coagulation (Anttila et al. 2010)
+    INTEGER(iwp) ::  nsnucl = 0             !< Choice of the nucleation scheme:
+                                            !< 0 = off
+                                            !< 1 = binary nucleation
+                                            !< 2 = activation type nucleation
+                                            !< 3 = kinetic nucleation
+                                            !< 4 = ternary nucleation
+                                            !< 5 = nucleation with ORGANICs
+                                            !< 6 = activation type of nucleation with H2SO4+ORG
+                                            !< 7 = heteromolecular nucleation with H2SO4*ORG
+                                            !< 8 = homomolecular nucleation of H2SO4
+                                            !<     + heteromolecular nucleation with H2SO4*ORG
+                                            !< 9 = homomolecular nucleation of H2SO4 and ORG
+                                            !<     + heteromolecular nucleation with H2SO4*ORG
+    INTEGER(iwp) ::  start_subrange_1a = 1  !< start index for bin subranges: subrange 1a
+    INTEGER(iwp) ::  start_subrange_2a = 1  !<                                subrange 2a
+    INTEGER(iwp) ::  start_subrange_2b = 1  !<                                subrange 2b
+
+    INTEGER(iwp), DIMENSION(nreg) ::  nbin = (/ 3, 7/)  !< Number of size bins per subrange: 1 & 2
+
+    INTEGER(iwp), DIMENSION(ngases_salsa) ::  gas_index_chem = &
+                                                 (/ 1, 1, 1, 1, 1/)  !< gas indices in chemistry_model_mod
+                                                 !< 1 = H2SO4, 2 = HNO3, 3 = NH3, 4 = OCNV, 5 = OCSV
+    INTEGER(iwp), DIMENSION(ngases_salsa) ::  emission_index_chem  !< gas indices in the gas emission file
+
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  k_topo_top  !< vertical index of the topography top
 !
 !-- SALSA switches:
-    INTEGER(iwp) ::  nj3 = 1 !< J3 parametrization (nucleation)
-                             !< 1 = condensational sink (Kerminen&Kulmala, 2002)
-                             !< 2 = coagulational sink (Lehtinen et al. 2007)
-                             !< 3 = coagS+self-coagulation (Anttila et al. 2010)                                       
-    INTEGER(iwp) ::  nsnucl = 0 !< Choice of the nucleation scheme:
-                                !< 0 = off   
-                                !< 1 = binary nucleation
-                                !< 2 = activation type nucleation
-                                !< 3 = kinetic nucleation
-                                !< 4 = ternary nucleation
-                                !< 5 = nucleation with ORGANICs
-                                !< 6 = activation type of nucleation with 
-                                !<     H2SO4+ORG
-                                !< 7 = heteromolecular nucleation with H2SO4*ORG
-                                !< 8 = homomolecular nucleation of  H2SO4 + 
-                                !<     heteromolecular nucleation with H2SO4*ORG
-                                !< 9 = homomolecular nucleation of  H2SO4 and ORG 
-                                !<     +heteromolecular nucleation with H2SO4*ORG 
-    LOGICAL ::  advect_particle_water = .TRUE.  !< advect water concentration of 
-                                                !< particles                                
-    LOGICAL ::  decycle_lr            = .FALSE. !< Undo cyclic boundary
-                                                !< conditions: left and right
-    LOGICAL ::  decycle_ns            = .FALSE. !< north and south boundaries
-    LOGICAL ::  feedback_to_palm      = .FALSE. !< allow feedback due to 
-                                                !< hydration and/or condensation
-                                                !< of H20
-    LOGICAL ::  no_insoluble          = .FALSE. !< Switch to exclude insoluble  
-                                                !< chemical components 
-    LOGICAL ::  read_restart_data_salsa = .FALSE. !< read restart data for salsa
-    LOGICAL ::  salsa_gases_from_chem = .FALSE.   !< Transfer the gaseous 
-                                                  !< components to SALSA from  
-                                                  !< from chemistry model
-    LOGICAL ::  van_der_waals_coagc   = .FALSE.   !< Enhancement of coagulation 
-                                                  !< kernel by van der Waals and
-                                                  !< viscous forces
-    LOGICAL ::  write_binary_salsa    = .FALSE.   !< read binary for salsa
+    LOGICAL ::  advect_particle_water = .TRUE.     !< advect water concentration of particles
+    LOGICAL ::  decycle_lr            = .FALSE.    !< Undo cyclic boundary conditions: left and right
+    LOGICAL ::  decycle_ns            = .FALSE.    !< north and south boundaries
+    LOGICAL ::  feedback_to_palm      = .FALSE.    !< allow feedback due to condensation of H2O
+    LOGICAL ::  nest_salsa            = .FALSE.    !< apply nesting for salsa
+    LOGICAL ::  no_insoluble          = .FALSE.    !< Switch to exclude insoluble chemical components
+    LOGICAL ::  read_restart_data_salsa = .FALSE.  !< read restart data for salsa
+    LOGICAL ::  salsa_gases_from_chem = .FALSE.    !< Transfer the gaseous components to SALSA from
+                                                   !< from chemistry model
+    LOGICAL ::  van_der_waals_coagc   = .FALSE.    !< Enhancement of coagulation kernel by van der
+                                                   !< Waals and viscous forces
+    LOGICAL ::  write_binary_salsa    = .FALSE.    !< read binary for salsa
+!
 !-- Process switches: nl* is read from the NAMELIST and is NOT changed.
-!--                   ls* is the switch used and will get the value of nl* 
+!--                   ls* is the switch used and will get the value of nl*
 !--                       except for special circumstances (spinup period etc.)
-    LOGICAL ::  nlcoag       = .FALSE. !< Coagulation master switch
-    LOGICAL ::  lscoag       = .FALSE. !<
-    LOGICAL ::  nlcnd        = .FALSE. !< Condensation master switch
-    LOGICAL ::  lscnd        = .FALSE. !<
-    LOGICAL ::  nlcndgas     = .FALSE. !< Condensation of precursor gases
-    LOGICAL ::  lscndgas     = .FALSE. !<
-    LOGICAL ::  nlcndh2oae   = .FALSE. !< Condensation of H2O on aerosol
-    LOGICAL ::  lscndh2oae   = .FALSE. !< particles (FALSE -> equilibrium calc.)
-    LOGICAL ::  nldepo       = .FALSE. !< Deposition master switch
-    LOGICAL ::  lsdepo       = .FALSE. !< 
-    LOGICAL ::  nldepo_topo  = .FALSE. !< Deposition on vegetation master switch
-    LOGICAL ::  lsdepo_topo  = .FALSE. !< 
-    LOGICAL ::  nldepo_vege  = .FALSE. !< Deposition on walls master switch
-    LOGICAL ::  lsdepo_vege  = .FALSE. !< 
-    LOGICAL ::  nldistupdate = .TRUE.  !< Size distribution update master switch                                      
-    LOGICAL ::  lsdistupdate = .FALSE. !<                                     
-!
-!-- SALSA variables:
-    CHARACTER (LEN=20) ::  bc_salsa_b = 'neumann'   !< bottom boundary condition                                      
-    CHARACTER (LEN=20) ::  bc_salsa_t = 'neumann'   !< top boundary condition 
-    CHARACTER (LEN=20) ::  depo_vege_type = 'zhang2001' !< or 'petroff2010' 
-    CHARACTER (LEN=20) ::  depo_topo_type = 'zhang2001' !< or 'petroff2010' 
-    CHARACTER (LEN=20), DIMENSION(4) ::  decycle_method = & 
-                             (/'dirichlet','dirichlet','dirichlet','dirichlet'/)
-                                 !< Decycling method at horizontal boundaries, 
-                                 !< 1=left, 2=right, 3=south, 4=north
-                                 !< dirichlet = initial size distribution and 
-                                 !< chemical composition set for the ghost and 
-                                 !< first three layers
-                                 !< neumann = zero gradient
-    CHARACTER (LEN=3), DIMENSION(maxspec) ::  listspec = &  !< Active aerosols
-                                   (/'SO4','   ','   ','   ','   ','   ','   '/)
-    CHARACTER (LEN=20) ::  salsa_source_mode = 'no_source' 
-                                                    !< 'read_from_file',
-                                                    !< 'constant' or 'no_source'                                   
-    INTEGER(iwp) ::  dots_salsa = 0  !< starting index for salsa-timeseries
-    INTEGER(iwp) ::  fn1a = 1    !< last index for bin subranges:  subrange 1a
-    INTEGER(iwp) ::  fn2a = 1    !<                              subrange 2a
-    INTEGER(iwp) ::  fn2b = 1    !<                              subrange 2b
-    INTEGER(iwp), DIMENSION(ngast) ::  gas_index_chem = (/ 1, 1, 1, 1, 1/) !<
-                                 !< Index of gaseous compounds in the chemistry 
-                                 !< model. In SALSA, 1 = H2SO4, 2 = HNO3, 
-                                 !< 3 = NH3, 4 = OCNV, 5 = OCSV
-    INTEGER(iwp) ::  ibc_salsa_b !<
-    INTEGER(iwp) ::  ibc_salsa_t !<
-    INTEGER(iwp) ::  igctyp = 0  !< Initial gas concentration type
-                                 !< 0 = uniform (use H2SO4_init, HNO3_init, 
-                                 !<     NH3_init, OCNV_init and OCSV_init)
-                                 !< 1 = read vertical profile from an input file  
-    INTEGER(iwp) ::  in1a = 1    !< start index for bin subranges: subrange 1a
-    INTEGER(iwp) ::  in2a = 1    !<                              subrange 2a
-    INTEGER(iwp) ::  in2b = 1    !<                              subrange 2b 
-    INTEGER(iwp) ::  isdtyp = 0  !< Initial size distribution type
-                                 !< 0 = uniform
-                                 !< 1 = read vertical profile of the mode number
-                                 !<     concentration from an input file  
-    INTEGER(iwp) ::  ibc  = -1 !< Indice for: black carbon (BC)
-    INTEGER(iwp) ::  idu  = -1 !< dust
-    INTEGER(iwp) ::  inh  = -1 !< NH3 
-    INTEGER(iwp) ::  ino  = -1 !< HNO3   
-    INTEGER(iwp) ::  ioc  = -1 !< organic carbon (OC)
-    INTEGER(iwp) ::  iso4 = -1 !< SO4 or H2SO4   
-    INTEGER(iwp) ::  iss  = -1 !< sea salt
-    INTEGER(iwp) ::  lod_aero = 0   !< level of detail for aerosol emissions
-    INTEGER(iwp) ::  lod_gases = 0  !< level of detail for gaseous emissions    
-    INTEGER(iwp), DIMENSION(nreg) ::  nbin = (/ 3, 7/)    !< Number of size bins
-                                               !< for each aerosol size subrange
-    INTEGER(iwp) ::  nbins = 1  !< total number of size bins
-    INTEGER(iwp) ::  ncc   = 1  !< number of chemical components used      
-    INTEGER(iwp) ::  ncc_tot = 1!< total number of chemical compounds (ncc+1 
-                                !< if particle water is advected)
-    REAL(wp) ::  act_coeff = 1.0E-7_wp     !< Activation coefficient
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::  emission_mass_fracs  !< array for 
-                                    !< aerosol composition per emission category
-                                    !< 1:SO4 2:OC 3:BC 4:DU 5:SS 6:NO 7:NH  
-    REAL(wp) ::  dt_salsa  = 0.00001_wp    !< Time step of SALSA
-    REAL(wp) ::  H2SO4_init = nclim        !< Init value for sulphuric acid gas
-    REAL(wp) ::  HNO3_init  = nclim        !< Init value for nitric acid gas
-    REAL(wp) ::  last_salsa_time = 0.0_wp  !< time of the previous salsa 
-                                           !< timestep
-    REAL(wp) ::  nf2a = 1.0_wp             !< Number fraction allocated to a-
-                                           !< bins in subrange 2
-                                           !< (b-bins will get 1-nf2a)   
-    REAL(wp) ::  NH3_init  = nclim         !< Init value for ammonia gas
-    REAL(wp) ::  OCNV_init = nclim         !< Init value for non-volatile 
-                                           !< organic gases
-    REAL(wp) ::  OCSV_init = nclim         !< Init value for semi-volatile 
-                                           !< organic gases
+    LOGICAL ::  nlcoag       = .FALSE.  !< Coagulation master switch
+    LOGICAL ::  lscoag       = .FALSE.  !<
+    LOGICAL ::  nlcnd        = .FALSE.  !< Condensation master switch
+    LOGICAL ::  lscnd        = .FALSE.  !<
+    LOGICAL ::  nlcndgas     = .FALSE.  !< Condensation of precursor gases
+    LOGICAL ::  lscndgas     = .FALSE.  !<
+    LOGICAL ::  nlcndh2oae   = .FALSE.  !< Condensation of H2O on aerosol
+    LOGICAL ::  lscndh2oae   = .FALSE.  !< particles (FALSE -> equilibrium calc.)
+    LOGICAL ::  nldepo       = .FALSE.  !< Deposition master switch
+    LOGICAL ::  lsdepo       = .FALSE.  !<
+    LOGICAL ::  nldepo_surf  = .FALSE.  !< Deposition on vegetation master switch
+    LOGICAL ::  lsdepo_surf  = .FALSE.  !<
+    LOGICAL ::  nldepo_pcm   = .FALSE.  !< Deposition on walls master switch
+    LOGICAL ::  lsdepo_pcm   = .FALSE.  !<
+    LOGICAL ::  nldistupdate = .TRUE.   !< Size distribution update master switch
+    LOGICAL ::  lsdistupdate = .FALSE.  !<
+    LOGICAL ::  lspartition  = .FALSE.  !< Partition of HNO3 and NH3
+
+    REAL(wp) ::  act_coeff = 1.0E-7_wp               !< Activation coefficient
+    REAL(wp) ::  dt_salsa  = 0.00001_wp              !< Time step of SALSA
+    REAL(wp) ::  h2so4_init = nclim                  !< Init value for sulphuric acid gas
+    REAL(wp) ::  hno3_init  = nclim                  !< Init value for nitric acid gas
+    REAL(wp) ::  last_salsa_time = 0.0_wp            !< previous salsa call
+    REAL(wp) ::  next_aero_emission_update = 0.0_wp  !< previous emission update
+    REAL(wp) ::  next_gas_emission_update = 0.0_wp   !< previous emission update
+    REAL(wp) ::  nf2a = 1.0_wp                       !< Number fraction allocated to 2a-bins
+    REAL(wp) ::  nh3_init  = nclim                   !< Init value for ammonia gas
+    REAL(wp) ::  ocnv_init = nclim                   !< Init value for non-volatile organic gases
+    REAL(wp) ::  ocsv_init = nclim                   !< Init value for semi-volatile organic gases
+    REAL(wp) ::  rhlim = 1.20_wp                     !< RH limit in %/100. Prevents unrealistical RH
+    REAL(wp) ::  skip_time_do_salsa = 0.0_wp         !< Starting time of SALSA (s)
+!
+!-- Initial log-normal size distribution: mode diameter (dpg, metres),
+!-- standard deviation (sigmag) and concentration (n_lognorm, #/m3)
+    REAL(wp), DIMENSION(nmod) ::  dpg   = &
+                                     (/0.013_wp, 0.054_wp, 0.86_wp, 0.2_wp, 0.2_wp, 0.2_wp, 0.2_wp/)
+    REAL(wp), DIMENSION(nmod) ::  sigmag  = &
+                                        (/1.8_wp, 2.16_wp, 2.21_wp, 2.0_wp, 2.0_wp, 2.0_wp, 2.0_wp/)
+    REAL(wp), DIMENSION(nmod) ::  n_lognorm = &
+                             (/1.04e+11_wp, 3.23E+10_wp, 5.4E+6_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp/)
+!
+!-- Initial mass fractions / chemical composition of the size distribution
+    REAL(wp), DIMENSION(maxspec) ::  mass_fracs_a = & !< mass fractions between
+             (/1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/) !< aerosol species for A bins
+    REAL(wp), DIMENSION(maxspec) ::  mass_fracs_b = & !< mass fractions between
+             (/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/) !< aerosol species for B bins
     REAL(wp), DIMENSION(nreg+1) ::  reglim = & !< Min&max diameters of size subranges
                                  (/ 3.0E-9_wp, 5.0E-8_wp, 1.0E-5_wp/)
-    REAL(wp) ::  rhlim = 1.20_wp    !< RH limit in %/100. Prevents 
-                                    !< unrealistically high RH in condensation                            
-    REAL(wp) ::  skip_time_do_salsa = 0.0_wp !< Starting time of SALSA (s) 
-!-- Initial log-normal size distribution: mode diameter (dpg, micrometres), 
-!-- standard deviation (sigmag) and concentration (n_lognorm, #/cm3)
-    REAL(wp), DIMENSION(nmod) ::  dpg   = (/0.013_wp, 0.054_wp, 0.86_wp,       &
-                                            0.2_wp, 0.2_wp, 0.2_wp, 0.2_wp/) 
-    REAL(wp), DIMENSION(nmod) ::  sigmag  = (/1.8_wp, 2.16_wp, 2.21_wp,        &
-                                              2.0_wp, 2.0_wp, 2.0_wp, 2.0_wp/)  
-    REAL(wp), DIMENSION(nmod) ::  n_lognorm = (/1.04e+5_wp, 3.23E+4_wp, 5.4_wp,&
-                                                0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp/)
-!-- Initial mass fractions / chemical composition of the size distribution    
-    REAL(wp), DIMENSION(maxspec) ::  mass_fracs_a = & !< mass fractions between 
-             (/1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/) !< aerosol species for A bins
-    REAL(wp), DIMENSION(maxspec) ::  mass_fracs_b = & !< mass fractions between 
-             (/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/) !< aerosol species for B bins
-             
-    REAL(wp), ALLOCATABLE, DIMENSION(:) ::  bin_low_limits  !< to deliver 
-                                                            !< information about 
-                                                            !< the lower 
-                                                            !< diameters per bin                                        
-    REAL(wp), ALLOCATABLE, DIMENSION(:) ::  nsect     !< Background number 
-                                                      !< concentration per bin
-    REAL(wp), ALLOCATABLE, DIMENSION(:) ::  massacc   !< Mass accomodation 
-                                                      !< coefficients per bin                                              
-!
-!-- SALSA derived datatypes: 
-!
-!-- Prognostic variable: Aerosol size bin information (number (#/m3) and 
-!-- mass (kg/m3) concentration) and the concentration of gaseous tracers (#/m3).
-!-- Gas tracers are contained sequentially in dimension 4 as: 
-!-- 1. H2SO4, 2. HNO3, 3. NH3, 4. OCNV (non-volatile organics), 
-!-- 5. OCSV (semi-volatile)
+!
+!-- Initial log-normal size distribution: mode diameter (dpg, metres), standard deviation (sigmag)
+!-- concentration (n_lognorm, #/m3) and mass fractions of all chemical components (listed in
+!-- listspec) for both a (soluble) and b (insoluble) bins.
+    REAL(wp), DIMENSION(nmod) ::  aerosol_flux_dpg   = &
+                                     (/0.013_wp, 0.054_wp, 0.86_wp, 0.2_wp, 0.2_wp, 0.2_wp, 0.2_wp/)
+    REAL(wp), DIMENSION(nmod) ::  aerosol_flux_sigmag  = &
+                                        (/1.8_wp, 2.16_wp, 2.21_wp, 2.0_wp, 2.0_wp, 2.0_wp, 2.0_wp/)
+    REAL(wp), DIMENSION(nmod) ::  surface_aerosol_flux = &
+                             (/1.04e+11_wp, 3.23E+10_wp, 5.4E+6_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp/)
+    REAL(wp), DIMENSION(maxspec) ::  aerosol_flux_mass_fracs_a = &
+                                                               (/1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/)
+    REAL(wp), DIMENSION(maxspec) ::  aerosol_flux_mass_fracs_b = &
+                                                               (/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/)
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  bin_low_limits     !< to deliver information about
+                                                               !< the lower diameters per bin
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  bc_am_t_val        !< vertical gradient of: aerosol mass
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  bc_an_t_val        !< of: aerosol number
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  bc_gt_t_val        !< salsa gases near domain top
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  gas_emission_time  !< Time array in gas emission data (s)
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  nsect              !< Background number concentrations
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  massacc            !< Mass accomodation coefficients
+!
+!-- SALSA derived datatypes:
+!
+!-- For matching LSM and the deposition module surface types
+    TYPE match_lsm_depo
+       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  match
+    END TYPE match_lsm_depo
+!
+!-- Aerosol emission data attributes
+    TYPE salsa_emission_attribute_type
+
+       CHARACTER(LEN=25) ::   units
+
+       CHARACTER(LEN=25), DIMENSION(:), ALLOCATABLE ::   cat_name    !<
+       CHARACTER(LEN=25), DIMENSION(:), ALLOCATABLE ::   cc_name     !<
+       CHARACTER(LEN=25), DIMENSION(:), ALLOCATABLE ::   unit_time   !<
+       CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE ::  var_names   !<
+
+       INTEGER(iwp) ::  lod = 0            !< level of detail
+       INTEGER(iwp) ::  nbins = 10         !< number of aerosol size bins
+       INTEGER(iwp) ::  ncat  = 0          !< number of emission categories
+       INTEGER(iwp) ::  ncc   = 7          !< number of aerosol chemical components
+       INTEGER(iwp) ::  nhoursyear = 0     !< number of hours: HOURLY mode
+       INTEGER(iwp) ::  nmonthdayhour = 0  !< number of month days and hours: MDH mode
+       INTEGER(iwp) ::  num_vars           !< number of variables
+       INTEGER(iwp) ::  nt  = 0            !< number of time steps
+       INTEGER(iwp) ::  nz  = 0            !< number of vertical levels
+       INTEGER(iwp) ::  tind               !< time index for reference time in salsa emission data
+
+       INTEGER(iwp), DIMENSION(maxspec) ::  cc_input_to_model   !<
+
+       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  cat_index  !< Index of emission categories
+       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  cc_index   !< Index of chemical components
+
+       REAL(wp) ::  conversion_factor  !< unit conversion factor for aerosol emissions
+
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  dmid         !< mean diameters of size bins (m)
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  rho          !< average density (kg/m3)
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  time         !< time (s)
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  time_factor  !< emission time factor
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  z            !< height (m)
+
+       REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  etf  !< emission time factor
+       REAL(wp), DIMENSION(:,:), ALLOCATABLE :: stack_height
+
+    END TYPE salsa_emission_attribute_type
+!
+!-- The default size distribution and mass composition per emission category:
+!-- 1 = traffic, 2 = road dust, 3 = wood combustion, 4 = other
+!-- Mass fractions: H2SO4, OC, BC, DU, SS, HNO3, NH3
+    TYPE salsa_emission_mode_type
+
+       INTEGER(iwp) ::  ndm = 3  !< number of default modes
+       INTEGER(iwp) ::  ndc = 4  !< number of default categories
+
+       CHARACTER(LEN=25), DIMENSION(1:4) ::  cat_name_table = (/'traffic exhaust', &
+                                                                'road dust      ', &
+                                                                'wood combustion', &
+                                                                'other          '/)
+
+       INTEGER(iwp), DIMENSION(1:4) ::  cat_input_to_model   !<
+
+       REAL(wp), DIMENSION(1:3) ::  dpg_table = (/ 13.5E-9_wp, 1.4E-6_wp, 5.4E-8_wp/)  !<
+       REAL(wp), DIMENSION(1:3) ::  ntot_table  !<
+       REAL(wp), DIMENSION(1:3) ::  sigmag_table = (/ 1.6_wp, 1.4_wp, 1.7_wp /)  !<
+
+       REAL(wp), DIMENSION(1:maxspec,1:4) ::  mass_frac_table = &  !<
+          RESHAPE( (/ 0.04_wp, 0.48_wp, 0.48_wp, 0.0_wp,  0.0_wp, 0.0_wp, 0.0_wp, &
+                      0.0_wp,  0.05_wp, 0.0_wp,  0.95_wp, 0.0_wp, 0.0_wp, 0.0_wp, &
+                      0.0_wp,  0.5_wp,  0.5_wp,  0.0_wp,  0.0_wp, 0.0_wp, 0.0_wp, &
+                      0.0_wp,  0.5_wp,  0.5_wp,  0.0_wp,  0.0_wp, 0.0_wp, 0.0_wp  &
+                   /), (/maxspec,4/) )
+
+       REAL(wp), DIMENSION(1:3,1:4) ::  pm_frac_table = & !< rel. mass
+                                     RESHAPE( (/ 0.016_wp, 0.000_wp, 0.984_wp, &
+                                                 0.000_wp, 1.000_wp, 0.000_wp, &
+                                                 0.000_wp, 0.000_wp, 1.000_wp, &
+                                                 1.000_wp, 0.000_wp, 1.000_wp  &
+                                              /), (/3,4/) )
+
+    END TYPE salsa_emission_mode_type
+!
+!-- Aerosol emission data values
+    TYPE salsa_emission_value_type
+
+       REAL(wp) ::  fill  !< fill value
+
+       REAL(wp), DIMENSION(:), ALLOCATABLE :: preproc_mass_fracs  !< mass fractions
+
+       REAL(wp), DIMENSION(:,:), ALLOCATABLE :: def_mass_fracs  !< mass fractions per emis. category
+
+       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: def_data      !< surface emission values in PM
+       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: preproc_data  !< surface emission values per bin
+
+    END TYPE salsa_emission_value_type
+!
+!-- Prognostic variable: Aerosol size bin information (number (#/m3) and mass (kg/m3) concentration)
+!-- and the concentration of gaseous tracers (#/m3). Gas tracers are contained sequentially in
+!-- dimension 4 as:
+!-- 1. H2SO4, 2. HNO3, 3. NH3, 4. OCNV (non-volatile organics), 5. OCSV (semi-volatile)
     TYPE salsa_variable
-       REAL(wp), POINTER, DIMENSION(:,:,:), CONTIGUOUS     ::  conc
-       REAL(wp), POINTER, DIMENSION(:,:,:), CONTIGUOUS     ::  conc_p
-       REAL(wp), POINTER, DIMENSION(:,:,:), CONTIGUOUS     ::  tconc_m
-       REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::  flux_s, diss_s
-       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  flux_l, diss_l
-       REAL(wp), ALLOCATABLE, DIMENSION(:)     ::  init
-       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  source
-       REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::  sums_ws_l
+
+       REAL(wp), ALLOCATABLE, DIMENSION(:)     ::  init  !<
+
+       REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::  diss_s     !<
+       REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::  flux_s     !<
+       REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::  source     !<
+       REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::  sums_ws_l  !<
+
+       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  diss_l  !<
+       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  flux_l  !<
+
+       REAL(wp), POINTER, DIMENSION(:,:,:), CONTIGUOUS ::  conc     !<
+       REAL(wp), POINTER, DIMENSION(:,:,:), CONTIGUOUS ::  conc_p   !<
+       REAL(wp), POINTER, DIMENSION(:,:,:), CONTIGUOUS ::  tconc_m  !<
+
     END TYPE salsa_variable
-    
-!-- Map bin indices between parallel size distributions    
-    TYPE t_parallelbin
-       INTEGER(iwp) ::  cur  ! Index for current distribution
-       INTEGER(iwp) ::  par  ! Index for corresponding parallel distribution
-    END TYPE t_parallelbin
-    
-!-- Datatype used to store information about the binned size distributions of 
-!-- aerosols
+!
+!-- Datatype used to store information about the binned size distributions of aerosols
     TYPE t_section
+
+       REAL(wp) ::  dmid     !< bin middle diameter (m)
        REAL(wp) ::  vhilim   !< bin volume at the high limit
        REAL(wp) ::  vlolim   !< bin volume at the low limit
        REAL(wp) ::  vratiohi !< volume ratio between the center and high limit
        REAL(wp) ::  vratiolo !< volume ratio between the center and low limit
-       REAL(wp) ::  dmid     !< bin middle diameter (m)
        !******************************************************
        ! ^ Do NOT change the stuff above after initialization !
        !******************************************************
+       REAL(wp) ::  core    !< Volume of dry particle
        REAL(wp) ::  dwet    !< Wet diameter or mean droplet diameter (m)
-       REAL(wp), DIMENSION(maxspec+1) ::  volc !< Volume concentrations 
-                            !< (m^3/m^3) of aerosols + water. Since most of 
-                            !< the stuff in SALSA is hard coded, these *have to
-                            !< be* in the order
-                            !< 1:SO4, 2:OC, 3:BC, 4:DU, 5:SS, 6:NO, 7:NH, 8:H2O
+       REAL(wp) ::  numc    !< Number concentration of particles/droplets (#/m3)
        REAL(wp) ::  veqh2o  !< Equilibrium H2O concentration for each particle
-       REAL(wp) ::  numc    !< Number concentration of particles/droplets (#/m3)
-       REAL(wp) ::  core    !< Volume of dry particle
-    END TYPE t_section  
-!
-!-- Local aerosol properties in SALSA 
-    TYPE(t_section), ALLOCATABLE ::  aero(:)
-!
-!-- SALSA tracers:
-!-- Tracers as x = x(k,j,i,bin). The 4th dimension contains all the size bins 
-!-- sequentially for each aerosol species  + water.
-!
-!-- Prognostic tracers:
-!
-!-- Number concentration (#/m3) 
-    TYPE(salsa_variable), ALLOCATABLE, DIMENSION(:), TARGET ::  aerosol_number
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  nconc_1
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  nconc_2
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  nconc_3
-!
-!-- Mass concentration (kg/m3) 
-    TYPE(salsa_variable), ALLOCATABLE, DIMENSION(:), TARGET ::  aerosol_mass
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mconc_1
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mconc_2
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mconc_3
-!
-!-- Gaseous tracers (#/m3) 
-    TYPE(salsa_variable), ALLOCATABLE, DIMENSION(:), TARGET ::  salsa_gas
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  gconc_1
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  gconc_2
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  gconc_3
+
+       REAL(wp), DIMENSION(maxspec+1) ::  volc !< Volume concentrations (m^3/m^3) of aerosols +
+                                               !< water. Since most of the stuff in SALSA is hard
+                                               !< coded, these *have to be* in the order
+                                               !< 1:SO4, 2:OC, 3:BC, 4:DU, 5:SS, 6:NO, 7:NH, 8:H2O
+    END TYPE t_section
+
+    TYPE(salsa_emission_attribute_type) ::  aero_emission_att  !< emission attributes
+    TYPE(salsa_emission_value_type)     ::  aero_emission      !< emission values
+    TYPE(salsa_emission_mode_type)      ::  def_modes          !< default emission modes
+
+    TYPE(t_section), DIMENSION(:), ALLOCATABLE ::  aero  !< local aerosol properties
+
+    TYPE(match_lsm_depo) ::  lsm_to_depo_h
+
+    TYPE(match_lsm_depo), DIMENSION(0:3) ::  lsm_to_depo_v
+!
+!-- SALSA variables: as x = x(k,j,i,bin). 
+!-- The 4th dimension contains all the size bins sequentially for each aerosol species  + water.
+!
+!-- Prognostic variables:
+!
+!-- Number concentration (#/m3)
+    TYPE(salsa_variable), ALLOCATABLE, DIMENSION(:), TARGET ::  aerosol_number  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  nconc_1  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  nconc_2  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  nconc_3  !<
+!
+!-- Mass concentration (kg/m3)
+    TYPE(salsa_variable), ALLOCATABLE, DIMENSION(:), TARGET ::  aerosol_mass  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mconc_1  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mconc_2  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mconc_3  !<
+!
+!-- Gaseous concentrations (#/m3)
+    TYPE(salsa_variable), ALLOCATABLE, DIMENSION(:), TARGET ::  salsa_gas  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  gconc_1  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  gconc_2  !<
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  gconc_3  !<
 !
 !-- Diagnostic tracers
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  sedim_vd !< sedimentation
-                                                           !< velocity per size 
-                                                           !< bin (m/s)
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  Ra_dry !< dry radius (m)
-    
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  sedim_vd  !< sedimentation velocity per bin (m/s)
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  ra_dry    !< aerosol dry radius (m)
+
 !-- Particle component index tables
-    TYPE(component_index) :: prtcl !< Contains "getIndex" which gives the index 
-                                   !< for a given aerosol component name, i.e. 
-                                   !< 1:SO4, 2:OC, 3:BC, 4:DU,
-                                   !< 5:SS, 6:NO, 7:NH, 8:H2O  
-!                                   
+    TYPE(component_index) :: prtcl  !< Contains "getIndex" which gives the index for a given aerosol
+                                    !< component name: 1:SO4, 2:OC, 3:BC, 4:DU, 5:SS, 6:NO, 7:NH, 8:H2O
+!
 !-- Data output arrays:
+!
 !-- Gases:
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_H2SO4_av  !< H2SO4
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_HNO3_av   !< HNO3
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_NH3_av    !< NH3
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_OCNV_av   !< non-vola-
-                                                                    !< tile OC
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_OCSV_av   !< semi-vol.
-                                                                    !< OC
-!-- Integrated:                                                                    
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  LDSA_av  !< lung-
-                                                                 !< deposited 
-                                                                 !< surface area                                                    
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  Ntot_av  !< total number
-                                                                 !< conc.
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  PM25_av  !< PM2.5
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  PM10_av  !< PM10
-!-- In the particle phase:    
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_BC_av  !< black carbon 
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_DU_av  !< dust 
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_H2O_av !< liquid water
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_NH_av  !< ammonia 
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_NO_av  !< nitrates 
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_OC_av  !< org. carbon 
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_SO4_av !< sulphates
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_SS_av  !< sea salt
-!-- Bins:    
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mbins_av !< bin mass  
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  Nbins_av !< bin number 
-
-    
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_h2so4_av  !< H2SO4
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_hno3_av   !< HNO3
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_nh3_av    !< NH3
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_ocnv_av   !< non-volatile OC
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  g_ocsv_av   !< semi-volatile OC
+!
+!-- Integrated:
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  ldsa_av  !< lung-deposited surface area
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  ntot_av  !< total number concentration
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  pm25_av  !< PM2.5
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  pm10_av  !< PM10
+!
+!-- In the particle phase:
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_bc_av   !< black carbon
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_du_av   !< dust
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_h2o_av  !< liquid water
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_nh_av   !< ammonia
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_no_av   !< nitrates
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_oc_av   !< org. carbon
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_so4_av  !< sulphates
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::  s_ss_av   !< sea salt
+!
+!-- Bin specific mass and number concentrations:
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  mbins_av  !< bin mas
+    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET ::  nbins_av  !< bin number
+
 !
 !-- PALM interfaces:
@@ -474,10 +652,9 @@
        MODULE PROCEDURE salsa_boundary_conds_decycle
     END INTERFACE salsa_boundary_conds
-!    
+!
 !-- Data output checks for 2D/3D data to be done in check_parameters
     INTERFACE salsa_check_data_output
        MODULE PROCEDURE salsa_check_data_output
     END INTERFACE salsa_check_data_output
-    
 !
 !-- Input parameter checks to be done in check_parameters
@@ -485,5 +662,4 @@
        MODULE PROCEDURE salsa_check_parameters
     END INTERFACE salsa_check_parameters
-
 !
 !-- Averaging of 3D data for output
@@ -491,5 +667,4 @@
        MODULE PROCEDURE salsa_3d_data_averaging
     END INTERFACE salsa_3d_data_averaging
-
 !
 !-- Data output of 2D quantities
@@ -497,5 +672,4 @@
        MODULE PROCEDURE salsa_data_output_2d
     END INTERFACE salsa_data_output_2d
-
 !
 !-- Data output of 3D data
@@ -503,5 +677,4 @@
        MODULE PROCEDURE salsa_data_output_3d
     END INTERFACE salsa_data_output_3d
-    
 !
 !-- Data output of 3D data
@@ -509,5 +682,4 @@
        MODULE PROCEDURE salsa_data_output_mask
     END INTERFACE salsa_data_output_mask
-
 !
 !-- Definition of data output quantities
@@ -515,5 +687,4 @@
        MODULE PROCEDURE salsa_define_netcdf_grid
     END INTERFACE salsa_define_netcdf_grid
-    
 !
 !-- Output of information to the header file
@@ -521,11 +692,9 @@
        MODULE PROCEDURE salsa_header
     END INTERFACE salsa_header
-  
-!
-!-- Initialization actions  
+!
+!-- Initialization actions
     INTERFACE salsa_init
        MODULE PROCEDURE salsa_init
     END INTERFACE salsa_init
- 
 !
 !-- Initialization of arrays
@@ -533,5 +702,4 @@
        MODULE PROCEDURE salsa_init_arrays
     END INTERFACE salsa_init_arrays
-
 !
 !-- Writing of binary output for restart runs  !!! renaming?!
@@ -539,5 +707,4 @@
        MODULE PROCEDURE salsa_wrd_local
     END INTERFACE salsa_wrd_local
-    
 !
 !-- Reading of NAMELIST parameters
@@ -545,5 +712,4 @@
        MODULE PROCEDURE salsa_parin
     END INTERFACE salsa_parin
-
 !
 !-- Reading of parameters for restart runs
@@ -551,5 +717,4 @@
        MODULE PROCEDURE salsa_rrd_local
     END INTERFACE salsa_rrd_local
-    
 !
 !-- Swapping of time levels (required for prognostic variables)
@@ -557,38 +722,43 @@
        MODULE PROCEDURE salsa_swap_timelevel
     END INTERFACE salsa_swap_timelevel
-
+!
+!-- Interface between PALM and salsa
     INTERFACE salsa_driver
        MODULE PROCEDURE salsa_driver
     END INTERFACE salsa_driver
-
+!
+!-- Prognostics equations for salsa variables
+    INTERFACE salsa_prognostic_equations
+       MODULE PROCEDURE salsa_prognostic_equations
+       MODULE PROCEDURE salsa_prognostic_equations_ij
+    END INTERFACE salsa_prognostic_equations
+!
+!-- Tendency salsa variables
     INTERFACE salsa_tendency
        MODULE PROCEDURE salsa_tendency
        MODULE PROCEDURE salsa_tendency_ij
     END INTERFACE salsa_tendency
-    
-    
-    
+
+
     SAVE
 
     PRIVATE
 !
-!-- Public functions: 
-    PUBLIC salsa_boundary_conds, salsa_check_data_output,                      &
-           salsa_check_parameters, salsa_3d_data_averaging,                    &
-           salsa_data_output_2d, salsa_data_output_3d, salsa_data_output_mask, &
-           salsa_define_netcdf_grid, salsa_diagnostics, salsa_driver,          &
-           salsa_header, salsa_init, salsa_init_arrays, salsa_parin,           &
-           salsa_rrd_local, salsa_swap_timelevel, salsa_tendency,              &
-           salsa_wrd_local
+!-- Public functions:
+    PUBLIC salsa_boundary_conds, salsa_check_data_output, salsa_check_parameters,                  &
+           salsa_3d_data_averaging, salsa_data_output_2d, salsa_data_output_3d,                    &
+           salsa_data_output_mask, salsa_define_netcdf_grid, salsa_diagnostics, salsa_driver,      &
+           salsa_emission_update, salsa_header, salsa_init, salsa_init_arrays, salsa_parin,        &
+           salsa_rrd_local, salsa_swap_timelevel, salsa_prognostic_equations, salsa_wrd_local
 !
 !-- Public parameters, constants and initial values
-    PUBLIC dots_salsa, dt_salsa, last_salsa_time, lsdepo, salsa,               &
-           salsa_gases_from_chem, skip_time_do_salsa
+    PUBLIC bc_am_t_val, bc_an_t_val, bc_gt_t_val, dots_salsa, dt_salsa,                            &
+           ibc_salsa_b, last_salsa_time, lsdepo, nest_salsa, salsa, salsa_gases_from_chem,         &
+           skip_time_do_salsa
 !
 !-- Public prognostic variables
-    PUBLIC aerosol_mass, aerosol_number, fn2a, fn2b, gconc_2, in1a, in2b,      &
-           mconc_2, nbins, ncc, ncc_tot, nclim, nconc_2, ngast, prtcl, Ra_dry, &
-           salsa_gas, sedim_vd
-           
+    PUBLIC aerosol_mass, aerosol_number, gconc_2, mconc_2, nbins_aerosol, ncc, ncomponents_mass,   &
+           nclim, nconc_2, ngases_salsa, prtcl, ra_dry, salsa_gas, sedim_vd
+
 
  CONTAINS
@@ -603,102 +773,21 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=80) ::  line   !< dummy string that contains the current line
-                                  !< of the parameter file 
-                                  
-    NAMELIST /salsa_parameters/             &
-                          advect_particle_water, & ! Switch for advecting 
-                                                ! particle water. If .FALSE., 
-                                                ! equilibration is called at 
-                                                ! each time step.       
-                          bc_salsa_b,       &   ! bottom boundary condition
-                          bc_salsa_t,       &   ! top boundary condition
-                          decycle_lr,       &   ! decycle SALSA components
-                          decycle_method,   &   ! decycle method applied: 
-                                                ! 1=left 2=right 3=south 4=north
-                          decycle_ns,       &   ! decycle SALSA components
-                          depo_vege_type,   &   ! Parametrisation type
-                          depo_topo_type,   &   ! Parametrisation type
-                          dpg,              &   ! Mean diameter for the initial 
-                                                ! log-normal modes
-                          dt_salsa,         &   ! SALSA timestep in seconds
-                          feedback_to_palm, &   ! allow feedback due to
-                                                ! hydration / condensation
-                          H2SO4_init,       &   ! Init value for sulphuric acid
-                          HNO3_init,        &   ! Init value for nitric acid
-                          igctyp,           &   ! Initial gas concentration type 
-                          isdtyp,           &   ! Initial size distribution type                                                
-                          listspec,         &   ! List of actived aerosols 
-                                                ! (string list)
-                          mass_fracs_a,     &   ! Initial relative contribution  
-                                                ! of each species to particle  
-                                                ! volume in a-bins, 0 for unused 
-                          mass_fracs_b,     &   ! Initial relative contribution  
-                                                ! of each species to particle 
-                                                ! volume in b-bins, 0 for unused
-                          n_lognorm,        &   ! Number concentration for the 
-                                                ! log-normal modes                                                
-                          nbin,             &   ! Number of size bins for 
-                                                ! aerosol size subranges 1 & 2
-                          nf2a,             &   ! Number fraction of particles 
-                                                ! allocated to a-bins in 
-                                                ! subrange 2 b-bins will get 
-                                                ! 1-nf2a                          
-                          NH3_init,         &   ! Init value for ammonia 
-                          nj3,              &   ! J3 parametrization
-                                                ! 1 = condensational sink 
-                                                !     (Kerminen&Kulmala, 2002)
-                                                ! 2 = coagulational sink 
-                                                !     (Lehtinen et al. 2007)
-                                                ! 3 = coagS+self-coagulation 
-                                                !     (Anttila et al. 2010)                                                   
-                          nlcnd,            &   ! Condensation master switch
-                          nlcndgas,         &   ! Condensation of gases
-                          nlcndh2oae,       &   ! Condensation of H2O                           
-                          nlcoag,           &   ! Coagulation master switch
-                          nldepo,           &   ! Deposition master switch
-                          nldepo_vege,      &   ! Deposition on vegetation 
-                                                ! master switch
-                          nldepo_topo,      &   ! Deposition on topo master
-                                                ! switch                          
-                          nldistupdate,     &   ! Size distribution update
-                                                ! master switch
-                          nsnucl,           &   ! Nucleation scheme: 
-                                                ! 0 = off,
-                                                ! 1 = binary nucleation
-                                                ! 2 = activation type nucleation
-                                                ! 3 = kinetic nucleation
-                                                ! 4 = ternary nucleation
-                                                ! 5 = nucleation with organics
-                                                ! 6 = activation type of 
-                                                !     nucleation with H2SO4+ORG
-                                                ! 7 = heteromolecular nucleation 
-                                                !     with H2SO4*ORG
-                                                ! 8 = homomolecular nucleation  
-                                                !     of H2SO4 + heteromolecular 
-                                                !     nucleation with H2SO4*ORG
-                                                ! 9 = homomolecular nucleation 
-                                                !     of H2SO4 and ORG + hetero-
-                                                !     molecular nucleation with 
-                                                !     H2SO4*ORG
-                          OCNV_init,        &   ! Init value for non-volatile 
-                                                ! organic gases
-                          OCSV_init,        &   ! Init value for semi-volatile 
-                                                ! organic gases
-                          read_restart_data_salsa, & ! read restart data for 
-                                                     ! salsa
-                          reglim,           &   ! Min&max diameter limits of 
-                                                ! size subranges
-                          salsa,            &   ! Master switch for SALSA
-                          salsa_source_mode,&   ! 'read_from_file' or 'constant' 
-                                                ! or 'no_source'
-                          sigmag,           &   ! stdev for the initial log-
-                                                ! normal modes                                                
-                          skip_time_do_salsa, & ! Starting time of SALSA (s)
-                          van_der_waals_coagc,& ! include van der Waals forces
-                          write_binary_salsa    ! Write binary for salsa
-                           
-       
+    CHARACTER(LEN=80) ::  line   !< dummy string that contains the current line
+                                  !< of the parameter file
+
+    NAMELIST /salsa_parameters/      aerosol_flux_dpg, aerosol_flux_mass_fracs_a,                  &
+                                     aerosol_flux_mass_fracs_b, aerosol_flux_sigmag,               &
+                                     advect_particle_water, bc_salsa_b, bc_salsa_t, decycle_lr,    &
+                                     decycle_method, decycle_ns, depo_pcm_par, depo_pcm_type,      &
+                                     depo_surf_par, dpg, dt_salsa, feedback_to_palm, h2so4_init,   &
+                                     hno3_init, igctyp, isdtyp, listspec, mass_fracs_a,            &
+                                     mass_fracs_b, n_lognorm, nbin, nest_salsa, nf2a, nh3_init,    &
+                                     nj3, nlcnd, nlcndgas, nlcndh2oae, nlcoag, nldepo, nldepo_pcm, &
+                                     nldepo_surf, nldistupdate, nsnucl, ocnv_init, ocsv_init,      &
+                                     read_restart_data_salsa, reglim, salsa, salsa_emission_mode,  &
+                                     sigmag, skip_time_do_salsa, surface_aerosol_flux,             &
+                                     van_der_waals_coagc, write_binary_salsa
+
     line = ' '
-       
 !
 !-- Try to find salsa package
@@ -709,9 +798,7 @@
     ENDDO
     BACKSPACE ( 11 )
-
 !
 !-- Read user-defined namelist
     READ ( 11, salsa_parameters )
-
 !
 !-- Enable salsa (salsa switch in modules.f90)
@@ -719,8 +806,7 @@
 
  10 CONTINUE
-       
+
  END SUBROUTINE salsa_parin
 
- 
 !------------------------------------------------------------------------------!
 ! Description:
@@ -730,17 +816,16 @@
  SUBROUTINE salsa_check_parameters
 
-    USE control_parameters,                                                    &
+    USE control_parameters,                                                                        &
         ONLY:  message_string
-       
+
     IMPLICIT NONE
-    
+
 !
 !-- Checks go here (cf. check_parameters.f90).
     IF ( salsa  .AND.  .NOT.  humidity )  THEN
-       WRITE( message_string, * ) 'salsa = ', salsa, ' is ',                   &
-              'not allowed with humidity = ', humidity
-       CALL message( 'check_parameters', 'SA0009', 1, 2, 0, 6, 0 )
+       WRITE( message_string, * ) 'salsa = ', salsa, ' is not allowed with humidity = ', humidity
+       CALL message( 'salsa_check_parameters', 'PA0594', 1, 2, 0, 6, 0 )
     ENDIF
-    
+
     IF ( bc_salsa_b == 'dirichlet' )  THEN
        ibc_salsa_b = 0
@@ -748,24 +833,29 @@
        ibc_salsa_b = 1
     ELSE
-       message_string = 'unknown boundary condition: bc_salsa_b = "'           &
-                         // TRIM( bc_salsa_t ) // '"'
-       CALL message( 'check_parameters', 'SA0011', 1, 2, 0, 6, 0 )                  
+       message_string = 'unknown boundary condition: bc_salsa_b = "' // TRIM( bc_salsa_t ) // '"'
+       CALL message( 'salsa_check_parameters', 'PA0595', 1, 2, 0, 6, 0 )
     ENDIF
-    
+
     IF ( bc_salsa_t == 'dirichlet' )  THEN
        ibc_salsa_t = 0
     ELSEIF ( bc_salsa_t == 'neumann' )  THEN
        ibc_salsa_t = 1
+    ELSEIF ( bc_salsa_t == 'nested' )  THEN
+       ibc_salsa_t = 2
     ELSE
-       message_string = 'unknown boundary condition: bc_salsa_t = "'           &
-                         // TRIM( bc_salsa_t ) // '"'
-       CALL message( 'check_parameters', 'SA0012', 1, 2, 0, 6, 0 )                  
+       message_string = 'unknown boundary condition: bc_salsa_t = "' // TRIM( bc_salsa_t ) // '"'
+       CALL message( 'salsa_check_parameters', 'PA0596', 1, 2, 0, 6, 0 )
     ENDIF
-    
+
     IF ( nj3 < 1  .OR.  nj3 > 3 )  THEN
        message_string = 'unknown nj3 (must be 1-3)'
-       CALL message( 'check_parameters', 'SA0044', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_check_parameters', 'PA0597', 1, 2, 0, 6, 0 )
     ENDIF
-           
+
+    IF ( salsa_emission_mode == 'read_from_file'  .AND.  ibc_salsa_b  == 0 ) THEN
+       message_string = 'salsa_emission_mode == read_from_file requires bc_salsa_b = "Neumann"'
+       CALL message( 'salsa_check_parameters','PA0598', 1, 2, 0, 6, 0 )
+    ENDIF
+
  END SUBROUTINE salsa_check_parameters
 
@@ -775,18 +865,18 @@
 ! ------------
 !> Subroutine defining appropriate grid for netcdf variables.
-!> It is called out from subroutine netcdf. 
+!> It is called out from subroutine netcdf.
 !> Same grid as for other scalars (see netcdf_interface_mod.f90)
 !------------------------------------------------------------------------------!
  SUBROUTINE salsa_define_netcdf_grid( var, found, grid_x, grid_y, grid_z )
-    
+
     IMPLICIT NONE
 
-    CHARACTER (LEN=*), INTENT(OUT) ::  grid_x   !< 
-    CHARACTER (LEN=*), INTENT(OUT) ::  grid_y   !< 
-    CHARACTER (LEN=*), INTENT(OUT) ::  grid_z   !< 
-    CHARACTER (LEN=*), INTENT(IN)  ::  var      !<
-    
+    CHARACTER(LEN=*), INTENT(OUT) ::  grid_x   !<
+    CHARACTER(LEN=*), INTENT(OUT) ::  grid_y   !<
+    CHARACTER(LEN=*), INTENT(OUT) ::  grid_z   !<
+    CHARACTER(LEN=*), INTENT(IN)  ::  var      !<
+
     LOGICAL, INTENT(OUT) ::  found   !<
-    
+
     found  = .TRUE.
 !
@@ -794,30 +884,30 @@
 
     IF ( var(1:2) == 'g_' )  THEN
-       grid_x = 'x' 
-       grid_y = 'y' 
-       grid_z = 'zu'    
+       grid_x = 'x'
+       grid_y = 'y'
+       grid_z = 'zu'
     ELSEIF ( var(1:4) == 'LDSA' )  THEN
-       grid_x = 'x' 
-       grid_y = 'y' 
+       grid_x = 'x'
+       grid_y = 'y'
        grid_z = 'zu'
     ELSEIF ( var(1:5) == 'm_bin' )  THEN
-       grid_x = 'x' 
-       grid_y = 'y' 
+       grid_x = 'x'
+       grid_y = 'y'
        grid_z = 'zu'
     ELSEIF ( var(1:5) == 'N_bin' )  THEN
-       grid_x = 'x' 
-       grid_y = 'y' 
+       grid_x = 'x'
+       grid_y = 'y'
        grid_z = 'zu'
     ELSEIF ( var(1:4) == 'Ntot' ) THEN
-       grid_x = 'x' 
-       grid_y = 'y' 
+       grid_x = 'x'
+       grid_y = 'y'
        grid_z = 'zu'
     ELSEIF ( var(1:2) == 'PM' )  THEN
-       grid_x = 'x' 
-       grid_y = 'y' 
+       grid_x = 'x'
+       grid_y = 'y'
        grid_z = 'zu'
     ELSEIF ( var(1:2) == 's_' )  THEN
-       grid_x = 'x' 
-       grid_y = 'y' 
+       grid_x = 'x'
+       grid_y = 'y'
        grid_z = 'zu'
     ELSE
@@ -830,5 +920,4 @@
  END SUBROUTINE salsa_define_netcdf_grid
 
- 
 !------------------------------------------------------------------------------!
 ! Description:
@@ -846,87 +935,87 @@
     WRITE( io, 2 ) skip_time_do_salsa
     WRITE( io, 3 ) dt_salsa
-    WRITE( io, 12 )  SHAPE( aerosol_number(1)%conc ), nbins
+    WRITE( io, 4 )  SHAPE( aerosol_number(1)%conc ), nbins_aerosol
     IF ( advect_particle_water )  THEN
-       WRITE( io, 16 )  SHAPE( aerosol_mass(1)%conc ), ncc_tot*nbins,          &
+       WRITE( io, 5 )  SHAPE( aerosol_mass(1)%conc ), ncomponents_mass*nbins_aerosol,             &
                         advect_particle_water
     ELSE
-       WRITE( io, 16 )  SHAPE( aerosol_mass(1)%conc ), ncc*nbins,              &
-                        advect_particle_water
+       WRITE( io, 5 )  SHAPE( aerosol_mass(1)%conc ), ncc*nbins_aerosol, advect_particle_water
     ENDIF
     IF ( .NOT. salsa_gases_from_chem )  THEN
-       WRITE( io, 17 )  SHAPE( aerosol_mass(1)%conc ), ngast,                  &
-                        salsa_gases_from_chem
+       WRITE( io, 6 )  SHAPE( aerosol_mass(1)%conc ), ngases_salsa, salsa_gases_from_chem
     ENDIF
-    WRITE( io, 4 ) 
+    WRITE( io, 7 )
     IF ( nsnucl > 0 )  THEN
-       WRITE( io, 5 ) nsnucl, nj3
+       WRITE( io, 8 ) nsnucl, nj3
     ENDIF
     IF ( nlcoag )  THEN
-       WRITE( io, 6 ) 
+       WRITE( io, 9 )
     ENDIF
     IF ( nlcnd )  THEN
-       WRITE( io, 7 ) nlcndgas, nlcndh2oae
+       WRITE( io, 10 ) nlcndgas, nlcndh2oae
+    ENDIF
+    IF ( lspartition )  THEN
+       WRITE( io, 11 )
     ENDIF
     IF ( nldepo )  THEN
-       WRITE( io, 14 ) nldepo_vege, nldepo_topo
+       WRITE( io, 12 ) nldepo_pcm, nldepo_surf
     ENDIF
-    WRITE( io, 8 )  reglim, nbin, bin_low_limits
-    WRITE( io, 15 ) nsect
-    WRITE( io, 13 ) ncc, listspec, mass_fracs_a, mass_fracs_b
+    WRITE( io, 13 )  reglim, nbin, bin_low_limits
+    IF ( isdtyp == 0 )  WRITE( io, 14 ) nsect
+    WRITE( io, 15 ) ncc, listspec, mass_fracs_a, mass_fracs_b
     IF ( .NOT. salsa_gases_from_chem )  THEN
-       WRITE( io, 18 ) ngast, H2SO4_init, HNO3_init, NH3_init, OCNV_init,      &
-                       OCSV_init
+       WRITE( io, 16 ) ngases_salsa, h2so4_init, hno3_init, nh3_init, ocnv_init, ocsv_init
     ENDIF
-    WRITE( io, 9 )  isdtyp, igctyp
+    WRITE( io, 17 )  isdtyp, igctyp
     IF ( isdtyp == 0 )  THEN
-       WRITE( io, 10 )  dpg, sigmag, n_lognorm
+       WRITE( io, 18 )  dpg, sigmag, n_lognorm
     ELSE
-       WRITE( io, 11 )
+       WRITE( io, 19 )
     ENDIF
-    
-
-1   FORMAT (//' SALSA information:'/                                           &
+    IF ( nest_salsa )  WRITE( io, 20 )  nest_salsa
+    WRITE( io, 21 ) salsa_emission_mode
+
+
+1   FORMAT (//' SALSA information:'/                                                               &
               ' ------------------------------'/)
 2   FORMAT   ('    Starts at: skip_time_do_salsa = ', F10.2, '  s')
 3   FORMAT  (/'    Timestep: dt_salsa = ', F6.2, '  s')
-12  FORMAT  (/'    Array shape (z,y,x,bins):'/                                 &
+4   FORMAT  (/'    Array shape (z,y,x,bins):'/                                                     &
               '       aerosol_number:  ', 4(I3)) 
-16  FORMAT  (/'       aerosol_mass:    ', 4(I3),/                              &
+5   FORMAT  (/'       aerosol_mass:    ', 4(I3),/                                                  &
               '       (advect_particle_water = ', L1, ')')
-17  FORMAT   ('       salsa_gas: ', 4(I3),/                                    &
+6   FORMAT   ('       salsa_gas: ', 4(I3),/                                                        &
               '       (salsa_gases_from_chem = ', L1, ')')
-4   FORMAT  (/'    Aerosol dynamic processes included: ')
-5   FORMAT  (/'       nucleation (scheme = ', I1, ' and J3 parametrization = ',&
-               I1, ')')
-6   FORMAT  (/'       coagulation')
-7   FORMAT  (/'       condensation (of precursor gases = ', L1,                &
-              '          and water vapour = ', L1, ')' )
-14  FORMAT  (/'       dry deposition (on vegetation = ', L1,                   &
-              '          and on topography = ', L1, ')')              
-8   FORMAT  (/'    Aerosol bin subrange limits (in metres): ',  3(ES10.2E3), / &
-              '    Number of size bins for each aerosol subrange: ', 2I3,/     &
+7   FORMAT  (/'    Aerosol dynamic processes included: ')
+8   FORMAT  (/'       nucleation (scheme = ', I1, ' and J3 parametrization = ', I1, ')')
+9   FORMAT  (/'       coagulation')
+10  FORMAT  (/'       condensation (of precursor gases = ', L1, ' and water vapour = ', L1, ')' )
+11  FORMAT  (/'       dissolutional growth by HNO3 and NH3')
+12  FORMAT  (/'       dry deposition (on vegetation = ', L1, ' and on topography = ', L1, ')')
+13  FORMAT  (/'    Aerosol bin subrange limits (in metres): ',  3(ES10.2E3), /                     &
+              '    Number of size bins for each aerosol subrange: ', 2I3,/                         &
               '    Aerosol bin limits (in metres): ', 9(ES10.2E3))
-15  FORMAT   ('    Initial number concentration in bins at the lowest level',  &
-              ' (#/m**3):', 9(ES10.2E3))        
-13  FORMAT  (/'    Number of chemical components used: ', I1,/                 &
-              '       Species: ',7(A6),/                                       &
-              '    Initial relative contribution of each species to particle', & 
-              ' volume in:',/                                                  &
-              '       a-bins: ', 7(F6.3),/                                     &
+14  FORMAT   ('    Initial number concentration in bins at the lowest level (#/m**3):', 9(ES10.2E3))
+15  FORMAT  (/'    Number of chemical components used: ', I1,/                                     &
+              '       Species: ',7(A6),/                                                           &
+              '    Initial relative contribution of each species to particle volume in:',/         &
+              '       a-bins: ', 7(F6.3),/                                                         &
               '       b-bins: ', 7(F6.3))
-18  FORMAT  (/'    Number of gaseous tracers used: ', I1,/                     &
-              '    Initial gas concentrations:',/                              &
-              '       H2SO4: ',ES12.4E3, ' #/m**3',/                           &
-              '       HNO3:  ',ES12.4E3, ' #/m**3',/                           &
-              '       NH3:   ',ES12.4E3, ' #/m**3',/                           &
-              '       OCNV:  ',ES12.4E3, ' #/m**3',/                           &
+16  FORMAT  (/'    Number of gaseous tracers used: ', I1,/                                         &
+              '    Initial gas concentrations:',/                                                  &
+              '       H2SO4: ',ES12.4E3, ' #/m**3',/                                               &
+              '       HNO3:  ',ES12.4E3, ' #/m**3',/                                               &
+              '       NH3:   ',ES12.4E3, ' #/m**3',/                                               &
+              '       OCNV:  ',ES12.4E3, ' #/m**3',/                                               &
               '       OCSV:  ',ES12.4E3, ' #/m**3')
-9    FORMAT (/'   Initialising concentrations: ', /                            &
-              '      Aerosol size distribution: isdtyp = ', I1,/               &
+17   FORMAT (/'   Initialising concentrations: ', /                                                &
+              '      Aerosol size distribution: isdtyp = ', I1,/                                   &
               '      Gas concentrations: igctyp = ', I1 )
-10   FORMAT ( '      Mode diametres: dpg(nmod) = ', 7(F7.3),/                  &
-              '      Standard deviation: sigmag(nmod) = ', 7(F7.2),/           &
-              '      Number concentration: n_lognorm(nmod) = ', 7(ES12.4E3) )
-11   FORMAT (/'      Size distribution read from a file.')
+18   FORMAT ( '      Mode diametres: dpg(nmod) = ', 7(F7.3), ' (m)', /                             &
+              '      Standard deviation: sigmag(nmod) = ', 7(F7.2),/                               &
+              '      Number concentration: n_lognorm(nmod) = ', 7(ES12.4E3), ' (#/m3)' )
+19   FORMAT (/'      Size distribution read from a file.')
+20   FORMAT (/'   Nesting for salsa variables: ', L1 )
+21   FORMAT (/'   Emissions: salsa_emission_mode = ', A )
 
  END SUBROUTINE salsa_header
@@ -938,69 +1027,68 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE salsa_init_arrays
- 
-    USE surface_mod,                                                           &
-        ONLY:  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,     &
-               surf_usm_v
+
+    USE chem_gasphase_mod,                                                                         &
+        ONLY:  nvar
+
+    USE surface_mod,                                                                               &
+        ONLY:  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h, surf_usm_v
 
     IMPLICIT NONE
-    
-    INTEGER(iwp) ::  gases_available !< Number of available gas components in 
-                                     !< the chemistry model
-    INTEGER(iwp) ::  i   !< loop index for allocating
-    INTEGER(iwp) ::  l   !< loop index for allocating: surfaces
-    INTEGER(iwp) ::  lsp !< loop index for chem species in the chemistry model
-    
+
+    INTEGER(iwp) ::  gases_available !< Number of available gas components in the chemistry model
+    INTEGER(iwp) ::  i               !< loop index for allocating
+    INTEGER(iwp) ::  l               !< loop index for allocating: surfaces
+    INTEGER(iwp) ::  lsp             !< loop index for chem species in the chemistry model
+
     gases_available = 0
-
 !
 !-- Allocate prognostic variables (see salsa_swap_timelevel)
-
 !
 !-- Set derived indices:
-!-- (This does the same as the subroutine salsa_initialize in SALSA/
-!-- UCLALES-SALSA)        
-    in1a = 1                ! 1st index of subrange 1a
-    in2a = in1a + nbin(1)   ! 1st index of subrange 2a
-    fn1a = in2a - 1         ! last index of subrange 1a
-    fn2a = fn1a + nbin(2)   ! last index of subrange 2a
-    
-!    
-!-- If the fraction of insoluble aerosols in subrange 2 is zero: do not allocate
-!-- arrays for them
+!-- (This does the same as the subroutine salsa_initialize in SALSA/UCLALES-SALSA)
+    start_subrange_1a = 1  ! 1st index of subrange 1a
+    start_subrange_2a = start_subrange_1a + nbin(1)  ! 1st index of subrange 2a
+    end_subrange_1a   = start_subrange_2a - 1        ! last index of subrange 1a
+    end_subrange_2a   = end_subrange_1a + nbin(2)    ! last index of subrange 2a
+
+!
+!-- If the fraction of insoluble aerosols in subrange 2 is zero: do not allocate arrays for them
     IF ( nf2a > 0.999999_wp  .AND.  SUM( mass_fracs_b ) < 0.00001_wp )  THEN
        no_insoluble = .TRUE.
-       in2b = fn2a+1    ! 1st index of subrange 2b
-       fn2b = fn2a      ! last index of subrange 2b
+       start_subrange_2b = end_subrange_2a+1  ! 1st index of subrange 2b
+       end_subrange_2b   = end_subrange_2a    ! last index of subrange 2b
     ELSE
-       in2b = in2a + nbin(2)   ! 1st index of subrange 2b
-       fn2b = fn2a + nbin(2)   ! last index of subrange 2b
+       start_subrange_2b = start_subrange_2a + nbin(2)  ! 1st index of subrange 2b
+       end_subrange_2b   = end_subrange_2a + nbin(2)    ! last index of subrange 2b
     ENDIF
-    
-    
-    nbins = fn2b   ! total number of aerosol size bins
-!    
+
+    nbins_aerosol = end_subrange_2b   ! total number of aerosol size bins
+!
 !-- Create index tables for different aerosol components
     CALL component_index_constructor( prtcl, ncc, maxspec, listspec )
-    
-    ncc_tot = ncc
-    IF ( advect_particle_water )  ncc_tot = ncc + 1  ! Add water 
-    
+
+    ncomponents_mass = ncc
+    IF ( advect_particle_water )  ncomponents_mass = ncc + 1  ! Add water 
+
 !
 !-- Allocate:
-    ALLOCATE( aero(nbins), bin_low_limits(nbins), nsect(nbins), massacc(nbins) )
-    IF ( nldepo ) ALLOCATE( sedim_vd(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins) )          
-    ALLOCATE( Ra_dry(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins) )
-    
-!    
+    ALLOCATE( aero(nbins_aerosol), bc_am_t_val(nbins_aerosol*ncomponents_mass),                    &
+              bc_an_t_val(ngases_salsa), bc_gt_t_val(nbins_aerosol), bin_low_limits(nbins_aerosol),&
+              nsect(nbins_aerosol), massacc(nbins_aerosol) )
+    ALLOCATE( k_topo_top(nysg:nyng,nxlg:nxrg) )
+    IF ( nldepo ) ALLOCATE( sedim_vd(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
+    ALLOCATE( ra_dry(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
+
+!
 !-- Aerosol number concentration
-    ALLOCATE( aerosol_number(nbins) )
-    ALLOCATE( nconc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins),                    &
-              nconc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins),                    &
-              nconc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins) )
+    ALLOCATE( aerosol_number(nbins_aerosol) )
+    ALLOCATE( nconc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol),                                &
+              nconc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol),                                &
+              nconc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
     nconc_1 = 0.0_wp
     nconc_2 = 0.0_wp
     nconc_3 = 0.0_wp
-    
-    DO i = 1, nbins
+
+    DO i = 1, nbins_aerosol
        aerosol_number(i)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)    => nconc_1(:,:,:,i)
        aerosol_number(i)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  => nconc_2(:,:,:,i)
@@ -1012,76 +1100,71 @@
                  aerosol_number(i)%init(nzb:nzt+1),                            &
                  aerosol_number(i)%sums_ws_l(nzb:nzt+1,0:threads_per_task-1) )
-    ENDDO      
-    
-!    
-!-- Aerosol mass concentration    
-    ALLOCATE( aerosol_mass(ncc_tot*nbins) ) 
-    ALLOCATE( mconc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncc_tot*nbins),            &
-              mconc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncc_tot*nbins),            &
-              mconc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncc_tot*nbins) )
+    ENDDO
+
+!
+!-- Aerosol mass concentration
+    ALLOCATE( aerosol_mass(ncomponents_mass*nbins_aerosol) )
+    ALLOCATE( mconc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncomponents_mass*nbins_aerosol),               &
+              mconc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncomponents_mass*nbins_aerosol),               &
+              mconc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncomponents_mass*nbins_aerosol) )
     mconc_1 = 0.0_wp
     mconc_2 = 0.0_wp
     mconc_3 = 0.0_wp
-    
-    DO i = 1, ncc_tot*nbins
+
+    DO i = 1, ncomponents_mass*nbins_aerosol
        aerosol_mass(i)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)    => mconc_1(:,:,:,i)
        aerosol_mass(i)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  => mconc_2(:,:,:,i)
-       aerosol_mass(i)%tconc_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => mconc_3(:,:,:,i)       
-       ALLOCATE( aerosol_mass(i)%flux_s(nzb+1:nzt,0:threads_per_task-1),       &
-                 aerosol_mass(i)%diss_s(nzb+1:nzt,0:threads_per_task-1),       &
-                 aerosol_mass(i)%flux_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),&
-                 aerosol_mass(i)%diss_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),&
-                 aerosol_mass(i)%init(nzb:nzt+1),                              &
+       aerosol_mass(i)%tconc_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => mconc_3(:,:,:,i)
+       ALLOCATE( aerosol_mass(i)%flux_s(nzb+1:nzt,0:threads_per_task-1),                           &
+                 aerosol_mass(i)%diss_s(nzb+1:nzt,0:threads_per_task-1),                           &
+                 aerosol_mass(i)%flux_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                   &
+                 aerosol_mass(i)%diss_l(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                   &
+                 aerosol_mass(i)%init(nzb:nzt+1),                                                  &
                  aerosol_mass(i)%sums_ws_l(nzb:nzt+1,0:threads_per_task-1)  )
     ENDDO
-    
-!
-!-- Surface fluxes: answs = aerosol number, amsws = aerosol mass 
+
+!
+!-- Surface fluxes: answs = aerosol number, amsws = aerosol mass
 !
 !-- Horizontal surfaces: default type
     DO  l = 0, 2   ! upward (l=0), downward (l=1) and model top (l=2)
-       ALLOCATE( surf_def_h(l)%answs( 1:surf_def_h(l)%ns, nbins ) )
-       ALLOCATE( surf_def_h(l)%amsws( 1:surf_def_h(l)%ns, nbins*ncc_tot ) )
+       ALLOCATE( surf_def_h(l)%answs( 1:surf_def_h(l)%ns, nbins_aerosol ) )
+       ALLOCATE( surf_def_h(l)%amsws( 1:surf_def_h(l)%ns, nbins_aerosol*ncomponents_mass ) )
        surf_def_h(l)%answs = 0.0_wp
        surf_def_h(l)%amsws = 0.0_wp
     ENDDO
-!-- Horizontal surfaces: natural type    
-    IF ( land_surface )  THEN
-       ALLOCATE( surf_lsm_h%answs( 1:surf_lsm_h%ns, nbins ) )
-       ALLOCATE( surf_lsm_h%amsws( 1:surf_lsm_h%ns, nbins*ncc_tot ) )
-       surf_lsm_h%answs = 0.0_wp
-       surf_lsm_h%amsws = 0.0_wp
-    ENDIF
-!-- Horizontal surfaces: urban type 
-    IF ( urban_surface )  THEN
-       ALLOCATE( surf_usm_h%answs( 1:surf_usm_h%ns, nbins ) )
-       ALLOCATE( surf_usm_h%amsws( 1:surf_usm_h%ns, nbins*ncc_tot ) )
-       surf_usm_h%answs = 0.0_wp
-       surf_usm_h%amsws = 0.0_wp
-    ENDIF
-!
-!-- Vertical surfaces: northward (l=0), southward (l=1), eastward (l=2) and 
-!-- westward (l=3) facing
-    DO  l = 0, 3    
-       ALLOCATE( surf_def_v(l)%answs( 1:surf_def_v(l)%ns, nbins ) )
+!
+!-- Horizontal surfaces: natural type
+    ALLOCATE( surf_lsm_h%answs( 1:surf_lsm_h%ns, nbins_aerosol ) )
+    ALLOCATE( surf_lsm_h%amsws( 1:surf_lsm_h%ns, nbins_aerosol*ncomponents_mass ) )
+    surf_lsm_h%answs = 0.0_wp
+    surf_lsm_h%amsws = 0.0_wp
+!
+!-- Horizontal surfaces: urban type
+    ALLOCATE( surf_usm_h%answs( 1:surf_usm_h%ns, nbins_aerosol ) )
+    ALLOCATE( surf_usm_h%amsws( 1:surf_usm_h%ns, nbins_aerosol*ncomponents_mass ) )
+    surf_usm_h%answs = 0.0_wp
+    surf_usm_h%amsws = 0.0_wp
+
+!
+!-- Vertical surfaces: northward (l=0), southward (l=1), eastward (l=2) and westward (l=3) facing
+    DO  l = 0, 3
+       ALLOCATE( surf_def_v(l)%answs( 1:surf_def_v(l)%ns, nbins_aerosol ) )
        surf_def_v(l)%answs = 0.0_wp
-       ALLOCATE( surf_def_v(l)%amsws( 1:surf_def_v(l)%ns, nbins*ncc_tot ) )
+       ALLOCATE( surf_def_v(l)%amsws( 1:surf_def_v(l)%ns, nbins_aerosol*ncomponents_mass ) )
        surf_def_v(l)%amsws = 0.0_wp
-       
-       IF ( land_surface)  THEN
-          ALLOCATE( surf_lsm_v(l)%answs( 1:surf_lsm_v(l)%ns, nbins ) )
-          surf_lsm_v(l)%answs = 0.0_wp
-          ALLOCATE( surf_lsm_v(l)%amsws( 1:surf_lsm_v(l)%ns, nbins*ncc_tot ) )
-          surf_lsm_v(l)%amsws = 0.0_wp
-       ENDIF
-       
-       IF ( urban_surface )  THEN
-          ALLOCATE( surf_usm_v(l)%answs( 1:surf_usm_v(l)%ns, nbins ) )
-          surf_usm_v(l)%answs = 0.0_wp
-          ALLOCATE( surf_usm_v(l)%amsws( 1:surf_usm_v(l)%ns, nbins*ncc_tot ) )
-          surf_usm_v(l)%amsws = 0.0_wp
-       ENDIF
-    ENDDO    
-    
+
+       ALLOCATE( surf_lsm_v(l)%answs( 1:surf_lsm_v(l)%ns, nbins_aerosol ) )
+       surf_lsm_v(l)%answs = 0.0_wp
+       ALLOCATE( surf_lsm_v(l)%amsws( 1:surf_lsm_v(l)%ns, nbins_aerosol*ncomponents_mass ) )
+       surf_lsm_v(l)%amsws = 0.0_wp
+
+       ALLOCATE( surf_usm_v(l)%answs( 1:surf_usm_v(l)%ns, nbins_aerosol ) )
+       surf_usm_v(l)%answs = 0.0_wp
+       ALLOCATE( surf_usm_v(l)%amsws( 1:surf_usm_v(l)%ns, nbins_aerosol*ncomponents_mass ) )
+       surf_usm_v(l)%amsws = 0.0_wp
+
+    ENDDO
+
 !
 !-- Concentration of gaseous tracers (1. SO4, 2. HNO3, 3. NH3, 4. OCNV, 5. OCSV)
@@ -1091,45 +1174,44 @@
 !-- allocate salsa_gas array.
 
-    IF ( air_chemistry )  THEN   
+    IF ( air_chemistry )  THEN
        DO  lsp = 1, nvar
-          IF ( TRIM( chem_species(lsp)%name ) == 'H2SO4' )  THEN
-             gases_available = gases_available + 1
-             gas_index_chem(1) = lsp
-          ELSEIF ( TRIM( chem_species(lsp)%name ) == 'HNO3' )  THEN
-             gases_available = gases_available + 1  
-             gas_index_chem(2) = lsp
-          ELSEIF ( TRIM( chem_species(lsp)%name ) == 'NH3' )  THEN
-             gases_available = gases_available + 1
-             gas_index_chem(3) = lsp
-          ELSEIF ( TRIM( chem_species(lsp)%name ) == 'OCNV' )  THEN
-             gases_available = gases_available + 1
-             gas_index_chem(4) = lsp
-          ELSEIF ( TRIM( chem_species(lsp)%name ) == 'OCSV' )  THEN
-             gases_available = gases_available + 1
-             gas_index_chem(5) = lsp
-          ENDIF
+          SELECT CASE ( TRIM( chem_species(lsp)%name ) )
+             CASE ( 'H2SO4', 'h2so4' )
+                gases_available = gases_available + 1
+                gas_index_chem(1) = lsp
+             CASE ( 'HNO3', 'hno3' )
+                gases_available = gases_available + 1
+                gas_index_chem(2) = lsp
+             CASE ( 'NH3', 'nh3' )
+                gases_available = gases_available + 1
+                gas_index_chem(3) = lsp
+             CASE ( 'OCNV', 'ocnv' )
+                gases_available = gases_available + 1
+                gas_index_chem(4) = lsp
+             CASE ( 'OCSV', 'ocsv' )
+                gases_available = gases_available + 1
+                gas_index_chem(5) = lsp
+          END SELECT
        ENDDO
 
-       IF ( gases_available == ngast )  THEN
+       IF ( gases_available == ngases_salsa )  THEN
           salsa_gases_from_chem = .TRUE.
        ELSE
-          WRITE( message_string, * ) 'SALSA is run together with chemistry '// &
-                                     'but not all gaseous components are '//   &
-                                     'provided by kpp (H2SO4, HNO3, NH3, '//   &
-                                     'OCNV, OCSC)'
-       CALL message( 'check_parameters', 'SA0024', 1, 2, 0, 6, 0 )
+          WRITE( message_string, * ) 'SALSA is run together with chemistry but not all gaseous '// &
+                                     'components are provided by kpp (H2SO4, HNO3, NH3, OCNV, OCSV)'
+       CALL message( 'check_parameters', 'PA0599', 1, 2, 0, 6, 0 )
        ENDIF
 
     ELSE
 
-       ALLOCATE( salsa_gas(ngast) ) 
-       ALLOCATE( gconc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngast),                 &
-                 gconc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngast),                 &
-                 gconc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngast) )
+       ALLOCATE( salsa_gas(ngases_salsa) )
+       ALLOCATE( gconc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngases_salsa),                 &
+                 gconc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngases_salsa),                 &
+                 gconc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngases_salsa) )
        gconc_1 = 0.0_wp
        gconc_2 = 0.0_wp
        gconc_3 = 0.0_wp
-       
-       DO i = 1, ngast
+
+       DO i = 1, ngases_salsa
           salsa_gas(i)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)    => gconc_1(:,:,:,i)
           salsa_gas(i)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  => gconc_2(:,:,:,i)
@@ -1141,5 +1223,5 @@
                     salsa_gas(i)%init(nzb:nzt+1),                              &
                     salsa_gas(i)%sums_ws_l(nzb:nzt+1,0:threads_per_task-1) )
-       ENDDO       
+       ENDDO
 !
 !--    Surface fluxes: gtsws = gaseous tracer flux
@@ -1147,34 +1229,26 @@
 !--    Horizontal surfaces: default type
        DO  l = 0, 2   ! upward (l=0), downward (l=1) and model top (l=2)
-          ALLOCATE( surf_def_h(l)%gtsws( 1:surf_def_h(l)%ns, ngast ) )
+          ALLOCATE( surf_def_h(l)%gtsws( 1:surf_def_h(l)%ns, ngases_salsa ) )
           surf_def_h(l)%gtsws = 0.0_wp
        ENDDO
-!--    Horizontal surfaces: natural type   
-       IF ( land_surface )  THEN
-          ALLOCATE( surf_lsm_h%gtsws( 1:surf_lsm_h%ns, ngast ) )
-          surf_lsm_h%gtsws = 0.0_wp
-       ENDIF
-!--    Horizontal surfaces: urban type          
-       IF ( urban_surface )  THEN 
-          ALLOCATE( surf_usm_h%gtsws( 1:surf_usm_h%ns, ngast ) )
-          surf_usm_h%gtsws = 0.0_wp
-       ENDIF
+!--    Horizontal surfaces: natural type
+       ALLOCATE( surf_lsm_h%gtsws( 1:surf_lsm_h%ns, ngases_salsa ) )
+       surf_lsm_h%gtsws = 0.0_wp
+!--    Horizontal surfaces: urban type
+       ALLOCATE( surf_usm_h%gtsws( 1:surf_usm_h%ns, ngases_salsa ) )
+       surf_usm_h%gtsws = 0.0_wp
 !
 !--    Vertical surfaces: northward (l=0), southward (l=1), eastward (l=2) and 
 !--    westward (l=3) facing
-       DO  l = 0, 3     
-          ALLOCATE( surf_def_v(l)%gtsws( 1:surf_def_v(l)%ns, ngast ) )
+       DO  l = 0, 3
+          ALLOCATE( surf_def_v(l)%gtsws( 1:surf_def_v(l)%ns, ngases_salsa ) )
           surf_def_v(l)%gtsws = 0.0_wp
-          IF ( land_surface )  THEN
-             ALLOCATE( surf_lsm_v(l)%gtsws( 1:surf_lsm_v(l)%ns, ngast ) )
-             surf_lsm_v(l)%gtsws = 0.0_wp
-          ENDIF
-          IF ( urban_surface )  THEN
-             ALLOCATE( surf_usm_v(l)%gtsws( 1:surf_usm_v(l)%ns, ngast ) )
-             surf_usm_v(l)%gtsws = 0.0_wp
-          ENDIF
+          ALLOCATE( surf_lsm_v(l)%gtsws( 1:surf_lsm_v(l)%ns, ngases_salsa ) )
+          surf_lsm_v(l)%gtsws = 0.0_wp
+          ALLOCATE( surf_usm_v(l)%gtsws( 1:surf_usm_v(l)%ns, ngases_salsa ) )
+          surf_usm_v(l)%gtsws = 0.0_wp
        ENDDO
     ENDIF
-    
+
  END SUBROUTINE salsa_init_arrays
 
@@ -1182,5 +1256,5 @@
 ! Description:
 ! ------------
-!> Initialization of SALSA. Based on salsa_initialize in UCLALES-SALSA. 
+!> Initialization of SALSA. Based on salsa_initialize in UCLALES-SALSA.
 !> Subroutines salsa_initialize, SALSAinit and DiagInitAero in UCLALES-SALSA are
 !> also merged here.
@@ -1189,56 +1263,59 @@
 
     IMPLICIT NONE
-    
-    INTEGER(iwp) :: b
-    INTEGER(iwp) :: c
-    INTEGER(iwp) :: g
-    INTEGER(iwp) :: i
-    INTEGER(iwp) :: j
-    
-    CALL location_message( 'initializing SALSA model', .TRUE. )
-    
+
+    INTEGER(iwp) :: i   !<
+    INTEGER(iwp) :: ib  !< loop index for aerosol number bins
+    INTEGER(iwp) :: ic  !< loop index for aerosol mass bins
+    INTEGER(iwp) :: ig  !< loop index for gases
+    INTEGER(iwp) :: ii  !< index for indexing
+    INTEGER(iwp) :: j   !<
+
+    CALL location_message( 'initializing salsa (sectional aerosol module )', .TRUE. )
+
     bin_low_limits = 0.0_wp
+    k_topo_top     = 0
     nsect          = 0.0_wp
-    massacc        = 1.0_wp 
-    
+    massacc        = 1.0_wp
+
 !
 !-- Indices for chemical components used (-1 = not used)
-    i = 0
+    ii = 0
     IF ( is_used( prtcl, 'SO4' ) )  THEN
-       iso4 = get_index( prtcl,'SO4' )
-       i = i + 1
+       index_so4 = get_index( prtcl,'SO4' )
+       ii = ii + 1
     ENDIF
     IF ( is_used( prtcl,'OC' ) )  THEN
-       ioc = get_index(prtcl, 'OC')
-       i = i + 1
+       index_oc = get_index(prtcl, 'OC')
+       ii = ii + 1
     ENDIF
     IF ( is_used( prtcl, 'BC' ) )  THEN
-       ibc = get_index( prtcl, 'BC' )
-       i = i + 1
+       index_bc = get_index( prtcl, 'BC' )
+       ii = ii + 1
     ENDIF
     IF ( is_used( prtcl, 'DU' ) )  THEN
-       idu = get_index( prtcl, 'DU' )
-       i = i + 1
+       index_du = get_index( prtcl, 'DU' )
+       ii = ii + 1
     ENDIF
     IF ( is_used( prtcl, 'SS' ) )  THEN
-       iss = get_index( prtcl, 'SS' )
-       i = i + 1
+       index_ss = get_index( prtcl, 'SS' )
+       ii = ii + 1
     ENDIF
     IF ( is_used( prtcl, 'NO' ) )  THEN
-       ino = get_index( prtcl, 'NO' )
-       i = i + 1
+       index_no = get_index( prtcl, 'NO' )
+       ii = ii + 1
     ENDIF
     IF ( is_used( prtcl, 'NH' ) )  THEN
-       inh = get_index( prtcl, 'NH' )
-       i = i + 1
+       index_nh = get_index( prtcl, 'NH' )
+       ii = ii + 1
     ENDIF
-!    
+!
 !-- All species must be known
-    IF ( i /= ncc )  THEN
-       message_string = 'Unknown aerosol species/component(s) given in the' // &
-                        ' initialization'
-       CALL message( 'salsa_mod: salsa_init', 'SA0020', 1, 2, 0, 6, 0 )
+    IF ( ii /= ncc )  THEN
+       message_string = 'Unknown aerosol species/component(s) given in the initialization'
+       CALL message( 'salsa_mod: salsa_init', 'PA0600', 1, 2, 0, 6, 0 )
     ENDIF
-    
+!
+!-- Partition and dissolutional growth by gaseous HNO3 and NH3
+    IF ( index_no > 0  .AND.  index_nh > 0  .AND.  index_so4 > 0 )  lspartition = .TRUE.
 !
 !-- Initialise
@@ -1249,63 +1326,63 @@
     aero(:)%numc     = nclim
     aero(:)%core     = 1.0E-10_wp
-    DO c = 1, maxspec+1    ! 1:SO4, 2:OC, 3:BC, 4:DU, 5:SS, 6:NO, 7:NH, 8:H2O
-       aero(:)%volc(c) = 0.0_wp
+    DO ic = 1, maxspec+1    ! 1:SO4, 2:OC, 3:BC, 4:DU, 5:SS, 6:NO, 7:NH, 8:H2O
+       aero(:)%volc(ic) = 0.0_wp
     ENDDO
-    
-    IF ( nldepo )  sedim_vd = 0.0_wp  
-    
-    DO  b = 1, nbins
-       IF ( .NOT. read_restart_data_salsa )  aerosol_number(b)%conc = nclim
-       aerosol_number(b)%conc_p    = 0.0_wp
-       aerosol_number(b)%tconc_m   = 0.0_wp
-       aerosol_number(b)%flux_s    = 0.0_wp
-       aerosol_number(b)%diss_s    = 0.0_wp
-       aerosol_number(b)%flux_l    = 0.0_wp
-       aerosol_number(b)%diss_l    = 0.0_wp
-       aerosol_number(b)%init      = nclim
-       aerosol_number(b)%sums_ws_l = 0.0_wp
+
+    IF ( nldepo )  sedim_vd = 0.0_wp
+
+    DO  ib = 1, nbins_aerosol
+       IF ( .NOT. read_restart_data_salsa )  aerosol_number(ib)%conc = nclim
+       aerosol_number(ib)%conc_p    = 0.0_wp
+       aerosol_number(ib)%tconc_m   = 0.0_wp
+       aerosol_number(ib)%flux_s    = 0.0_wp
+       aerosol_number(ib)%diss_s    = 0.0_wp
+       aerosol_number(ib)%flux_l    = 0.0_wp
+       aerosol_number(ib)%diss_l    = 0.0_wp
+       aerosol_number(ib)%init      = nclim
+       aerosol_number(ib)%sums_ws_l = 0.0_wp
     ENDDO
-    DO  c = 1, ncc_tot*nbins
-       IF ( .NOT. read_restart_data_salsa )  aerosol_mass(c)%conc = mclim
-       aerosol_mass(c)%conc_p    = 0.0_wp
-       aerosol_mass(c)%tconc_m   = 0.0_wp
-       aerosol_mass(c)%flux_s    = 0.0_wp
-       aerosol_mass(c)%diss_s    = 0.0_wp
-       aerosol_mass(c)%flux_l    = 0.0_wp
-       aerosol_mass(c)%diss_l    = 0.0_wp
-       aerosol_mass(c)%init      = mclim
-       aerosol_mass(c)%sums_ws_l = 0.0_wp
+    DO  ic = 1, ncomponents_mass*nbins_aerosol
+       IF ( .NOT. read_restart_data_salsa )  aerosol_mass(ic)%conc = mclim
+       aerosol_mass(ic)%conc_p    = 0.0_wp
+       aerosol_mass(ic)%tconc_m   = 0.0_wp
+       aerosol_mass(ic)%flux_s    = 0.0_wp
+       aerosol_mass(ic)%diss_s    = 0.0_wp
+       aerosol_mass(ic)%flux_l    = 0.0_wp
+       aerosol_mass(ic)%diss_l    = 0.0_wp
+       aerosol_mass(ic)%init      = mclim
+       aerosol_mass(ic)%sums_ws_l = 0.0_wp
     ENDDO
-    
+
     IF ( .NOT. salsa_gases_from_chem )  THEN
-       DO  g = 1, ngast
-          salsa_gas(g)%conc_p    = 0.0_wp
-          salsa_gas(g)%tconc_m   = 0.0_wp
-          salsa_gas(g)%flux_s    = 0.0_wp
-          salsa_gas(g)%diss_s    = 0.0_wp
-          salsa_gas(g)%flux_l    = 0.0_wp
-          salsa_gas(g)%diss_l    = 0.0_wp
-          salsa_gas(g)%sums_ws_l = 0.0_wp
+       DO  ig = 1, ngases_salsa
+          salsa_gas(ig)%conc_p    = 0.0_wp
+          salsa_gas(ig)%tconc_m   = 0.0_wp
+          salsa_gas(ig)%flux_s    = 0.0_wp
+          salsa_gas(ig)%diss_s    = 0.0_wp
+          salsa_gas(ig)%flux_l    = 0.0_wp
+          salsa_gas(ig)%diss_l    = 0.0_wp
+          salsa_gas(ig)%sums_ws_l = 0.0_wp
        ENDDO
        IF ( .NOT. read_restart_data_salsa )  THEN
-          salsa_gas(1)%conc = H2SO4_init
-          salsa_gas(2)%conc = HNO3_init
-          salsa_gas(3)%conc = NH3_init
-          salsa_gas(4)%conc = OCNV_init
-          salsa_gas(5)%conc = OCSV_init 
+          salsa_gas(1)%conc = h2so4_init
+          salsa_gas(2)%conc = hno3_init
+          salsa_gas(3)%conc = nh3_init
+          salsa_gas(4)%conc = ocnv_init
+          salsa_gas(5)%conc = ocsv_init 
        ENDIF
 !
 !--    Set initial value for gas compound tracers and initial values
-       salsa_gas(1)%init = H2SO4_init
-       salsa_gas(2)%init = HNO3_init
-       salsa_gas(3)%init = NH3_init
-       salsa_gas(4)%init = OCNV_init
-       salsa_gas(5)%init = OCSV_init      
+       salsa_gas(1)%init = h2so4_init
+       salsa_gas(2)%init = hno3_init
+       salsa_gas(3)%init = nh3_init
+       salsa_gas(4)%init = ocnv_init
+       salsa_gas(5)%init = ocsv_init
     ENDIF
 !
 !-- Aerosol radius in each bin: dry and wet (m)
-    Ra_dry = 1.0E-10_wp
-!    
-!-- Initialise aerosol tracers    
+    ra_dry = 1.0E-10_wp
+!
+!-- Initialise aerosol tracers
     aero(:)%vhilim   = 0.0_wp
     aero(:)%vlolim   = 0.0_wp
@@ -1315,25 +1392,34 @@
 !
 !-- Initialise the sectional particle size distribution
-    CALL set_sizebins()
-!
-!-- Initialise location-dependent aerosol size distributions and 
-!-- chemical compositions:
-    CALL aerosol_init 
-!
-!-- Initalisation run of SALSA
+    CALL set_sizebins
+!
+!-- Initialise location-dependent aerosol size distributions and chemical compositions:
+    CALL aerosol_init
+!
+!-- Initalisation run of SALSA + calculate the vertical top index of the topography
     DO  i = nxl, nxr
        DO  j = nys, nyn
+
+          k_topo_top(j,i) = MAXLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,j,i), 12 ) ), DIM = 1 ) - 1
+
           CALL salsa_driver( i, j, 1 )
           CALL salsa_diagnostics( i, j )
        ENDDO
-    ENDDO 
-!
-!-- Set the aerosol and gas sources
-    IF ( salsa_source_mode == 'read_from_file' )  THEN
-       CALL salsa_set_source
+    ENDDO
+!
+!-- Initialise the deposition scheme and surface types
+    IF ( nldepo )  CALL init_deposition
+
+    IF ( salsa_emission_mode /= 'no_emission' )  THEN
+!
+!--    Read in and initialize emissions
+       CALL salsa_emission_setup( .TRUE. )
+       IF ( .NOT. salsa_gases_from_chem  .AND.  salsa_emission_mode == 'read_from_file' )  THEN
+          CALL salsa_gas_emission_setup( .TRUE. )
+       ENDIF
     ENDIF
-    
+
     CALL location_message( 'finished', .TRUE. )
-    
+
  END SUBROUTINE salsa_init
 
@@ -1363,13 +1449,13 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE set_sizebins
-               
+
     IMPLICIT NONE
-!    
-!-- Local variables
-    INTEGER(iwp) ::  cc
-    INTEGER(iwp) ::  dd
-    REAL(wp) ::  ratio_d !< ratio of the upper and lower diameter of subranges
-!
-!-- vlolim&vhilim: min & max *dry* volumes [fxm] 
+
+    INTEGER(iwp) ::  cc  !< running index
+    INTEGER(iwp) ::  dd  !< running index
+
+    REAL(wp) ::  ratio_d  !< ratio of the upper and lower diameter of subranges
+!
+!-- vlolim&vhilim: min & max *dry* volumes [fxm]
 !-- dmid: bin mid *dry* diameter (m)
 !-- vratiolo&vratiohi: volume ratio between the center and low/high limit
@@ -1377,50 +1463,45 @@
 !-- 1) Size subrange 1:
     ratio_d = reglim(2) / reglim(1)   ! section spacing (m)
-    DO  cc = in1a,fn1a
-       aero(cc)%vlolim = api6 * ( reglim(1) * ratio_d **                       &
-                                ( REAL( cc-1 ) / nbin(1) ) ) ** 3.0_wp
-       aero(cc)%vhilim = api6 * ( reglim(1) * ratio_d **                       &
-                                ( REAL( cc ) / nbin(1) ) ) ** 3.0_wp
-       aero(cc)%dmid = SQRT( ( aero(cc)%vhilim / api6 ) ** ( 1.0_wp / 3.0_wp ) &
-                           * ( aero(cc)%vlolim / api6 ) ** ( 1.0_wp / 3.0_wp ) )
-       aero(cc)%vratiohi = aero(cc)%vhilim / ( api6 * aero(cc)%dmid ** 3.0_wp )
-       aero(cc)%vratiolo = aero(cc)%vlolim / ( api6 * aero(cc)%dmid ** 3.0_wp )
+    DO  cc = start_subrange_1a, end_subrange_1a
+       aero(cc)%vlolim = api6 * ( reglim(1) * ratio_d**( REAL( cc-1 ) / nbin(1) ) )**3
+       aero(cc)%vhilim = api6 * ( reglim(1) * ratio_d**( REAL( cc ) / nbin(1) ) )**3
+       aero(cc)%dmid = SQRT( ( aero(cc)%vhilim / api6 )**0.33333333_wp *                           &
+                             ( aero(cc)%vlolim / api6 )**0.33333333_wp )
+       aero(cc)%vratiohi = aero(cc)%vhilim / ( api6 * aero(cc)%dmid**3 )
+       aero(cc)%vratiolo = aero(cc)%vlolim / ( api6 * aero(cc)%dmid**3 )
     ENDDO
 !
-!-- 2) Size subrange 2: 
+!-- 2) Size subrange 2:
 !-- 2.1) Sub-subrange 2a: high hygroscopicity
     ratio_d = reglim(3) / reglim(2)   ! section spacing
-    DO  dd = in2a, fn2a
-       cc = dd - in2a
-       aero(dd)%vlolim = api6 * ( reglim(2) * ratio_d **                       &
-                                  ( REAL( cc ) / nbin(2) ) ) ** 3.0_wp
-       aero(dd)%vhilim = api6 * ( reglim(2) * ratio_d **                       &
-                                  ( REAL( cc+1 ) / nbin(2) ) ) ** 3.0_wp
-       aero(dd)%dmid = SQRT( ( aero(dd)%vhilim / api6 ) ** ( 1.0_wp / 3.0_wp ) &
-                           * ( aero(dd)%vlolim / api6 ) ** ( 1.0_wp / 3.0_wp ) )
-       aero(dd)%vratiohi = aero(dd)%vhilim / ( api6 * aero(dd)%dmid ** 3.0_wp )
-       aero(dd)%vratiolo = aero(dd)%vlolim / ( api6 * aero(dd)%dmid ** 3.0_wp )
+    DO  dd = start_subrange_2a, end_subrange_2a
+       cc = dd - start_subrange_2a
+       aero(dd)%vlolim = api6 * ( reglim(2) * ratio_d**( REAL( cc ) / nbin(2) ) )**3
+       aero(dd)%vhilim = api6 * ( reglim(2) * ratio_d**( REAL( cc+1 ) / nbin(2) ) )**3
+       aero(dd)%dmid = SQRT( ( aero(dd)%vhilim / api6 )**0.33333333_wp *                           &
+                             ( aero(dd)%vlolim / api6 )**0.33333333_wp )
+       aero(dd)%vratiohi = aero(dd)%vhilim / ( api6 * aero(dd)%dmid**3 )
+       aero(dd)%vratiolo = aero(dd)%vlolim / ( api6 * aero(dd)%dmid**3 )
     ENDDO
-!          
+!
 !-- 2.2) Sub-subrange 2b: low hygroscopicity
     IF ( .NOT. no_insoluble )  THEN
-       aero(in2b:fn2b)%vlolim   = aero(in2a:fn2a)%vlolim
-       aero(in2b:fn2b)%vhilim   = aero(in2a:fn2a)%vhilim
-       aero(in2b:fn2b)%dmid     = aero(in2a:fn2a)%dmid
-       aero(in2b:fn2b)%vratiohi = aero(in2a:fn2a)%vratiohi
-       aero(in2b:fn2b)%vratiolo = aero(in2a:fn2a)%vratiolo
+       aero(start_subrange_2b:end_subrange_2b)%vlolim   = aero(start_subrange_2a:end_subrange_2a)%vlolim
+       aero(start_subrange_2b:end_subrange_2b)%vhilim   = aero(start_subrange_2a:end_subrange_2a)%vhilim
+       aero(start_subrange_2b:end_subrange_2b)%dmid     = aero(start_subrange_2a:end_subrange_2a)%dmid
+       aero(start_subrange_2b:end_subrange_2b)%vratiohi = aero(start_subrange_2a:end_subrange_2a)%vratiohi
+       aero(start_subrange_2b:end_subrange_2b)%vratiolo = aero(start_subrange_2a:end_subrange_2a)%vratiolo
     ENDIF
-!          
-!-- Initialize the wet diameter with the bin dry diameter to avoid numerical 
-!-- problems later
+!
+!-- Initialize the wet diameter with the bin dry diameter to avoid numerical problems later
     aero(:)%dwet = aero(:)%dmid
 !
-!-- Save bin limits (lower diameter) to be delivered to the host model if needed
-    DO cc = 1, nbins
-       bin_low_limits(cc) = ( aero(cc)%vlolim / api6 )**( 1.0_wp / 3.0_wp )
-    ENDDO    
-    
+!-- Save bin limits (lower diameter) to be delivered to PALM if needed
+    DO cc = 1, nbins_aerosol
+       bin_low_limits(cc) = ( aero(cc)%vlolim / api6 )**0.33333333_wp
+    ENDDO
+
  END SUBROUTINE set_sizebins
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -1434,317 +1515,378 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE aerosol_init
- 
-    USE arrays_3d,                                                             &
-        ONLY:  zu
- 
-!    USE NETCDF
-    
-    USE netcdf_data_input_mod,                                                 &
-        ONLY:  get_attribute, get_variable,                                    &
-               netcdf_data_input_get_dimension_length, open_read_file
-    
+
+    USE netcdf_data_input_mod,                                                                     &
+        ONLY:  get_attribute, get_variable, netcdf_data_input_get_dimension_length, open_read_file
+
     IMPLICIT NONE
-    
-    INTEGER(iwp) ::  b          !< loop index: size bins
-    INTEGER(iwp) ::  c          !< loop index: chemical components
-    INTEGER(iwp) ::  ee         !< index: end
-    INTEGER(iwp) ::  g          !< loop index: gases
-    INTEGER(iwp) ::  i          !< loop index: x-direction
-    INTEGER(iwp) ::  id_faero   !< NetCDF id of PIDS_SALSA
-    INTEGER(iwp) ::  id_fchem   !< NetCDF id of PIDS_CHEM
-    INTEGER(iwp) ::  j          !< loop index: y-direction
-    INTEGER(iwp) ::  k          !< loop index: z-direction
-    INTEGER(iwp) ::  kk         !< loop index: z-direction
-    INTEGER(iwp) ::  nz_file    !< Number of grid-points in file (heights)                            
-    INTEGER(iwp) ::  prunmode
-    INTEGER(iwp) ::  ss !< index: start 
-    LOGICAL  ::  netcdf_extend = .FALSE. !< Flag indicating wether netcdf 
-                                         !< topography input file or not
-    REAL(wp), DIMENSION(nbins) ::  core  !< size of the bin mid aerosol particle, 
-    REAL(wp) ::  flag           !< flag to mask topography grid points
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pr_gas !< gas profiles
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pr_mass_fracs_a !< mass fraction 
-                                                              !< profiles: a
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pr_mass_fracs_b !< and b
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pr_nsect !< sectional size 
-                                                       !< distribution profile
-    REAL(wp), DIMENSION(nbins)            ::  nsect  !< size distribution (#/m3)
-    REAL(wp), DIMENSION(0:nz+1,nbins)     ::  pndist !< size dist as a function 
-                                                     !< of height (#/m3)
-    REAL(wp), DIMENSION(0:nz+1)           ::  pnf2a  !< number fraction: bins 2a
-    REAL(wp), DIMENSION(0:nz+1,maxspec)   ::  pvf2a  !< mass distributions of  
-                                                     !< aerosol species for a  
-    REAL(wp), DIMENSION(0:nz+1,maxspec)   ::  pvf2b  !< and b-bins     
-    REAL(wp), DIMENSION(0:nz+1)           ::  pvfOC1a !< mass fraction between 
-                                                     !< SO4 and OC in 1a
-    REAL(wp), DIMENSION(:), ALLOCATABLE   ::  pr_z
-
+
+    CHARACTER(LEN=25), DIMENSION(:), ALLOCATABLE :: cc_name  !< chemical component name
+
+    INTEGER(iwp) ::  ee        !< index: end
+    INTEGER(iwp) ::  i         !< loop index: x-direction
+    INTEGER(iwp) ::  ib        !< loop index: size bins
+    INTEGER(iwp) ::  ic        !< loop index: chemical components
+    INTEGER(iwp) ::  id_dyn    !< NetCDF id of PIDS_DYNAMIC_SALSA
+    INTEGER(iwp) ::  ig        !< loop index: gases
+    INTEGER(iwp) ::  j         !< loop index: y-direction
+    INTEGER(iwp) ::  k         !< loop index: z-direction
+    INTEGER(iwp) ::  lod_aero  !< level of detail of inital aerosol concentrations
+    INTEGER(iwp) ::  pr_nbins  !< Number of aerosol size bins in file
+    INTEGER(iwp) ::  pr_ncc    !< Number of aerosol chemical components in file
+    INTEGER(iwp) ::  pr_nz     !< Number of vertical grid-points in file
+    INTEGER(iwp) ::  prunmode  !< running mode of SALSA
+    INTEGER(iwp) ::  ss        !< index: start
+
+    INTEGER(iwp), DIMENSION(maxspec) ::  cc_input_to_model
+
+    LOGICAL  ::  netcdf_extend = .FALSE. !< Flag: netcdf file exists
+
+    REAL(wp) ::  flag  !< flag to mask topography grid points
+
+    REAL(wp), DIMENSION(nbins_aerosol) ::  core   !< size of the bin mid aerosol particle
+    REAL(wp), DIMENSION(nbins_aerosol) ::  nsect  !< size distribution (#/m3)
+
+    REAL(wp), DIMENSION(0:nz+1) ::  pnf2a   !< number fraction in 2a
+    REAL(wp), DIMENSION(0:nz+1) ::  pmfoc1a !< mass fraction of OC in 1a
+
+    REAL(wp), DIMENSION(0:nz+1,nbins_aerosol)   ::  pndist  !< size dist as a function of height (#/m3)
+    REAL(wp), DIMENSION(0:nz+1,maxspec)         ::  pmf2a   !< mass distributions in subrange 2a
+    REAL(wp), DIMENSION(0:nz+1,maxspec)         ::  pmf2b   !< mass distributions in subrange 2b
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  pr_dmid  !< vertical profile of aerosol bin diameters
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  pr_z     !< z levels of profiles
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pr_mass_fracs_a  !< mass fraction: a
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pr_mass_fracs_b  !< and b
+
+    cc_input_to_model = 0
     prunmode = 1
 !
 !-- Bin mean aerosol particle volume (m3)
     core(:) = 0.0_wp
-    core(1:nbins) = api6 * aero(1:nbins)%dmid ** 3.0_wp
-!    
-!-- Set concentrations to zero 
+    core(1:nbins_aerosol) = api6 * aero(1:nbins_aerosol)%dmid**3
+!
+!-- Set concentrations to zero
     nsect(:)     = 0.0_wp
     pndist(:,:)  = 0.0_wp
-    pnf2a(:)     = nf2a   
-    pvf2a(:,:)   = 0.0_wp
-    pvf2b(:,:)   = 0.0_wp
-    pvfOC1a(:)   = 0.0_wp
+    pnf2a(:)     = nf2a
+    pmf2a(:,:)   = 0.0_wp
+    pmf2b(:,:)   = 0.0_wp
+    pmfoc1a(:)   = 0.0_wp
 
     IF ( isdtyp == 1 )  THEN
 !
-!--    Read input profiles from PIDS_SALSA    
+!--    Read input profiles from PIDS_DYNAMIC_SALSA
 #if defined( __netcdf )
-!    
-!--    Location-dependent size distributions and compositions.      
-       INQUIRE( FILE='PIDS_SALSA'// TRIM( coupling_char ), EXIST=netcdf_extend )
+!
+!--    Location-dependent size distributions and compositions.
+       INQUIRE( FILE = TRIM( input_file_dynamic ) //  TRIM( coupling_char ), EXIST = netcdf_extend )
        IF ( netcdf_extend )  THEN
 !
-!--       Open file in read-only mode  
-          CALL open_read_file( 'PIDS_SALSA' // TRIM( coupling_char ), id_faero )
-!
-!--       Input heights   
-          CALL netcdf_data_input_get_dimension_length( id_faero, nz_file,      &
-                                                       "profile_z" ) 
-          
-          ALLOCATE( pr_z(nz_file), pr_mass_fracs_a(maxspec,nz_file),           &
-                    pr_mass_fracs_b(maxspec,nz_file), pr_nsect(nbins,nz_file) ) 
-          CALL get_variable( id_faero, 'profile_z', pr_z ) 
-!       
-!--       Mass fracs profile: 1: H2SO4 (sulphuric acid), 2: OC (organic carbon), 
-!--                           3: BC (black carbon),      4: DU (dust),  
-!--                           5: SS (sea salt),          6: HNO3 (nitric acid),
-!--                           7: NH3 (ammonia)          
-          CALL get_variable( id_faero, "profile_mass_fracs_a", pr_mass_fracs_a,&
-                             0, nz_file-1, 0, maxspec-1 )
-          CALL get_variable( id_faero, "profile_mass_fracs_b", pr_mass_fracs_b,&
-                             0, nz_file-1, 0, maxspec-1 )
-          CALL get_variable( id_faero, "profile_nsect", pr_nsect, 0, nz_file-1,&
-                             0, nbins-1 )                   
-          
-          kk = 1
-          DO  k = nzb, nz+1
-             IF ( kk < nz_file )  THEN
-                DO  WHILE ( pr_z(kk+1) <= zu(k) )
-                   kk = kk + 1
-                   IF ( kk == nz_file )  EXIT
-                ENDDO
+!--       Open file in read-only mode
+          CALL open_read_file( input_file_dynamic // TRIM( coupling_char ), id_dyn )
+!
+!--       Inquire dimensions:
+          CALL netcdf_data_input_get_dimension_length( id_dyn, pr_nz, 'z' )
+          IF ( pr_nz /= nz )  THEN
+             WRITE( message_string, * ) 'Number of inifor horizontal grid points does not match '//&
+                                        'the number of numeric grid points.'
+             CALL message( 'aerosol_init', 'PA0601', 1, 2, 0, 6, 0 )
+          ENDIF
+          CALL netcdf_data_input_get_dimension_length( id_dyn, pr_ncc, 'composition_index' )
+!
+!--       Allocate memory
+          ALLOCATE( pr_z(1:pr_nz), pr_mass_fracs_a(nzb:nzt+1,pr_ncc),                            &
+                    pr_mass_fracs_b(nzb:nzt+1,pr_ncc) )
+          pr_mass_fracs_a = 0.0_wp
+          pr_mass_fracs_b = 0.0_wp
+!
+!--       Read vertical levels
+          CALL get_variable( id_dyn, 'z', pr_z )
+!
+!--       Read name and index of chemical components
+          CALL get_variable( id_dyn, 'composition_name', cc_name, pr_ncc )
+          DO  ic = 1, pr_ncc
+             SELECT CASE ( TRIM( cc_name(ic) ) )
+                CASE ( 'H2SO4', 'SO4', 'h2so4', 'so4' )
+                   cc_input_to_model(1) = ic
+                CASE ( 'OC', 'oc' )
+                   cc_input_to_model(2) = ic
+                CASE ( 'BC', 'bc' )
+                   cc_input_to_model(3) = ic
+                CASE ( 'DU', 'du' )
+                   cc_input_to_model(4) = ic
+                CASE ( 'SS', 'ss' )
+                   cc_input_to_model(5) = ic
+                CASE ( 'HNO3', 'hno3', 'NO', 'no' )
+                   cc_input_to_model(6) = ic
+                CASE ( 'NH3', 'nh3', 'NH', 'nh' )
+                   cc_input_to_model(7) = ic
+             END SELECT
+          ENDDO
+
+          IF ( SUM( cc_input_to_model ) == 0 )  THEN
+             message_string = 'None of the aerosol chemical components in ' // TRIM(               &
+                              input_file_dynamic ) // ' correspond to ones applied in SALSA.'
+             CALL message( 'salsa_mod: aerosol_init', 'PA0602', 2, 2, 0, 6, 0 )
+          ENDIF
+!
+!--       Vertical profiles of mass fractions of different chemical components:
+          CALL get_variable( id_dyn, 'init_atmosphere_mass_fracs_a', pr_mass_fracs_a,              &
+                             0, pr_ncc-1, 0, pr_nz-1 )
+          CALL get_variable( id_dyn, 'init_atmosphere_mass_fracs_b', pr_mass_fracs_b,              &
+                             0, pr_ncc-1, 0, pr_nz-1  )
+!
+!--       Match the input data with the chemical composition applied in the model
+          DO  ic = 1, maxspec
+             ss = cc_input_to_model(ic)
+             IF ( ss == 0 )  CYCLE
+             pmf2a(nzb+1:nzt+1,ic) = pr_mass_fracs_a(nzb:nzt,ss)
+             pmf2b(nzb+1:nzt+1,ic) = pr_mass_fracs_b(nzb:nzt,ss)
+          ENDDO
+!
+!--       Aerosol concentrations: lod=1 (total PM) or lod=2 (sectional number size distribution)
+          CALL get_attribute( id_dyn, 'lod', lod_aero, .FALSE., 'init_atmosphere_aerosol' )
+          IF ( lod_aero /= 2 )  THEN
+             message_string = 'Currently only lod=2 accepted for init_atmosphere_aerosol'
+             CALL message( 'salsa_mod: aerosol_init', 'PA0603', 2, 2, 0, 6, 0 )
+          ELSE
+!
+!--          Bin mean diameters in the input file
+             CALL netcdf_data_input_get_dimension_length( id_dyn, pr_nbins, 'Dmid')
+             IF ( pr_nbins /= nbins_aerosol )  THEN
+                message_string = 'Number of size bins in init_atmosphere_aerosol does not match '  &
+                                 // 'with that applied in the model'
+                CALL message( 'salsa_mod: aerosol_init', 'PA0604', 2, 2, 0, 6, 0 )
              ENDIF
-             IF ( kk < nz_file )  THEN
-!             
-!--             Set initial value for gas compound tracers and initial values
-                pvf2a(k,:) = pr_mass_fracs_a(:,kk) + ( zu(k) - pr_z(kk) ) / (  &
-                            pr_z(kk+1) - pr_z(kk) ) * ( pr_mass_fracs_a(:,kk+1)&
-                            - pr_mass_fracs_a(:,kk) )    
-                pvf2b(k,:) = pr_mass_fracs_b(:,kk) + ( zu(k) - pr_z(kk) ) / (  &
-                            pr_z(kk+1) - pr_z(kk) ) * ( pr_mass_fracs_b(:,kk+1)&
-                            - pr_mass_fracs_b(:,kk) )             
-                pndist(k,:) = pr_nsect(:,kk) + ( zu(k) - pr_z(kk) ) / (        &
-                              pr_z(kk+1) - pr_z(kk) ) * ( pr_nsect(:,kk+1) -   &
-                              pr_nsect(:,kk) )
-             ELSE
-                pvf2a(k,:) = pr_mass_fracs_a(:,kk)       
-                pvf2b(k,:) = pr_mass_fracs_b(:,kk)
-                pndist(k,:) = pr_nsect(:,kk)
+
+             ALLOCATE( pr_dmid(pr_nbins) )
+             pr_dmid    = 0.0_wp
+
+             CALL get_variable( id_dyn, 'Dmid', pr_dmid )
+!
+!--          Check whether the sectional representation conform to the one 
+!--          applied in the model
+             IF ( ANY( ABS( ( aero(1:nbins_aerosol)%dmid - pr_dmid ) /                             &
+                              aero(1:nbins_aerosol)%dmid )  > 0.1_wp )  ) THEN
+                message_string = 'Mean diameters of the aerosol size bins ' // TRIM(               &
+                                 input_file_dynamic ) // ' in do not conform to the sectional '//  &
+                                 'representation of the model.'
+                CALL message( 'salsa_mod: aerosol_init', 'PA0605', 2, 2, 0, 6, 0 )
              ENDIF
-             IF ( iso4 < 0 )  THEN 
-                pvf2a(k,1) = 0.0_wp
-                pvf2b(k,1) = 0.0_wp
-             ENDIF
-             IF ( ioc < 0 )  THEN 
-                pvf2a(k,2) = 0.0_wp
-                pvf2b(k,2) = 0.0_wp
-             ENDIF
-             IF ( ibc < 0 )  THEN 
-                pvf2a(k,3) = 0.0_wp
-                pvf2b(k,3) = 0.0_wp
-             ENDIF
-             IF ( idu < 0 )  THEN 
-                pvf2a(k,4) = 0.0_wp
-                pvf2b(k,4) = 0.0_wp
-             ENDIF
-             IF ( iss < 0 )  THEN 
-                pvf2a(k,5) = 0.0_wp
-                pvf2b(k,5) = 0.0_wp
-             ENDIF
-             IF ( ino < 0 )  THEN 
-                pvf2a(k,6) = 0.0_wp
-                pvf2b(k,6) = 0.0_wp
-             ENDIF
-             IF ( inh < 0 )  THEN 
-                pvf2a(k,7) = 0.0_wp
-                pvf2b(k,7) = 0.0_wp
-             ENDIF
-!
-!--          Then normalise the mass fraction so that SUM = 1 
-             pvf2a(k,:) = pvf2a(k,:) / SUM( pvf2a(k,:) )
-             IF ( SUM( pvf2b(k,:) ) > 0.0_wp ) pvf2b(k,:) = pvf2b(k,:) /       &
-                                                            SUM( pvf2b(k,:) )
-          ENDDO          
-          DEALLOCATE( pr_z, pr_mass_fracs_a, pr_mass_fracs_b, pr_nsect )
+!
+!--          Inital aerosol concentrations
+             CALL get_variable( id_dyn, 'init_atmosphere_aerosol', pndist(nzb+1:nzt,:),            &
+                                0, pr_nbins-1, 0, pr_nz-1 )
+          ENDIF
+!
+!--       Set bottom and top boundary condition (Neumann)
+          pmf2a(nzb,:)    = pmf2a(nzb+1,:)
+          pmf2a(nzt+1,:)  = pmf2a(nzt,:)
+          pmf2b(nzb,:)    = pmf2b(nzb+1,:)
+          pmf2b(nzt+1,:)  = pmf2b(nzt,:)
+          pndist(nzb,:)   = pndist(nzb+1,:)
+          pndist(nzt+1,:) = pndist(nzt,:)
+
+          IF ( index_so4 < 0 )  THEN
+             pmf2a(:,1) = 0.0_wp
+             pmf2b(:,1) = 0.0_wp
+          ENDIF
+          IF ( index_oc < 0 )  THEN
+             pmf2a(:,2) = 0.0_wp
+             pmf2b(:,2) = 0.0_wp
+          ENDIF
+          IF ( index_bc < 0 )  THEN
+             pmf2a(:,3) = 0.0_wp
+             pmf2b(:,3) = 0.0_wp
+          ENDIF
+          IF ( index_du < 0 )  THEN
+             pmf2a(:,4) = 0.0_wp
+             pmf2b(:,4) = 0.0_wp
+          ENDIF
+          IF ( index_ss < 0 )  THEN
+             pmf2a(:,5) = 0.0_wp
+             pmf2b(:,5) = 0.0_wp
+          ENDIF
+          IF ( index_no < 0 )  THEN
+             pmf2a(:,6) = 0.0_wp
+             pmf2b(:,6) = 0.0_wp
+          ENDIF
+          IF ( index_nh < 0 )  THEN
+             pmf2a(:,7) = 0.0_wp
+             pmf2b(:,7) = 0.0_wp
+          ENDIF
+
+          IF ( SUM( pmf2a ) < 0.00001_wp  .AND.  SUM( pmf2b ) < 0.00001_wp )  THEN
+             message_string = 'Error in initialising mass fractions of chemical components. ' //   &
+                              'Check that all chemical components are included in parameter file!'
+             CALL message( 'salsa_mod: aerosol_init', 'PA0606', 2, 2, 0, 6, 0 ) 
+          ENDIF
+!
+!--       Then normalise the mass fraction so that SUM = 1
+          DO  k = nzb, nzt+1
+             pmf2a(k,:) = pmf2a(k,:) / SUM( pmf2a(k,:) )
+             IF ( SUM( pmf2b(k,:) ) > 0.0_wp )  pmf2b(k,:) = pmf2b(k,:) / SUM( pmf2b(k,:) )
+          ENDDO
+
+          DEALLOCATE( pr_z, pr_mass_fracs_a, pr_mass_fracs_b )
+
        ELSE
-          message_string = 'Input file '// TRIM( 'PIDS_SALSA' ) //             &
-                           TRIM( coupling_char ) // ' for SALSA missing!'
-          CALL message( 'salsa_mod: aerosol_init', 'SA0032', 1, 2, 0, 6, 0 )                
-       ENDIF   ! netcdf_extend   
+          message_string = 'Input file '// TRIM( input_file_dynamic ) // TRIM( coupling_char ) //  &
+                           ' for SALSA missing!'
+          CALL message( 'salsa_mod: aerosol_init', 'PA0607', 1, 2, 0, 6, 0 )
+
+       ENDIF   ! netcdf_extend
+
+#else
+       message_string = 'isdtyp = 1 but preprocessor directive __netcdf is not used in compiling!'
+       CALL message( 'salsa_mod: aerosol_init', 'PA0608', 1, 2, 0, 6, 0 )
+
 #endif
- 
+
     ELSEIF ( isdtyp == 0 )  THEN
 !
 !--    Mass fractions for species in a and b-bins
-       IF ( iso4 > 0 )  THEN
-          pvf2a(:,1) = mass_fracs_a(iso4) 
-          pvf2b(:,1) = mass_fracs_b(iso4)
-       ENDIF
-       IF ( ioc > 0 )  THEN
-          pvf2a(:,2) = mass_fracs_a(ioc)
-          pvf2b(:,2) = mass_fracs_b(ioc) 
-       ENDIF
-       IF ( ibc > 0 )  THEN
-          pvf2a(:,3) = mass_fracs_a(ibc) 
-          pvf2b(:,3) = mass_fracs_b(ibc)
-       ENDIF 
-       IF ( idu > 0 )  THEN
-          pvf2a(:,4) = mass_fracs_a(idu)
-          pvf2b(:,4) = mass_fracs_b(idu) 
-       ENDIF
-       IF ( iss > 0 )  THEN
-          pvf2a(:,5) = mass_fracs_a(iss)
-          pvf2b(:,5) = mass_fracs_b(iss) 
-       ENDIF
-       IF ( ino > 0 )  THEN
-          pvf2a(:,6) = mass_fracs_a(ino)
-          pvf2b(:,6) = mass_fracs_b(ino)
-       ENDIF
-       IF ( inh > 0 )  THEN
-          pvf2a(:,7) = mass_fracs_a(inh)
-          pvf2b(:,7) = mass_fracs_b(inh)
-       ENDIF
-       DO  k = nzb, nz+1
-          pvf2a(k,:) = pvf2a(k,:) / SUM( pvf2a(k,:) )
-          IF ( SUM( pvf2b(k,:) ) > 0.0_wp ) pvf2b(k,:) = pvf2b(k,:) /          &
-                                                         SUM( pvf2b(k,:) )
+       IF ( index_so4 > 0 )  THEN
+          pmf2a(:,1) = mass_fracs_a(index_so4)
+          pmf2b(:,1) = mass_fracs_b(index_so4)
+       ENDIF
+       IF ( index_oc > 0 )  THEN
+          pmf2a(:,2) = mass_fracs_a(index_oc)
+          pmf2b(:,2) = mass_fracs_b(index_oc)
+       ENDIF
+       IF ( index_bc > 0 )  THEN
+          pmf2a(:,3) = mass_fracs_a(index_bc)
+          pmf2b(:,3) = mass_fracs_b(index_bc)
+       ENDIF
+       IF ( index_du > 0 )  THEN
+          pmf2a(:,4) = mass_fracs_a(index_du)
+          pmf2b(:,4) = mass_fracs_b(index_du)
+       ENDIF
+       IF ( index_ss > 0 )  THEN
+          pmf2a(:,5) = mass_fracs_a(index_ss)
+          pmf2b(:,5) = mass_fracs_b(index_ss)
+       ENDIF
+       IF ( index_no > 0 )  THEN
+          pmf2a(:,6) = mass_fracs_a(index_no)
+          pmf2b(:,6) = mass_fracs_b(index_no)
+       ENDIF
+       IF ( index_nh > 0 )  THEN
+          pmf2a(:,7) = mass_fracs_a(index_nh)
+          pmf2b(:,7) = mass_fracs_b(index_nh)
+       ENDIF
+       DO  k = nzb, nzt+1
+          pmf2a(k,:) = pmf2a(k,:) / SUM( pmf2a(k,:) )
+          IF ( SUM( pmf2b(k,:) ) > 0.0_wp ) pmf2b(k,:) = pmf2b(k,:) / SUM( pmf2b(k,:) )
        ENDDO
-       
+
        CALL size_distribution( n_lognorm, dpg, sigmag, nsect )
 !
 !--    Normalize by the given total number concentration
-       nsect = nsect * SUM( n_lognorm ) * 1.0E+6_wp / SUM( nsect )      
-       DO  b = in1a, fn2b
-          pndist(:,b) = nsect(b)
+       nsect = nsect * SUM( n_lognorm ) / SUM( nsect )
+       DO  ib = start_subrange_1a, end_subrange_2b
+          pndist(:,ib) = nsect(ib)
        ENDDO
     ENDIF
-    
+
     IF ( igctyp == 1 )  THEN
 !
-!--    Read input profiles from PIDS_CHEM    
+!--    Read input profiles from PIDS_CHEM
 #if defined( __netcdf )
-!    
-!--    Location-dependent size distributions and compositions.      
-       INQUIRE( FILE='PIDS_CHEM' // TRIM( coupling_char ), EXIST=netcdf_extend )
+!
+!--    Location-dependent size distributions and compositions.
+       INQUIRE( FILE = TRIM( input_file_dynamic ) //  TRIM( coupling_char ), EXIST = netcdf_extend )
        IF ( netcdf_extend  .AND.  .NOT. salsa_gases_from_chem )  THEN
 !
-!--       Open file in read-only mode      
-          CALL open_read_file( 'PIDS_CHEM' // TRIM( coupling_char ), id_fchem )
-!
-!--       Input heights   
-          CALL netcdf_data_input_get_dimension_length( id_fchem, nz_file,      &
-                                                       "profile_z" ) 
-          ALLOCATE( pr_z(nz_file), pr_gas(ngast,nz_file) ) 
-          CALL get_variable( id_fchem, 'profile_z', pr_z ) 
-!       
-!--       Gases:
-          CALL get_variable( id_fchem, "profile_H2SO4", pr_gas(1,:) )
-          CALL get_variable( id_fchem, "profile_HNO3", pr_gas(2,:) )
-          CALL get_variable( id_fchem, "profile_NH3", pr_gas(3,:) )
-          CALL get_variable( id_fchem, "profile_OCNV", pr_gas(4,:) )
-          CALL get_variable( id_fchem, "profile_OCSV", pr_gas(5,:) )
-          
-          kk = 1
-          DO  k = nzb, nz+1
-             IF ( kk < nz_file )  THEN
-                DO  WHILE ( pr_z(kk+1) <= zu(k) )
-                   kk = kk + 1
-                   IF ( kk == nz_file )  EXIT
-                ENDDO
-             ENDIF
-             IF ( kk < nz_file )  THEN
-!             
-!--             Set initial value for gas compound tracers and initial values
-                DO  g = 1, ngast
-                   salsa_gas(g)%init(k) =  pr_gas(g,kk) + ( zu(k) - pr_z(kk) ) &
-                                           / ( pr_z(kk+1) - pr_z(kk) ) *       &
-                                           ( pr_gas(g,kk+1) - pr_gas(g,kk) )
-                   salsa_gas(g)%conc(k,:,:) = salsa_gas(g)%init(k)
-                ENDDO
-             ELSE
-                DO  g = 1, ngast
-                   salsa_gas(g)%init(k) =  pr_gas(g,kk) 
-                   salsa_gas(g)%conc(k,:,:) = salsa_gas(g)%init(k)
-                ENDDO
-             ENDIF
+!--       Open file in read-only mode
+          CALL open_read_file( input_file_dynamic // TRIM( coupling_char ), id_dyn )
+!
+!--       Inquire dimensions:
+          CALL netcdf_data_input_get_dimension_length( id_dyn, pr_nz, 'z' )
+          IF ( pr_nz /= nz )  THEN
+             WRITE( message_string, * ) 'Number of inifor horizontal grid points does not match '//&
+                                        'the number of numeric grid points.'
+             CALL message( 'aerosol_init', 'PA0609', 1, 2, 0, 6, 0 )
+          ENDIF
+!
+!--       Read vertical profiles of gases:
+          CALL get_variable( id_dyn, 'init_atmosphere_h2so4', salsa_gas(1)%init(nzb+1:nzt) )
+          CALL get_variable( id_dyn, 'init_atmosphere_hno3',  salsa_gas(2)%init(nzb+1:nzt) )
+          CALL get_variable( id_dyn, 'init_atmosphere_nh3',   salsa_gas(3)%init(nzb+1:nzt) )
+          CALL get_variable( id_dyn, 'init_atmosphere_ocnv',  salsa_gas(4)%init(nzb+1:nzt) )
+          CALL get_variable( id_dyn, 'init_atmosphere_ocsv',  salsa_gas(5)%init(nzb+1:nzt) )
+!
+!--       Set Neumann top and surface boundary condition for initial + initialise concentrations
+          DO  ig = 1, ngases_salsa
+             salsa_gas(ig)%init(nzb)   =  salsa_gas(ig)%init(nzb+1)
+             salsa_gas(ig)%init(nzt+1) =  salsa_gas(ig)%init(nzt)
+             DO  k = nzb, nzt+1
+                salsa_gas(ig)%conc(k,:,:) = salsa_gas(ig)%init(k)
+             ENDDO
           ENDDO
-          
-          DEALLOCATE( pr_z, pr_gas )
+
        ELSEIF ( .NOT. netcdf_extend  .AND.  .NOT.  salsa_gases_from_chem )  THEN
-          message_string = 'Input file '// TRIM( 'PIDS_CHEM' ) //              &
-                           TRIM( coupling_char ) // ' for SALSA missing!'
-          CALL message( 'salsa_mod: aerosol_init', 'SA0033', 1, 2, 0, 6, 0 )                
-       ENDIF   ! netcdf_extend     
+          message_string = 'Input file '// TRIM( input_file_dynamic ) // TRIM( coupling_char ) //  &
+                           ' for SALSA missing!'
+          CALL message( 'salsa_mod: aerosol_init', 'PA0610', 1, 2, 0, 6, 0 )
+       ENDIF   ! netcdf_extend
+#else
+       message_string = 'igctyp = 1 but preprocessor directive __netcdf is not used in compiling!'
+       CALL message( 'salsa_mod: aerosol_init', 'PA0611', 1, 2, 0, 6, 0 )
+
 #endif
 
     ENDIF
-
-    IF ( ioc > 0  .AND.  iso4 > 0 )  THEN      
-!--    Both are there, so use the given "massDistrA"
-       pvfOC1a(:) = pvf2a(:,2) / ( pvf2a(:,2) + pvf2a(:,1) )  ! Normalize
-    ELSEIF ( ioc > 0 )  THEN
-!--    Pure organic carbon
-       pvfOC1a(:) = 1.0_wp
-    ELSEIF ( iso4 > 0 )  THEN
-!--    Pure SO4
-       pvfOC1a(:) = 0.0_wp   
+!
+!-- Both SO4 and OC are included, so use the given mass fractions
+    IF ( index_oc > 0  .AND.  index_so4 > 0 )  THEN
+       pmfoc1a(:) = pmf2a(:,2) / ( pmf2a(:,2) + pmf2a(:,1) )  ! Normalize
+!
+!-- Pure organic carbon
+    ELSEIF ( index_oc > 0 )  THEN
+       pmfoc1a(:) = 1.0_wp
+!
+!-- Pure SO4
+    ELSEIF ( index_so4 > 0 )  THEN
+       pmfoc1a(:) = 0.0_wp
+
     ELSE
        message_string = 'Either OC or SO4 must be active for aerosol region 1a!'
-       CALL message( 'salsa_mod: aerosol_init', 'SA0021', 1, 2, 0, 6, 0 )
-    ENDIF    
-    
+       CALL message( 'salsa_mod: aerosol_init', 'PA0612', 1, 2, 0, 6, 0 )
+    ENDIF
+
 !
 !-- Initialize concentrations
-    DO  i = nxlg, nxrg 
+    DO  i = nxlg, nxrg
        DO  j = nysg, nyng
           DO  k = nzb, nzt+1
 !
-!--          Predetermine flag to mask topography          
+!--          Predetermine flag to mask topography
              flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
-!          
+!
 !--          a) Number concentrations
-!--           Region 1:
-             DO  b = in1a, fn1a
-                aerosol_number(b)%conc(k,j,i) = pndist(k,b) * flag
+!--          Region 1:
+             DO  ib = start_subrange_1a, end_subrange_1a
+                aerosol_number(ib)%conc(k,j,i) = pndist(k,ib) * flag
                 IF ( prunmode == 1 )  THEN
-                   aerosol_number(b)%init = pndist(:,b)
+                   aerosol_number(ib)%init = pndist(:,ib)
                 ENDIF
              ENDDO
-!             
-!--           Region 2:
+!
+!--          Region 2:
              IF ( nreg > 1 )  THEN
-                DO  b = in2a, fn2a
-                   aerosol_number(b)%conc(k,j,i) = MAX( 0.0_wp, pnf2a(k) ) *   &
-                                                    pndist(k,b) * flag
+                DO  ib = start_subrange_2a, end_subrange_2a
+                   aerosol_number(ib)%conc(k,j,i) = MAX( 0.0_wp, pnf2a(k) ) * pndist(k,ib) * flag
                    IF ( prunmode == 1 )  THEN
-                      aerosol_number(b)%init = MAX( 0.0_wp, nf2a ) * pndist(:,b)
+                      aerosol_number(ib)%init = MAX( 0.0_wp, nf2a ) * pndist(:,ib)
                    ENDIF
                 ENDDO
                 IF ( .NOT. no_insoluble )  THEN
-                   DO  b = in2b, fn2b
-                      IF ( pnf2a(k) < 1.0_wp )  THEN              
-                         aerosol_number(b)%conc(k,j,i) = MAX( 0.0_wp, 1.0_wp   &
-                                               - pnf2a(k) ) * pndist(k,b) * flag
+                   DO  ib = start_subrange_2b, end_subrange_2b
+                      IF ( pnf2a(k) < 1.0_wp )  THEN
+                         aerosol_number(ib)%conc(k,j,i) = MAX( 0.0_wp, 1.0_wp - pnf2a(k) ) *       &
+                                                          pndist(k,ib) * flag
                          IF ( prunmode == 1 )  THEN
-                            aerosol_number(b)%init = MAX( 0.0_wp, 1.0_wp -     &
-                                                          nf2a ) * pndist(:,b)
+                            aerosol_number(ib)%init = MAX( 0.0_wp, 1.0_wp - nf2a ) * pndist(:,ib)
                          ENDIF
                       ENDIF
@@ -1755,81 +1897,74 @@
 !--          b) Aerosol mass concentrations
 !--             bin subrange 1: done here separately due to the SO4/OC convention
+!
 !--          SO4:
-             IF ( iso4 > 0 )  THEN
-                ss = ( iso4 - 1 ) * nbins + in1a !< start
-                ee = ( iso4 - 1 ) * nbins + fn1a !< end
-                b = in1a
-                DO  c = ss, ee
-                   aerosol_mass(c)%conc(k,j,i) = MAX( 0.0_wp, 1.0_wp -         &
-                                                  pvfOC1a(k) ) * pndist(k,b) * &
-                                                  core(b) * arhoh2so4 * flag
+             IF ( index_so4 > 0 )  THEN
+                ss = ( index_so4 - 1 ) * nbins_aerosol + start_subrange_1a !< start
+                ee = ( index_so4 - 1 ) * nbins_aerosol + end_subrange_1a !< end
+                ib = start_subrange_1a
+                DO  ic = ss, ee
+                   aerosol_mass(ic)%conc(k,j,i) = MAX( 0.0_wp, 1.0_wp - pmfoc1a(k) ) * pndist(k,ib)&
+                                                  * core(ib) * arhoh2so4 * flag
                    IF ( prunmode == 1 )  THEN
-                      aerosol_mass(c)%init = MAX( 0.0_wp, 1.0_wp - MAXVAL(     &
-                                             pvfOC1a ) ) * pndist(:,b) *       &
-                                             core(b) * arhoh2so4
+                      aerosol_mass(ic)%init(k) = MAX( 0.0_wp, 1.0_wp - pmfoc1a(k) ) * pndist(k,ib) &
+                                                 * core(ib) * arhoh2so4
                    ENDIF
-                   b = b+1
+                   ib = ib+1
                 ENDDO
              ENDIF
+!
 !--          OC:
-             IF ( ioc > 0 ) THEN
-                ss = ( ioc - 1 ) * nbins + in1a !< start
-                ee = ( ioc - 1 ) * nbins + fn1a !< end 
-                b = in1a
-                DO  c = ss, ee 
-                   aerosol_mass(c)%conc(k,j,i) = MAX( 0.0_wp, pvfOC1a(k) ) *   &
-                                           pndist(k,b) * core(b) * arhooc * flag
+             IF ( index_oc > 0 ) THEN
+                ss = ( index_oc - 1 ) * nbins_aerosol + start_subrange_1a !< start
+                ee = ( index_oc - 1 ) * nbins_aerosol + end_subrange_1a !< end
+                ib = start_subrange_1a
+                DO  ic = ss, ee 
+                   aerosol_mass(ic)%conc(k,j,i) = MAX( 0.0_wp, pmfoc1a(k) ) * pndist(k,ib) *       &
+                                                  core(ib) * arhooc * flag
                    IF ( prunmode == 1 )  THEN
-                      aerosol_mass(c)%init = MAX( 0.0_wp, MAXVAL( pvfOC1a ) )  &
-                                             * pndist(:,b) *  core(b) * arhooc
+                      aerosol_mass(ic)%init(k) = MAX( 0.0_wp, pmfoc1a(k) ) * pndist(k,ib) *        &
+                                                 core(ib) * arhooc
                    ENDIF
-                   b = b+1
+                   ib = ib+1
                 ENDDO 
              ENDIF
-             
-             prunmode = 3  ! Init only once
-  
           ENDDO !< k
+
+          prunmode = 3  ! Init only once
+
        ENDDO !< j
     ENDDO !< i
-    
+
 !
 !-- c) Aerosol mass concentrations
 !--    bin subrange 2:
     IF ( nreg > 1 ) THEN
-    
-       IF ( iso4 > 0 ) THEN
-          CALL set_aero_mass( iso4, pvf2a(:,1), pvf2b(:,1), pnf2a, pndist,     &
-                              core, arhoh2so4 )
-       ENDIF
-       IF ( ioc > 0 ) THEN
-          CALL set_aero_mass( ioc, pvf2a(:,2), pvf2b(:,2), pnf2a, pndist, core,&
-                              arhooc )
-       ENDIF
-       IF ( ibc > 0 ) THEN
-          CALL set_aero_mass( ibc, pvf2a(:,3), pvf2b(:,3), pnf2a, pndist, core,&
-                              arhobc )
-       ENDIF
-       IF ( idu > 0 ) THEN
-          CALL set_aero_mass( idu, pvf2a(:,4), pvf2b(:,4), pnf2a, pndist, core,&
-                              arhodu )
-       ENDIF
-       IF ( iss > 0 ) THEN
-          CALL set_aero_mass( iss, pvf2a(:,5), pvf2b(:,5), pnf2a, pndist, core,&
-                              arhoss )
-       ENDIF
-       IF ( ino > 0 ) THEN
-          CALL set_aero_mass( ino, pvf2a(:,6), pvf2b(:,6), pnf2a, pndist, core,&
-                              arhohno3 )
-       ENDIF
-       IF ( inh > 0 ) THEN
-          CALL set_aero_mass( inh, pvf2a(:,7), pvf2b(:,7), pnf2a, pndist, core,&
-                              arhonh3 )
+
+       IF ( index_so4 > 0 ) THEN
+          CALL set_aero_mass( index_so4, pmf2a(:,1), pmf2b(:,1), pnf2a, pndist, core, arhoh2so4 )
+       ENDIF
+       IF ( index_oc > 0 ) THEN
+          CALL set_aero_mass( index_oc, pmf2a(:,2), pmf2b(:,2), pnf2a, pndist, core, arhooc )
+       ENDIF
+       IF ( index_bc > 0 ) THEN
+          CALL set_aero_mass( index_bc, pmf2a(:,3), pmf2b(:,3), pnf2a, pndist, core, arhobc )
+       ENDIF
+       IF ( index_du > 0 ) THEN
+          CALL set_aero_mass( index_du, pmf2a(:,4), pmf2b(:,4), pnf2a, pndist, core, arhodu )
+       ENDIF
+       IF ( index_ss > 0 ) THEN
+          CALL set_aero_mass( index_ss, pmf2a(:,5), pmf2b(:,5), pnf2a, pndist, core, arhoss )
+       ENDIF
+       IF ( index_no > 0 ) THEN
+          CALL set_aero_mass( index_no, pmf2a(:,6), pmf2b(:,6), pnf2a, pndist, core, arhohno3 )
+       ENDIF
+       IF ( index_nh > 0 ) THEN
+          CALL set_aero_mass( index_nh, pmf2a(:,7), pmf2b(:,7), pnf2a, pndist, core, arhonh3 )
        ENDIF
 
     ENDIF
-    
+
  END SUBROUTINE aerosol_init
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -1839,51 +1974,52 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE size_distribution( in_ntot, in_dpg, in_sigma, psd_sect )
-   
+
     IMPLICIT NONE
-   
-!-- Log-normal size distribution: modes   
-    REAL(wp), DIMENSION(:), INTENT(in) ::  in_dpg    !< geometric mean diameter 
-                                                     !< (micrometres) 
-    REAL(wp), DIMENSION(:), INTENT(in) ::  in_ntot   !< number conc. (#/cm3)
+
+    INTEGER(iwp) ::  ib         !< running index: bin
+    INTEGER(iwp) ::  iteration  !< running index: iteration
+
+    REAL(wp) ::  d1         !< particle diameter (m, dummy)
+    REAL(wp) ::  d2         !< particle diameter (m, dummy)
+    REAL(wp) ::  delta_d    !< (d2-d1)/10
+    REAL(wp) ::  deltadp    !< bin width
+    REAL(wp) ::  dmidi      !< ( d1 + d2 ) / 2
+
+    REAL(wp), DIMENSION(:), INTENT(in) ::  in_dpg    !< geometric mean diameter (m)
+    REAL(wp), DIMENSION(:), INTENT(in) ::  in_ntot   !< number conc. (#/m3)
     REAL(wp), DIMENSION(:), INTENT(in) ::  in_sigma  !< standard deviation
-    REAL(wp), DIMENSION(:), INTENT(inout) ::  psd_sect !< sectional size 
-                                                       !< distribution
-    INTEGER(iwp) ::  b          !< running index: bin
-    INTEGER(iwp) ::  ib         !< running index: iteration
-    REAL(wp) ::  d1             !< particle diameter (m, dummy)
-    REAL(wp) ::  d2             !< particle diameter (m, dummy)
-    REAL(wp) ::  delta_d        !< (d2-d1)/10                                                      
-    REAL(wp) ::  deltadp        !< bin width 
-    REAL(wp) ::  dmidi          !< ( d1 + d2 ) / 2
-    
-    DO  b = in1a, fn2b !< aerosol size bins
-       psd_sect(b) = 0.0_wp
+
+    REAL(wp), DIMENSION(:), INTENT(inout) ::  psd_sect  !< sectional size distribution
+
+    DO  ib = start_subrange_1a, end_subrange_2b
+       psd_sect(ib) = 0.0_wp
+!
 !--    Particle diameter at the low limit (largest in the bin) (m)
-       d1 = ( aero(b)%vlolim / api6 ) ** ( 1.0_wp / 3.0_wp )
+       d1 = ( aero(ib)%vlolim / api6 )**0.33333333_wp
+!
 !--    Particle diameter at the high limit (smallest in the bin) (m)
-       d2 = ( aero(b)%vhilim / api6 ) ** ( 1.0_wp / 3.0_wp )
+       d2 = ( aero(ib)%vhilim / api6 )**0.33333333_wp
+!
 !--    Span of particle diameter in a bin (m)
-       delta_d = ( d2 - d1 ) / 10.0_wp
-!--    Iterate:             
-       DO  ib = 1, 10
-          d1 = ( aero(b)%vlolim / api6 ) ** ( 1.0_wp / 3.0_wp ) + ( ib - 1)    &
-               * delta_d
+       delta_d = 0.1_wp * ( d2 - d1 )
+!
+!--    Iterate:
+       DO  iteration = 1, 10
+          d1 = ( aero(ib)%vlolim / api6 )**0.33333333_wp + ( ib - 1) * delta_d
           d2 = d1 + delta_d
-          dmidi = ( d1 + d2 ) / 2.0_wp
+          dmidi = 0.5_wp * ( d1 + d2 )
           deltadp = LOG10( d2 / d1 )
-          
+!
 !--       Size distribution
 !--       in_ntot = total number, total area, or total volume concentration
 !--       in_dpg = geometric-mean number, area, or volume diameter
 !--       n(k) = number, area, or volume concentration in a bin
-!--       n_lognorm and dpg converted to units of #/m3 and m
-          psd_sect(b) = psd_sect(b) + SUM( in_ntot * 1.0E+6_wp * deltadp /     &
-                     ( SQRT( 2.0_wp * pi ) * LOG10( in_sigma ) ) *             &
-                     EXP( -LOG10( dmidi / ( 1.0E-6_wp * in_dpg ) )**2.0_wp /   &
-                     ( 2.0_wp * LOG10( in_sigma ) ** 2.0_wp ) ) )
- 
+          psd_sect(ib) = psd_sect(ib) + SUM( in_ntot * deltadp / ( SQRT( 2.0_wp * pi ) *           &
+                        LOG10( in_sigma ) ) * EXP( -LOG10( dmidi / in_dpg )**2.0_wp /              &
+                        ( 2.0_wp * LOG10( in_sigma ) ** 2.0_wp ) ) )
+
        ENDDO
     ENDDO
-   
+
  END SUBROUTINE size_distribution
 
@@ -1895,70 +2031,219 @@
 !> Tomi Raatikainen, FMI, 29.2.2016
 !------------------------------------------------------------------------------!
- SUBROUTINE set_aero_mass( ispec, ppvf2a, ppvf2b, ppnf2a, ppndist, pcore, prho )
-    
+ SUBROUTINE set_aero_mass( ispec, pmf2a, pmf2b, pnf2a, pndist, pcore, prho )
+
     IMPLICIT NONE
 
+    INTEGER(iwp) ::  ee        !< index: end
+    INTEGER(iwp) ::  i         !< loop index
+    INTEGER(iwp) ::  ib        !< loop index
+    INTEGER(iwp) ::  ic        !< loop index
+    INTEGER(iwp) ::  j         !< loop index
+    INTEGER(iwp) ::  k         !< loop index
+    INTEGER(iwp) ::  prunmode  !< 1 = initialise
+    INTEGER(iwp) ::  ss        !< index: start
+
     INTEGER(iwp), INTENT(in) :: ispec  !< Aerosol species index
-    REAL(wp), INTENT(in) ::  pcore(nbins) !< Aerosol bin mid core volume    
-    REAL(wp), INTENT(in) ::  ppndist(0:nz+1,nbins) !< Aerosol size distribution
-    REAL(wp), INTENT(in) ::  ppnf2a(0:nz+1) !< Number fraction for 2a    
-    REAL(wp), INTENT(in) ::  ppvf2a(0:nz+1) !< Mass distributions for a 
-    REAL(wp), INTENT(in) ::  ppvf2b(0:nz+1) !< and b bins    
+
+    REAL(wp) ::  flag   !< flag to mask topography grid points
+
     REAL(wp), INTENT(in) ::  prho !< Aerosol density
-    INTEGER(iwp) ::  b  !< loop index 
-    INTEGER(iwp) ::  c  !< loop index        
-    INTEGER(iwp) ::  ee !< index: end 
-    INTEGER(iwp) ::  i  !< loop index 
-    INTEGER(iwp) ::  j  !< loop index 
-    INTEGER(iwp) ::  k  !< loop index
-    INTEGER(iwp) ::  prunmode  !< 1 = initialise
-    INTEGER(iwp) ::  ss !< index: start 
-    REAL(wp) ::  flag   !< flag to mask topography grid points
-    
+
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pcore !< Aerosol bin mid core volume
+    REAL(wp), DIMENSION(0:nz+1), INTENT(in)        ::  pnf2a !< Number fraction for 2a
+    REAL(wp), DIMENSION(0:nz+1), INTENT(in)        ::  pmf2a !< Mass distributions for a
+    REAL(wp), DIMENSION(0:nz+1), INTENT(in)        ::  pmf2b !< and b bins
+
+    REAL(wp), DIMENSION(0:nz+1,nbins_aerosol), INTENT(in) ::  pndist !< Aerosol size distribution
+
     prunmode = 1
-    
-    DO i = nxlg, nxrg 
+
+    DO i = nxlg, nxrg
        DO j = nysg, nyng
-          DO k = nzb, nzt+1  
+          DO k = nzb, nzt+1
 !
 !--          Predetermine flag to mask topography
              flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) 
-!             
+!
 !--          Regime 2a:
-             ss = ( ispec - 1 ) * nbins + in2a
-             ee = ( ispec - 1 ) * nbins + fn2a
-             b = in2a
-             DO c = ss, ee
-                aerosol_mass(c)%conc(k,j,i) = MAX( 0.0_wp, ppvf2a(k) ) *       &
-                               ppnf2a(k) * ppndist(k,b) * pcore(b) * prho * flag
+             ss = ( ispec - 1 ) * nbins_aerosol + start_subrange_2a
+             ee = ( ispec - 1 ) * nbins_aerosol + end_subrange_2a
+             ib = start_subrange_2a
+             DO ic = ss, ee
+                aerosol_mass(ic)%conc(k,j,i) = MAX( 0.0_wp, pmf2a(k) ) * pnf2a(k) * pndist(k,ib) * &
+                                              pcore(ib) * prho * flag
                 IF ( prunmode == 1 )  THEN
-                   aerosol_mass(c)%init = MAX( 0.0_wp, MAXVAL( ppvf2a(:) ) ) * &
-                                          MAXVAL( ppnf2a ) * pcore(b) * prho * &
-                                          MAXVAL( ppndist(:,b) ) 
+                   aerosol_mass(ic)%init(k) = MAX( 0.0_wp, pmf2a(k) ) * pnf2a(k) * pndist(k,ib) *  &
+                                              pcore(ib) * prho
                 ENDIF
-                b = b+1
+                ib = ib + 1
              ENDDO
+!
 !--          Regime 2b:
              IF ( .NOT. no_insoluble )  THEN
-                ss = ( ispec - 1 ) * nbins + in2b
-                ee = ( ispec - 1 ) * nbins + fn2b
-                b = in2a
-                DO c = ss, ee
-                   aerosol_mass(c)%conc(k,j,i) = MAX( 0.0_wp, ppvf2b(k) ) * (  &
-                                         1.0_wp - ppnf2a(k) ) * ppndist(k,b) * &
-                                         pcore(b) * prho * flag
+                ss = ( ispec - 1 ) * nbins_aerosol + start_subrange_2b
+                ee = ( ispec - 1 ) * nbins_aerosol + end_subrange_2b
+                ib = start_subrange_2a
+                DO ic = ss, ee
+                   aerosol_mass(ic)%conc(k,j,i) = MAX( 0.0_wp, pmf2b(k) ) * ( 1.0_wp - pnf2a(k) ) *&
+                                                  pndist(k,ib) * pcore(ib) * prho * flag
                    IF ( prunmode == 1 )  THEN
-                      aerosol_mass(c)%init = MAX( 0.0_wp, MAXVAL( ppvf2b(:) ) )&
-                                        * ( 1.0_wp - MAXVAL( ppnf2a ) ) *      &
-                                        MAXVAL( ppndist(:,b) ) * pcore(b) * prho
+                      aerosol_mass(ic)%init(k) = MAX( 0.0_wp, pmf2b(k) ) * ( 1.0_wp - pnf2a(k) ) * &
+                                                 pndist(k,ib) * pcore(ib) * prho 
                    ENDIF
-                   b = b+1
-                ENDDO
+                   ib = ib + 1
+                ENDDO  ! c
+
              ENDIF
-             prunmode = 3  ! Init only once
-          ENDDO
+          ENDDO   ! k
+
+          prunmode = 3  ! Init only once
+
+       ENDDO   ! j
+    ENDDO   ! i
+
+ END SUBROUTINE set_aero_mass
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Initialise the matching between surface types in LSM and deposition models.
+!> Do the matching based on Zhang et al. (2001). Atmos. Environ. 35, 549-560
+!> (here referred as Z01).
+!------------------------------------------------------------------------------!
+ SUBROUTINE init_deposition
+
+    USE surface_mod,                                                                               &
+        ONLY:  surf_lsm_h, surf_lsm_v
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  l  !< loop index for vertical surfaces
+
+    IF ( nldepo_surf  .AND.  land_surface )  THEN
+
+       ALLOCATE( lsm_to_depo_h%match(1:surf_lsm_h%ns) )
+       lsm_to_depo_h%match = 0
+       CALL match_lsm_zhang( surf_lsm_h, lsm_to_depo_h%match )
+
+       DO  l = 0, 3
+          ALLOCATE( lsm_to_depo_v(l)%match(1:surf_lsm_v(l)%ns) )
+          lsm_to_depo_v(l)%match = 0
+          CALL match_lsm_zhang( surf_lsm_v(l), lsm_to_depo_v(l)%match )
        ENDDO
+    ENDIF
+
+    IF ( nldepo_pcm )  THEN
+       SELECT CASE ( depo_pcm_type )
+          CASE ( 'evergreen_needleleaf' )
+             depo_pcm_type_num = 1
+          CASE ( 'evergreen_broadleaf' )
+             depo_pcm_type_num = 2
+          CASE ( 'deciduous_needleleaf' )
+             depo_pcm_type_num = 3
+          CASE ( 'deciduous_broadleaf' )
+             depo_pcm_type_num = 4
+          CASE DEFAULT
+             message_string = 'depo_pcm_type not set correctly.'
+             CALL message( 'salsa_mod: init_deposition', 'PA0613', 1, 2, 0, 6, 0 )
+       END SELECT
+    ENDIF
+
+ END SUBROUTINE init_deposition
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Match the surface types in PALM and Zhang et al. 2001 deposition module
+!------------------------------------------------------------------------------!
+ SUBROUTINE match_lsm_zhang( surf, match_array )
+
+    USE surface_mod,                                                           &
+        ONLY:  ind_pav_green, ind_veg_wall, ind_wat_win, surf_type
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  m                !< index for surface elements
+    INTEGER(iwp) ::  pav_type_palm    !< pavement type in PALM
+    INTEGER(iwp) ::  vege_type_palm   !< vegetation type in PALM
+    INTEGER(iwp) ::  water_type_palm  !< water type in PALM
+
+    INTEGER(iwp), DIMENSION(:), INTENT(inout) ::  match_array !< array matching
+                                                              !< the surface types
+    TYPE(surf_type), INTENT(in) :: surf  !< respective surface type
+
+    DO  m = 1, surf%ns
+
+       IF ( surf%frac(ind_veg_wall,m) > 0 )  THEN
+          vege_type_palm = surf%vegetation_type(m)
+          SELECT CASE ( vege_type_palm )
+             CASE ( 0 )
+                message_string = 'No vegetation type defined.'
+                CALL message( 'salsa_mod: init_depo_surfaces', 'PA0614', 1, 2, 0, 6, 0 )
+             CASE ( 1 )  ! bare soil
+                match_array(m) = 6  ! grass in Z01
+             CASE ( 2 )  ! crops, mixed farming
+                match_array(m) = 7  !  crops, mixed farming Z01
+             CASE ( 3 )  ! short grass
+                match_array(m) = 6  ! grass in Z01
+             CASE ( 4 )  ! evergreen needleleaf trees
+                 match_array(m) = 1  ! evergreen needleleaf trees in Z01
+             CASE ( 5 )  ! deciduous needleleaf trees
+                match_array(m) = 3  ! deciduous needleleaf trees in Z01
+             CASE ( 6 )  ! evergreen broadleaf trees
+                match_array(m) = 2  ! evergreen broadleaf trees in Z01
+             CASE ( 7 )  ! deciduous broadleaf trees
+                match_array(m) = 4  ! deciduous broadleaf trees in Z01
+             CASE ( 8 )  ! tall grass
+                match_array(m) = 6  ! grass in Z01
+             CASE ( 9 )  ! desert
+                match_array(m) = 8  ! desert in Z01
+             CASE ( 10 )  ! tundra
+                match_array(m) = 9  ! tundra in Z01
+             CASE ( 11 )  ! irrigated crops
+                match_array(m) = 7  !  crops, mixed farming Z01
+             CASE ( 12 )  ! semidesert
+                match_array(m) = 8  ! desert in Z01
+             CASE ( 13 )  ! ice caps and glaciers
+                match_array(m) = 12  ! ice cap and glacier in Z01
+             CASE ( 14 )  ! bogs and marshes
+                match_array(m) = 11  ! wetland with plants in Z01
+             CASE ( 15 )  ! evergreen shrubs
+                match_array(m) = 10  ! shrubs and interrupted woodlands in Z01
+             CASE ( 16 )  ! deciduous shrubs
+                match_array(m) = 10  ! shrubs and interrupted woodlands in Z01
+             CASE ( 17 )  ! mixed forest/woodland
+                match_array(m) = 5  ! mixed broadleaf and needleleaf trees in Z01
+             CASE ( 18 )  ! interrupted forest
+                match_array(m) = 10  ! shrubs and interrupted woodlands in Z01
+          END SELECT
+       ENDIF
+
+       IF ( surf%frac(ind_pav_green,m) > 0 )  THEN
+          pav_type_palm = surf%pavement_type(m)
+          IF ( pav_type_palm == 0 )  THEN  ! error
+             message_string = 'No pavement type defined.'
+             CALL message( 'salsa_mod: match_lsm_zhang', 'PA0615', 1, 2, 0, 6, 0 )
+          ELSEIF ( pav_type_palm > 0  .AND.  pav_type_palm <= 15 )  THEN
+             match_array(m) = 15  ! urban in Z01
+          ENDIF
+       ENDIF
+
+       IF ( surf%frac(ind_wat_win,m) > 0 )  THEN
+          water_type_palm = surf%water_type(m)
+          IF ( water_type_palm == 0 )  THEN  ! error
+             message_string = 'No water type defined.'
+             CALL message( 'salsa_mod: match_lsm_zhang', 'PA0616', 1, 2, 0, 6, 0 )
+          ELSEIF ( water_type_palm == 3 )  THEN
+             match_array(m) = 14  ! ocean in Z01
+          ELSEIF ( water_type_palm == 1  .OR.  water_type_palm == 2 .OR.  water_type_palm == 4     &
+                   .OR.  water_type_palm == 5  )  THEN
+             match_array(m) = 13  ! inland water in Z01
+          ENDIF
+       ENDIF
+
     ENDDO
- END SUBROUTINE set_aero_mass
+
+ END SUBROUTINE match_lsm_zhang
 
 !------------------------------------------------------------------------------!
@@ -1971,65 +2256,55 @@
     IMPLICIT NONE
 
+    INTEGER(iwp) ::  ib   !<
+    INTEGER(iwp) ::  ic   !<
+    INTEGER(iwp) ::  icc  !<
+    INTEGER(iwp) ::  ig   !<
+
     INTEGER(iwp), INTENT(IN) ::  mod_count  !<
-    INTEGER(iwp) ::  b  !<    
-    INTEGER(iwp) ::  c  !<    
-    INTEGER(iwp) ::  cc !<
-    INTEGER(iwp) ::  g  !<
-
-    IF ( simulated_time >= time_since_reference_point )  THEN
-
-    SELECT CASE ( mod_count )
-
-       CASE ( 0 )
-
-          DO  b = 1, nbins
-             aerosol_number(b)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   =>        &
-                nconc_1(:,:,:,b)
-             aerosol_number(b)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) =>        &
-                nconc_2(:,:,:,b)
-             DO  c = 1, ncc_tot
-                cc = ( c-1 ) * nbins + b  ! required due to possible Intel18 bug
-                aerosol_mass(cc)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   =>      &
-                   mconc_1(:,:,:,cc)
-                aerosol_mass(cc)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) =>      &
-                   mconc_2(:,:,:,cc)
+
+    IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
+
+       SELECT CASE ( mod_count )
+
+          CASE ( 0 )
+
+             DO  ib = 1, nbins_aerosol
+                aerosol_number(ib)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   => nconc_1(:,:,:,ib)
+                aerosol_number(ib)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => nconc_2(:,:,:,ib)
+
+                DO  ic = 1, ncomponents_mass
+                   icc = ( ic-1 ) * nbins_aerosol + ib
+                   aerosol_mass(icc)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   => mconc_1(:,:,:,icc)
+                   aerosol_mass(icc)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => mconc_2(:,:,:,icc)
+                ENDDO
              ENDDO
-          ENDDO
-          
-          IF ( .NOT. salsa_gases_from_chem )  THEN
-             DO  g = 1, ngast
-                salsa_gas(g)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   =>          &
-                   gconc_1(:,:,:,g)
-                salsa_gas(g)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) =>          &
-                   gconc_2(:,:,:,g)
+
+             IF ( .NOT. salsa_gases_from_chem )  THEN
+                DO  ig = 1, ngases_salsa
+                   salsa_gas(ig)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   => gconc_1(:,:,:,ig)
+                   salsa_gas(ig)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => gconc_2(:,:,:,ig)
+                ENDDO
+             ENDIF
+
+          CASE ( 1 )
+
+             DO  ib = 1, nbins_aerosol
+                aerosol_number(ib)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   => nconc_2(:,:,:,ib)
+                aerosol_number(ib)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => nconc_1(:,:,:,ib)
+                DO  ic = 1, ncomponents_mass
+                   icc = ( ic-1 ) * nbins_aerosol + ib
+                   aerosol_mass(icc)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   => mconc_2(:,:,:,icc)
+                   aerosol_mass(icc)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => mconc_1(:,:,:,icc)
+                ENDDO
              ENDDO
-          ENDIF
-
-       CASE ( 1 )
-
-          DO  b = 1, nbins
-             aerosol_number(b)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   =>        &
-                nconc_2(:,:,:,b)
-             aerosol_number(b)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) =>        &
-                nconc_1(:,:,:,b)
-             DO  c = 1, ncc_tot
-                cc = ( c-1 ) * nbins + b  ! required due to possible Intel18 bug
-                aerosol_mass(cc)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   =>      &
-                   mconc_2(:,:,:,cc)
-                aerosol_mass(cc)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) =>      &
-                   mconc_1(:,:,:,cc)
-             ENDDO
-          ENDDO
-          
-          IF ( .NOT. salsa_gases_from_chem )  THEN
-             DO  g = 1, ngast
-                salsa_gas(g)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   =>          &
-                   gconc_2(:,:,:,g)
-                salsa_gas(g)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) =>          &
-                   gconc_1(:,:,:,g)
-             ENDDO
-          ENDIF
-
-    END SELECT
+
+             IF ( .NOT. salsa_gases_from_chem )  THEN
+                DO  ig = 1, ngases_salsa
+                   salsa_gas(ig)%conc(nzb:nzt+1,nysg:nyng,nxlg:nxrg)   => gconc_2(:,:,:,ig)
+                   salsa_gas(ig)%conc_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg) => gconc_1(:,:,:,ig)
+                ENDDO
+             ENDIF
+
+       END SELECT
 
     ENDIF
@@ -2043,15 +2318,13 @@
 !> This routine reads the respective restart data.
 !------------------------------------------------------------------------------!
- SUBROUTINE salsa_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 )
-
-    
+ SUBROUTINE salsa_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 )
+
     IMPLICIT NONE
-    
-    INTEGER(iwp) ::  b  !<    
-    INTEGER(iwp) ::  c  !<
-    INTEGER(iwp) ::  g  !<
-    INTEGER(iwp) ::  k  !<
+
+    INTEGER(iwp) ::  ib              !<
+    INTEGER(iwp) ::  ic              !<
+    INTEGER(iwp) ::  ig              !<
+    INTEGER(iwp) ::  k               !<
     INTEGER(iwp) ::  nxlc            !<
     INTEGER(iwp) ::  nxlf            !<
@@ -2067,47 +2340,46 @@
     INTEGER(iwp) ::  nys_on_file     !<
 
-    LOGICAL, INTENT(OUT)  ::  found
+    LOGICAL, INTENT(OUT)  ::  found  !<
 
     REAL(wp), &
        DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
-       
+
     found = .FALSE.
-    
+
     IF ( read_restart_data_salsa )  THEN
-    
+
        SELECT CASE ( restart_string(1:length) )
-       
+
           CASE ( 'aerosol_number' )
-             DO  b = 1, nbins
+             DO  ib = 1, nbins_aerosol
                 IF ( k == 1 )  READ ( 13 ) tmp_3d
-                aerosol_number(b)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & 
-                               tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+                aerosol_number(ib)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =               &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
                 found = .TRUE.
              ENDDO
-       
+
           CASE ( 'aerosol_mass' )
-             DO  c = 1, ncc_tot * nbins
+             DO  ic = 1, ncomponents_mass * nbins_aerosol
                 IF ( k == 1 )  READ ( 13 ) tmp_3d
-                aerosol_mass(c)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & 
-                               tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+                aerosol_mass(ic)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                 &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
                 found = .TRUE.
              ENDDO
-          
+
           CASE ( 'salsa_gas' )
-             DO  g = 1, ngast
+             DO  ig = 1, ngases_salsa
                 IF ( k == 1 )  READ ( 13 ) tmp_3d
-                salsa_gas(g)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =  & 
-                               tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+                salsa_gas(ig)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                    &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
                 found = .TRUE.
              ENDDO
-             
+
           CASE DEFAULT
              found = .FALSE.
-             
+
        END SELECT
     ENDIF
 
  END SUBROUTINE salsa_rrd_local
-    
 
 !------------------------------------------------------------------------------!
@@ -2122,30 +2394,29 @@
 
     IMPLICIT NONE
-    
-    INTEGER(iwp) ::  b  !<    
-    INTEGER(iwp) ::  c  !<
-    INTEGER(iwp) ::  g  !<
-    
+
+    INTEGER(iwp) ::  ib   !<
+    INTEGER(iwp) ::  ic   !<
+    INTEGER(iwp) ::  ig  !<
+
     IF ( write_binary  .AND.  write_binary_salsa )  THEN
-    
+
        CALL wrd_write_string( 'aerosol_number' )
-       DO  b = 1, nbins
-          WRITE ( 14 )  aerosol_number(b)%conc
+       DO  ib = 1, nbins_aerosol
+          WRITE ( 14 )  aerosol_number(ib)%conc
        ENDDO
-       
+
        CALL wrd_write_string( 'aerosol_mass' )
-       DO  c = 1, nbins*ncc_tot
-          WRITE ( 14 )  aerosol_mass(c)%conc
+       DO  ic = 1, nbins_aerosol * ncomponents_mass
+          WRITE ( 14 )  aerosol_mass(ic)%conc
        ENDDO
-       
+
        CALL wrd_write_string( 'salsa_gas' )
-       DO  g = 1, ngast
-          WRITE ( 14 )  salsa_gas(g)%conc
+       DO  ig = 1, ngases_salsa
+          WRITE ( 14 )  salsa_gas(ig)%conc
        ENDDO
-          
+
     ENDIF
-       
- END SUBROUTINE salsa_wrd_local   
-
+
+ END SUBROUTINE salsa_wrd_local
 
 !------------------------------------------------------------------------------!
@@ -2165,68 +2436,61 @@
  SUBROUTINE salsa_driver( i, j, prunmode )
 
-    USE arrays_3d,                                                             &
-        ONLY: pt_p, q_p, rho_air_zw, u, v, w
-        
-    USE plant_canopy_model_mod,                                                &
+    USE arrays_3d,                                                                                 &
+        ONLY: pt_p, q_p, u, v, w
+
+    USE plant_canopy_model_mod,                                                                    &
         ONLY: lad_s
-        
-    USE surface_mod,                                                           &
-        ONLY:  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,     &
-               surf_usm_v
- 
+
+    USE surface_mod,                                                                               &
+        ONLY:  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h, surf_usm_v
+
     IMPLICIT NONE
-    
-    INTEGER(iwp), INTENT(in) ::  i   !< loop index
-    INTEGER(iwp), INTENT(in) ::  j   !< loop index
-    INTEGER(iwp), INTENT(in) ::  prunmode !< 1: Initialization call
-                                          !< 2: Spinup period call
-                                          !< 3: Regular runtime call
-!-- Local variables
-    TYPE(t_section), DIMENSION(fn2b) ::  aero_old !< helper array 
-    INTEGER(iwp) ::  bb     !< loop index
-    INTEGER(iwp) ::  cc     !< loop index
-    INTEGER(iwp) ::  endi   !< end index
-    INTEGER(iwp) ::  k_wall !< vertical index of topography top
-    INTEGER(iwp) ::  k      !< loop index
-    INTEGER(iwp) ::  l      !< loop index
-    INTEGER(iwp) ::  nc_h2o !< index of H2O in the prtcl index table 
-    INTEGER(iwp) ::  ss     !< loop index
-    INTEGER(iwp) ::  str    !< start index
-    INTEGER(iwp) ::  vc     !< default index in prtcl
-    REAL(wp) ::  cw_old     !< previous H2O mixing ratio 
-    REAL(wp) ::  flag       !< flag to mask topography grid points
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_adn !< air density (kg/m3)    
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_cs  !< H2O sat. vapour conc.
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_cw  !< H2O vapour concentration
-    REAL(wp) ::  in_lad                       !< leaf area density (m2/m3)
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_p   !< pressure (Pa)     
-    REAL(wp) ::  in_rh                        !< relative humidity                     
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_t   !< temperature (K)
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_u   !< wind magnitude (m/s) 
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  kvis   !< kinematic viscosity of air(m2/s)                                            
-    REAL(wp), DIMENSION(nzb:nzt+1,fn2b) ::  Sc      !< particle Schmidt number    
-    REAL(wp), DIMENSION(nzb:nzt+1,fn2b) ::  vd      !< particle fall seed (m/s,
-                                                    !< sedimentation velocity)
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  ppm_to_nconc !< Conversion factor 
-                                                    !< from ppm to #/m3                                                     
-    REAL(wp) ::  zgso4  !< SO4
-    REAL(wp) ::  zghno3 !< HNO3
-    REAL(wp) ::  zgnh3  !< NH3
-    REAL(wp) ::  zgocnv !< non-volatile OC
-    REAL(wp) ::  zgocsv !< semi-volatile OC 
-    
+
+    INTEGER(iwp) ::  endi    !< end index
+    INTEGER(iwp) ::  ib      !< loop index
+    INTEGER(iwp) ::  ic      !< loop index
+    INTEGER(iwp) ::  ig      !< loop index
+    INTEGER(iwp) ::  k_wall  !< vertical index of topography top
+    INTEGER(iwp) ::  k       !< loop index
+    INTEGER(iwp) ::  l       !< loop index
+    INTEGER(iwp) ::  nc_h2o  !< index of H2O in the prtcl index table
+    INTEGER(iwp) ::  ss      !< loop index
+    INTEGER(iwp) ::  str     !< start index
+    INTEGER(iwp) ::  vc      !< default index in prtcl
+
+    INTEGER(iwp), INTENT(in) ::  i         !< loop index
+    INTEGER(iwp), INTENT(in) ::  j         !< loop index
+    INTEGER(iwp), INTENT(in) ::  prunmode  !< 1: Initialization, 2: Spinup, 3: Regular runtime
+
+    REAL(wp) ::  cw_old  !< previous H2O mixing ratio
+    REAL(wp) ::  flag    !< flag to mask topography grid points
+    REAL(wp) ::  in_lad  !< leaf area density (m2/m3)
+    REAL(wp) ::  in_rh   !< relative humidity
+    REAL(wp) ::  zgso4   !< SO4
+    REAL(wp) ::  zghno3  !< HNO3
+    REAL(wp) ::  zgnh3   !< NH3
+    REAL(wp) ::  zgocnv  !< non-volatile OC
+    REAL(wp) ::  zgocsv  !< semi-volatile OC
+
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_adn  !< air density (kg/m3)
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_cs   !< H2O sat. vapour conc.
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_cw   !< H2O vapour concentration
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_p    !< pressure (Pa)
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_t    !< temperature (K)
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_u    !< wind magnitude (m/s)
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  kvis    !< kinematic viscosity of air(m2/s)
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  ppm_to_nconc  !< Conversion factor from ppm to #/m3
+
+    REAL(wp), DIMENSION(nzb:nzt+1,nbins_aerosol) ::  schmidt_num  !< particle Schmidt number
+    REAL(wp), DIMENSION(nzb:nzt+1,nbins_aerosol) ::  vd           !< particle fall seed (m/s)
+
+    TYPE(t_section), DIMENSION(nbins_aerosol) ::  aero_old !< helper array
+
     aero_old(:)%numc = 0.0_wp
-    in_adn           = 0.0_wp    
-    in_cs            = 0.0_wp
-    in_cw            = 0.0_wp 
     in_lad           = 0.0_wp
-    in_rh            = 0.0_wp
-    in_p             = 0.0_wp 
-    in_t             = 0.0_wp 
     in_u             = 0.0_wp
     kvis             = 0.0_wp
-    Sc               = 0.0_wp
+    schmidt_num      = 0.0_wp
     vd               = 0.0_wp
-    ppm_to_nconc     = 1.0_wp
     zgso4            = nclim
     zghno3           = nclim
@@ -2234,46 +2498,39 @@
     zgocnv           = nclim
     zgocsv           = nclim
-    
-!       
+!
 !-- Aerosol number is always set, but mass can be uninitialized
-    DO cc = 1, nbins
-       aero(cc)%volc     = 0.0_wp
-       aero_old(cc)%volc = 0.0_wp
-    ENDDO 
-!    
+    DO ib = 1, nbins_aerosol
+       aero(ib)%volc(:)     = 0.0_wp
+       aero_old(ib)%volc(:) = 0.0_wp
+    ENDDO
+!
 !-- Set the salsa runtime config (How to make this more efficient?)
     CALL set_salsa_runtime( prunmode )
-!             
+!
 !-- Calculate thermodynamic quantities needed in SALSA
-    CALL salsa_thrm_ij( i, j, p_ij=in_p, temp_ij=in_t, cw_ij=in_cw,            &
-                        cs_ij=in_cs, adn_ij=in_adn )
+    CALL salsa_thrm_ij( i, j, p_ij=in_p, temp_ij=in_t, cw_ij=in_cw, cs_ij=in_cs, adn_ij=in_adn )
 !
 !-- Magnitude of wind: needed for deposition
     IF ( lsdepo )  THEN
-       in_u(nzb+1:nzt) = SQRT(                                                 &
-                   ( 0.5_wp * ( u(nzb+1:nzt,j,i) + u(nzb+1:nzt,j,i+1) ) )**2 + &  
-                   ( 0.5_wp * ( v(nzb+1:nzt,j,i) + v(nzb+1:nzt,j+1,i) ) )**2 + &
-                   ( 0.5_wp * ( w(nzb:nzt-1,j,i) + w(nzb+1:nzt,j,  i) ) )**2 )
+       in_u(nzb+1:nzt) = SQRT( ( 0.5_wp * ( u(nzb+1:nzt,j,i) + u(nzb+1:nzt,j,i+1) ) )**2 +         &
+                               ( 0.5_wp * ( v(nzb+1:nzt,j,i) + v(nzb+1:nzt,j+1,i) ) )**2 +         &
+                               ( 0.5_wp * ( w(nzb:nzt-1,j,i) + w(nzb+1:nzt,j,  i) ) )**2 )
     ENDIF
 !
 !-- Calculate conversion factors for gas concentrations
-    ppm_to_nconc = for_ppm_to_nconc * in_p / in_t
+    ppm_to_nconc(:) = for_ppm_to_nconc * in_p(:) / in_t(:)
 !
 !-- Determine topography-top index on scalar grid
-    k_wall = MAXLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,j,i), 12 ) ),          &
-                     DIM = 1 ) - 1     
-               
+    k_wall = k_topo_top(j,i)
+
     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 ) )
-!       
-!--    Do not run inside buildings        
-       IF ( flag == 0.0_wp )  CYCLE   
-!
-!--    Wind velocity for dry depositon on vegetation   
-       IF ( lsdepo_vege  .AND.  plant_canopy  )  THEN
-          in_lad = lad_s(k-k_wall,j,i)
-       ENDIF       
+!
+!--    Wind velocity for dry depositon on vegetation
+       IF ( lsdepo_pcm  .AND.  plant_canopy )  THEN
+          in_lad = lad_s( MAX( k-k_wall,0 ),j,i)
+       ENDIF
 !
 !--    For initialization and spinup, limit the RH with the parameter rhlim
@@ -2284,128 +2541,127 @@
        ENDIF
        cw_old = in_cw(k) !* in_adn(k)
-!                
+!
 !--    Set volume concentrations:
 !--    Sulphate (SO4) or sulphuric acid H2SO4 
-       IF ( iso4 > 0 )  THEN
+       IF ( index_so4 > 0 )  THEN
           vc = 1
-          str = ( iso4-1 ) * nbins + 1    ! start index
-          endi = iso4 * nbins             ! end index
-          cc = 1
+          str = ( index_so4-1 ) * nbins_aerosol + 1    ! start index
+          endi = index_so4 * nbins_aerosol             ! end index
+          ic = 1
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2so4
-             cc = cc+1
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2so4
+             ic = ic+1
           ENDDO
-          aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
-       ENDIF
-       
+          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+       ENDIF
+!
 !--    Organic carbon (OC) compounds
-       IF ( ioc > 0 )  THEN
+       IF ( index_oc > 0 )  THEN
           vc = 2
-          str = ( ioc-1 ) * nbins + 1
-          endi = ioc * nbins
-          cc = 1
+          str = ( index_oc-1 ) * nbins_aerosol + 1
+          endi = index_oc * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhooc 
-             cc = cc+1
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhooc
+             ic = ic+1
           ENDDO
-          aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
-       ENDIF
-       
+          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+       ENDIF
+!
 !--    Black carbon (BC)
-       IF ( ibc > 0 )  THEN
+       IF ( index_bc > 0 )  THEN
           vc = 3
-          str = ( ibc-1 ) * nbins + 1 + fn1a
-          endi = ibc * nbins
-          cc = 1 + fn1a
+          str = ( index_bc-1 ) * nbins_aerosol + 1 + end_subrange_1a
+          endi = index_bc * nbins_aerosol
+          ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhobc 
-             cc = cc+1
-          ENDDO                   
-          aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
-       ENDIF
-
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhobc
+             ic = ic+1
+          ENDDO
+          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+       ENDIF
+!
 !--    Dust (DU)
-       IF ( idu > 0 )  THEN
+       IF ( index_du > 0 )  THEN
           vc = 4
-          str = ( idu-1 ) * nbins + 1 + fn1a
-          endi = idu * nbins
-          cc = 1 + fn1a
+          str = ( index_du-1 ) * nbins_aerosol + 1 + end_subrange_1a
+          endi = index_du * nbins_aerosol
+          ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhodu 
-             cc = cc+1
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhodu
+             ic = ic+1
           ENDDO
-          aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
-       ENDIF
-
+          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+       ENDIF
+!
 !--    Sea salt (SS)
-       IF ( iss > 0 )  THEN
+       IF ( index_ss > 0 )  THEN
           vc = 5
-          str = ( iss-1 ) * nbins + 1 + fn1a
-          endi = iss * nbins
-          cc = 1 + fn1a
+          str = ( index_ss-1 ) * nbins_aerosol + 1 + end_subrange_1a
+          endi = index_ss * nbins_aerosol
+          ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoss  
-             cc = cc+1
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoss
+             ic = ic+1
           ENDDO
-          aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
-       ENDIF
-
+          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+       ENDIF
+!
 !--    Nitrate (NO(3-)) or nitric acid HNO3
-       IF ( ino > 0 )  THEN
+       IF ( index_no > 0 )  THEN
           vc = 6
-          str = ( ino-1 ) * nbins + 1 
-          endi = ino * nbins
-          cc = 1
+          str = ( index_no-1 ) * nbins_aerosol + 1 
+          endi = index_no * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhohno3 
-             cc = cc+1
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhohno3
+             ic = ic+1
           ENDDO
-          aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
-       ENDIF
-
+          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+       ENDIF
+!
 !--    Ammonium (NH(4+)) or ammonia NH3
-       IF ( inh > 0 )  THEN
+       IF ( index_nh > 0 )  THEN
           vc = 7
-          str = ( inh-1 ) * nbins + 1
-          endi = inh * nbins
-          cc = 1
+          str = ( index_nh-1 ) * nbins_aerosol + 1
+          endi = index_nh * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhonh3  
-             cc = cc+1
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhonh3
+             ic = ic+1
           ENDDO
-          aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
-       ENDIF
-
+          aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
+       ENDIF
+!
 !--    Water (always used)
        nc_h2o = get_index( prtcl,'H2O' )
        vc = 8
-       str = ( nc_h2o-1 ) * nbins + 1
-       endi = nc_h2o * nbins
-       cc = 1
+       str = ( nc_h2o-1 ) * nbins_aerosol + 1
+       endi = nc_h2o * nbins_aerosol
+       ic = 1
        IF ( advect_particle_water )  THEN
           DO ss = str, endi
-             aero(cc)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2o 
-             cc = cc+1
+             aero(ic)%volc(vc) = aerosol_mass(ss)%conc(k,j,i) / arhoh2o
+             ic = ic+1
           ENDDO
        ELSE
-         aero(1:nbins)%volc(vc) = mclim 
-       ENDIF
-       aero_old(1:nbins)%volc(vc) = aero(1:nbins)%volc(vc)
+         aero(1:nbins_aerosol)%volc(vc) = mclim 
+       ENDIF
+       aero_old(1:nbins_aerosol)%volc(vc) = aero(1:nbins_aerosol)%volc(vc)
 !
 !--    Number concentrations (numc) and particle sizes 
 !--    (dwet = wet diameter, core = dry volume)
-       DO  bb = 1, nbins
-          aero(bb)%numc = aerosol_number(bb)%conc(k,j,i)  
-          aero_old(bb)%numc = aero(bb)%numc
-          IF ( aero(bb)%numc > nclim )  THEN
-             aero(bb)%dwet = ( SUM( aero(bb)%volc(:) ) / aero(bb)%numc / api6 )&
-                                **( 1.0_wp / 3.0_wp )
-             aero(bb)%core = SUM( aero(bb)%volc(1:7) ) / aero(bb)%numc 
+       DO  ib = 1, nbins_aerosol
+          aero(ib)%numc = aerosol_number(ib)%conc(k,j,i)
+          aero_old(ib)%numc = aero(ib)%numc
+          IF ( aero(ib)%numc > nclim )  THEN
+             aero(ib)%dwet = ( SUM( aero(ib)%volc(:) ) / aero(ib)%numc / api6 )**0.33333333_wp
+             aero(ib)%core = SUM( aero(ib)%volc(1:7) ) / aero(ib)%numc
           ELSE
-             aero(bb)%dwet = aero(bb)%dmid
-             aero(bb)%core = api6 * ( aero(bb)%dwet ) ** 3.0_wp
+             aero(ib)%dwet = aero(ib)%dmid
+             aero(ib)%core = api6 * ( aero(ib)%dwet )**3
           ENDIF
        ENDDO
-!       
+!
 !--    On EACH call of salsa_driver, calculate the ambient sizes of 
 !--    particles by equilibrating soluble fraction of particles with water
@@ -2417,202 +2673,213 @@
 !
 !--    Gaseous tracer concentrations in #/m3
-       IF ( salsa_gases_from_chem )  THEN       
-!       
+       IF ( salsa_gases_from_chem )  THEN
+!
 !--       Convert concentrations in ppm to #/m3
           zgso4  = chem_species(gas_index_chem(1))%conc(k,j,i) * ppm_to_nconc(k)
           zghno3 = chem_species(gas_index_chem(2))%conc(k,j,i) * ppm_to_nconc(k)
           zgnh3  = chem_species(gas_index_chem(3))%conc(k,j,i) * ppm_to_nconc(k)
-          zgocnv = chem_species(gas_index_chem(4))%conc(k,j,i) * ppm_to_nconc(k)     
-          zgocsv = chem_species(gas_index_chem(5))%conc(k,j,i) * ppm_to_nconc(k)                 
+          zgocnv = chem_species(gas_index_chem(4))%conc(k,j,i) * ppm_to_nconc(k)
+          zgocsv = chem_species(gas_index_chem(5))%conc(k,j,i) * ppm_to_nconc(k)
        ELSE
-          zgso4  = salsa_gas(1)%conc(k,j,i) 
-          zghno3 = salsa_gas(2)%conc(k,j,i) 
-          zgnh3  = salsa_gas(3)%conc(k,j,i) 
-          zgocnv = salsa_gas(4)%conc(k,j,i) 
+          zgso4  = salsa_gas(1)%conc(k,j,i)
+          zghno3 = salsa_gas(2)%conc(k,j,i)
+          zgnh3  = salsa_gas(3)%conc(k,j,i)
+          zgocnv = salsa_gas(4)%conc(k,j,i)
           zgocsv = salsa_gas(5)%conc(k,j,i)
-       ENDIF    
-!
-!--    ***************************************!
-!--                   Run SALSA               !
-!--    ***************************************!
-       CALL run_salsa( in_p(k), in_cw(k), in_cs(k), in_t(k), in_u(k),          &
-                       in_adn(k), in_lad, zgso4, zgocnv, zgocsv, zghno3, zgnh3,&
-                       aero, prtcl, kvis(k), Sc(k,:), vd(k,:), dt_salsa )
-!--    ***************************************!
+       ENDIF
+!
+!--    Calculate aerosol processes:
+!--    *********************************************************************************************
+!
+!--    Coagulation
+       IF ( lscoag )   THEN
+          CALL coagulation( aero, dt_salsa, in_t(k), in_p(k) )
+       ENDIF
+!
+!--    Condensation
+       IF ( lscnd )   THEN
+          CALL condensation( aero, zgso4, zgocnv, zgocsv,  zghno3, zgnh3, in_cw(k), in_cs(k),      &
+                             in_t(k), in_p(k), dt_salsa, prtcl )
+       ENDIF
+!
+!--    Deposition
+       IF ( lsdepo )  THEN
+          CALL deposition( aero, in_t(k), in_adn(k), in_u(k), in_lad, kvis(k), schmidt_num(k,:),   &
+                           vd(k,:) )
+       ENDIF
+!
+!--    Size distribution bin update
+       IF ( lsdistupdate )   THEN
+          CALL distr_update( aero )
+       ENDIF
+!--    *********************************************************************************************
+
        IF ( lsdepo ) sedim_vd(k,j,i,:) = vd(k,:)
-!                            
+!
 !--    Calculate changes in concentrations
-       DO bb = 1, nbins
-          aerosol_number(bb)%conc(k,j,i) = aerosol_number(bb)%conc(k,j,i)      &
-                                 +  ( aero(bb)%numc - aero_old(bb)%numc ) * flag
+       DO ib = 1, nbins_aerosol
+          aerosol_number(ib)%conc(k,j,i) = aerosol_number(ib)%conc(k,j,i) + ( aero(ib)%numc -      &
+                                           aero_old(ib)%numc ) * flag
        ENDDO
-       
-       IF ( iso4 > 0 )  THEN
+
+       IF ( index_so4 > 0 )  THEN
           vc = 1
-          str = ( iso4-1 ) * nbins + 1
-          endi = iso4 * nbins
-          cc = 1
+          str = ( index_so4-1 ) * nbins_aerosol + 1
+          endi = index_so4 * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhoh2so4 * flag
-             cc = cc+1
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhoh2so4 * flag
+             ic = ic+1
           ENDDO
        ENDIF
-       
-       IF ( ioc > 0 )  THEN
+
+       IF ( index_oc > 0 )  THEN
           vc = 2
-          str = ( ioc-1 ) * nbins + 1
-          endi = ioc * nbins
-          cc = 1
+          str = ( index_oc-1 ) * nbins_aerosol + 1
+          endi = index_oc * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhooc * flag
-             cc = cc+1
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhooc * flag
+             ic = ic+1
           ENDDO
        ENDIF
-       
-       IF ( ibc > 0 )  THEN
+
+       IF ( index_bc > 0 )  THEN
           vc = 3
-          str = ( ibc-1 ) * nbins + 1 + fn1a
-          endi = ibc * nbins
-          cc = 1 + fn1a
+          str = ( index_bc-1 ) * nbins_aerosol + 1 + end_subrange_1a
+          endi = index_bc * nbins_aerosol
+          ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhobc * flag 
-             cc = cc+1
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhobc * flag
+             ic = ic+1
           ENDDO
        ENDIF
-       
-       IF ( idu > 0 )  THEN
+
+       IF ( index_du > 0 )  THEN
           vc = 4
-          str = ( idu-1 ) * nbins + 1 + fn1a
-          endi = idu * nbins
-          cc = 1 + fn1a
+          str = ( index_du-1 ) * nbins_aerosol + 1 + end_subrange_1a
+          endi = index_du * nbins_aerosol
+          ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhodu * flag
-             cc = cc+1
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhodu * flag
+             ic = ic+1
           ENDDO
        ENDIF
-       
-       IF ( iss > 0 )  THEN
+
+       IF ( index_ss > 0 )  THEN
           vc = 5
-          str = ( iss-1 ) * nbins + 1 + fn1a
-          endi = iss * nbins
-          cc = 1 + fn1a
+          str = ( index_ss-1 ) * nbins_aerosol + 1 + end_subrange_1a
+          endi = index_ss * nbins_aerosol
+          ic = 1 + end_subrange_1a
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhoss * flag
-             cc = cc+1
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhoss * flag
+             ic = ic+1
           ENDDO
        ENDIF
-       
-       IF ( ino > 0 )  THEN
+
+       IF ( index_no > 0 )  THEN
           vc = 6
-          str = ( ino-1 ) * nbins + 1
-          endi = ino * nbins
-          cc = 1
+          str = ( index_no-1 ) * nbins_aerosol + 1
+          endi = index_no * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhohno3 * flag
-             cc = cc+1
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhohno3 * flag
+             ic = ic+1
           ENDDO
        ENDIF
-       
-       IF ( inh > 0 )  THEN
+
+       IF ( index_nh > 0 )  THEN
           vc = 7
-          str = ( ino-1 ) * nbins + 1
-          endi = ino * nbins
-          cc = 1
+          str = ( index_nh-1 ) * nbins_aerosol + 1
+          endi = index_nh * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhonh3 * flag
-             cc = cc+1
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhonh3 * flag
+             ic = ic+1
           ENDDO
        ENDIF
-       
+
        IF ( advect_particle_water )  THEN
           nc_h2o = get_index( prtcl,'H2O' )
           vc = 8
-          str = ( nc_h2o-1 ) * nbins + 1
-          endi = nc_h2o * nbins
-          cc = 1
+          str = ( nc_h2o-1 ) * nbins_aerosol + 1
+          endi = nc_h2o * nbins_aerosol
+          ic = 1
           DO ss = str, endi
-             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i)       &
-                               + ( aero(cc)%volc(vc) - aero_old(cc)%volc(vc) ) &
-                               * arhoh2o * flag
+             aerosol_mass(ss)%conc(k,j,i) = aerosol_mass(ss)%conc(k,j,i) + ( aero(ic)%volc(vc) -   &
+                                            aero_old(ic)%volc(vc) ) * arhoh2o * flag
              IF ( prunmode == 1 )  THEN
-                aerosol_mass(ss)%init(k) = MAX( aerosol_mass(ss)%init(k),      &
-                                               aerosol_mass(ss)%conc(k,j,i) )
+                aerosol_mass(ss)%init(k) = MAX( aerosol_mass(ss)%init(k),                          &
+                                                aerosol_mass(ss)%conc(k,j,i) )
+                IF ( k == nzb+1 )  THEN
+                   aerosol_mass(ss)%init(k-1) = 0.0_wp
+                ELSEIF ( k == nzt  )  THEN
+                   aerosol_mass(ss)%init(k+1) = aerosol_mass(ss)%init(k)
+                ENDIF
              ENDIF
-             cc = cc+1                              
+             ic = ic+1
           ENDDO
        ENDIF
-
+!
 !--    Condensation of precursor gases
        IF ( lscndgas )  THEN
-          IF ( salsa_gases_from_chem )  THEN          
-!          
+          IF ( salsa_gases_from_chem )  THEN
+!
 !--          SO4 (or H2SO4)
-             chem_species( gas_index_chem(1) )%conc(k,j,i) =                &
-                            chem_species( gas_index_chem(1) )%conc(k,j,i) + &
-                                                  ( zgso4 / ppm_to_nconc(k) - &
-                       chem_species( gas_index_chem(1) )%conc(k,j,i) ) * flag
-!                            
+             ig = gas_index_chem(1)
+             chem_species(ig)%conc(k,j,i) = chem_species(ig)%conc(k,j,i) + ( zgso4 /               &
+                                            ppm_to_nconc(k) - chem_species(ig)%conc(k,j,i) ) * flag
+!
 !--          HNO3
-             chem_species( gas_index_chem(2) )%conc(k,j,i) =                &
-                            chem_species( gas_index_chem(2) )%conc(k,j,i) + &
-                                                 ( zghno3 / ppm_to_nconc(k) - &
-                       chem_species( gas_index_chem(2) )%conc(k,j,i) ) * flag
-!                           
+             ig = gas_index_chem(2)
+             chem_species(ig)%conc(k,j,i) = chem_species(ig)%conc(k,j,i) + ( zghno3 /              &
+                                            ppm_to_nconc(k) - chem_species(ig)%conc(k,j,i) ) * flag
+!
 !--          NH3
-             chem_species( gas_index_chem(3) )%conc(k,j,i) =                &
-                            chem_species( gas_index_chem(3) )%conc(k,j,i) + &
-                                                  ( zgnh3 / ppm_to_nconc(k) - &
-                       chem_species( gas_index_chem(3) )%conc(k,j,i) ) * flag
-!                            
+             ig = gas_index_chem(3)
+             chem_species(ig)%conc(k,j,i) = chem_species(ig)%conc(k,j,i) + ( zgnh3 /               &
+                                            ppm_to_nconc(k) - chem_species(ig)%conc(k,j,i) ) * flag
+!
 !--          non-volatile OC
-             chem_species( gas_index_chem(4) )%conc(k,j,i) =                &
-                            chem_species( gas_index_chem(4) )%conc(k,j,i) + &
-                                                 ( zgocnv / ppm_to_nconc(k) - &
-                       chem_species( gas_index_chem(4) )%conc(k,j,i) ) * flag
-!                           
+             ig = gas_index_chem(4)
+             chem_species(ig)%conc(k,j,i) = chem_species(ig)%conc(k,j,i) + ( zgocnv /              &
+                                            ppm_to_nconc(k) - chem_species(ig)%conc(k,j,i) ) * flag
+!
 !--          semi-volatile OC
-             chem_species( gas_index_chem(5) )%conc(k,j,i) =                &
-                            chem_species( gas_index_chem(5) )%conc(k,j,i) + &
-                                                 ( zgocsv / ppm_to_nconc(k) - &
-                       chem_species( gas_index_chem(5) )%conc(k,j,i) ) * flag                 
-          
+             ig = gas_index_chem(5)
+             chem_species(ig)%conc(k,j,i) = chem_species(ig)%conc(k,j,i) + ( zgocsv /              &
+                                            ppm_to_nconc(k) - chem_species(ig)%conc(k,j,i) ) * flag
+
           ELSE
-!          
+!
 !--          SO4 (or H2SO4)
-             salsa_gas(1)%conc(k,j,i) = salsa_gas(1)%conc(k,j,i) + ( zgso4 -   &
-                                          salsa_gas(1)%conc(k,j,i) ) * flag
-!                            
+             salsa_gas(1)%conc(k,j,i) = salsa_gas(1)%conc(k,j,i) + ( zgso4 -                       &
+                                        salsa_gas(1)%conc(k,j,i) ) * flag
+!
 !--          HNO3
-             salsa_gas(2)%conc(k,j,i) = salsa_gas(2)%conc(k,j,i) + ( zghno3 -  &
-                                          salsa_gas(2)%conc(k,j,i) ) * flag
-!                           
+             salsa_gas(2)%conc(k,j,i) = salsa_gas(2)%conc(k,j,i) + ( zghno3 -                      &
+                                        salsa_gas(2)%conc(k,j,i) ) * flag
+!
 !--          NH3
-             salsa_gas(3)%conc(k,j,i) = salsa_gas(3)%conc(k,j,i) + ( zgnh3 -   &
-                                          salsa_gas(3)%conc(k,j,i) ) * flag
-!                            
+             salsa_gas(3)%conc(k,j,i) = salsa_gas(3)%conc(k,j,i) + ( zgnh3 -                       &
+                                        salsa_gas(3)%conc(k,j,i) ) * flag
+!
 !--          non-volatile OC
-             salsa_gas(4)%conc(k,j,i) = salsa_gas(4)%conc(k,j,i) + ( zgocnv -  &
-                                          salsa_gas(4)%conc(k,j,i) ) * flag
-!                           
+             salsa_gas(4)%conc(k,j,i) = salsa_gas(4)%conc(k,j,i) + ( zgocnv -                      &
+                                        salsa_gas(4)%conc(k,j,i) ) * flag
+!
 !--          semi-volatile OC
-             salsa_gas(5)%conc(k,j,i) = salsa_gas(5)%conc(k,j,i) + ( zgocsv -  &
-                                          salsa_gas(5)%conc(k,j,i) ) * flag
+             salsa_gas(5)%conc(k,j,i) = salsa_gas(5)%conc(k,j,i) + ( zgocsv -                      &
+                                        salsa_gas(5)%conc(k,j,i) ) * flag
           ENDIF
        ENDIF
-!                
+!
 !--    Tendency of water vapour mixing ratio is obtained from the 
 !--    change in RH during SALSA run. This releases heat and changes pt.
@@ -2621,101 +2888,33 @@
 !
        IF ( feedback_to_palm )  THEN
-          q_p(k,j,i) = q_p(k,j,i) + 1.0_wp / ( in_cw(k) * in_adn(k) + 1.0_wp ) &
-                       ** 2.0_wp * ( in_cw(k) - cw_old ) * in_adn(k) 
-          pt_p(k,j,i) = pt_p(k,j,i) + alv / c_p * ( in_cw(k) - cw_old ) *      &
-                        in_adn(k) / ( in_cw(k) / in_adn(k) + 1.0_wp ) ** 2.0_wp&
-                        * pt_p(k,j,i) / in_t(k)
-       ENDIF
-                         
+          q_p(k,j,i) = q_p(k,j,i) + 1.0_wp / ( in_cw(k) * in_adn(k) + 1.0_wp )**2 *                &
+                       ( in_cw(k) - cw_old ) * in_adn(k) * flag
+          pt_p(k,j,i) = pt_p(k,j,i) + alv / c_p * ( in_cw(k) - cw_old ) * in_adn(k) / ( in_cw(k) / &
+                        in_adn(k) + 1.0_wp )**2 * pt_p(k,j,i) / in_t(k) * flag
+       ENDIF
+
     ENDDO   ! k
-!    
-!-- Set surfaces and wall fluxes due to deposition  
-    IF ( lsdepo_topo  .AND.  prunmode == 3 )  THEN 
+!
+!-- Set surfaces and wall fluxes due to deposition
+    IF ( lsdepo  .AND.  lsdepo_surf  .AND.  prunmode == 3 )  THEN 
        IF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
-          CALL depo_topo( i, j, surf_def_h(0), vd, Sc, kvis, in_u, rho_air_zw )
+          CALL depo_surf( i, j, surf_def_h(0), vd, schmidt_num, kvis, in_u, .TRUE. )
           DO  l = 0, 3
-             CALL depo_topo( i, j, surf_def_v(l), vd, Sc, kvis, in_u,          &
-                             rho_air_zw**0.0_wp )
+             CALL depo_surf( i, j, surf_def_v(l), vd, schmidt_num, kvis, in_u, .FALSE., l )
           ENDDO
        ELSE
-          CALL depo_topo( i, j, surf_usm_h, vd, Sc, kvis, in_u, rho_air_zw )
+          CALL depo_surf( i, j, surf_usm_h, vd, schmidt_num, kvis, in_u, .TRUE. )
           DO  l = 0, 3
-             CALL depo_topo( i, j, surf_usm_v(l), vd, Sc, kvis, in_u,          &
-                             rho_air_zw**0.0_wp )
+             CALL depo_surf( i, j, surf_usm_v(l), vd, schmidt_num, kvis, in_u, .FALSE., l )
           ENDDO
-          CALL depo_topo( i, j, surf_lsm_h, vd, Sc, kvis, in_u, rho_air_zw )
+          CALL depo_surf( i, j, surf_lsm_h, vd, schmidt_num, kvis, in_u, .TRUE. )
           DO  l = 0, 3
-             CALL depo_topo( i, j, surf_lsm_v(l), vd, Sc, kvis, in_u,          &
-                             rho_air_zw**0.0_wp )
+             CALL depo_surf( i, j, surf_lsm_v(l), vd, schmidt_num, kvis, in_u, .FALSE., l )
           ENDDO
        ENDIF
     ENDIF
-    
+
  END SUBROUTINE salsa_driver
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> The SALSA subroutine
-!> Modified for the new aerosol datatype,
-!> Juha Tonttila, FMI, 2014.
-!> Only aerosol processes included, Mona Kurppa, UHel, 2017
-!------------------------------------------------------------------------------!    
- SUBROUTINE run_salsa( ppres, pcw, pcs, ptemp, mag_u, adn, lad, pc_h2so4,      &
-                       pc_ocnv, pc_ocsv, pc_hno3, pc_nh3, paero, prtcl, kvis,  &
-                       Sc, vc, ptstep )
-
-    IMPLICIT NONE
-!
-!-- Input parameters and variables 
-    REAL(wp), INTENT(in) ::  adn    !< air density (kg/m3)
-    REAL(wp), INTENT(in) ::  lad    !< leaf area density (m2/m3)
-    REAL(wp), INTENT(in) ::  mag_u  !< magnitude of wind (m/s)
-    REAL(wp), INTENT(in) ::  ppres  !< atmospheric pressure at each grid 
-                                    !< point (Pa)
-    REAL(wp), INTENT(in) ::  ptemp  !< temperature at each grid point (K)
-    REAL(wp), INTENT(in) ::  ptstep !< time step of salsa processes (s)
-    TYPE(component_index), INTENT(in) :: prtcl  !< part. component index table
-!       
-!-- Input variables that are changed within:
-    REAL(wp), INTENT(inout) ::  kvis     !< kinematic viscosity of air (m2/s)
-    REAL(wp), INTENT(inout) ::  Sc(:)    !< particle Schmidt number
-    REAL(wp), INTENT(inout) ::  vc(:)    !< particle fall speed (m/s, 
-                                         !< sedimentation velocity)
-!-- Gas phase concentrations at each grid point (#/m3)
-    REAL(wp), INTENT(inout) ::  pc_h2so4 !< sulphuric acid
-    REAL(wp), INTENT(inout) ::  pc_hno3  !< nitric acid
-    REAL(wp), INTENT(inout) ::  pc_nh3   !< ammonia
-    REAL(wp), INTENT(inout) ::  pc_ocnv  !< nonvolatile OC
-    REAL(wp), INTENT(inout) ::  pc_ocsv  !< semivolatile OC
-    REAL(wp), INTENT(inout) ::  pcs      !< Saturation concentration of water
-                                         !< vapour (kg/m3)
-    REAL(wp), INTENT(inout) ::  pcw      !< Water vapour concentration (kg/m3)                                                   
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b) 
-!
-!-- Coagulation
-    IF ( lscoag )   THEN
-       CALL coagulation( paero, ptstep, ptemp, ppres )
-    ENDIF
-!
-!-- Condensation
-    IF ( lscnd )   THEN
-       CALL condensation( paero, pc_h2so4, pc_ocnv, pc_ocsv,  pc_hno3, pc_nh3, &
-                          pcw, pcs, ptemp, ppres, ptstep, prtcl )
-    ENDIF   
-!    
-!-- Deposition
-    IF ( lsdepo )  THEN
-       CALL deposition( paero, ptemp, adn, mag_u, lad, kvis, Sc, vc ) 
-    ENDIF        
-!
-!-- Size distribution bin update
-!-- Mona: why done 3 times in SALSA-standalone?
-    IF ( lsdistupdate )   THEN
-       CALL distr_update( paero )
-    ENDIF
-    
-  END SUBROUTINE run_salsa 
- 
 !------------------------------------------------------------------------------!
 ! Description:
@@ -2727,9 +2926,9 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE set_salsa_runtime( prunmode )
- 
+
     IMPLICIT NONE
-    
+
     INTEGER(iwp), INTENT(in) ::  prunmode
-    
+
     SELECT CASE(prunmode)
 
@@ -2740,7 +2939,8 @@
           lscndh2oae   = .FALSE.
           lsdepo       = .FALSE.
-          lsdepo_vege  = .FALSE.
-          lsdepo_topo  = .FALSE.
+          lsdepo_pcm   = .FALSE.
+          lsdepo_surf  = .FALSE.
           lsdistupdate = .TRUE.
+          lspartition  = .FALSE.
 
        CASE(2)  !< Spinup period
@@ -2756,12 +2956,11 @@
           lscndh2oae   = nlcndh2oae
           lsdepo       = nldepo
-          lsdepo_vege  = nldepo_vege
-          lsdepo_topo  = nldepo_topo
+          lsdepo_pcm   = nldepo_pcm
+          lsdepo_surf  = nldepo_surf
           lsdistupdate = nldistupdate
-
     END SELECT
 
 
- END SUBROUTINE set_salsa_runtime 
+ END SUBROUTINE set_salsa_runtime
  
 !------------------------------------------------------------------------------!
@@ -2770,5 +2969,5 @@
 !> Calculates the absolute temperature (using hydrostatic pressure), saturation 
 !> vapour pressure and mixing ratio over water, relative humidity and air 
-!> density needed in the SALSA model. 
+!> density needed in the SALSA model.
 !> NOTE, no saturation adjustment takes place -> the resulting water vapour 
 !> mixing ratio can be supersaturated, allowing the microphysical calculations
@@ -2779,34 +2978,36 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE salsa_thrm_ij( i, j, p_ij, temp_ij, cw_ij, cs_ij, adn_ij )
- 
-    USE arrays_3d,                                                             &
-        ONLY: p, pt, q, zu
-       
-    USE basic_constants_and_equations_mod,                                     &
+
+    USE arrays_3d,                                                                                 &
+        ONLY: pt, q, zu
+
+    USE basic_constants_and_equations_mod,                                                         &
         ONLY:  barometric_formula, exner_function, ideal_gas_law_rho, magnus
-       
-    USE control_parameters,                                                    &
+
+    USE control_parameters,                                                                        &
         ONLY: pt_surface, surface_pressure
-       
+
     IMPLICIT NONE
-   
-    INTEGER(iwp), INTENT(in) ::  i
-    INTEGER(iwp), INTENT(in) ::  j
-    REAL(wp), DIMENSION(:), INTENT(inout) ::  adn_ij
-    REAL(wp), DIMENSION(:), INTENT(inout) ::  p_ij       
-    REAL(wp), DIMENSION(:), INTENT(inout) ::  temp_ij
-    REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL ::  cw_ij
-    REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL ::  cs_ij
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  e_s !< saturation vapour pressure
-                                           !< over water (Pa)
-    REAL(wp) ::  t_surface !< absolute surface temperature (K)
-!
-!-- Pressure p_ijk (Pa) = hydrostatic pressure + perturbation pressure (p)
+
+    INTEGER(iwp), INTENT(in) ::  i  !<
+    INTEGER(iwp), INTENT(in) ::  j  !<
+
+    REAL(wp) ::  t_surface  !< absolute surface temperature (K)
+
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  e_s  !< saturation vapour pressure over water (Pa)
+
+    REAL(wp), DIMENSION(:), INTENT(inout) ::  adn_ij   !< air density (kg/m3)
+    REAL(wp), DIMENSION(:), INTENT(inout) ::  p_ij     !< air pressure (Pa)
+    REAL(wp), DIMENSION(:), INTENT(inout) ::  temp_ij  !< air temperature (K)
+
+    REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL ::  cw_ij  !< water vapour concentration (kg/m3)
+    REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL ::  cs_ij  !< saturation water vap. conc.(kg/m3)
+!
+!-- Pressure p_ijk (Pa) = hydrostatic pressure
     t_surface = pt_surface * exner_function( surface_pressure * 100.0_wp )
-    p_ij(:) = barometric_formula( zu, t_surface, surface_pressure * 100.0_wp ) &
-              + p(:,j,i)
-!             
+    p_ij(:) = barometric_formula( zu, t_surface, surface_pressure * 100.0_wp )
+!
 !-- Absolute ambient temperature (K)
-    temp_ij(:) = pt(:,j,i) * exner_function( p_ij(:) )       
+    temp_ij(:) = pt(:,j,i) * exner_function( p_ij(:) )
 !
 !-- Air density
@@ -2815,5 +3016,5 @@
 !-- Water vapour concentration r_v (kg/m3)
     IF ( PRESENT( cw_ij ) )  THEN
-       cw_ij(:) = ( q(:,j,i) / ( 1.0_wp - q(:,j,i) ) ) * adn_ij(:) 
+       cw_ij(:) = ( q(:,j,i) / ( 1.0_wp - q(:,j,i) ) ) * adn_ij(:)
     ENDIF
 !
@@ -2822,8 +3023,8 @@
        e_s(:) = 611.0_wp * EXP( alv_d_rv * ( 3.6609E-3_wp - 1.0_wp /           &
                 temp_ij(:) ) )! magnus( temp_ij(:) )
-       cs_ij(:) = ( 0.622_wp * e_s / ( p_ij(:) - e_s(:) ) ) * adn_ij(:) 
+       cs_ij(:) = ( 0.622_wp * e_s / ( p_ij(:) - e_s(:) ) ) * adn_ij(:)
     ENDIF
 
- END SUBROUTINE salsa_thrm_ij 
+ END SUBROUTINE salsa_thrm_ij
 
 !------------------------------------------------------------------------------!
@@ -2862,133 +3063,117 @@
 !> fxm: crashes if no sulphate or sea salt
 !> fxm: do we really need to consider Kelvin effect for subrange 2
-!------------------------------------------------------------------------------!      
+!------------------------------------------------------------------------------!
  SUBROUTINE equilibration( prh, ptemp, paero, init )
-     
+
     IMPLICIT NONE
-!
-!-- Input variables
-    LOGICAL, INTENT(in) ::  init   !< TRUE: Initialization call
-                                   !< FALSE: Normal runtime: update water 
-                                   !<        content only for 1a
-    REAL(wp), INTENT(in) ::  prh   !< relative humidity [0-1]
-    REAL(wp), INTENT(in) ::  ptemp !< temperature (K)
-!
-!-- Output variables 
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b)     
-!
-!-- Local
-    INTEGER(iwp) :: b      !< loop index
+
+    INTEGER(iwp) :: ib      !< loop index
     INTEGER(iwp) :: counti  !< loop index
-    REAL(wp) ::  zaw        !< water activity [0-1]        
-    REAL(wp) ::  zbinmol(7) !< binary molality of each components (mol/kg)
-    REAL(wp) ::  zcore      !< Volume of dry particle    
-    REAL(wp) ::  zdold      !< Old diameter
-    REAL(wp) ::  zdwet      !< Wet diameter or mean droplet diameter
-    REAL(wp) ::  zke        !< Kelvin term in the KÃ¶hler equation
-    REAL(wp) ::  zlwc       !< liquid water content [kg/m3-air]
-    REAL(wp) ::  zrh        !< Relative humidity
-    REAL(wp) ::  zvpart(7)  !< volume of chem. compounds in one particle 
-    
+
+    LOGICAL, INTENT(in) ::  init   !< TRUE: Initialization, FALSE: Normal runtime: update water
+                                   !< content only for 1a
+
+    REAL(wp) ::  zaw      !< water activity [0-1]
+    REAL(wp) ::  zcore    !< Volume of dry particle
+    REAL(wp) ::  zdold    !< Old diameter
+    REAL(wp) ::  zdwet    !< Wet diameter or mean droplet diameter
+    REAL(wp) ::  zke      !< Kelvin term in the KÃ¶hler equation
+    REAL(wp) ::  zlwc     !< liquid water content [kg/m3-air]
+    REAL(wp) ::  zrh      !< Relative humidity
+
+    REAL(wp), DIMENSION(maxspec) ::  zbinmol  !< binary molality of each components (mol/kg)
+    REAL(wp), DIMENSION(maxspec) ::  zvpart   !< volume of chem. compounds in one particle
+
+    REAL(wp), INTENT(in) ::  prh    !< relative humidity [0-1]
+    REAL(wp), INTENT(in) ::  ptemp  !< temperature (K)
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero  !< aerosol properties
+
     zaw       = 0.0_wp
-    zbinmol   = 0.0_wp
-    zcore     = 0.0_wp
-    zdold     = 0.0_wp
-    zdwet     = 0.0_wp
     zlwc      = 0.0_wp
-    zrh       = 0.0_wp
-    
-!                
+!
 !-- Relative humidity:
     zrh = prh
     zrh = MAX( zrh, 0.05_wp )
-    zrh = MIN( zrh, 0.98_wp)    
+    zrh = MIN( zrh, 0.98_wp)
 !
 !-- 1) Regime 1: sulphate and partly water-soluble OC. Done for every CALL
-    DO  b = in1a, fn1a   ! size bin
-          
+    DO  ib = start_subrange_1a, end_subrange_1a   ! size bin
+
        zbinmol = 0.0_wp
-       zdold   = 1.0_wp  
+       zdold   = 1.0_wp
        zke     = 1.02_wp
-        
-       IF ( paero(b)%numc > nclim )  THEN
+
+       IF ( paero(ib)%numc > nclim )  THEN
 !
 !--       Volume in one particle
           zvpart = 0.0_wp
-          zvpart(1:2) = paero(b)%volc(1:2) / paero(b)%numc
-          zvpart(6:7) = paero(b)%volc(6:7) / paero(b)%numc
-!                
+          zvpart(1:2) = paero(ib)%volc(1:2) / paero(ib)%numc
+          zvpart(6:7) = paero(ib)%volc(6:7) / paero(ib)%numc
+!
 !--       Total volume and wet diameter of one dry particle 
           zcore = SUM( zvpart(1:2) )
-          zdwet = paero(b)%dwet
-          
+          zdwet = paero(ib)%dwet
+
           counti = 0
-          DO  WHILE ( ABS( zdwet / zdold - 1.0_wp ) > 1.0E-2_wp ) 
-          
+          DO  WHILE ( ABS( zdwet / zdold - 1.0_wp ) > 1.0E-2_wp )
+
              zdold = MAX( zdwet, 1.0E-20_wp )
              zaw = MAX( 1.0E-3_wp, zrh / zke ) ! To avoid underflow
-!                   
+!
 !--          Binary molalities (mol/kg): 
 !--          Sulphate
-             zbinmol(1) = 1.1065495E+2_wp - 3.6759197E+2_wp * zaw              &
-                                          + 5.0462934E+2_wp * zaw**2.0_wp      &
-                                          - 3.1543839E+2_wp * zaw**3.0_wp      &
-                                          + 6.770824E+1_wp  * zaw**4.0_wp 
-!--          Organic carbon                     
-             zbinmol(2) = 1.0_wp / ( zaw * amh2o ) - 1.0_wp / amh2o 
-!--          Nitric acid                              
-             zbinmol(6) = 2.306844303E+1_wp - 3.563608869E+1_wp * zaw          &
-                                            - 6.210577919E+1_wp * zaw**2.0_wp  &
-                                            + 5.510176187E+2_wp * zaw**3.0_wp  &
-                                            - 1.460055286E+3_wp * zaw**4.0_wp  &
-                                            + 1.894467542E+3_wp * zaw**5.0_wp  &
-                                            - 1.220611402E+3_wp * zaw**6.0_wp  &
-                                            + 3.098597737E+2_wp * zaw**7.0_wp 
-! 
-!--          Calculate the liquid water content (kg/m3-air) using ZSR (see e.g. 
-!--          Eq. 10.98 in Seinfeld and Pandis (2006))
-             zlwc = ( paero(b)%volc(1) * ( arhoh2so4 / amh2so4 ) ) /           &
-                    zbinmol(1) + epsoc * paero(b)%volc(2) * ( arhooc / amoc )  &
-                    / zbinmol(2) + ( paero(b)%volc(6) * ( arhohno3/amhno3 ) )  &
-                    / zbinmol(6)
-!                            
-!--          Particle wet diameter (m) 
-             zdwet = ( zlwc / paero(b)%numc / arhoh2o / api6 +                 &
-                     ( SUM( zvpart(6:7) ) / api6 ) +      &
-                       zcore / api6 )**( 1.0_wp / 3.0_wp )
-!                             
+             zbinmol(1) = 1.1065495E+2_wp - 3.6759197E+2_wp * zaw + 5.0462934E+2_wp * zaw**2 -     &
+                          3.1543839E+2_wp * zaw**3 + 6.770824E+1_wp  * zaw**4
+!--          Organic carbon
+             zbinmol(2) = 1.0_wp / ( zaw * amh2o ) - 1.0_wp / amh2o
+!--          Nitric acid
+             zbinmol(6) = 2.306844303E+1_wp - 3.563608869E+1_wp * zaw - 6.210577919E+1_wp * zaw**2 &
+                          + 5.510176187E+2_wp * zaw**3 - 1.460055286E+3_wp * zaw**4                &
+                          + 1.894467542E+3_wp * zaw**5 - 1.220611402E+3_wp * zaw**6                &
+                          + 3.098597737E+2_wp * zaw**7
+!
+!--          Calculate the liquid water content (kg/m3-air) using ZSR (see e.g. Eq. 10.98 in
+!--          Seinfeld and Pandis (2006))
+             zlwc = ( paero(ib)%volc(1) * ( arhoh2so4 / amh2so4 ) ) / zbinmol(1) +                 &
+                    epsoc * paero(ib)%volc(2) * ( arhooc / amoc ) / zbinmol(2) +                   &
+                    ( paero(ib)%volc(6) * ( arhohno3/amhno3 ) ) / zbinmol(6)
+!
+!--          Particle wet diameter (m)
+             zdwet = ( zlwc / paero(ib)%numc / arhoh2o / api6 + ( SUM( zvpart(6:7) ) / api6 ) +    &
+                       zcore / api6 )**0.33333333_wp
+!
 !--          Kelvin effect (Eq. 10.85 in in Seinfeld and Pandis (2006)). Avoid 
 !--          overflow.
-             zke = EXP( MIN( 50.0_wp,                                          &
-                       4.0_wp * surfw0 * amvh2so4 / ( abo * ptemp *  zdwet ) ) )
-             
+             zke = EXP( MIN( 50.0_wp, 4.0_wp * surfw0 * amvh2so4 / ( abo * ptemp *  zdwet ) ) )
+
              counti = counti + 1
              IF ( counti > 1000 )  THEN 
                 message_string = 'Subrange 1: no convergence!'
-                CALL message( 'salsa_mod: equilibration', 'SA0042',            &
-                              1, 2, 0, 6, 0 )
+                CALL message( 'salsa_mod: equilibration', 'PA0617', 1, 2, 0, 6, 0 )
              ENDIF
           ENDDO
-!                
+!
 !--       Instead of lwc, use the volume concentration of water from now on 
 !--       (easy to convert...)
-          paero(b)%volc(8) = zlwc / arhoh2o
-!                
+          paero(ib)%volc(8) = zlwc / arhoh2o
+!
 !--       If this is initialization, update the core and wet diameter
           IF ( init )  THEN
-             paero(b)%dwet = zdwet
-             paero(b)%core = zcore
+             paero(ib)%dwet = zdwet
+             paero(ib)%core = zcore
           ENDIF
-          
+
        ELSE
 !--       If initialization
-!--       1.2) empty bins given bin average values  
+!--       1.2) empty bins given bin average values
           IF ( init )  THEN
-             paero(b)%dwet = paero(b)%dmid
-             paero(b)%core = api6 * paero(b)%dmid ** 3.0_wp
+             paero(ib)%dwet = paero(ib)%dmid
+             paero(ib)%core = api6 * paero(ib)%dmid**3
           ENDIF
-          
-       ENDIF
-             
-    ENDDO !< b
+
+       ENDIF
+
+    ENDDO  ! ib
 !
 !-- 2) Regime 2a: sulphate, OC, BC and sea salt
@@ -2996,165 +3181,154 @@
 !--    are computed via condensation
     IF ( init )  THEN
-       DO  b = in2a, fn2b 
-             
+       DO  ib = start_subrange_2a, end_subrange_2b
+!
 !--       Initialize
           zke     = 1.02_wp
           zbinmol = 0.0_wp
           zdold   = 1.0_wp
-!                
+!
 !--       1) Particle properties calculated for non-empty bins
-          IF ( paero(b)%numc > nclim )  THEN
-!                
+          IF ( paero(ib)%numc > nclim )  THEN
+!
 !--          Volume in one particle [fxm]
              zvpart = 0.0_wp
-             zvpart(1:7) = paero(b)%volc(1:7) / paero(b)%numc
-!
-!--          Total volume and wet diameter of one dry particle [fxm] 
+             zvpart(1:7) = paero(ib)%volc(1:7) / paero(ib)%numc
+!
+!--          Total volume and wet diameter of one dry particle [fxm]
              zcore = SUM( zvpart(1:5) )
-             zdwet = paero(b)%dwet
+             zdwet = paero(ib)%dwet
 
              counti = 0
              DO  WHILE ( ABS( zdwet / zdold - 1.0_wp ) > 1.0E-12_wp )
-             
+
                 zdold = MAX( zdwet, 1.0E-20_wp )
                 zaw = zrh / zke
-!                      
+!
 !--             Binary molalities (mol/kg):
 !--             Sulphate
-                zbinmol(1) = 1.1065495E+2_wp - 3.6759197E+2_wp * zaw           &  
-                        + 5.0462934E+2_wp * zaw**2 - 3.1543839E+2_wp * zaw**3  &
-                        + 6.770824E+1_wp  * zaw**4 
-!--             Organic carbon                        
-                zbinmol(2) = 1.0_wp / ( zaw * amh2o ) - 1.0_wp / amh2o 
+                zbinmol(1) = 1.1065495E+2_wp - 3.6759197E+2_wp * zaw + 5.0462934E+2_wp * zaw**2 -  &
+                             3.1543839E+2_wp * zaw**3 + 6.770824E+1_wp  * zaw**4
+!--             Organic carbon
+                zbinmol(2) = 1.0_wp / ( zaw * amh2o ) - 1.0_wp / amh2o
 !--             Nitric acid
-                zbinmol(6) = 2.306844303E+1_wp - 3.563608869E+1_wp * zaw       &
-                     - 6.210577919E+1_wp * zaw**2 + 5.510176187E+2_wp * zaw**3 &
-                     - 1.460055286E+3_wp * zaw**4 + 1.894467542E+3_wp * zaw**5 &
-                     - 1.220611402E+3_wp * zaw**6 + 3.098597737E+2_wp * zaw**7 
-!--             Sea salt (natrium chloride)                                 
-                zbinmol(5) = 5.875248E+1_wp - 1.8781997E+2_wp * zaw            &
-                         + 2.7211377E+2_wp * zaw**2 - 1.8458287E+2_wp * zaw**3 &
-                         + 4.153689E+1_wp  * zaw**4 
-!                                 
+                zbinmol(6) = 2.306844303E+1_wp          - 3.563608869E+1_wp * zaw -                &
+                             6.210577919E+1_wp * zaw**2 + 5.510176187E+2_wp * zaw**3 -             &
+                             1.460055286E+3_wp * zaw**4 + 1.894467542E+3_wp * zaw**5 -             &
+                             1.220611402E+3_wp * zaw**6 + 3.098597737E+2_wp * zaw**7 
+!--             Sea salt (natrium chloride)
+                zbinmol(5) = 5.875248E+1_wp - 1.8781997E+2_wp * zaw + 2.7211377E+2_wp * zaw**2 -   &
+                             1.8458287E+2_wp * zaw**3 + 4.153689E+1_wp  * zaw**4
+!
 !--             Calculate the liquid water content (kg/m3-air)
-                zlwc = ( paero(b)%volc(1) * ( arhoh2so4 / amh2so4 ) ) /        &
-                       zbinmol(1) + epsoc * ( paero(b)%volc(2) * ( arhooc /    &
-                       amoc ) ) / zbinmol(2) + ( paero(b)%volc(6) * ( arhohno3 &
-                       / amhno3 ) ) / zbinmol(6) + ( paero(b)%volc(5) *        &
-                       ( arhoss / amss ) ) / zbinmol(5)
-                       
-!--             Particle wet radius (m) 
-                zdwet = ( zlwc / paero(b)%numc / arhoh2o / api6 +              &
-                          ( SUM( zvpart(6:7) ) / api6 )  + &
-                           zcore / api6 ) ** ( 1.0_wp / 3.0_wp )
-!                                
+                zlwc = ( paero(ib)%volc(1) * ( arhoh2so4 / amh2so4 ) ) / zbinmol(1) +              &
+                       epsoc * ( paero(ib)%volc(2) * ( arhooc / amoc ) ) / zbinmol(2) +            &
+                       ( paero(ib)%volc(6) * ( arhohno3 / amhno3 ) ) / zbinmol(6) +                &
+                       ( paero(ib)%volc(5) * ( arhoss / amss ) ) / zbinmol(5)
+
+!--             Particle wet radius (m)
+                zdwet = ( zlwc / paero(ib)%numc / arhoh2o / api6 + ( SUM( zvpart(6:7) ) / api6 )  + &
+                           zcore / api6 )**0.33333333_wp
+!
 !--             Kelvin effect (Eq. 10.85 in Seinfeld and Pandis (2006))
-                zke = EXP( MIN( 50.0_wp,                                       &
-                        4.0_wp * surfw0 * amvh2so4 / ( abo * zdwet * ptemp ) ) )
-                         
+                zke = EXP( MIN( 50.0_wp, 4.0_wp * surfw0 * amvh2so4 / ( abo * zdwet * ptemp ) ) )
+
                 counti = counti + 1
                 IF ( counti > 1000 )  THEN 
                    message_string = 'Subrange 2: no convergence!'
-                CALL message( 'salsa_mod: equilibration', 'SA0043',            &
-                              1, 2, 0, 6, 0 )
+                CALL message( 'salsa_mod: equilibration', 'PA0618', 1, 2, 0, 6, 0 )
                 ENDIF
              ENDDO
-!                   
+!
 !--          Liquid water content; instead of LWC use the volume concentration
-             paero(b)%volc(8) = zlwc / arhoh2o
-             paero(b)%dwet    = zdwet
-             paero(b)%core    = zcore
-             
+             paero(ib)%volc(8) = zlwc / arhoh2o
+             paero(ib)%dwet    = zdwet
+             paero(ib)%core    = zcore
+
           ELSE
-!--          2.2) empty bins given bin average values 
-             paero(b)%dwet = paero(b)%dmid
-             paero(b)%core = api6 * paero(b)%dmid ** 3.0_wp
+!--          2.2) empty bins given bin average values
+             paero(ib)%dwet = paero(ib)%dmid
+             paero(ib)%core = api6 * paero(ib)%dmid**3
           ENDIF
-               
-       ENDDO   ! b
+
+       ENDDO   ! ib
     ENDIF
 
- END SUBROUTINE equilibration 
- 
+ END SUBROUTINE equilibration
+
 !------------------------------------------------------------------------------!
 !> Description:
 !> ------------
 !> Calculation of the settling velocity vc (m/s) per aerosol size bin and 
-!> deposition on plant canopy (lsdepo_vege). 
-!
-!> Deposition is based on either the scheme presented in: 
-!> Zhang et al. (2001), Atmos. Environ. 35, 549-560 (includes collection due to 
-!> Brownian diffusion, impaction, interception and sedimentation) 
+!> deposition on plant canopy (lsdepo_pcm).
+!
+!> Deposition is based on either the scheme presented in:
+!> Zhang et al. (2001), Atmos. Environ. 35, 549-560 (includes collection due to
+!> Brownian diffusion, impaction, interception and sedimentation; hereafter ZO1)
 !> OR
-!> Petroff & Zhang (2010), Geosci. Model Dev. 3, 753-769 (includes also 
-!> collection due to turbulent impaction)
-!
-!> Equation numbers refer to equation in Jacobson (2005): Fundamentals of 
-!> Atmospheric Modeling, 2nd Edition. 
-!
-!> Subroutine follows closely sedim_SALSA in UCLALES-SALSA written by Juha 
+!> Petroff & Zhang (2010), Geosci. Model Dev. 3, 753-769 (includes also
+!> collection due to turbulent impaction, hereafter P10)
+!
+!> Equation numbers refer to equation in Jacobson (2005): Fundamentals of
+!> Atmospheric Modeling, 2nd Edition.
+!
+!> Subroutine follows closely sedim_SALSA in UCLALES-SALSA written by Juha
 !> Tonttila (KIT/FMI) and Zubair Maalick (UEF).
-!> Rewritten to PALM by Mona Kurppa (UH), 2017. 
+!> Rewritten to PALM by Mona Kurppa (UH), 2017.
 !
 !> Call for grid point i,j,k
 !------------------------------------------------------------------------------!
 
- SUBROUTINE deposition( paero, tk, adn, mag_u, lad, kvis, Sc, vc )
- 
+ SUBROUTINE deposition( paero, tk, adn, mag_u, lad, kvis, schmidt_num, vc )
+
     USE plant_canopy_model_mod,                                                &
         ONLY: cdc
- 
+
     IMPLICIT NONE
-    
-    REAL(wp), INTENT(in)    ::  adn    !< air density (kg/m3)  
-    REAL(wp), INTENT(out)   ::  kvis   !< kinematic viscosity of air (m2/s) 
-    REAL(wp), INTENT(in) ::     lad    !< leaf area density (m2/m3)
-    REAL(wp), INTENT(in)    ::  mag_u  !< wind velocity (m/s)
-    REAL(wp), INTENT(out)   ::  Sc(:)  !< particle Schmidt number  
-    REAL(wp), INTENT(in)    ::  tk     !< abs.temperature (K)   
-    REAL(wp), INTENT(out)   ::  vc(:)  !< critical fall speed i.e. settling 
-                                       !< velocity of an aerosol particle (m/s) 
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b)        
-    
-    INTEGER(iwp) ::  b      !< loop index
+
+    INTEGER(iwp) ::  ib     !< loop index
+
     REAL(wp) ::  avis       !< molecular viscocity of air (kg/(m*s))
-    REAL(wp), PARAMETER ::  c_A = 1.249_wp !< Constants A, B and C for 
-    REAL(wp), PARAMETER ::  c_B = 0.42_wp  !< calculating  the Cunningham  
-    REAL(wp), PARAMETER ::  c_C = 0.87_wp  !< slip-flow correction (Cc)  
-                                           !< according to Jacobson (2005), 
-                                           !< Eq. 15.30
-    REAL(wp) ::  Cc         !< Cunningham slip-flow correction factor     
-    REAL(wp) ::  Kn         !< Knudsen number    
+    REAL(wp) ::  Cc         !< Cunningham slip-flow correction factor
+    REAL(wp) ::  Kn         !< Knudsen number
     REAL(wp) ::  lambda     !< molecular mean free path (m)
-    REAL(wp) ::  mdiff      !< particle diffusivity coefficient    
-    REAL(wp) ::  pdn        !< particle density (kg/m3)      
-    REAL(wp) ::  ustar      !< friction velocity (m/s)    
+    REAL(wp) ::  mdiff      !< particle diffusivity coefficient
+    REAL(wp) ::  pdn        !< particle density (kg/m3)
+    REAL(wp) ::  ustar      !< friction velocity (m/s)
     REAL(wp) ::  va         !< thermal speed of an air molecule (m/s) 
-    REAL(wp) ::  zdwet      !< wet diameter (m)                              
-!
-!-- Initialise 
-    Cc            = 0.0_wp
-    Kn            = 0.0_wp
-    mdiff         = 0.0_wp
-    pdn           = 1500.0_wp    ! default value 
-    ustar         = 0.0_wp 
+    REAL(wp) ::  zdwet      !< wet diameter (m)
+
+    REAL(wp), INTENT(in) ::  adn    !< air density (kg/m3)
+    REAL(wp), INTENT(in) ::  lad    !< leaf area density (m2/m3)
+    REAL(wp), INTENT(in) ::  mag_u  !< wind velocity (m/s)
+    REAL(wp), INTENT(in) ::  tk     !< abs.temperature (K)
+
+    REAL(wp), INTENT(inout) ::  kvis   !< kinematic viscosity of air (m2/s)
+
+    REAL(wp), DIMENSION(:), INTENT(inout) ::  schmidt_num  !< particle Schmidt number
+    REAL(wp), DIMENSION(:), INTENT(inout) ::  vc  !< critical fall speed i.e. settling velocity of
+                                                  !< an aerosol particle (m/s)
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero  !< aerosol properties
+!
+!-- Initialise
+    pdn           = 1500.0_wp    ! default value
+    ustar         = 0.0_wp
 !
 !-- Molecular viscosity of air (Eq. 4.54)
-    avis = 1.8325E-5_wp * ( 416.16_wp / ( tk + 120.0_wp ) ) * ( tk /           &
-           296.16_wp )**1.5_wp
-!              
+    avis = 1.8325E-5_wp * ( 416.16_wp / ( tk + 120.0_wp ) ) * ( tk / 296.16_wp )**1.5_wp
+!
 !-- Kinematic viscosity (Eq. 4.55)
     kvis =  avis / adn
-!       
+!
 !-- Thermal velocity of an air molecule (Eq. 15.32)
-    va = SQRT( 8.0_wp * abo * tk / ( pi * am_airmol ) ) 
+    va = SQRT( 8.0_wp * abo * tk / ( pi * am_airmol ) )
 !
 !-- Mean free path (m) (Eq. 15.24)
     lambda = 2.0_wp * avis / ( adn * va )
-    
-    DO  b = 1, nbins
-    
-       IF ( paero(b)%numc < nclim )  CYCLE
-       zdwet = paero(b)%dwet
+
+    DO  ib = 1, nbins_aerosol
+
+       IF ( paero(ib)%numc < nclim )  CYCLE
+       zdwet = paero(ib)%dwet
 !
 !--    Knudsen number (Eq. 15.23)
@@ -3162,279 +3336,320 @@
 !
 !--    Cunningham slip-flow correction (Eq. 15.30)
-       Cc = 1.0_wp + Kn * ( c_A + c_B * EXP( -c_C / Kn ) )
+       Cc = 1.0_wp + Kn * ( 1.249_wp + 0.42_wp * EXP( -0.87_wp / Kn ) )
 
 !--    Particle diffusivity coefficient (Eq. 15.29)
        mdiff = ( abo * tk * Cc ) / ( 3.0_wp * pi * avis * zdwet )
-!       
+!
 !--    Particle Schmidt number (Eq. 15.36)
-       Sc(b) = kvis / mdiff       
-!       
-!--    Critical fall speed i.e. settling velocity  (Eq. 20.4)                 
-       vc(b) = MIN( 1.0_wp, terminal_vel( 0.5_wp * zdwet, pdn, adn, avis, Cc) )
-       
-       IF ( lsdepo_vege  .AND.  plant_canopy  .AND.  lad > 0.0_wp )  THEN
-!       
-!--       Friction velocity calculated following Prandtl (1925):
+       schmidt_num(ib) = kvis / mdiff
+!
+!--    Critical fall speed i.e. settling velocity  (Eq. 20.4)
+       vc(ib) = MIN( 1.0_wp, terminal_vel( 0.5_wp * zdwet, pdn, adn, avis, Cc) )
+!
+!--    Friction velocity for deposition on vegetation. Calculated following Prandtl (1925):
+       IF ( lsdepo_pcm  .AND.  plant_canopy  .AND.  lad > 0.0_wp )  THEN
           ustar = SQRT( cdc ) * mag_u
-          CALL depo_vege( paero, b, vc(b), mag_u, ustar, kvis, Sc(b), lad )
-       ENDIF 
+          CALL depo_pcm( paero, ib, vc(ib), mag_u, ustar, kvis, schmidt_num(ib), lad )
+       ENDIF
     ENDDO
- 
- END SUBROUTINE deposition 
- 
+
+ END SUBROUTINE deposition
+
 !------------------------------------------------------------------------------!
 ! Description:
-! ------------ 
-!> Calculate change in number and volume concentrations due to deposition on 
+! ------------
+!> Calculate change in number and volume concentrations due to deposition on
 !> plant canopy.
 !------------------------------------------------------------------------------!
- SUBROUTINE depo_vege( paero, b, vc, mag_u, ustar, kvis_a, Sc, lad )
-  
-    IMPLICIT NONE 
-    
-    INTEGER(iwp), INTENT(in) ::  b  !< loop index
-    REAL(wp), INTENT(in) ::  kvis_a !< kinematic viscosity of air (m2/s)
-    REAL(wp), INTENT(in) ::  lad    !< leaf area density (m2/m3)
-    REAL(wp), INTENT(in) ::  mag_u  !< wind velocity (m/s)   
-    REAL(wp), INTENT(in) ::  Sc     !< particle Schmidt number 
-    REAL(wp), INTENT(in) ::  ustar  !< friction velocity (m/s)                                    
-    REAL(wp), INTENT(in) ::  vc     !< terminal velocity (m/s)  
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b)  
-    
-    INTEGER(iwp) ::  c      !< loop index
-
-    REAL(wp) ::  alpha       !< parameter, Table 3 in Zhang et al. (2001)  
-    REAL(wp) ::  depo        !< deposition efficiency
-    REAL(wp) ::  C_Br        !< coefficient for Brownian diffusion
-    REAL(wp) ::  C_IM        !< coefficient for inertial impaction
-    REAL(wp) ::  C_IN        !< coefficient for interception
-    REAL(wp) ::  C_IT        !< coefficient for turbulent impaction   
-    REAL(wp) ::  gamma       !< parameter, Table 3 in Zhang et al. (2001)    
-    REAL(wp) ::  par_A       !< parameter A for the characteristic radius of 
-                             !< collectors, Table 3 in Zhang et al. (2001)    
-    REAL(wp) ::  rt          !< the overall quasi-laminar resistance for 
-                             !< particles
-    REAL(wp) ::  St          !< Stokes number for smooth surfaces or bluff 
-                             !< surface elements                                 
-    REAL(wp) ::  tau_plus    !< dimensionless particle relaxation time   
-    REAL(wp) ::  v_bd        !< deposition velocity due to Brownian diffusion
-    REAL(wp) ::  v_im        !< deposition velocity due to impaction
-    REAL(wp) ::  v_in        !< deposition velocity due to interception
-    REAL(wp) ::  v_it        !< deposition velocity due to turbulent impaction                                
-!
-!-- Initialise 
-    depo     = 0.0_wp 
-    rt       = 0.0_wp
-    St       = 0.0_wp
+ SUBROUTINE depo_pcm( paero, ib, vc, mag_u, ustar, kvis_a, schmidt_num, lad )
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  ic      !< loop index
+
+    INTEGER(iwp), INTENT(in) ::  ib  !< loop index
+
+    REAL(wp) ::  alpha             !< parameter, Table 3 in Z01
+    REAL(wp) ::  beta_im           !< parameter for turbulent impaction
+    REAL(wp) ::  depo              !< deposition efficiency
+    REAL(wp) ::  c_brownian_diff   !< coefficient for Brownian diffusion
+    REAL(wp) ::  c_impaction       !< coefficient for inertial impaction
+    REAL(wp) ::  c_interception    !< coefficient for interception
+    REAL(wp) ::  c_turb_impaction  !< coefficient for turbulent impaction
+    REAL(wp) ::  gamma             !< parameter, Table 3 in Z01
+    REAL(wp) ::  par_a             !< parameter A for the characteristic radius of collectors, 
+                                   !< Table 3 in Z01
+    REAL(wp) ::  par_l             !< obstacle characteristic dimension in P10
+    REAL(wp) ::  rs                !< overall quasi-laminar resistance for particles
+    REAL(wp) ::  stokes_num        !< Stokes number for smooth or bluff surfaces
+    REAL(wp) ::  tau_plus          !< dimensionless particle relaxation time
+    REAL(wp) ::  v_bd              !< deposition velocity due to Brownian diffusion
+    REAL(wp) ::  v_im              !< deposition velocity due to impaction
+    REAL(wp) ::  v_in              !< deposition velocity due to interception
+    REAL(wp) ::  v_it              !< deposition velocity due to turbulent impaction
+
+    REAL(wp), INTENT(in) ::  kvis_a       !< kinematic viscosity of air (m2/s)
+    REAL(wp), INTENT(in) ::  lad          !< leaf area density (m2/m3)
+    REAL(wp), INTENT(in) ::  mag_u        !< wind velocity (m/s)
+    REAL(wp), INTENT(in) ::  schmidt_num  !< particle Schmidt number 
+    REAL(wp), INTENT(in) ::  ustar        !< friction velocity (m/s)
+    REAL(wp), INTENT(in) ::  vc           !< terminal velocity (m/s)
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero  !< aerosol properties
+!
+!-- Initialise
+    rs       = 0.0_wp
     tau_plus = 0.0_wp
-    v_bd     = 0.0_wp     
-    v_im     = 0.0_wp        
-    v_in     = 0.0_wp        
-    v_it     = 0.0_wp         
-       
-    IF ( depo_vege_type == 'zhang2001' )  THEN
-!       
-!--    Parameters for the land use category 'deciduous broadleaf trees'(Table 3)     
-       par_A = 5.0E-3_wp
-       alpha = 0.8_wp
-       gamma = 0.56_wp  
-!       
-!--    Stokes number for vegetated surfaces (Seinfeld & Pandis (2006): Eq.19.24)  
-       St = vc * ustar / ( g * par_A )         
-!          
-!--    The overall quasi-laminar resistance for particles (Zhang et al., Eq. 5)        
-       rt = MAX( EPSILON( 1.0_wp ), ( 3.0_wp * ustar * EXP( -St**0.5_wp ) *    &
-                         ( Sc**( -gamma ) + ( St / ( alpha + St ) )**2.0_wp +  &
-                           0.5_wp * ( paero(b)%dwet / par_A )**2.0_wp ) ) )
-       depo = ( rt + vc ) * lad
-       paero(b)%numc = paero(b)%numc - depo * paero(b)%numc * dt_salsa
-       DO  c = 1, maxspec+1
-          paero(b)%volc(c) = paero(b)%volc(c) - depo * paero(b)%volc(c) *      &
-                             dt_salsa
-       ENDDO
-       
-    ELSEIF ( depo_vege_type == 'petroff2010' )  THEN
-!
-!--    vd = v_BD + v_IN + v_IM + v_IT + vc 
+    v_bd     = 0.0_wp
+    v_im     = 0.0_wp
+    v_in     = 0.0_wp
+    v_it     = 0.0_wp
+
+    IF ( depo_pcm_par == 'zhang2001' )  THEN
+!
+!--    Parameters for the land use category 'deciduous broadleaf trees'(Table 3)
+       alpha   = alpha_z01(depo_pcm_type_num)
+       gamma   = gamma_z01(depo_pcm_type_num)
+       par_a   = A_z01(depo_pcm_type_num, season) * 1.0E-3_wp
+!
+!--    Stokes number for vegetated surfaces (Seinfeld & Pandis (2006): Eq.19.24)
+       stokes_num = vc * ustar / ( g * par_a )
+!
+!--    The overall quasi-laminar resistance for particles (Zhang et al., Eq. 5)
+       rs = MAX( EPSILON( 1.0_wp ), ( 3.0_wp * ustar * EXP( -stokes_num**0.5_wp ) *                &
+                 ( schmidt_num**( -gamma ) + ( stokes_num / ( alpha + stokes_num ) )**2 +          &
+                 0.5_wp * ( paero(ib)%dwet / par_a )**2 ) ) )
+
+       depo = ( rs + vc ) * lad
+
+    ELSEIF ( depo_pcm_par == 'petroff2010' )  THEN
+!
+!--    vd = v_BD + v_IN + v_IM + v_IT + vc
 !--    Deposition efficiencies from Table 1. Constants from Table 2.
-       C_Br  = 1.262_wp
-       C_IM  = 0.130_wp
-       C_IN  = 0.216_wp
-       C_IT  = 0.056_wp
-       par_A = 0.03_wp   ! Here: leaf width (m)      
-!       
-!--    Stokes number for vegetated surfaces (Seinfeld & Pandis (2006): Eq.19.24)  
-       St = vc * ustar / ( g * par_A )         
+       par_l   = l_p10(depo_pcm_type_num) * 0.01_wp
+       c_brownian_diff     = c_b_p10(depo_pcm_type_num)
+       c_interception    = c_in_p10(depo_pcm_type_num)
+       c_impaction    = c_im_p10(depo_pcm_type_num)
+       beta_im = beta_im_p10(depo_pcm_type_num)
+       c_turb_impaction    = c_it_p10(depo_pcm_type_num)
+!
+!--    Stokes number for vegetated surfaces (Seinfeld & Pandis (2006): Eq.19.24)
+       stokes_num = vc * ustar / ( g * par_l )
 !
 !--    Non-dimensional relexation time of the particle on top of canopy
-       tau_plus = vc * ustar**2.0_wp / ( kvis_a * g ) 
+       tau_plus = vc * ustar**2 / ( kvis_a * g )
 !
 !--    Brownian diffusion
-       v_bd = mag_u * C_Br * Sc**( -2.0_wp / 3.0_wp ) *                        &
-              ( mag_u * par_A / kvis_a )**( -0.5_wp )
+       v_bd = mag_u * c_brownian_diff * schmidt_num**( -0.66666666_wp ) *                          &
+              ( mag_u * par_l / kvis_a )**( -0.5_wp )
 !
 !--    Interception
-       v_in = mag_u * C_IN * paero(b)%dwet / par_A * ( 2.0_wp + LOG( 2.0_wp *  &
-              par_A / paero(b)%dwet ) )                     
+       v_in = mag_u * c_interception * paero(ib)%dwet / par_l * ( 2.0_wp + LOG( 2.0_wp * par_l /    &
+              paero(ib)%dwet ) )
 !
 !--    Impaction: Petroff (2009) Eq. 18
-       v_im = mag_u * C_IM * ( St / ( St + 0.47_wp ) )**2.0_wp
-       
+       v_im = mag_u * c_impaction * ( stokes_num / ( stokes_num + beta_im ) )**2
+!
+!--    Turbulent impaction
        IF ( tau_plus < 20.0_wp )  THEN
-          v_it = 2.5E-3_wp * C_IT * tau_plus**2.0_wp
+          v_it = 2.5E-3_wp * c_turb_impaction * tau_plus**2
        ELSE
-          v_it = C_IT
-       ENDIF
-       depo = ( v_bd + v_in + v_im + v_it + vc ) * lad     
-       paero(b)%numc = paero(b)%numc - depo * paero(b)%numc * dt_salsa     
-       DO  c = 1, maxspec+1
-          paero(b)%volc(c) = paero(b)%volc(c) - depo * paero(b)%volc(c) *      &
-                             dt_salsa
-       ENDDO
-    ENDIF  
- 
- END SUBROUTINE depo_vege
- 
+          v_it = c_turb_impaction
+       ENDIF
+
+       depo = ( v_bd + v_in + v_im + v_it + vc ) * lad
+
+    ENDIF
+!
+!-- Calculate the change in concentrations
+    paero(ib)%numc = paero(ib)%numc - depo * paero(ib)%numc * dt_salsa
+    DO  ic = 1, maxspec+1
+       paero(ib)%volc(ic) = paero(ib)%volc(ic) - depo * paero(ib)%volc(ic) * dt_salsa
+    ENDDO
+
+ END SUBROUTINE depo_pcm
+
 !------------------------------------------------------------------------------!
 ! Description:
-! ------------  
-!> Calculate deposition on horizontal and vertical surfaces. Implement as 
-!> surface flux.
-!------------------------------------------------------------------------------!
-
- SUBROUTINE depo_topo( i, j, surf, vc, Sc, kvis, mag_u, norm )
- 
+! ------------
+!> Calculate the dry deposition on horizontal and vertical surfaces. Implement
+!> as a surface flux.
+!> @todo aerodynamic resistance ignored for now (not important for 
+!        high-resolution simulations)
+!------------------------------------------------------------------------------!
+ SUBROUTINE depo_surf( i, j, surf, vc, schmidt_num, kvis, mag_u, norm, l )
+
+    USE arrays_3d,                                                             &
+        ONLY: rho_air_zw
+
     USE surface_mod,                                                           &
         ONLY:  surf_type
- 
+
     IMPLICIT NONE
-    
+
+    INTEGER(iwp) ::  ib      !< loop index
+    INTEGER(iwp) ::  ic      !< loop index
+    INTEGER(iwp) ::  icc     !< additional loop index
+    INTEGER(iwp) ::  k       !< loop index
+    INTEGER(iwp) ::  m       !< loop index
+    INTEGER(iwp) ::  surf_e  !< End index of surface elements at (j,i)-gridpoint
+    INTEGER(iwp) ::  surf_s  !< Start index of surface elements at (j,i)-gridpoint
+
     INTEGER(iwp), INTENT(in) ::  i     !< loop index
     INTEGER(iwp), INTENT(in) ::  j     !< loop index
-    REAL(wp), INTENT(in) ::  kvis(:)   !< kinematic viscosity of air (m2/s) 
-    REAL(wp), INTENT(in) ::  mag_u(:)  !< wind velocity (m/s)                                                 
-    REAL(wp), INTENT(in) ::  norm(:)   !< normalisation (usually air density)
-    REAL(wp), INTENT(in) ::  Sc(:,:)  !< particle Schmidt number 
-    REAL(wp), INTENT(in) ::  vc(:,:)  !< terminal velocity (m/s)   
-    TYPE(surf_type), INTENT(inout) :: surf  !< respective surface type 
-    INTEGER(iwp) ::  b      !< loop index
-    INTEGER(iwp) ::  c      !< loop index
-    INTEGER(iwp) ::  k      !< loop index
-    INTEGER(iwp) ::  m      !< loop index
-    INTEGER(iwp) ::  surf_e !< End index of surface elements at (j,i)-gridpoint
-    INTEGER(iwp) ::  surf_s !< Start index of surface elements at (j,i)-gridpoint
-    REAL(wp) ::  alpha      !< parameter, Table 3 in Zhang et al. (2001) 
-    REAL(wp) ::  C_Br       !< coefficient for Brownian diffusion
-    REAL(wp) ::  C_IM       !< coefficient for inertial impaction
-    REAL(wp) ::  C_IN       !< coefficient for interception
-    REAL(wp) ::  C_IT       !< coefficient for turbulent impaction 
-    REAL(wp) ::  depo       !< deposition efficiency
-    REAL(wp) ::  gamma      !< parameter, Table 3 in Zhang et al. (2001) 
-    REAL(wp) ::  par_A      !< parameter A for the characteristic radius of 
-                            !< collectors, Table 3 in Zhang et al. (2001) 
-    REAL(wp) ::  rt         !< the overall quasi-laminar resistance for 
-                            !< particles
-    REAL(wp) ::  St         !< Stokes number for bluff surface elements  
-    REAL(wp) ::  tau_plus   !< dimensionless particle relaxation time   
-    REAL(wp) ::  v_bd       !< deposition velocity due to Brownian diffusion
-    REAL(wp) ::  v_im       !< deposition velocity due to impaction
-    REAL(wp) ::  v_in       !< deposition velocity due to interception
-    REAL(wp) ::  v_it       !< deposition velocity due to turbulent impaction  
-!
-!-- Initialise 
-    rt       = 0.0_wp
-    St       = 0.0_wp
+
+    INTEGER(iwp), INTENT(in), OPTIONAL ::  l  !< index variable for surface facing
+
+    LOGICAL, INTENT(in) ::  norm      !< to normalise or not
+
+    REAL(wp) ::  alpha             !< parameter, Table 3 in Z01
+    REAL(wp) ::  beta_im           !< parameter for turbulent impaction
+    REAL(wp) ::  c_brownian_diff   !< coefficient for Brownian diffusion
+    REAL(wp) ::  c_impaction       !< coefficient for inertial impaction
+    REAL(wp) ::  c_interception    !< coefficient for interception
+    REAL(wp) ::  c_turb_impaction  !< coefficient for turbulent impaction
+    REAL(wp) ::  depo              !< deposition efficiency
+    REAL(wp) ::  gamma             !< parameter, Table 3 in Z01
+    REAL(wp) ::  norm_fac          !< normalisation factor (usually air density)
+    REAL(wp) ::  par_a             !< parameter A for the characteristic radius of collectors,
+                                   !< Table 3 in Z01
+    REAL(wp) ::  par_l             !< obstacle characteristic dimension in P10
+    REAL(wp) ::  rs                !< the overall quasi-laminar resistance for particles
+    REAL(wp) ::  stokes_num        !< Stokes number for bluff surface elements
+    REAL(wp) ::  tau_plus          !< dimensionless particle relaxation time
+    REAL(wp) ::  v_bd              !< deposition velocity due to Brownian diffusion
+    REAL(wp) ::  v_im              !< deposition velocity due to impaction
+    REAL(wp) ::  v_in              !< deposition velocity due to interception
+    REAL(wp) ::  v_it              !< deposition velocity due to turbulent impaction
+
+    REAL(wp), DIMENSION(:), INTENT(in) ::  kvis   !< kinematic viscosity of air (m2/s)
+    REAL(wp), DIMENSION(:), INTENT(in) ::  mag_u  !< wind velocity (m/s)
+
+    REAL(wp), DIMENSION(:,:), INTENT(in) ::  schmidt_num   !< particle Schmidt number
+    REAL(wp), DIMENSION(:,:), INTENT(in) ::  vc            !< terminal velocity (m/s)
+
+    TYPE(surf_type), INTENT(inout) :: surf  !< respective surface type
+!
+!-- Initialise
+    rs       = 0.0_wp
+    surf_s   = surf%start_index(j,i)
+    surf_e   = surf%end_index(j,i)
     tau_plus = 0.0_wp
-    v_bd     = 0.0_wp     
-    v_im     = 0.0_wp        
-    v_in     = 0.0_wp        
-    v_it     = 0.0_wp                                 
-    surf_s   = surf%start_index(j,i)
-    surf_e   = surf%end_index(j,i) 
-    
-    DO  m = surf_s, surf_e 
-       k = surf%k(m)        
-       DO  b = 1, nbins
-          IF ( aerosol_number(b)%conc(k,j,i) <= nclim  .OR.                    &
-               Sc(k+1,b) < 1.0_wp )  CYCLE   
-                    
-          IF ( depo_topo_type == 'zhang2001' )  THEN
-!       
-!--          Parameters for the land use category 'urban' in Table 3
-             alpha = 1.5_wp
-             gamma = 0.56_wp 
-             par_A = 10.0E-3_wp
-!       
+    v_bd     = 0.0_wp
+    v_im     = 0.0_wp
+    v_in     = 0.0_wp
+    v_it     = 0.0_wp
+!
+!-- Model parameters for the land use category. If LSM is applied, import
+!-- characteristics. Otherwise, apply surface type "urban".
+    alpha   = alpha_z01(luc_urban)
+    gamma   = gamma_z01(luc_urban)
+    par_a   = A_z01(luc_urban, season) * 1.0E-3_wp
+
+    par_l            = l_p10(luc_urban) * 0.01_wp
+    c_brownian_diff  = c_b_p10(luc_urban)
+    c_interception   = c_in_p10(luc_urban)
+    c_impaction      = c_im_p10(luc_urban)
+    beta_im          = beta_im_p10(luc_urban)
+    c_turb_impaction = c_it_p10(luc_urban)
+
+    DO  m = surf_s, surf_e
+       k = surf%k(m)
+
+       IF ( norm )  THEN
+          norm_fac = rho_air_zw(k)
+          IF ( land_surface )  THEN
+             alpha            = alpha_z01( lsm_to_depo_h%match(m) )
+             beta_im          = beta_im_p10( lsm_to_depo_h%match(m) )
+             c_brownian_diff  = c_b_p10( lsm_to_depo_h%match(m) )
+             c_impaction      = c_im_p10( lsm_to_depo_h%match(m) )
+             c_interception   = c_in_p10( lsm_to_depo_h%match(m) )
+             c_turb_impaction = c_it_p10( lsm_to_depo_h%match(m) )
+             gamma            = gamma_z01( lsm_to_depo_h%match(m) )
+             par_a            = A_z01( lsm_to_depo_h%match(m), season ) * 1.0E-3_wp
+             par_l            = l_p10( lsm_to_depo_h%match(m) ) * 0.01_wp
+          ENDIF
+       ELSE
+          norm_fac = 0.0_wp
+          IF ( land_surface )  THEN
+             alpha            = alpha_z01( lsm_to_depo_v(l)%match(m) )
+             beta_im          = beta_im_p10( lsm_to_depo_v(l)%match(m) )
+             c_brownian_diff  = c_b_p10( lsm_to_depo_v(l)%match(m) )
+             c_impaction      = c_im_p10( lsm_to_depo_v(l)%match(m) )
+             c_interception   = c_in_p10( lsm_to_depo_v(l)%match(m) )
+             c_turb_impaction = c_it_p10( lsm_to_depo_v(l)%match(m) )
+             gamma            = gamma_z01( lsm_to_depo_v(l)%match(m) )
+             par_a            = A_z01( lsm_to_depo_v(l)%match(m), season ) * 1.0E-3_wp
+             par_l            = l_p10( lsm_to_depo_v(l)%match(m) ) * 0.01_wp
+          ENDIF
+       ENDIF
+
+       DO  ib = 1, nbins_aerosol
+          IF ( aerosol_number(ib)%conc(k,j,i) <= nclim  .OR.  schmidt_num(k+1,ib) < 1.0_wp )  CYCLE
+
+          IF ( depo_surf_par == 'zhang2001' )  THEN
+!
 !--          Stokes number for smooth surfaces or surfaces with bluff roughness
-!--          elements (Seinfeld and Pandis, 2nd edition (2006): Eq. 19.23)       
-             St = MAX( 0.01_wp, vc(k+1,b) * surf%us(m) ** 2.0_wp /             &
-                       ( g * kvis(k+1)  ) ) 
-!          
-!--          The overall quasi-laminar resistance for particles (Eq. 5)        
-             rt = MAX( EPSILON( 1.0_wp ), ( 3.0_wp * surf%us(m) * (            &
-                       Sc(k+1,b)**( -gamma ) + ( St / ( alpha + St ) )**2.0_wp &
-                        + 0.5_wp * ( Ra_dry(k,j,i,b) / par_A )**2.0_wp ) *     &
-                       EXP( -St**0.5_wp ) ) ) 
-             depo = vc(k+1,b) + rt
-             
-          ELSEIF ( depo_topo_type == 'petroff2010' )  THEN 
-!
-!--          vd = v_BD + v_IN + v_IM + v_IT + vc 
-!--          Deposition efficiencies from Table 1. Constants from Table 2.
-             C_Br  = 1.262_wp
-             C_IM  = 0.130_wp
-             C_IN  = 0.216_wp
-             C_IT  = 0.056_wp
-             par_A = 0.03_wp   ! Here: leaf width (m)  
-!       
+!--          elements (Seinfeld and Pandis, 2nd edition (2006): Eq. 19.23)
+             stokes_num = MAX( 0.01_wp, vc(k+1,ib) * surf%us(m)**2 / ( g * kvis(k+1)  ) )
+!
+!--          The overall quasi-laminar resistance for particles (Eq. 5)
+             rs = MAX( EPSILON( 1.0_wp ), ( 3.0_wp * surf%us(m) * ( schmidt_num(k+1,ib)**( -gamma )&
+                       + ( stokes_num / ( alpha + stokes_num ) )**2 + 0.5_wp * ( ra_dry(k,j,i,ib) /&
+                       par_a )**2 ) * EXP( -stokes_num**0.5_wp ) ) )
+             depo = vc(k+1,ib) + rs
+
+          ELSEIF ( depo_surf_par == 'petroff2010' )  THEN 
+!
+!--          vd = v_BD + v_IN + v_IM + v_IT + vc
+!
 !--          Stokes number for smooth surfaces or surfaces with bluff roughness
-!--          elements (Seinfeld and Pandis, 2nd edition (2006): Eq. 19.23)       
-             St = MAX( 0.01_wp, vc(k+1,b) * surf%us(m) ** 2.0_wp /             &
-                       ( g *  kvis(k+1) ) )              
+!--          elements (Seinfeld and Pandis, 2nd edition (2006): Eq. 19.23)
+             stokes_num = MAX( 0.01_wp, vc(k+1,ib) * surf%us(m)**2 / ( g *  kvis(k+1) ) )
 !
 !--          Non-dimensional relexation time of the particle on top of canopy
-             tau_plus = vc(k+1,b) * surf%us(m)**2.0_wp / ( kvis(k+1) * g ) 
+             tau_plus = vc(k+1,ib) * surf%us(m)**2 / ( kvis(k+1) * g )
 !
 !--          Brownian diffusion
-             v_bd = mag_u(k+1) * C_Br * Sc(k+1,b)**( -2.0_wp / 3.0_wp ) *      &
-                    ( mag_u(k+1) * par_A / kvis(k+1) )**( -0.5_wp )
+             v_bd = mag_u(k+1) * c_brownian_diff * schmidt_num(k+1,ib)**( -0.666666_wp ) *         &
+                    ( mag_u(k+1) * par_l / kvis(k+1) )**( -0.5_wp )
 !
 !--          Interception
-             v_in = mag_u(k+1) * C_IN * Ra_dry(k,j,i,b)/ par_A * ( 2.0_wp +    &
-                    LOG( 2.0_wp * par_A / Ra_dry(k,j,i,b) ) )                     
+             v_in = mag_u(k+1) * c_interception * ra_dry(k,j,i,ib)/ par_l *                        &
+                    ( 2.0_wp + LOG( 2.0_wp * par_l / ra_dry(k,j,i,ib) ) )
 !
 !--          Impaction: Petroff (2009) Eq. 18
-             v_im = mag_u(k+1) * C_IM * ( St / ( St + 0.47_wp ) )**2.0_wp
-             
+             v_im = mag_u(k+1) * c_impaction * ( stokes_num / ( stokes_num + beta_im ) )**2
+
              IF ( tau_plus < 20.0_wp )  THEN
-                v_it = 2.5E-3_wp * C_IT * tau_plus**2.0_wp
+                v_it = 2.5E-3_wp * c_turb_impaction * tau_plus**2
              ELSE
-                v_it = C_IT
+                v_it = c_turb_impaction
              ENDIF
-             depo =  v_bd + v_in + v_im + v_it + vc(k+1,b)        
-          
+             depo =  v_bd + v_in + v_im + v_it + vc(k+1,ib)
+
           ENDIF
-          IF ( lod_aero == 3  .OR.  salsa_source_mode ==  'no_source' )  THEN
-             surf%answs(m,b) = -depo * norm(k) * aerosol_number(b)%conc(k,j,i) 
-             DO  c = 1, ncc_tot    
-                surf%amsws(m,(c-1)*nbins+b) = -depo *  norm(k) *               &
-                                         aerosol_mass((c-1)*nbins+b)%conc(k,j,i)
-             ENDDO    ! c
+!
+!--       Calculate changes in surface fluxes due to dry deposition
+          IF ( aero_emission_att%lod == 2  .OR.  salsa_emission_mode ==  'no_emission' )  THEN
+             surf%answs(m,ib) = -depo * norm_fac * aerosol_number(ib)%conc(k,j,i)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                surf%amsws(m,icc) = -depo *  norm_fac * aerosol_mass(icc)%conc(k,j,i)
+             ENDDO    ! ic
           ELSE
-             surf%answs(m,b) = SUM( aerosol_number(b)%source(:,j,i) ) -        &
-                               MAX( 0.0_wp, depo * norm(k) *                   &
-                               aerosol_number(b)%conc(k,j,i) )
-             DO  c = 1, ncc_tot    
-                surf%amsws(m,(c-1)*nbins+b) = SUM(                             &
-                               aerosol_mass((c-1)*nbins+b)%source(:,j,i) ) -   &
-                               MAX(  0.0_wp, depo *  norm(k) *                 &
-                               aerosol_mass((c-1)*nbins+b)%conc(k,j,i) )
-             ENDDO 
+             surf%answs(m,ib) = aerosol_number(ib)%source(j,i) -                                   &
+                                MAX( 0.0_wp, depo * norm_fac * aerosol_number(ib)%conc(k,j,i) )
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                surf%amsws(m,icc) = aerosol_mass(icc)%source(j,i) -                                &
+                                    MAX( 0.0_wp, depo *  norm_fac * aerosol_mass(icc)%conc(k,j,i) )
+             ENDDO  ! ic
           ENDIF
-       ENDDO    ! b
-    ENDDO    ! m     
-     
- END SUBROUTINE depo_topo
- 
+       ENDDO    ! ib
+    ENDDO    ! m
+
+ END SUBROUTINE depo_surf
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -3443,7 +3658,7 @@
 !------------------------------------------------------------------------------!
  REAL(wp) FUNCTION terminal_vel( radius, rhop, rhoa, visc, beta )
- 
+
     IMPLICIT NONE
-   
+
     REAL(wp), INTENT(in) ::  beta    !< Cunningham correction factor
     REAL(wp), INTENT(in) ::  radius  !< particle radius (m)
@@ -3451,12 +3666,11 @@
     REAL(wp), INTENT(in) ::  rhoa    !< air density (kg/m3)
     REAL(wp), INTENT(in) ::  visc    !< molecular viscosity of air (kg/(m*s))
-    
+
 !
 !-- Stokes law with Cunningham slip correction factor
-    terminal_vel = ( 4.0_wp * radius**2.0_wp ) * ( rhop - rhoa ) * g * beta /  &
-                   ( 18.0_wp * visc ) ! (m/s)
-        
+    terminal_vel = 4.0_wp * radius**2 * ( rhop - rhoa ) * g * beta / ( 18.0_wp * visc ) ! (m/s)
+
  END FUNCTION terminal_vel
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -3498,31 +3712,31 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE coagulation( paero, ptstep, ptemp, ppres )
-               
+
     IMPLICIT NONE
-    
-!-- Input and output variables
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b) !< Aerosol properties
-    REAL(wp), INTENT(in) ::  ppres  !< ambient pressure (Pa)
-    REAL(wp), INTENT(in) ::  ptemp  !< ambient temperature (K) 
-    REAL(wp), INTENT(in) ::  ptstep !< time step (s)
-!-- Local variables
+
     INTEGER(iwp) ::  index_2a !< corresponding bin in subrange 2a
     INTEGER(iwp) ::  index_2b !< corresponding bin in subrange 2b
-    INTEGER(iwp) ::  b !< loop index
-    INTEGER(iwp) ::  ll !< loop index
-    INTEGER(iwp) ::  mm !< loop index
-    INTEGER(iwp) ::  nn !< loop index
-    REAL(wp) ::  pressi !< pressure
-    REAL(wp) ::  temppi !< temperature
-    REAL(wp) ::  zcc(fn2b,fn2b)   !< updated coagulation coefficients (m3/s)  
-    REAL(wp) ::  zdpart_mm        !< diameter of particle (m)
-    REAL(wp) ::  zdpart_nn        !< diameter of particle (m)    
-    REAL(wp) ::  zminusterm       !< coagulation loss in a bin (1/s)
-    REAL(wp) ::  zplusterm(8)     !< coagulation gain in a bin (fxm/s)
-                                  !< (for each chemical compound)
-    REAL(wp) ::  zmpart(fn2b)     !< approximate mass of particles (kg)
-    
-    zcc       = 0.0_wp
-    zmpart    = 0.0_wp
+    INTEGER(iwp) ::  ib       !< loop index
+    INTEGER(iwp) ::  ll       !< loop index
+    INTEGER(iwp) ::  mm       !< loop index
+    INTEGER(iwp) ::  nn       !< loop index
+
+    REAL(wp) ::  pressi          !< pressure
+    REAL(wp) ::  temppi          !< temperature
+    REAL(wp) ::  zdpart_mm       !< diameter of particle (m)
+    REAL(wp) ::  zdpart_nn       !< diameter of particle (m)
+    REAL(wp) ::  zminusterm      !< coagulation loss in a bin (1/s)
+
+    REAL(wp), INTENT(in) ::  ppres  !< ambient pressure (Pa)
+    REAL(wp), INTENT(in) ::  ptemp  !< ambient temperature (K)
+    REAL(wp), INTENT(in) ::  ptstep !< time step (s)
+
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zmpart     !< approximate mass of particles (kg)
+    REAL(wp), DIMENSION(maxspec+1)     ::  zplusterm  !< coagulation gain in a bin (for each
+                                                      !< chemical compound)
+    REAL(wp), DIMENSION(nbins_aerosol,nbins_aerosol) ::  zcc  !< updated coagulation coefficients (m3/s)
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero  !< Aerosol properties
+
     zdpart_mm = 0.0_wp
     zdpart_nn = 0.0_wp
@@ -3533,8 +3747,8 @@
 
 !-- 2) Updating coagulation coefficients 
-!    
+!
 !-- Aerosol mass (kg). Density of 1500 kg/m3 assumed
-    zmpart(1:fn2b) = api6 * ( MIN( paero(1:fn2b)%dwet, 30.0E-6_wp )**3.0_wp  ) &
-                     * 1500.0_wp 
+    zmpart(1:end_subrange_2b) = api6 * ( MIN( paero(1:end_subrange_2b)%dwet, 30.0E-6_wp )**3 )     &
+                                * 1500.0_wp
     temppi = ptemp
     pressi = ppres
@@ -3542,136 +3756,131 @@
 !
 !-- Aero-aero coagulation
-    DO  mm = 1, fn2b   ! smaller colliding particle
+    DO  mm = 1, end_subrange_2b   ! smaller colliding particle
        IF ( paero(mm)%numc < nclim )  CYCLE
-       DO  nn = mm, fn2b   ! larger colliding particle
+       DO  nn = mm, end_subrange_2b   ! larger colliding particle
           IF ( paero(nn)%numc < nclim )  CYCLE
-          
+
           zdpart_mm = MIN( paero(mm)%dwet, 30.0E-6_wp )     ! Limit to 30 um
           zdpart_nn = MIN( paero(nn)%dwet, 30.0E-6_wp )     ! Limit to 30 um
-!             
+!
 !--       Coagulation coefficient of particles (m3/s)
-          zcc(mm,nn) = coagc( zdpart_mm, zdpart_nn, zmpart(mm), zmpart(nn),    &
-                              temppi, pressi )
+          zcc(mm,nn) = coagc( zdpart_mm, zdpart_nn, zmpart(mm), zmpart(nn), temppi, pressi )
           zcc(nn,mm) = zcc(mm,nn)
        ENDDO
     ENDDO
-       
-!    
+
+!
 !-- 3) New particle and volume concentrations after coagulation:
 !--    Calculated according to Jacobson (2005) eq. 15.9
 !
 !-- Aerosols in subrange 1a:
-    DO  b = in1a, fn1a
-       IF ( paero(b)%numc < nclim )  CYCLE
+    DO  ib = start_subrange_1a, end_subrange_1a
+       IF ( paero(ib)%numc < nclim )  CYCLE
        zminusterm   = 0.0_wp
        zplusterm(:) = 0.0_wp
-!       
+!
 !--    Particles lost by coagulation with larger aerosols
-       DO  ll = b+1, fn2b
-          zminusterm = zminusterm + zcc(b,ll) * paero(ll)%numc
+       DO  ll = ib+1, end_subrange_2b
+          zminusterm = zminusterm + zcc(ib,ll) * paero(ll)%numc
        ENDDO
-!       
+!
 !--    Coagulation gain in a bin: change in volume conc. (cm3/cm3):
-       DO ll = in1a, b-1
-          zplusterm(1:2) = zplusterm(1:2) + zcc(ll,b) * paero(ll)%volc(1:2)
-          zplusterm(6:7) = zplusterm(6:7) + zcc(ll,b) * paero(ll)%volc(6:7)
-          zplusterm(8)   = zplusterm(8)   + zcc(ll,b) * paero(ll)%volc(8)
+       DO ll = start_subrange_1a, ib - 1
+          zplusterm(1:2) = zplusterm(1:2) + zcc(ll,ib) * paero(ll)%volc(1:2)
+          zplusterm(6:7) = zplusterm(6:7) + zcc(ll,ib) * paero(ll)%volc(6:7)
+          zplusterm(8)   = zplusterm(8)   + zcc(ll,ib) * paero(ll)%volc(8)
        ENDDO
-!       
+!
 !--    Volume and number concentrations after coagulation update [fxm]
-       paero(b)%volc(1:2) = ( paero(b)%volc(1:2) + ptstep * zplusterm(1:2) * &
-                             paero(b)%numc ) / ( 1.0_wp + ptstep * zminusterm )
-       paero(b)%volc(6:7) = ( paero(b)%volc(6:7) + ptstep * zplusterm(6:7) * &
-                             paero(b)%numc ) / ( 1.0_wp + ptstep * zminusterm )
-       paero(b)%volc(8)   = ( paero(b)%volc(8)   + ptstep * zplusterm(8) *   &
-                             paero(b)%numc ) / ( 1.0_wp + ptstep * zminusterm )
-       paero(b)%numc = paero(b)%numc / ( 1.0_wp + ptstep * zminusterm  +     &
-                        0.5_wp * ptstep * zcc(b,b) * paero(b)%numc )               
+       paero(ib)%volc(1:2) = ( paero(ib)%volc(1:2) + ptstep * zplusterm(1:2) * paero(ib)%numc ) /  &
+                            ( 1.0_wp + ptstep * zminusterm )
+       paero(ib)%volc(6:8) = ( paero(ib)%volc(6:8) + ptstep * zplusterm(6:8) * paero(ib)%numc ) /  &
+                            ( 1.0_wp + ptstep * zminusterm )
+       paero(ib)%numc = paero(ib)%numc / ( 1.0_wp + ptstep * zminusterm + 0.5_wp * ptstep *        &
+                        zcc(ib,ib) * paero(ib)%numc )
     ENDDO
-!             
+!
 !-- Aerosols in subrange 2a:
-    DO  b = in2a, fn2a
-       IF ( paero(b)%numc < nclim )  CYCLE
+    DO  ib = start_subrange_2a, end_subrange_2a
+       IF ( paero(ib)%numc < nclim )  CYCLE
        zminusterm   = 0.0_wp
        zplusterm(:) = 0.0_wp
-!       
+!
 !--    Find corresponding size bin in subrange 2b
-       index_2b = b - in2a + in2b
-!       
+       index_2b = ib - start_subrange_2a + start_subrange_2b
+!
 !--    Particles lost by larger particles in 2a
-       DO  ll = b+1, fn2a
-          zminusterm = zminusterm + zcc(b,ll) * paero(ll)%numc 
+       DO  ll = ib+1, end_subrange_2a
+          zminusterm = zminusterm + zcc(ib,ll) * paero(ll)%numc
        ENDDO
-!       
+!
 !--    Particles lost by larger particles in 2b
        IF ( .NOT. no_insoluble )  THEN
-          DO  ll = index_2b+1, fn2b
-             zminusterm = zminusterm + zcc(b,ll) * paero(ll)%numc
+          DO  ll = index_2b+1, end_subrange_2b
+             zminusterm = zminusterm + zcc(ib,ll) * paero(ll)%numc
           ENDDO
        ENDIF
-!       
+!
 !--    Particle volume gained from smaller particles in subranges 1, 2a and 2b
-       DO  ll = in1a, b-1
-          zplusterm(1:2) = zplusterm(1:2) + zcc(ll,b) * paero(ll)%volc(1:2)
-          zplusterm(6:7) = zplusterm(6:7) + zcc(ll,b) * paero(ll)%volc(6:7)
-          zplusterm(8)   = zplusterm(8)   + zcc(ll,b) * paero(ll)%volc(8)
-       ENDDO  
-!       
+       DO  ll = start_subrange_1a, ib-1
+          zplusterm(1:2) = zplusterm(1:2) + zcc(ll,ib) * paero(ll)%volc(1:2)
+          zplusterm(6:8) = zplusterm(6:8) + zcc(ll,ib) * paero(ll)%volc(6:8)
+       ENDDO
+!
 !--    Particle volume gained from smaller particles in 2a
 !--    (Note, for components not included in the previous loop!)
-       DO  ll = in2a, b-1
-          zplusterm(3:5) = zplusterm(3:5) + zcc(ll,b)*paero(ll)%volc(3:5)             
+       DO  ll = start_subrange_2a, ib-1
+          zplusterm(3:5) = zplusterm(3:5) + zcc(ll,ib)*paero(ll)%volc(3:5)
        ENDDO
-       
-!       
+!
 !--    Particle volume gained from smaller (and equal) particles in 2b
        IF ( .NOT. no_insoluble )  THEN
-          DO  ll = in2b, index_2b
-             zplusterm(1:8) = zplusterm(1:8) + zcc(ll,b) * paero(ll)%volc(1:8)
+          DO  ll = start_subrange_2b, index_2b
+             zplusterm(1:8) = zplusterm(1:8) + zcc(ll,ib) * paero(ll)%volc(1:8)
           ENDDO
        ENDIF
-!       
+!
 !--    Volume and number concentrations after coagulation update [fxm]
-       paero(b)%volc(1:8) = ( paero(b)%volc(1:8) + ptstep * zplusterm(1:8) * &
-                             paero(b)%numc ) / ( 1.0_wp + ptstep * zminusterm )
-       paero(b)%numc = paero(b)%numc / ( 1.0_wp + ptstep * zminusterm +      &
-                        0.5_wp * ptstep * zcc(b,b) * paero(b)%numc )
+       paero(ib)%volc(1:8) = ( paero(ib)%volc(1:8) + ptstep * zplusterm(1:8) * paero(ib)%numc ) /  &
+                            ( 1.0_wp + ptstep * zminusterm )
+       paero(ib)%numc = paero(ib)%numc / ( 1.0_wp + ptstep * zminusterm + 0.5_wp * ptstep *        &
+                        zcc(ib,ib) * paero(ib)%numc )
     ENDDO
-!             
+!
 !-- Aerosols in subrange 2b:
     IF ( .NOT. no_insoluble )  THEN
-       DO  b = in2b, fn2b
-          IF ( paero(b)%numc < nclim )  CYCLE
+       DO  ib = start_subrange_2b, end_subrange_2b
+          IF ( paero(ib)%numc < nclim )  CYCLE
           zminusterm   = 0.0_wp
           zplusterm(:) = 0.0_wp
-!       
+!
 !--       Find corresponding size bin in subsubrange 2a
-          index_2a = b - in2b + in2a
-!       
+          index_2a = ib - start_subrange_2b + start_subrange_2a
+!
 !--       Particles lost to larger particles in subranges 2b
-          DO  ll = b+1, fn2b
-             zminusterm = zminusterm + zcc(b,ll) * paero(ll)%numc
+          DO  ll = ib + 1, end_subrange_2b
+             zminusterm = zminusterm + zcc(ib,ll) * paero(ll)%numc
           ENDDO
-!       
+!
 !--       Particles lost to larger and equal particles in 2a
-          DO  ll = index_2a, fn2a
-             zminusterm = zminusterm + zcc(b,ll) * paero(ll)%numc
+          DO  ll = index_2a, end_subrange_2a
+             zminusterm = zminusterm + zcc(ib,ll) * paero(ll)%numc
           ENDDO
-!       
+!
 !--       Particle volume gained from smaller particles in subranges 1 & 2a
-          DO  ll = in1a, index_2a-1
-             zplusterm(1:8) = zplusterm(1:8) + zcc(ll,b) * paero(ll)%volc(1:8)
+          DO  ll = start_subrange_1a, index_2a - 1
+             zplusterm(1:8) = zplusterm(1:8) + zcc(ll,ib) * paero(ll)%volc(1:8)
           ENDDO
-!       
+!
 !--       Particle volume gained from smaller particles in 2b
-          DO  ll = in2b, b-1
-             zplusterm(1:8) = zplusterm(1:8) + zcc(ll,b) * paero(ll)%volc(1:8)
+          DO  ll = start_subrange_2b, ib - 1
+             zplusterm(1:8) = zplusterm(1:8) + zcc(ll,ib) * paero(ll)%volc(1:8)
           ENDDO
-!       
+!
 !--       Volume and number concentrations after coagulation update [fxm]
-          paero(b)%volc(1:8) = ( paero(b)%volc(1:8) + ptstep * zplusterm(1:8)&
-                           * paero(b)%numc ) / ( 1.0_wp + ptstep * zminusterm )
-          paero(b)%numc = paero(b)%numc / ( 1.0_wp + ptstep * zminusterm  +  &
-                           0.5_wp * ptstep * zcc(b,b) * paero(b)%numc )
+          paero(ib)%volc(1:8) = ( paero(ib)%volc(1:8) + ptstep * zplusterm(1:8) * paero(ib)%numc ) &
+                                / ( 1.0_wp + ptstep * zminusterm )
+          paero(ib)%numc = paero(ib)%numc / ( 1.0_wp + ptstep * zminusterm + 0.5_wp * ptstep *     &
+                           zcc(ib,ib) * paero(ib)%numc )
        ENDDO
     ENDIF
@@ -3682,38 +3891,35 @@
 ! Description:
 ! ------------
-!> Calculation of coagulation coefficients. Extended version of the function 
-!> originally found in mo_salsa_init. 
-!
-!> J. Tonttila, FMI, 05/2014 
-!------------------------------------------------------------------------------! 
+!> Calculation of coagulation coefficients. Extended version of the function
+!> originally found in mo_salsa_init.
+!
+!> J. Tonttila, FMI, 05/2014
+!------------------------------------------------------------------------------!
  REAL(wp) FUNCTION coagc( diam1, diam2, mass1, mass2, temp, pres )
- 
+
     IMPLICIT NONE
-!       
-!-- Input and output variables
-    REAL(wp), INTENT(in) ::  diam1 !< diameter of colliding particle 1 (m)
-    REAL(wp), INTENT(in) ::  diam2 !< diameter of colliding particle 2 (m)
-    REAL(wp), INTENT(in) ::  mass1 !< mass of colliding particle 1 (kg)
-    REAL(wp), INTENT(in) ::  mass2 !< mass of colliding particle 2 (kg)
-    REAL(wp), INTENT(in) ::  pres  !< ambient pressure (Pa?) [fxm]
-    REAL(wp), INTENT(in) ::  temp  !< ambient temperature (K)       
-!
-!-- Local variables
-    REAL(wp) ::  fmdist !< distance of flux matching (m)   
-    REAL(wp) ::  knud_p !< particle Knudsen number
-    REAL(wp) ::  mdiam  !< mean diameter of colliding particles (m)  
-    REAL(wp) ::  mfp    !< mean free path of air molecules (m)    
-    REAL(wp) ::  visc   !< viscosity of air (kg/(m s))                   
-    REAL(wp), DIMENSION (2) ::  beta   !< Cunningham correction factor
-    REAL(wp), DIMENSION (2) ::  dfpart !< particle diffusion coefficient 
-                                       !< (m2/s)       
-    REAL(wp), DIMENSION (2) ::  diam   !< diameters of particles (m)
-    REAL(wp), DIMENSION (2) ::  flux   !< flux in continuum and free molec. 
-                                       !< regime (m/s)       
-    REAL(wp), DIMENSION (2) ::  knud   !< particle Knudsen number        
-    REAL(wp), DIMENSION (2) ::  mpart  !< masses of particles (kg)
-    REAL(wp), DIMENSION (2) ::  mtvel  !< particle mean thermal velocity (m/s)
-    REAL(wp), DIMENSION (2) ::  omega  !< particle mean free path             
-    REAL(wp), DIMENSION (2) ::  tva    !< temporary variable (m)       
+
+    REAL(wp) ::  fmdist  !< distance of flux matching (m)
+    REAL(wp) ::  knud_p  !< particle Knudsen number
+    REAL(wp) ::  mdiam   !< mean diameter of colliding particles (m)
+    REAL(wp) ::  mfp     !< mean free path of air molecules (m)
+    REAL(wp) ::  visc    !< viscosity of air (kg/(m s))
+
+    REAL(wp), INTENT(in) ::  diam1  !< diameter of colliding particle 1 (m)
+    REAL(wp), INTENT(in) ::  diam2  !< diameter of colliding particle 2 (m)
+    REAL(wp), INTENT(in) ::  mass1  !< mass of colliding particle 1 (kg)
+    REAL(wp), INTENT(in) ::  mass2  !< mass of colliding particle 2 (kg)
+    REAL(wp), INTENT(in) ::  pres   !< ambient pressure (Pa?) [fxm]
+    REAL(wp), INTENT(in) ::  temp   !< ambient temperature (K)
+
+    REAL(wp), DIMENSION (2) ::  beta    !< Cunningham correction factor
+    REAL(wp), DIMENSION (2) ::  dfpart  !< particle diffusion coefficient (m2/s)
+    REAL(wp), DIMENSION (2) ::  diam    !< diameters of particles (m)
+    REAL(wp), DIMENSION (2) ::  flux    !< flux in continuum and free molec. regime (m/s)
+    REAL(wp), DIMENSION (2) ::  knud    !< particle Knudsen number
+    REAL(wp), DIMENSION (2) ::  mpart   !< masses of particles (kg)
+    REAL(wp), DIMENSION (2) ::  mtvel   !< particle mean thermal velocity (m/s)
+    REAL(wp), DIMENSION (2) ::  omega   !< particle mean free path
+    REAL(wp), DIMENSION (2) ::  tva     !< temporary variable (m)
 !
 !-- Initialisation
@@ -3723,53 +3929,56 @@
     diam  = (/ diam1, diam2 /) !< particle diameters (m)
     mpart = (/ mass1, mass2 /) !< particle masses (kg)
-!-- Viscosity of air (kg/(m s))       
-    visc = ( 7.44523E-3_wp * temp ** 1.5_wp ) /                                &
-           ( 5093.0_wp * ( temp + 110.4_wp ) ) 
-!-- Mean free path of air (m)            
+!
+!-- Viscosity of air (kg/(m s))
+    visc = ( 7.44523E-3_wp * temp ** 1.5_wp ) / ( 5093.0_wp * ( temp + 110.4_wp ) )
+!
+!-- Mean free path of air (m)
     mfp = ( 1.656E-10_wp * temp + 1.828E-8_wp ) * ( p_0 + 1325.0_wp ) / pres
 !
 !-- 2) Slip correction factor for small particles 
     knud = 2.0_wp * EXP( LOG(mfp) - LOG(diam) )! Knudsen number for air (15.23)
-!-- Cunningham correction factor (Allen and Raabe, Aerosol Sci. Tech. 4, 269)       
+!
+!-- Cunningham correction factor (Allen and Raabe, Aerosol Sci. Tech. 4, 269)
     beta = 1.0_wp + knud * ( 1.142_wp + 0.558_wp * EXP( -0.999_wp / knud ) )
 !
 !-- 3) Particle properties
 !-- Diffusion coefficient (m2/s) (Jacobson (2005) eq. 15.29)
-    dfpart = beta * abo * temp / ( 3.0_wp * pi * visc * diam ) 
+    dfpart = beta * abo * temp / ( 3.0_wp * pi * visc * diam )
+!
 !-- Mean thermal velocity (m/s) (Jacobson (2005) eq. 15.32)
     mtvel = SQRT( ( 8.0_wp * abo * temp ) / ( pi * mpart ) )
+!
 !-- Particle mean free path (m) (Jacobson (2005) eq. 15.34 )
-    omega = 8.0_wp * dfpart / ( pi * mtvel ) 
+    omega = 8.0_wp * dfpart / ( pi * mtvel )
+!
 !-- Mean diameter (m)
     mdiam = 0.5_wp * ( diam(1) + diam(2) )
 !
-!-- 4) Calculation of fluxes (Brownian collision kernels) and flux matching 
+!-- 4) Calculation of fluxes (Brownian collision kernels) and flux matching
 !-- following Jacobson (2005):
+!
 !-- Flux in continuum regime (m3/s) (eq. 15.28)
     flux(1) = 4.0_wp * pi * mdiam * ( dfpart(1) + dfpart(2) )
+!
 !-- Flux in free molec. regime (m3/s) (eq. 15.31)
-    flux(2) = pi * SQRT( ( mtvel(1)**2.0_wp ) + ( mtvel(2)**2.0_wp ) ) *      &
-              ( mdiam**2.0_wp )
+    flux(2) = pi * SQRT( ( mtvel(1)**2 ) + ( mtvel(2)**2 ) ) * ( mdiam**2 )
+!
 !-- temporary variables (m) to calculate flux matching distance (m)
-    tva(1) = ( ( mdiam + omega(1) )**3.0_wp - ( mdiam**2.0_wp +                &
-               omega(1)**2.0_wp ) * SQRT( ( mdiam**2.0_wp + omega(1)**2.0_wp ) &
-               ) ) / ( 3.0_wp * mdiam * omega(1) ) - mdiam
-    tva(2) = ( ( mdiam + omega(2) )**3.0_wp - ( mdiam**2.0_wp +                &
-               omega(2)**2.0_wp ) * SQRT( ( mdiam**2 + omega(2)**2 ) ) ) /     &
-             ( 3.0_wp * mdiam * omega(2) ) - mdiam
-!-- Flux matching distance (m) i.e. the mean distance from the centre of a 
-!-- sphere reached by particles leaving sphere's surface and travelling a 
-!-- distance of particle mean free path mfp (eq. 15 34)                 
-    fmdist = SQRT( tva(1)**2 + tva(2)**2.0_wp) 
-!
-!-- 5) Coagulation coefficient (m3/s) (eq. 15.33). Here assumed 
-!-- coalescence efficiency 1!!
-    coagc = flux(1) / ( mdiam / ( mdiam + fmdist) + flux(1) / flux(2) ) 
-!-- coagulation coefficient = coalescence efficiency * collision kernel
-!
-!-- Corrected collision kernel following Karl et al., 2016 (ACP):
-!-- Inclusion of van der Waals and viscous forces
+    tva(1) = ( ( mdiam + omega(1) )**3 - ( mdiam**2 + omega(1)**2 ) * SQRT( ( mdiam**2 +           &
+               omega(1)**2 ) ) ) / ( 3.0_wp * mdiam * omega(1) ) - mdiam
+    tva(2) = ( ( mdiam + omega(2) )**3 - ( mdiam**2 + omega(2)**2 ) * SQRT( ( mdiam**2 +           &
+               omega(2)**2 ) ) ) / ( 3.0_wp * mdiam * omega(2) ) - mdiam
+!
+!-- Flux matching distance (m): the mean distance from the centre of a sphere reached by particles
+!-- that leave sphere's surface and travel a distance of particle mean free path (eq. 15.34)
+    fmdist = SQRT( tva(1)**2 + tva(2)**2 )
+!
+!-- 5) Coagulation coefficient = coalescence efficiency * collision kernel (m3/s) (eq. 15.33). 
+!--    Here assumed coalescence efficiency 1!!
+    coagc = flux(1) / ( mdiam / ( mdiam + fmdist) + flux(1) / flux(2) )
+!
+!-- Corrected collision kernel (Karl et al., 2016 (ACP)): Include van der Waals and viscous forces
     IF ( van_der_waals_coagc )  THEN
-       knud_p = SQRT( omega(1)**2 + omega(2)**2 ) / mdiam   
+       knud_p = SQRT( omega(1)**2 + omega(2)**2 ) / mdiam
        IF ( knud_p >= 0.1_wp  .AND.  knud_p <= 10.0_wp )  THEN
           coagc = coagc * ( 2.0_wp + 0.4_wp * LOG( knud_p ) )
@@ -3778,8 +3987,8 @@
        ENDIF
     ENDIF
-    
+
  END FUNCTION coagc
- 
-!------------------------------------------------------------------------------!    
+
+!------------------------------------------------------------------------------!
 ! Description:
 ! ------------
@@ -3799,80 +4008,73 @@
 !> D = {1.d-7*sqrt(1/M_air + 1/M_gas)*T^1.75} / &
 !      {p_atm/p_stand * (d_air^(1/3) + d_gas^(1/3))^2 }
-! M_air = 28.965 : molar mass of air (g/mol)
-! d_air = 19.70  : diffusion volume of air
-! M_h2so4 = 98.08 : molar mass of h2so4 (g/mol)
-! d_h2so4 = 51.96  : diffusion volume of h2so4 
+!> M_air = 28.965 : molar mass of air (g/mol)
+!> d_air = 19.70  : diffusion volume of air
+!> M_h2so4 = 98.08 : molar mass of h2so4 (g/mol)
+!> d_h2so4 = 51.96  : diffusion volume of h2so4 
 !
 !> Called from main aerosol model
-!
-!> fxm: calculated for empty bins too
-!> fxm: same diffusion coefficients and mean free paths used for sulphuric acid
-!>      and organic vapours (average values? 'real' values for each?)
-!> fxm: one should really couple with vapour production and loss terms as well
-!>      should nucleation be coupled here as well????
-!
-! Coded by:
-! Hannele Korhonen (FMI) 2005
-! Harri Kokkola (FMI) 2006
-! Juha Tonttila (FMI) 2014
-! Rewritten to PALM by Mona Kurppa (UHel) 2017
-!------------------------------------------------------------------------------!
- SUBROUTINE condensation( paero, pcsa, pcocnv, pcocsv, pchno3, pcnh3, pcw, pcs,&
-                          ptemp, ppres, ptstep, prtcl )
-        
+!> For equations, see Jacobson, Fundamentals of Atmospheric Modeling, 2nd Edition (2005)
+!
+!> Coded by:
+!> Hannele Korhonen (FMI) 2005
+!> Harri Kokkola (FMI) 2006
+!> Juha Tonttila (FMI) 2014
+!> Rewritten to PALM by Mona Kurppa (UHel) 2017
+!------------------------------------------------------------------------------!
+ SUBROUTINE condensation( paero, pc_sa, pc_ocnv, pcocsv, pchno3, pc_nh3, pcw, pcs, ptemp, ppres,   &
+                          ptstep, prtcl )
+
     IMPLICIT NONE
-    
-!-- Input and output variables
-    REAL(wp), INTENT(IN) ::  ppres !< ambient pressure (Pa)
-    REAL(wp), INTENT(IN) ::  pcs   !< Water vapour saturation concentration 
-                                   !< (kg/m3)      
-    REAL(wp), INTENT(IN) ::  ptemp !< ambient temperature (K)
-    REAL(wp), INTENT(IN) ::  ptstep            !< timestep (s)  
-    TYPE(component_index), INTENT(in) :: prtcl !< Keeps track which substances
-                                               !< are used                                               
-    REAL(wp), INTENT(INOUT) ::  pchno3 !< Gas concentrations (#/m3):
-                                       !< nitric acid HNO3
-    REAL(wp), INTENT(INOUT) ::  pcnh3  !< ammonia NH3
-    REAL(wp), INTENT(INOUT) ::  pcocnv !< non-volatile organics
-    REAL(wp), INTENT(INOUT) ::  pcocsv !< semi-volatile organics
-    REAL(wp), INTENT(INOUT) ::  pcsa   !< sulphuric acid H2SO4
-    REAL(wp), INTENT(INOUT) ::  pcw    !< Water vapor concentration (kg/m3) 
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b) !< Aerosol properties                                      
-!-- Local variables 
-    REAL(wp) ::  zbeta(fn2b) !< transitional correction factor for aerosols
-    REAL(wp) ::  zcolrate(fn2b) !< collision rate of molecules to particles 
-                                !< (1/s)
-    REAL(wp) ::  zcolrate_ocnv(fn2b) !< collision rate of organic molecules 
-                                     !< to particles (1/s)
-    REAL(wp) ::  zcs_ocnv !< condensation sink of nonvolatile organics (1/s)       
-    REAL(wp) ::  zcs_ocsv !< condensation sink of semivolatile organics (1/s)
-    REAL(wp) ::  zcs_su !< condensation sink of sulfate (1/s)
-    REAL(wp) ::  zcs_tot!< total condensation sink (1/s) (gases) 
-!-- vapour concentration after time step (#/m3)
-    REAL(wp) ::  zcvap_new1 !< sulphuric acid
-    REAL(wp) ::  zcvap_new2 !< nonvolatile organics
-    REAL(wp) ::  zcvap_new3 !< semivolatile organics
-    REAL(wp) ::  zdfpart(in1a+1) !< particle diffusion coefficient (m2/s)     
-    REAL(wp) ::  zdfvap !< air diffusion coefficient (m2/s)
-!-- change in vapour concentration (#/m3)
-    REAL(wp) ::  zdvap1 !< sulphuric acid
-    REAL(wp) ::  zdvap2 !< nonvolatile organics
-    REAL(wp) ::  zdvap3 !< semivolatile organics 
-    REAL(wp) ::  zdvoloc(fn2b) !< change of organics volume in each bin [fxm]    
-    REAL(wp) ::  zdvolsa(fn2b) !< change of sulphate volume in each bin [fxm]
-    REAL(wp) ::  zj3n3(2)      !< Formation massrate of molecules in 
-                               !< nucleation, (molec/m3s). 1: H2SO4
-                               !< and 2: organic vapor       
-    REAL(wp) ::  zknud(fn2b) !< particle Knudsen number       
-    REAL(wp) ::  zmfp    !< mean free path of condensing vapour (m)
-    REAL(wp) ::  zrh     !< Relative humidity [0-1]         
-    REAL(wp) ::  zvisc   !< viscosity of air (kg/(m s))     
-    REAL(wp) ::  zn_vs_c !< ratio of nucleation of all mass transfer in the 
-                         !< smallest bin
-    REAL(wp) ::  zxocnv  !< ratio of organic vapour in 3nm particles 
-    REAL(wp) ::  zxsa    !< Ratio in 3nm particles: sulphuric acid
-    
+
+    INTEGER(iwp) ::  ss      !< start index
+    INTEGER(iwp) ::  ee      !< end index
+
+    REAL(wp) ::  zcs_ocnv    !< condensation sink of nonvolatile organics (1/s)
+    REAL(wp) ::  zcs_ocsv    !< condensation sink of semivolatile organics (1/s)
+    REAL(wp) ::  zcs_su      !< condensation sink of sulfate (1/s)
+    REAL(wp) ::  zcs_tot     !< total condensation sink (1/s) (gases)
+    REAL(wp) ::  zcvap_new1  !< vapour concentration after time step (#/m3): sulphuric acid
+    REAL(wp) ::  zcvap_new2  !< nonvolatile organics
+    REAL(wp) ::  zcvap_new3  !< semivolatile organics
+    REAL(wp) ::  zdfvap      !< air diffusion coefficient (m2/s)
+    REAL(wp) ::  zdvap1      !< change in vapour concentration (#/m3): sulphuric acid
+    REAL(wp) ::  zdvap2      !< nonvolatile organics
+    REAL(wp) ::  zdvap3      !< semivolatile organics
+    REAL(wp) ::  zmfp        !< mean free path of condensing vapour (m)
+    REAL(wp) ::  zrh         !< Relative humidity [0-1]
+    REAL(wp) ::  zvisc       !< viscosity of air (kg/(m s))
+    REAL(wp) ::  zn_vs_c     !< ratio of nucleation of all mass transfer in the smallest bin
+    REAL(wp) ::  zxocnv      !< ratio of organic vapour in 3nm particles
+    REAL(wp) ::  zxsa        !< Ratio in 3nm particles: sulphuric acid
+
+    REAL(wp), INTENT(in) ::  ppres   !< ambient pressure (Pa)
+    REAL(wp), INTENT(in) ::  pcs     !< Water vapour saturation concentration (kg/m3)
+    REAL(wp), INTENT(in) ::  ptemp   !< ambient temperature (K)
+    REAL(wp), INTENT(in) ::  ptstep  !< timestep (s)
+
+    REAL(wp), INTENT(inout) ::  pchno3   !< Gas concentrations (#/m3): nitric acid HNO3
+    REAL(wp), INTENT(inout) ::  pc_nh3   !< ammonia NH3
+    REAL(wp), INTENT(inout) ::  pc_ocnv  !< non-volatile organics
+    REAL(wp), INTENT(inout) ::  pcocsv   !< semi-volatile organics
+    REAL(wp), INTENT(inout) ::  pc_sa    !< sulphuric acid H2SO4
+    REAL(wp), INTENT(inout) ::  pcw      !< Water vapor concentration (kg/m3)
+
+    REAL(wp), DIMENSION(nbins_aerosol)               ::  zbeta          !< transitional correction factor
+    REAL(wp), DIMENSION(nbins_aerosol)               ::  zcolrate       !< collision rate (1/s)
+    REAL(wp), DIMENSION(nbins_aerosol)               ::  zcolrate_ocnv  !< collision rate of non-vol. OC (1/s)
+    REAL(wp), DIMENSION(start_subrange_1a+1) ::  zdfpart        !< particle diffusion coefficient (m2/s)
+    REAL(wp), DIMENSION(nbins_aerosol)               ::  zdvoloc        !< change of organics volume
+    REAL(wp), DIMENSION(nbins_aerosol)               ::  zdvolsa        !< change of sulphate volume
+    REAL(wp), DIMENSION(2)                   ::  zj3n3          !< Formation massrate of molecules
+                                                                !< in nucleation, (molec/m3s),
+                                                                !< 1: H2SO4 and 2: organic vapor
+    REAL(wp), DIMENSION(nbins_aerosol)   ::  zknud          !< particle Knudsen number
+
+    TYPE(component_index), INTENT(in) :: prtcl  !< Keeps track which substances are used
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero  !< Aerosol properties
+
     zj3n3  = 0.0_wp
-    zrh    = pcw / pcs    
+    zrh    = pcw / pcs
     zxocnv = 0.0_wp
     zxsa   = 0.0_wp
@@ -3880,6 +4082,6 @@
 !-- Nucleation
     IF ( nsnucl > 0 )  THEN
-       CALL nucleation( paero, ptemp, zrh, ppres, pcsa, pcocnv, pcnh3, ptstep, &
-                        zj3n3, zxsa, zxocnv )
+       CALL nucleation( paero, ptemp, zrh, ppres, pc_sa, pc_ocnv, pc_nh3, ptstep, zj3n3, zxsa,     &
+                        zxocnv )
     ENDIF
 !
@@ -3888,51 +4090,52 @@
 !
 !--    Initialise:
-       zdvolsa = 0.0_wp  
+       zdvolsa = 0.0_wp
        zdvoloc = 0.0_wp
        zcolrate = 0.0_wp
-!             
+!
 !--    1) Properties of air and condensing gases:
 !--    Viscosity of air (kg/(m s)) (Eq. 4.54 in Jabonson (2005))
-       zvisc = ( 7.44523E-3_wp * ptemp ** 1.5_wp ) / ( 5093.0_wp *             &
-                 ( ptemp + 110.4_wp ) )
+       zvisc = ( 7.44523E-3_wp * ptemp ** 1.5_wp ) / ( 5093.0_wp * ( ptemp + 110.4_wp ) )
+!
 !--    Diffusion coefficient of air (m2/s)
-       zdfvap = 5.1111E-10_wp * ptemp ** 1.75_wp * ( p_0 + 1325.0_wp ) / ppres 
+       zdfvap = 5.1111E-10_wp * ptemp ** 1.75_wp * ( p_0 + 1325.0_wp ) / ppres
+!
 !--    Mean free path (m): same for H2SO4 and organic compounds
        zmfp = 3.0_wp * zdfvap * SQRT( pi * amh2so4 / ( 8.0_wp * argas * ptemp ) )
-!                    
-!--    2) Transition regime correction factor zbeta for particles:
-!--       Fuchs and Sutugin (1971), In: Hidy et al. (ed.) Topics in current 
-!--       aerosol research, Pergamon. Size of condensing molecule considered  
-!--       only for nucleation mode (3 - 20 nm)
-!
-!--    Particle Knudsen number: condensation of gases on aerosols 
-       zknud(in1a:in1a+1) = 2.0_wp * zmfp / ( paero(in1a:in1a+1)%dwet + d_sa )
-       zknud(in1a+2:fn2b) = 2.0_wp * zmfp / paero(in1a+2:fn2b)%dwet
-!    
-!--    Transitional correction factor: aerosol + gas (the semi-empirical Fuchs-
-!--    Sutugin interpolation function (Fuchs and Sutugin, 1971))
-       zbeta = ( zknud + 1.0_wp ) / ( 0.377_wp * zknud + 1.0_wp + 4.0_wp /     &
-               ( 3.0_wp * massacc ) * ( zknud + zknud ** 2.0_wp ) )
-!                   
+!
+!--    2) Transition regime correction factor zbeta for particles (Fuchs and Sutugin (1971)):
+!--       Size of condensing molecule considered only for nucleation mode (3 - 20 nm).
+!
+!--    Particle Knudsen number: condensation of gases on aerosols
+       ss = start_subrange_1a
+       ee = start_subrange_1a+1
+       zknud(ss:ee) = 2.0_wp * zmfp / ( paero(ss:ee)%dwet + d_sa )
+       ss = start_subrange_1a+2
+       ee = end_subrange_2b
+       zknud(ss:ee) = 2.0_wp * zmfp / paero(ss:ee)%dwet
+!
+!--    Transitional correction factor: aerosol + gas (the semi-empirical Fuchs- Sutugin 
+!--    interpolation function (Fuchs and Sutugin, 1971))
+       zbeta = ( zknud + 1.0_wp ) / ( 0.377_wp * zknud + 1.0_wp + 4.0_wp / ( 3.0_wp * massacc ) *  &
+               ( zknud + zknud ** 2 ) )
+!
 !--    3) Collision rate of molecules to particles
-!--       Particle diffusion coefficient considered only for nucleation mode 
-!--       (3 - 20 nm)
+!--       Particle diffusion coefficient considered only for nucleation mode (3 - 20 nm)
 !
 !--    Particle diffusion coefficient (m2/s) (e.g. Eq. 15.29 in Jacobson (2005))
-       zdfpart = abo * ptemp * zbeta(in1a:in1a+1) / ( 3.0_wp * pi * zvisc *    &
-                 paero(in1a:in1a+1)%dwet )
-!              
-!--    Collision rate (mass-transfer coefficient): gases on aerosols (1/s) 
-!--    (Eq. 16.64 in Jacobson (2005))
-       zcolrate(in1a:in1a+1) = MERGE( 2.0_wp * pi *                            &
-                                      ( paero(in1a:in1a+1)%dwet + d_sa ) *     &
-                                      ( zdfvap + zdfpart ) * zbeta(in1a:in1a+1)& 
-                                        * paero(in1a:in1a+1)%numc, 0.0_wp,     &
-                                      paero(in1a:in1a+1)%numc > nclim )
-       zcolrate(in1a+2:fn2b) = MERGE( 2.0_wp * pi * paero(in1a+2:fn2b)%dwet *  &
-                                      zdfvap * zbeta(in1a+2:fn2b) *            &
-                                      paero(in1a+2:fn2b)%numc, 0.0_wp,         &
-                                      paero(in1a+2:fn2b)%numc > nclim )
-!                  
+       zdfpart = abo * ptemp * zbeta(start_subrange_1a:start_subrange_1a+1) / ( 3.0_wp * pi * zvisc&
+                 * paero(start_subrange_1a:start_subrange_1a+1)%dwet)
+!
+!--    Collision rate (mass-transfer coefficient): gases on aerosols (1/s) (Eq. 16.64 in 
+!--    Jacobson (2005))
+       ss = start_subrange_1a
+       ee = start_subrange_1a+1
+       zcolrate(ss:ee) = MERGE( 2.0_wp * pi * ( paero(ss:ee)%dwet + d_sa ) * ( zdfvap + zdfpart ) *&
+                               zbeta(ss:ee) * paero(ss:ee)%numc, 0.0_wp, paero(ss:ee)%numc > nclim )
+       ss = start_subrange_1a+2
+       ee = end_subrange_2b
+       zcolrate(ss:ee) = MERGE( 2.0_wp * pi * paero(ss:ee)%dwet * zdfvap * zbeta(ss:ee) *          &
+                                paero(ss:ee)%numc, 0.0_wp, paero(ss:ee)%numc > nclim )
+!
 !-- 4) Condensation sink (1/s)
        zcs_tot = SUM( zcolrate )   ! total sink
@@ -3943,117 +4146,114 @@
 !
 !--    5.1.1) Non-volatile organic compound: condenses onto all bins
-       IF ( pcocnv > 1.0E+10_wp  .AND.  zcs_tot > 1.0E-30_wp  .AND.            &
-            is_used( prtcl,'OC' ) )                                            &
+       IF ( pc_ocnv > 1.0E+10_wp  .AND.  zcs_tot > 1.0E-30_wp  .AND. index_oc > 0 )  &
        THEN
-!--       Ratio of nucleation vs. condensation rates in the smallest bin    
-          zn_vs_c = 0.0_wp  
+!--       Ratio of nucleation vs. condensation rates in the smallest bin
+          zn_vs_c = 0.0_wp
           IF ( zj3n3(2) > 1.0_wp )  THEN
-             zn_vs_c = ( zj3n3(2) ) / ( zj3n3(2) + pcocnv * zcolrate(in1a) )
+             zn_vs_c = ( zj3n3(2) ) / ( zj3n3(2) + pc_ocnv * zcolrate(start_subrange_1a) )
           ENDIF
-!       
-!--       Collision rate in the smallest bin, including nucleation and 
-!--       condensation(see Jacobson, Fundamentals of Atmospheric Modeling, 2nd 
-!--       Edition (2005), equation (16.73) )
+!
+!--       Collision rate in the smallest bin, including nucleation and condensation (see
+!--       Jacobson (2005), eq. (16.73) )
           zcolrate_ocnv = zcolrate
-          zcolrate_ocnv(in1a) = zcolrate_ocnv(in1a) + zj3n3(2) / pcocnv
-!       
+          zcolrate_ocnv(start_subrange_1a) = zcolrate_ocnv(start_subrange_1a) + zj3n3(2) / pc_ocnv
+!
 !--       Total sink for organic vapor
-          zcs_ocnv = zcs_tot + zj3n3(2) / pcocnv
-!       
+          zcs_ocnv = zcs_tot + zj3n3(2) / pc_ocnv
+!
 !--       New gas phase concentration (#/m3)
-          zcvap_new2 = pcocnv / ( 1.0_wp + ptstep * zcs_ocnv )
-!       
+          zcvap_new2 = pc_ocnv / ( 1.0_wp + ptstep * zcs_ocnv )
+!
 !--       Change in gas concentration (#/m3)
-          zdvap2 = pcocnv - zcvap_new2
-!
-!--       Updated vapour concentration (#/m3)                
-          pcocnv = zcvap_new2
-!       
+          zdvap2 = pc_ocnv - zcvap_new2
+!
+!--       Updated vapour concentration (#/m3)
+          pc_ocnv = zcvap_new2
+!
 !--       Volume change of particles (m3(OC)/m3(air))
-          zdvoloc = zcolrate_ocnv(in1a:fn2b) / zcs_ocnv * amvoc * zdvap2
-!       
+          zdvoloc = zcolrate_ocnv(start_subrange_1a:end_subrange_2b) / zcs_ocnv * amvoc * zdvap2
+!
 !--       Change of volume due to condensation in 1a-2b
-          paero(in1a:fn2b)%volc(2) = paero(in1a:fn2b)%volc(2) + zdvoloc  
-!       
-!--       Change of number concentration in the smallest bin caused by 
-!--       nucleation (Jacobson (2005), equation (16.75)). If zxocnv = 0, then  
-!--       the chosen nucleation mechanism doesn't take into account the non-
-!--       volatile organic vapors and thus the paero doesn't have to be updated.
+          paero(start_subrange_1a:end_subrange_2b)%volc(2) =                                       &
+                                          paero(start_subrange_1a:end_subrange_2b)%volc(2) + zdvoloc
+!
+!--       Change of number concentration in the smallest bin caused by nucleation (Jacobson (2005),
+!--       eq. (16.75)). If zxocnv = 0, then the chosen nucleation mechanism doesn't take into
+!--       account the non-volatile organic vapors and thus the paero doesn't have to be updated.
           IF ( zxocnv > 0.0_wp )  THEN
-             paero(in1a)%numc = paero(in1a)%numc + zn_vs_c * zdvoloc(in1a) /   &
-                                amvoc / ( n3 * zxocnv )
+             paero(start_subrange_1a)%numc = paero(start_subrange_1a)%numc + zn_vs_c *             &
+                                             zdvoloc(start_subrange_1a) / amvoc / ( n3 * zxocnv )
           ENDIF
        ENDIF
-!    
+!
 !--    5.1.2) Semivolatile organic compound: all bins except subrange 1
-       zcs_ocsv = SUM( zcolrate(in2a:fn2b) ) !< sink for semi-volatile organics
-       IF ( pcocsv > 1.0E+10_wp  .AND.  zcs_ocsv > 1.0E-30  .AND.              &
-            is_used( prtcl,'OC') )                                             &
-       THEN
+       zcs_ocsv = SUM( zcolrate(start_subrange_2a:end_subrange_2b) ) !< sink for semi-volatile organics
+       IF ( pcocsv > 1.0E+10_wp  .AND.  zcs_ocsv > 1.0E-30  .AND. is_used( prtcl,'OC') )  THEN
 !
 !--       New gas phase concentration (#/m3)
           zcvap_new3 = pcocsv / ( 1.0_wp + ptstep * zcs_ocsv )
-!       
+!
 !--       Change in gas concentration (#/m3)
           zdvap3 = pcocsv - zcvap_new3 
-!       
-!--       Updated gas concentration (#/m3)                
+!
+!--       Updated gas concentration (#/m3)
           pcocsv = zcvap_new3
-!       
+!
 !--       Volume change of particles (m3(OC)/m3(air))
-          zdvoloc(in2a:fn2b) = zdvoloc(in2a:fn2b) + zcolrate(in2a:fn2b) /      &
-                               zcs_ocsv * amvoc * zdvap3
-!                            
+          ss = start_subrange_2a
+          ee = end_subrange_2b
+          zdvoloc(ss:ee) = zdvoloc(ss:ee) + zcolrate(ss:ee) / zcs_ocsv * amvoc * zdvap3
+!
 !--       Change of volume due to condensation in 1a-2b
-          paero(in1a:fn2b)%volc(2) = paero(in1a:fn2b)%volc(2) + zdvoloc 
-       ENDIF
-!
-!-- 5.2) Sulphate: condensed on all bins
-       IF ( pcsa > 1.0E+10_wp  .AND.  zcs_tot > 1.0E-30_wp  .AND.              &
-            is_used( prtcl,'SO4' ) )                                           &
-       THEN
-!    
+          paero(start_subrange_1a:end_subrange_2b)%volc(2) =                                       &
+                                          paero(start_subrange_1a:end_subrange_2b)%volc(2) + zdvoloc
+       ENDIF
+!
+!--    5.2) Sulphate: condensed on all bins
+       IF ( pc_sa > 1.0E+10_wp  .AND.  zcs_tot > 1.0E-30_wp  .AND.  index_so4 > 0 )  THEN
+!
 !--    Ratio of mass transfer between nucleation and condensation
           zn_vs_c = 0.0_wp
           IF ( zj3n3(1) > 1.0_wp )  THEN
-             zn_vs_c = ( zj3n3(1) ) / ( zj3n3(1) + pcsa * zcolrate(in1a) )
+             zn_vs_c = ( zj3n3(1) ) / ( zj3n3(1) + pc_sa * zcolrate(start_subrange_1a) )
           ENDIF
-!       
-!--       Collision rate in the smallest bin, including nucleation and 
-!--       condensation (see Jacobson, Fundamentals of Atmospheric Modeling, 2nd 
-!--       Edition (2005), equation (16.73))
-          zcolrate(in1a) = zcolrate(in1a) + zj3n3(1) / pcsa     
-!       
+!
+!--       Collision rate in the smallest bin, including nucleation and condensation (see
+!--       Jacobson (2005), eq. (16.73))
+          zcolrate(start_subrange_1a) = zcolrate(start_subrange_1a) + zj3n3(1) / pc_sa
+!
 !--       Total sink for sulfate (1/s)
-          zcs_su = zcs_tot + zj3n3(1) / pcsa
-!       
+          zcs_su = zcs_tot + zj3n3(1) / pc_sa
+!
 !--       Sulphuric acid:
 !--       New gas phase concentration (#/m3)
-          zcvap_new1 = pcsa / ( 1.0_wp + ptstep * zcs_su )
-!       
+          zcvap_new1 = pc_sa / ( 1.0_wp + ptstep * zcs_su )
+!
 !--       Change in gas concentration (#/m3)
-          zdvap1 = pcsa - zcvap_new1
-!       
+          zdvap1 = pc_sa - zcvap_new1
+!
 !--       Updating vapour concentration (#/m3)
-          pcsa = zcvap_new1
-!       
+          pc_sa = zcvap_new1
+!
 !--       Volume change of particles (m3(SO4)/m3(air)) by condensation
-          zdvolsa = zcolrate(in1a:fn2b) / zcs_su * amvh2so4 * zdvap1
-!--       For validation: zdvolsa = 5.5 mum3/cm3 per 12 h       
-       !   zdvolsa = zdvolsa / SUM( zdvolsa ) * 5.5E-12_wp * dt_salsa / 43200.0_wp  
-          !0.3E-12_wp, 0.6E-12_wp, 11.0E-12_wp, 4.6E-12_wp, 9.2E-12_wp    
-!       
+          zdvolsa = zcolrate(start_subrange_1a:end_subrange_2b) / zcs_su * amvh2so4 * zdvap1
+!
 !--       Change of volume concentration of sulphate in aerosol [fxm]
-          paero(in1a:fn2b)%volc(1) = paero(in1a:fn2b)%volc(1) + zdvolsa
-!       
+          paero(start_subrange_1a:end_subrange_2b)%volc(1) =                                       &
+                                          paero(start_subrange_1a:end_subrange_2b)%volc(1) + zdvolsa
+!
 !--       Change of number concentration in the smallest bin caused by nucleation
 !--       (Jacobson (2005), equation (16.75))
           IF ( zxsa > 0.0_wp )  THEN
-             paero(in1a)%numc = paero(in1a)%numc + zn_vs_c * zdvolsa(in1a) /   &
-                                amvh2so4 / ( n3 * zxsa )
+             paero(start_subrange_1a)%numc = paero(start_subrange_1a)%numc + zn_vs_c *             &
+                                             zdvolsa(start_subrange_1a) / amvh2so4 / ( n3 * zxsa)
           ENDIF
        ENDIF
+!
+!--    Partitioning of H2O, HNO3, and NH3: Dissolutional growth
+       IF ( lspartition  .AND.  ( pchno3 > 1.0E+10_wp  .OR.  pc_nh3 > 1.0E+10_wp ) )  THEN
+          CALL gpparthno3( ppres, ptemp, paero, pchno3, pc_nh3, pcw, pcs, zbeta, ptstep )
+       ENDIF
     ENDIF
-!
 !
 !-- Condensation of water vapour
@@ -4061,16 +4261,7 @@
        CALL gpparth2o( paero, ptemp, ppres, pcs, pcw, ptstep )
     ENDIF
-!   
-!
-!-- Partitioning of H2O, HNO3, and NH3: Dissolutional growth
-    IF ( lscndgas  .AND.  ino > 0  .AND.  inh > 0  .AND.                       &
-         ( pchno3 > 1.0E+10_wp  .OR.  pcnh3 > 1.0E+10_wp ) )                   &
-    THEN
-       CALL gpparthno3( ppres, ptemp, paero, pchno3, pcnh3, pcw, pcs, zbeta,   &
-                        ptstep )
-    ENDIF
-    
+
  END SUBROUTINE condensation
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -4091,4 +4282,8 @@
 !> nj3 = 3: Anttila et al. (2010), J. Aerosol Sci., 41(7), 621-636.
 !
+!> c = aerosol of critical radius (1 nm)
+!> x = aerosol with radius 3 nm
+!> 2 = wet or mean droplet
+!
 !> Called from subroutine condensation (in module salsa_dynamics_mod.f90)
 !
@@ -4109,97 +4304,96 @@
 !------------------------------------------------------------------------------!
 
- SUBROUTINE nucleation( paero, ptemp, prh, ppres, pcsa, pcocnv, pcnh3, ptstep, &
-                        pj3n3, pxsa, pxocnv )
+ SUBROUTINE nucleation( paero, ptemp, prh, ppres, pc_sa, pc_ocnv, pc_nh3, ptstep, pj3n3, pxsa,     &
+                        pxocnv )
+
     IMPLICIT NONE
-!       
-!-- Input and output variables
-    REAL(wp), INTENT(in) ::  pcnh3    !< ammonia concentration (#/m3) 
-    REAL(wp), INTENT(in) ::  pcocnv   !< conc. of non-volatile OC (#/m3)      
-    REAL(wp), INTENT(in) ::  pcsa     !< sulphuric acid conc. (#/m3)
+
+    INTEGER(iwp) ::  iteration
+
+    REAL(wp) ::  zc_h2so4     !< H2SO4 conc. (#/cm3) !UNITS!
+    REAL(wp) ::  zc_org       !< organic vapour conc. (#/cm3)
+    REAL(wp) ::  zcc_c        !< Cunningham correct factor for c = critical (1nm)
+    REAL(wp) ::  zcc_x        !< Cunningham correct factor for x = 3nm
+    REAL(wp) ::  zcoags_c     !< coagulation sink (1/s) for c = critical (1nm)
+    REAL(wp) ::  zcoags_x     !< coagulation sink (1/s) for x = 3nm
+    REAL(wp) ::  zcoagstot    !< total particle losses due to coagulation, including condensation
+                              !< and self-coagulation
+    REAL(wp) ::  zcocnv_local !< organic vapour conc. (#/m3)
+    REAL(wp) ::  zcsink       !< condensational sink (#/m2)
+    REAL(wp) ::  zcsa_local   !< H2SO4 conc. (#/m3)
+    REAL(wp) ::  zcv_c        !< mean relative thermal velocity (m/s) for c = critical (1nm)
+    REAL(wp) ::  zcv_x        !< mean relative thermal velocity (m/s) for x = 3nm
+    REAL(wp) ::  zdcrit       !< diameter of critical cluster (m)
+    REAL(wp) ::  zdelta_vap   !< change of H2SO4 and organic vapour concentration (#/m3)
+    REAL(wp) ::  zdfvap       !< air diffusion coefficient (m2/s)
+    REAL(wp) ::  zdmean       !< mean diameter of existing particles (m) 
+    REAL(wp) ::  zeta         !< constant: proportional to ratio of CS/GR (m)
+                              !< (condensation sink / growth rate)
+    REAL(wp) ::  zgamma       !< proportionality factor ((nm2*m2)/h)
+    REAL(wp) ::  z_gr_clust   !< growth rate of formed clusters (nm/h)
+    REAL(wp) ::  z_gr_tot     !< total growth rate
+    REAL(wp) ::  zj3          !< number conc. of formed 3nm particles (#/m3)
+    REAL(wp) ::  zjnuc        !< nucleation rate at ~1nm (#/m3s)
+    REAL(wp) ::  z_k_eff      !< effective cogulation coefficient for freshly nucleated particles
+    REAL(wp) ::  zknud_c      !< Knudsen number for c = critical (1nm)
+    REAL(wp) ::  zknud_x      !< Knudsen number for x = 3nm
+    REAL(wp) ::  zkocnv       !< lever: zkocnv=1 --> organic compounds involved in nucleation
+    REAL(wp) ::  zksa         !< lever: zksa=1 --> H2SO4 involved in nucleation
+    REAL(wp) ::  zlambda      !< parameter for adjusting the growth rate due to self-coagulation
+    REAL(wp) ::  zm_c         !< particle mass (kg) for c = critical (1nm)
+    REAL(wp) ::  zm_para      !< Parameter m for calculating the coagulation sink (Eq. 5&6 in 
+                              !< Lehtinen et al. 2007)
+    REAL(wp) ::  zm_x         !< particle mass (kg) for x = 3nm
+    REAL(wp) ::  zmfp         !< mean free path of condesing vapour(m)
+    REAL(wp) ::  zmixnh3      !< ammonia mixing ratio (ppt)
+    REAL(wp) ::  zmyy         !< gas dynamic viscosity (N*s/m2)
+    REAL(wp) ::  z_n_nuc      !< number of clusters/particles at the size range d1-dx (#/m3)
+    REAL(wp) ::  znoc         !< number of organic molecules in critical cluster
+    REAL(wp) ::  znsa         !< number of H2SO4 molecules in critical cluster
+
+    REAL(wp), INTENT(in) ::  pc_nh3   !< ammonia concentration (#/m3) 
+    REAL(wp), INTENT(in) ::  pc_ocnv  !< conc. of non-volatile OC (#/m3)
+    REAL(wp), INTENT(in) ::  pc_sa    !< sulphuric acid conc. (#/m3)
     REAL(wp), INTENT(in) ::  ppres    !< ambient air pressure (Pa)
-    REAL(wp), INTENT(in) ::  prh      !< ambient rel. humidity [0-1]       
+    REAL(wp), INTENT(in) ::  prh      !< ambient rel. humidity [0-1]
     REAL(wp), INTENT(in) ::  ptemp    !< ambient temperature (K)
     REAL(wp), INTENT(in) ::  ptstep   !< time step (s) of SALSA
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b) !< aerosol properties                                                  
-    REAL(wp), INTENT(inout) ::  pj3n3(2) !< formation mass rate of molecules 
-                                         !< (molec/m3s) for 1: H2SO4 and 
-                                         !< 2: organic vapour 
-    REAL(wp), INTENT(out) ::  pxocnv !< ratio of non-volatile organic vapours in
-                                     !< 3nm aerosol particles
-    REAL(wp), INTENT(out) ::  pxsa   !< ratio of H2SO4 in 3nm aerosol particles
-!-- Local variables
-    INTEGER(iwp) ::  iteration
-    REAL(wp) ::  zbeta(fn2b)  !< transitional correction factor                                         
-    REAL(wp) ::  zc_h2so4     !< H2SO4 conc. (#/cm3) !UNITS!
-    REAL(wp) ::  zc_org       !< organic vapour conc. (#/cm3)
-    REAL(wp) ::  zCoagStot    !< total losses due to coagulation, including 
-                              !< condensation and self-coagulation       
-    REAL(wp) ::  zcocnv_local !< organic vapour conc. (#/m3) 
-    REAL(wp) ::  zcsink       !< condensational sink (#/m2)       
-    REAL(wp) ::  zcsa_local   !< H2SO4 conc. (#/m3)       
-    REAL(wp) ::  zdcrit       !< diameter of critical cluster (m)
-    REAL(wp) ::  zdelta_vap   !< change of H2SO4 and organic vapour
-                              !< concentration (#/m3)       
-    REAL(wp) ::  zdfvap       !< air diffusion coefficient (m2/s)
-    REAL(wp) ::  zdmean       !< mean diameter of existing particles (m) 
-    REAL(wp) ::  zeta         !< constant: proportional to ratio of CS/GR (m) 
-                              !< (condensation sink / growth rate)                                   
-    REAL(wp) ::  zgamma       !< proportionality factor ((nm2*m2)/h)                                        
-    REAL(wp) ::  zGRclust     !< growth rate of formed clusters (nm/h)
-    REAL(wp) ::  zGRtot       !< total growth rate        
-    REAL(wp) ::  zj3          !< number conc. of formed 3nm particles (#/m3)       
-    REAL(wp) ::  zjnuc        !< nucleation rate at ~1nm (#/m3s)
-    REAL(wp) ::  zKeff        !< effective cogulation coefficient between 
-                              !< freshly nucleated particles       
-    REAL(wp) ::  zknud(fn2b)  !< particle Knudsen number       
-    REAL(wp) ::  zkocnv       !< lever: zkocnv=1 --> organic compounds involved
-                              !< in nucleation    
-    REAL(wp) ::  zksa         !< lever: zksa=1 --> H2SO4 involved in nucleation 
-    REAL(wp) ::  zlambda      !< parameter for adjusting the growth rate due to 
-                              !< self-coagulation                                  
-    REAL(wp) ::  zmfp         !< mean free path of condesing vapour(m)                                        
-    REAL(wp) ::  zmixnh3      !< ammonia mixing ratio (ppt)
-    REAL(wp) ::  zNnuc        !< number of clusters/particles at the size range
-                              !< d1-dx (#/m3)  
-    REAL(wp) ::  znoc         !< number of organic molecules in critical cluster
-    REAL(wp) ::  znsa         !< number of H2SO4 molecules in critical cluster                                           
-!
-!-- Variable determined for the m-parameter
-    REAL(wp) ::  zCc_2(fn2b) !<
-    REAL(wp) ::  zCc_c !<
-    REAL(wp) ::  zCc_x !<
-    REAL(wp) ::  zCoagS_c !<
-    REAL(wp) ::  zCoagS_x !<
-    REAL(wp) ::  zcv_2(fn2b) !<
-    REAL(wp) ::  zcv_c !<
-    REAL(wp) ::  zcv_c2(fn2b) !<
-    REAL(wp) ::  zcv_x !<
-    REAL(wp) ::  zcv_x2(fn2b) !<
-    REAL(wp) ::  zDc_2(fn2b) !<
-    REAL(wp) ::  zDc_c(fn2b) !<
-    REAL(wp) ::  zDc_c2(fn2b) !<
-    REAL(wp) ::  zDc_x(fn2b) !<
-    REAL(wp) ::  zDc_x2(fn2b) !<
-    REAL(wp) ::  zgammaF_2(fn2b) !<
-    REAL(wp) ::  zgammaF_c(fn2b) !<
-    REAL(wp) ::  zgammaF_x(fn2b) !<
-    REAL(wp) ::  zK_c2(fn2b) !<
-    REAL(wp) ::  zK_x2(fn2b) !<
-    REAL(wp) ::  zknud_2(fn2b) !<
-    REAL(wp) ::  zknud_c !<
-    REAL(wp) ::  zknud_x !<       
-    REAL(wp) ::  zm_2(fn2b) !<
-    REAL(wp) ::  zm_c !<
-    REAL(wp) ::  zm_para !<
-    REAL(wp) ::  zm_x !<
-    REAL(wp) ::  zmyy !<
-    REAL(wp) ::  zomega_2c(fn2b) !<
-    REAL(wp) ::  zomega_2x(fn2b) !<
-    REAL(wp) ::  zomega_c(fn2b) !<
-    REAL(wp) ::  zomega_x(fn2b) !<
-    REAL(wp) ::  zRc2(fn2b) !<
-    REAL(wp) ::  zRx2(fn2b) !<
-    REAL(wp) ::  zsigma_c2(fn2b) !<
-    REAL(wp) ::  zsigma_x2(fn2b) !<
+
+    REAL(wp), INTENT(inout) ::  pj3n3(2) !< formation mass rate of molecules (molec/m3s) for
+                                         !< 1: H2SO4 and 2: organic vapour
+
+    REAL(wp), INTENT(out) ::  pxocnv  !< ratio of non-volatile organic vapours in 3 nm particles
+    REAL(wp), INTENT(out) ::  pxsa    !< ratio of H2SO4 in 3 nm aerosol particles
+
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zbeta       !< transitional correction factor
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcc_2       !< Cunningham correct factor:2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcv_2       !< mean relative thermal velocity (m/s): 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcv_c2      !< average velocity after coagulation: c & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcv_x2      !< average velocity after coagulation: x & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zdc_2       !< particle diffusion coefficient (m2/s): 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zdc_c       !< particle diffusion coefficient (m2/s): c
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zdc_c2      !< sum of diffusion coef. for c and 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zdc_x       !< particle diffusion coefficient (m2/s): x
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zdc_x2      !< sum of diffusion coef. for: x & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zgamma_f_2  !< zgamma_f for calculating zomega
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zgamma_f_c  !< zgamma_f for calculating zomega
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zgamma_f_x  !< zgamma_f for calculating zomega
+    REAL(wp), DIMENSION(nbins_aerosol) ::  z_k_c2      !< coagulation coef. in the continuum
+                                                       !< regime: c & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  z_k_x2      !< coagulation coef. in the continuum
+                                                       !< regime: x & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zknud       !< particle Knudsen number
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zknud_2     !< particle Knudsen number: 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zm_2        !< particle mass (kg): 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zomega_2c   !< zomega (m) for calculating zsigma: c & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zomega_2x   !< zomega (m) for calculating zsigma: x & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zomega_c    !< zomega (m) for calculating zsigma: c
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zomega_x    !< zomega (m) for calculating zsigma: x
+    REAL(wp), DIMENSION(nbins_aerosol) ::  z_r_c2      !< sum of the radii: c & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  z_r_x2      !< sum of the radii: x & 2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zsigma_c2   !<
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zsigma_x2   !<
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero  !< aerosol properties
 !
 !-- 1) Nucleation rate (zjnuc) and diameter of critical cluster (zdcrit)
@@ -4210,343 +4404,307 @@
     zksa   = 0.0_wp
     zkocnv = 0.0_wp
-    
+
     SELECT CASE ( nsnucl )
-    
-    CASE(1)   ! Binary H2SO4-H2O nucleation
-       
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit,  zksa, &
-                     zkocnv )      
-    
-    CASE(2)   ! Activation type nucleation
-    
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa,  znoc, zdcrit, zksa,  &
-                     zkocnv )
-       CALL actnucl( pcsa, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv, act_coeff )
-    
-    CASE(3)   ! Kinetically limited nucleation of (NH4)HSO4 clusters
-       
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa,    &
-                     zkocnv )
-
-       CALL kinnucl( zc_h2so4, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
-    
-    CASE(4)   ! Ternary H2SO4-H2O-NH3 nucleation
-    
-       zmixnh3 = pcnh3 * ptemp * argas / ( ppres * avo )
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       CALL ternucl( zc_h2so4, zmixnh3, ptemp, prh, zjnuc, znsa, znoc, zdcrit, &
-                     zksa, zkocnv ) 
-    
-    CASE(5)   ! Organic nucleation, J~[ORG] or J~[ORG]**2
-    
-       zc_org = pcocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa,    &
-                     zkocnv )  
-       CALL orgnucl( pcocnv, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
-    
-    CASE(6)   ! Sum of H2SO4 and organic activation type nucleation, 
-              ! J~[H2SO4]+[ORG]
-       
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa,    &
-                     zkocnv )  
-       CALL sumnucl( pcsa, pcocnv, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
-
-            
-    CASE(7)   ! Heteromolecular nucleation, J~[H2SO4]*[ORG]
-       
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       zc_org = pcocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa,    &
-                     zkocnv )  
-       CALL hetnucl( zc_h2so4, zc_org, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
-    
-    CASE(8)   ! Homomolecular nucleation of H2SO4 and heteromolecular 
-              ! nucleation of H2SO4 and organic vapour, 
-              ! J~[H2SO4]**2 + [H2SO4]*[ORG] (EUCAARI project)
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       zc_org = pcocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa,    &
-                     zkocnv )  
-       CALL SAnucl( zc_h2so4, zc_org, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
-    
-    CASE(9)   ! Homomolecular nucleation of H2SO4 and organic vapour and
-              ! heteromolecular nucleation of H2SO4 and organic vapour,
-              ! J~[H2SO4]**2 + [H2SO4]*[ORG]+[ORG]**2 (EUCAARI project)
-    
-       zc_h2so4 = pcsa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
-       zc_org = pcocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
-       CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa,    &
-                     zkocnv )  
-
-       CALL SAORGnucl( zc_h2so4, zc_org, zjnuc, zdcrit, znsa, znoc, zksa,      &
-                       zkocnv )
+!
+!--    Binary H2SO4-H2O nucleation
+       CASE(1)
+
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit,  zksa, zkocnv )
+!
+!--    Activation type nucleation
+       CASE(2)
+
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa,  znoc, zdcrit, zksa, zkocnv )
+          CALL actnucl( pc_sa, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv, act_coeff )
+!
+!--    Kinetically limited nucleation of (NH4)HSO4 clusters
+       CASE(3)
+
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa, zkocnv )
+          CALL kinnucl( zc_h2so4, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
+!
+!--    Ternary H2SO4-H2O-NH3 nucleation
+       CASE(4)
+
+          zmixnh3 = pc_nh3 * ptemp * argas / ( ppres * avo )
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          CALL ternucl( zc_h2so4, zmixnh3, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa, zkocnv )
+!
+!--    Organic nucleation, J~[ORG] or J~[ORG]**2
+       CASE(5)
+
+          zc_org = pc_ocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa, zkocnv )
+          CALL orgnucl( pc_ocnv, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
+!
+!--    Sum of H2SO4 and organic activation type nucleation, J~[H2SO4]+[ORG]
+       CASE(6)
+
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa, zkocnv )
+          CALL sumnucl( pc_sa, pc_ocnv, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
+!
+!--    Heteromolecular nucleation, J~[H2SO4]*[ORG]
+       CASE(7)
+
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          zc_org = pc_ocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa, zkocnv )
+          CALL hetnucl( zc_h2so4, zc_org, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
+!
+!--    Homomolecular nucleation of H2SO4 and heteromolecular nucleation of H2SO4 and organic vapour,
+!--    J~[H2SO4]**2 + [H2SO4]*[ORG] (EUCAARI project)
+       CASE(8)
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          zc_org = pc_ocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa, zkocnv )
+          CALL SAnucl( zc_h2so4, zc_org, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
+!
+!--    Homomolecular nucleation of H2SO4 and organic vapour and heteromolecular nucleation of H2SO4
+!--    and organic vapour, J~[H2SO4]**2 + [H2SO4]*[ORG]+[ORG]**2 (EUCAARI project)
+       CASE(9)
+
+          zc_h2so4 = pc_sa * 1.0E-6_wp   ! sulphuric acid conc. to #/cm3
+          zc_org = pc_ocnv * 1.0E-6_wp   ! conc. of non-volatile OC to #/cm3
+          CALL binnucl( zc_h2so4, ptemp, prh, zjnuc, znsa, znoc, zdcrit, zksa, zkocnv )
+          CALL SAORGnucl( zc_h2so4, zc_org, zjnuc, zdcrit, znsa, znoc, zksa, zkocnv )
+
     END SELECT
-    
-    zcsa_local = pcsa
-    zcocnv_local = pcocnv
+
+    zcsa_local = pc_sa
+    zcocnv_local = pc_ocnv
 !
 !-- 2) Change of particle and gas concentrations due to nucleation
-!          
-!-- 2.1) Check that there is enough H2SO4 and organic vapour to produce the
-!--      nucleation  
+!
+!-- 2.1) Check that there is enough H2SO4 and organic vapour to produce the nucleation
     IF ( nsnucl <= 4 )  THEN 
-!--    If the chosen nucleation scheme is 1-4, nucleation occurs only due to 
-!--    H2SO4. All of the total vapour concentration that is taking part to the
-!--    nucleation is there for sulphuric acid (sa = H2SO4) and non-volatile 
-!--    organic vapour is zero.
-       pxsa   = 1.0_wp   ! ratio of sulphuric acid in 3nm particles 
+!
+!--    If the chosen nucleation scheme is 1-4, nucleation occurs only due to H2SO4. All of the total
+!--    vapour concentration that is taking part to the nucleation is there for sulphuric acid
+!--    (sa = H2SO4) and non-volatile organic vapour is zero.
+       pxsa   = 1.0_wp   ! ratio of sulphuric acid in 3nm particles
        pxocnv = 0.0_wp   ! ratio of non-volatile origanic vapour
                                 ! in 3nm particles
     ELSEIF ( nsnucl > 4 )  THEN
-!--    If the chosen nucleation scheme is 5-9, nucleation occurs due to organic
-!--    vapour or the combination of organic vapour and H2SO4. The number of 
-!--    needed molecules depends on the chosen nucleation type and it has an 
-!--    effect also on the minimum ratio of the molecules present. 
-       IF ( pcsa * znsa + pcocnv * znoc < 1.E-14_wp )  THEN
+!
+!--    If the chosen nucleation scheme is 5-9, nucleation occurs due to organic vapour or the
+!--    combination of organic vapour and H2SO4. The number of needed molecules depends on the chosen
+!--    nucleation type and it has an effect also on the minimum ratio of the molecules present.
+       IF ( pc_sa * znsa + pc_ocnv * znoc < 1.E-14_wp )  THEN
           pxsa   = 0.0_wp
-          pxocnv = 0.0_wp             
+          pxocnv = 0.0_wp
        ELSE
-          pxsa   = pcsa * znsa / ( pcsa * znsa + pcocnv * znoc ) 
-          pxocnv = pcocnv * znoc / ( pcsa * znsa + pcocnv * znoc )
-       ENDIF  
+          pxsa   = pc_sa * znsa / ( pc_sa * znsa + pc_ocnv * znoc ) 
+          pxocnv = pc_ocnv * znoc / ( pc_sa * znsa + pc_ocnv * znoc )
+       ENDIF
     ENDIF
-!    
-!-- The change in total vapour concentration is the sum of the concentrations
-!-- of the vapours taking part to the nucleation (depends on the chosen 
-!-- nucleation scheme)
-    zdelta_vap = MIN( zjnuc * ( znoc + znsa ), ( pcocnv * zkocnv + pcsa *      &
-                      zksa ) / ptstep ) 
-!                      
-!-- Nucleation rate J at ~1nm (#/m3s)                           
+!
+!-- The change in total vapour concentration is the sum of the concentrations of the vapours taking
+!-- part to the nucleation (depends on the chosen nucleation scheme)
+    zdelta_vap = MIN( zjnuc * ( znoc + znsa ), ( pc_ocnv * zkocnv + pc_sa * zksa ) / ptstep )
+!
+!-- Nucleation rate J at ~1nm (#/m3s)
     zjnuc = zdelta_vap / ( znoc + znsa )
-!    
-!-- H2SO4 concentration after nucleation in #/m3            
-    zcsa_local = MAX( 1.0_wp, pcsa - zdelta_vap * pxsa ) 
-!    
+!
+!-- H2SO4 concentration after nucleation (#/m3)
+    zcsa_local = MAX( 1.0_wp, pc_sa - zdelta_vap * pxsa )
+!
 !-- Non-volative organic vapour concentration after nucleation (#/m3)
-    zcocnv_local = MAX( 1.0_wp, pcocnv - zdelta_vap * pxocnv )
+    zcocnv_local = MAX( 1.0_wp, pc_ocnv - zdelta_vap * pxocnv )
 !
 !-- 2.2) Formation rate of 3 nm particles (Kerminen & Kulmala, 2002)
 !
-!-- 2.2.1) Growth rate of clusters formed by H2SO4
-!
-!-- GR = 3.0e-15 / dens_clus * sum( molecspeed * molarmass * conc )
-!  
-!-- dens_clus  = density of the clusters (here 1830 kg/m3) 
-!-- molarmass  = molar mass of condensing species (here 98.08 g/mol)
-!-- conc       = concentration of condensing species [#/m3]
-!-- molecspeed = molecular speed of condensing species [m/s]
-!--            = sqrt( 8.0 * R * ptemp / ( pi * molarmass ) )
-!-- (Seinfeld & Pandis, 1998)
-!
-!-- Growth rate by H2SO4 and organic vapour in nm/h (Eq. 21)
-    zGRclust = 2.3623E-15_wp * SQRT( ptemp ) * ( zcsa_local + zcocnv_local )
-!    
+!-- Growth rate by H2SO4 and organic vapour (nm/h, Eq. 21)
+    z_gr_clust = 2.3623E-15_wp * SQRT( ptemp ) * ( zcsa_local + zcocnv_local )
+!
 !-- 2.2.2) Condensational sink of pre-existing particle population
 !
 !-- Diffusion coefficient (m2/s)
-    zdfvap = 5.1111E-10_wp * ptemp ** 1.75_wp * ( p_0 + 1325.0_wp ) / ppres
-!-- Mean free path of condensing vapour (m) (Jacobson (2005), Eq. 15.25 and 
-!-- 16.29)
+    zdfvap = 5.1111E-10_wp * ptemp**1.75_wp * ( p_0 + 1325.0_wp ) / ppres
+!
+!-- Mean free path of condensing vapour (m) (Jacobson (2005), Eq. 15.25 and 16.29)
     zmfp = 3.0_wp * zdfvap * SQRT( pi * amh2so4 / ( 8.0_wp * argas * ptemp ) )
-!-- Knudsen number            
-    zknud = 2.0_wp * zmfp / ( paero(:)%dwet + d_sa )                     
-!-- Transitional regime correction factor (zbeta) according to Fuchs and 
-!-- Sutugin (1971), In: Hidy et al. (ed.), Topics in current  aerosol research,
-!-- Pergamon. (Eq. 4 in Kerminen and Kulmala, 2002)
-    zbeta = ( zknud + 1.0_wp) / ( 0.377_wp * zknud + 1.0_wp + 4.0_wp /         &
-            ( 3.0_wp * massacc ) * ( zknud + zknud ** 2 ) )  
-!-- Condensational sink (#/m2) (Eq. 3)
+!
+!-- Knudsen number
+    zknud = 2.0_wp * zmfp / ( paero(:)%dwet + d_sa )
+!
+!-- Transitional regime correction factor (zbeta) according to Fuchs and Sutugin (1971) (Eq. 4 in
+!-- Kerminen and Kulmala, 2002)
+    zbeta = ( zknud + 1.0_wp) / ( 0.377_wp * zknud + 1.0_wp + 4.0_wp / ( 3.0_wp * massacc ) *      &
+            ( zknud + zknud**2 ) )
+!
+!-- Condensational sink (#/m2, Eq. 3)
     zcsink = SUM( paero(:)%dwet * zbeta * paero(:)%numc )
 !
-!-- Parameterised formation rate of detectable 3 nm particles (i.e. J3)
+!-- 2.2.3) Parameterised formation rate of detectable 3 nm particles (i.e. J3)
     IF ( nj3 == 1 )  THEN   ! Kerminen and Kulmala (2002)
-!--    2.2.3) Parameterised formation rate of detectable 3 nm particles
-!--    Constants needed for the parameterisation:
-!--    dapp = 3 nm and dens_nuc = 1830 kg/m3
-       IF ( zcsink < 1.0E-30_wp )  THEN 
+!
+!--    Constants needed for the parameterisation: dapp = 3 nm and dens_nuc = 1830 kg/m3
+       IF ( zcsink < 1.0E-30_wp )  THEN
           zeta = 0._dp
        ELSE
+!
 !--       Mean diameter of backgroud population (nm)
-          zdmean = 1.0_wp / SUM( paero(:)%numc ) * SUM( paero(:)%numc *        &
-                   paero(:)%dwet ) * 1.0E+9_wp
+          zdmean = 1.0_wp / SUM( paero(:)%numc ) * SUM( paero(:)%numc * paero(:)%dwet ) * 1.0E+9_wp
+!
 !--       Proportionality factor (nm2*m2/h) (Eq. 22)
-          zgamma = 0.23_wp * ( zdcrit * 1.0E+9_wp ) ** 0.2_wp * ( zdmean /     &
-                 150.0_wp ) ** 0.048_wp * ( ptemp / 293.0_wp ) ** ( -0.75_wp ) &
-                 * ( arhoh2so4 / 1000.0_wp ) ** ( -0.33_wp )
-!--       Factor eta (nm) (Eq. 11)
-          zeta = MIN( zgamma * zcsink / zGRclust, zdcrit * 1.0E11_wp ) 
-       ENDIF
-!       
-!--    Number conc. of clusters surviving to 3 nm in a time step (#/m3) (Eq.14)
-       zj3 = zjnuc * EXP( MIN( 0.0_wp, zeta / 3.0_wp - zeta /                  &
-                               ( zdcrit * 1.0E9_wp ) ) )                    
-
-    ELSEIF ( nj3 > 1 )  THEN
-!--    Defining the value for zm_para. The growth is investigated between
-!--    [d1,reglim(1)] = [zdcrit,3nm]    
-!--    m = LOG( CoagS_dx / CoagX_zdcrit ) / LOG( reglim / zdcrit ) 
-!--    (Lehtinen et al. 2007, Eq. 5)
-!--    The steps for the coagulation sink for reglim = 3nm and zdcrit ~= 1nm are
-!--    explained in article of Kulmala et al. (2001). The particles of diameter
-!--    zdcrit ~1.14 nm  and reglim = 3nm are both in turn the "number 1" 
-!--    variables (Kulmala et al. 2001).             
+          zgamma = 0.23_wp * ( zdcrit * 1.0E+9_wp )**0.2_wp * ( zdmean / 150.0_wp )**0.048_wp *    &
+                   ( ptemp / 293.0_wp )**( -0.75_wp ) * ( arhoh2so4 / 1000.0_wp )**( -0.33_wp )
+!
+!--       Factor eta (nm, Eq. 11)
+          zeta = MIN( zgamma * zcsink / z_gr_clust, zdcrit * 1.0E11_wp )
+       ENDIF
+!
+!--    Number conc. of clusters surviving to 3 nm in a time step (#/m3, Eq.14)
+       zj3 = zjnuc * EXP( MIN( 0.0_wp, zeta / 3.0_wp - zeta / ( zdcrit * 1.0E9_wp ) ) )
+
+    ELSEIF ( nj3 > 1 )  THEN   ! Lehtinen et al. (2007) or Anttila et al. (2010)
+!
+!--    Defining the parameter m (zm_para) for calculating the coagulation sink onto background
+!--    particles (Eq. 5&6 in Lehtinen et al. 2007). The growth is investigated between 
+!--    [d1,reglim(1)] = [zdcrit,3nm] and m = LOG( CoagS_dx / CoagX_zdcrit ) / LOG( reglim / zdcrit )
+!--    (Lehtinen et al. 2007, Eq. 6).
+!--    The steps for the coagulation sink for reglim = 3nm and zdcrit ~= 1nm are explained in 
+!--    Kulmala et al. (2001). The particles of diameter zdcrit ~1.14 nm  and reglim = 3nm are both 
+!--    in turn the "number 1" variables (Kulmala et al. 2001).
 !--    c = critical (1nm), x = 3nm, 2 = wet or mean droplet
-!--    Sum of the radii, R12 = R1 + zR2 (m) of two particles 1 and 2
-       zRc2 = zdcrit / 2.0_wp + paero(:)%dwet / 2.0_wp
-       zRx2 = reglim(1) / 2.0_wp + paero(:)%dwet / 2.0_wp
-!       
-!--    The mass of particle (kg) (comes only from H2SO4)
-       zm_c = 4.0_wp / 3.0_wp * pi * ( zdcrit / 2.0_wp ) ** 3.0_wp * arhoh2so4                     
-       zm_x = 4.0_wp / 3.0_wp * pi * ( reglim(1) / 2.0_wp ) ** 3.0_wp *        &
-              arhoh2so4                  
-       zm_2 = 4.0_wp / 3.0_wp * pi * ( paero(:)%dwet / 2.0_wp )** 3.0_wp *     &
-              arhoh2so4
-!              
+!
+!--    Sum of the radii, R12 = R1 + R2 (m) of two particles 1 and 2
+       z_r_c2 = zdcrit / 2.0_wp + paero(:)%dwet / 2.0_wp
+       z_r_x2 = reglim(1) / 2.0_wp + paero(:)%dwet / 2.0_wp
+!
+!--    Particle mass (kg) (comes only from H2SO4)
+       zm_c = 4.0_wp / 3.0_wp * pi * ( zdcrit / 2.0_wp )**3 * arhoh2so4
+       zm_x = 4.0_wp / 3.0_wp * pi * ( reglim(1) / 2.0_wp )**3 * arhoh2so4
+       zm_2 = 4.0_wp / 3.0_wp * pi * ( 0.5_wp * paero(:)%dwet )**3 * arhoh2so4
+!
 !--    Mean relative thermal velocity between the particles (m/s)
        zcv_c = SQRT( 8.0_wp * abo * ptemp / ( pi * zm_c ) )
        zcv_x = SQRT( 8.0_wp * abo * ptemp / ( pi * zm_x ) )
        zcv_2 = SQRT( 8.0_wp * abo * ptemp / ( pi * zm_2 ) )
-!       
-!--    Average velocity after coagulation               
-       zcv_c2 = SQRT( zcv_c ** 2.0_wp + zcv_2 ** 2.0_wp )
-       zcv_x2 = SQRT( zcv_x ** 2.0_wp + zcv_2 ** 2.0_wp )
-!       
+!
+!--    Average velocity after coagulation
+       zcv_c2(:) = SQRT( zcv_c**2 + zcv_2**2 )
+       zcv_x2(:) = SQRT( zcv_x**2 + zcv_2**2 )
+!
 !--    Knudsen number (zmfp = mean free path of condensing vapour)
        zknud_c = 2.0_wp * zmfp / zdcrit
        zknud_x = 2.0_wp * zmfp / reglim(1)
-       zknud_2 = MAX( 0.0_wp, 2.0_wp * zmfp / paero(:)%dwet )
-!
-!--    Cunningham correction factor                
-       zCc_c = 1.0_wp + zknud_c * ( 1.142_wp + 0.558_wp *                      &
-               EXP( -0.999_wp / zknud_c ) ) 
-       zCc_x = 1.0_wp + zknud_x * ( 1.142_wp + 0.558_wp *                      &
-               EXP( -0.999_wp / zknud_x ) )
-       zCc_2 = 1.0_wp + zknud_2 * ( 1.142_wp + 0.558_wp *                      &
-               EXP( -0.999_wp / zknud_2 ) )
-!                      
-!--    Gas dynamic viscosity (N*s/m2). 
-!--    Viscocity(air @20C) = 1.81e-5_dp N/m2 *s (Hinds, p. 25)                      
-       zmyy = 1.81E-5_wp * ( ptemp / 293.0_wp) ** ( 0.74_wp ) 
-!       
-!--    Particle diffusion coefficient (m2/s)                
-       zDc_c = abo * ptemp * zCc_c / ( 3.0_wp * pi * zmyy * zdcrit )  
-       zDc_x = abo * ptemp * zCc_x / ( 3.0_wp * pi * zmyy * reglim(1) )
-       zDc_2 = abo * ptemp * zCc_2 / ( 3.0_wp * pi * zmyy * paero(:)%dwet )
-!       
+       zknud_2(:) = MAX( 0.0_wp, 2.0_wp * zmfp / paero(:)%dwet )
+!
+!--    Cunningham correction factors (Allen and Raabe, 1985)
+       zcc_c    = 1.0_wp + zknud_c    * ( 1.142_wp + 0.558_wp * EXP( -0.999_wp / zknud_c ) )
+       zcc_x    = 1.0_wp + zknud_x    * ( 1.142_wp + 0.558_wp * EXP( -0.999_wp / zknud_x ) )
+       zcc_2(:) = 1.0_wp + zknud_2(:) * ( 1.142_wp + 0.558_wp * EXP( -0.999_wp / zknud_2(:) ) )
+!
+!--    Gas dynamic viscosity (N*s/m2). Here, viscocity(air @20C) = 1.81e-5_dp N/m2 *s (Hinds, p. 25)
+       zmyy = 1.81E-5_wp * ( ptemp / 293.0_wp )**0.74_wp
+!
+!--    Particle diffusion coefficient (m2/s) (continuum regime)
+       zdc_c(:) = abo * ptemp * zcc_c    / ( 3.0_wp * pi * zmyy * zdcrit )
+       zdc_x(:) = abo * ptemp * zcc_x    / ( 3.0_wp * pi * zmyy * reglim(1) )
+       zdc_2(:) = abo * ptemp * zcc_2(:) / ( 3.0_wp * pi * zmyy * paero(:)%dwet )
+!
 !--    D12 = D1+D2 (Seinfield and Pandis, 2nd ed. Eq. 13.38)
-       zDc_c2 = zDc_c + zDc_2   
-       zDc_x2 = zDc_x + zDc_2 
-!       
-!--    zgammaF = 8*D/pi/zcv (m) for calculating zomega
-       zgammaF_c = 8.0_wp * zDc_c / pi / zcv_c 
-       zgammaF_x = 8.0_wp * zDc_x / pi / zcv_x
-       zgammaF_2 = 8.0_wp * zDc_2 / pi / zcv_2
-!       
-!--    zomega (m) for calculating zsigma              
-       zomega_c = ( ( zRc2 + zgammaF_c ) ** 3 - ( zRc2 ** 2 +                  &
-                      zgammaF_c ) ** ( 3.0_wp / 2.0_wp ) ) / ( 3.0_wp *        &
-                      zRc2 * zgammaF_c ) - zRc2  
-       zomega_x = ( ( zRx2 + zgammaF_x ) ** 3.0_wp - ( zRx2 ** 2.0_wp +        &
-                      zgammaF_x ) ** ( 3.0_wp / 2.0_wp ) ) / ( 3.0_wp *        &
-                      zRx2 * zgammaF_x ) - zRx2
-       zomega_2c = ( ( zRc2 + zgammaF_2 ) ** 3.0_wp - ( zRc2 ** 2.0_wp +       &
-                       zgammaF_2 ) ** ( 3.0_wp / 2.0_wp ) ) / ( 3.0_wp *       &
-                       zRc2 * zgammaF_2 ) - zRc2 
-       zomega_2x = ( ( zRx2 + zgammaF_2 ) ** 3.0_wp - ( zRx2 ** 2.0_wp +       &
-                       zgammaF_2 ) ** ( 3.0_wp / 2.0_wp ) ) / ( 3.0_wp *       &
-                       zRx2 * zgammaF_2 ) - zRx2 
-!                       
-!--    The distance (m) at which the two fluxes are matched (condensation and
-!--    coagulation sinks?)           
-       zsigma_c2 = SQRT( zomega_c ** 2.0_wp + zomega_2c ** 2.0_wp ) 
-       zsigma_x2 = SQRT( zomega_x ** 2.0_wp + zomega_2x ** 2.0_wp ) 
-!       
-!--    Coagulation coefficient in the continuum regime (m*m2/s)
-       zK_c2 = 4.0_wp * pi * zRc2 * zDc_c2 / ( zRc2 / ( zRc2 + zsigma_c2 ) +   &
-               4.0_wp * zDc_c2 / ( zcv_c2 * zRc2 ) ) 
-       zK_x2 = 4.0_wp * pi * zRx2 * zDc_x2 / ( zRx2 / ( zRx2 + zsigma_x2 ) +   &
-               4.0_wp * zDc_x2 / ( zcv_x2 * zRx2 ) )
-!               
-!--    Coagulation sink (1/s)
-       zCoagS_c = MAX( 1.0E-20_wp, SUM( zK_c2 * paero(:)%numc ) )          
-       zCoagS_x = MAX( 1.0E-20_wp, SUM( zK_x2 * paero(:)%numc ) ) 
-!       
-!--    Parameter m for calculating the coagulation sink onto background 
-!--    particles (Eq. 5&6 in Lehtinen et al. 2007)             
-       zm_para = LOG( zCoagS_x / zCoagS_c ) / LOG( reglim(1) / zdcrit )
-!       
+       zdc_c2 = zdc_c + zdc_2
+       zdc_x2 = zdc_x + zdc_2
+!
+!--    zgamma_f = 8*D/pi/zcv (m) for calculating zomega (Fuchs, 1964)
+       zgamma_f_c = 8.0_wp * zdc_c / pi / zcv_c
+       zgamma_f_x = 8.0_wp * zdc_x / pi / zcv_x
+       zgamma_f_2 = 8.0_wp * zdc_2 / pi / zcv_2
+!
+!--    zomega (m) for calculating zsigma
+       zomega_c = ( ( z_r_c2 + zgamma_f_c )**3 - ( z_r_c2 ** 2 + zgamma_f_c )**1.5_wp ) /          &
+                  ( 3.0_wp * z_r_c2 * zgamma_f_c ) - z_r_c2
+       zomega_x = ( ( z_r_x2 + zgamma_f_x )**3 - ( z_r_x2**2 + zgamma_f_x )** 1.5_wp ) /           &
+                  ( 3.0_wp * z_r_x2 * zgamma_f_x ) - z_r_x2
+       zomega_2c = ( ( z_r_c2 + zgamma_f_2 )**3 - ( z_r_c2**2 + zgamma_f_2 )**1.5_wp ) /           &
+                   ( 3.0_wp * z_r_c2 * zgamma_f_2 ) - z_r_c2
+       zomega_2x = ( ( z_r_x2 + zgamma_f_2 )**3 - ( z_r_x2**2 + zgamma_f_2 )**1.5_wp ) /           &
+                   ( 3.0_wp * z_r_x2 * zgamma_f_2 ) - z_r_x2 
+!
+!--    The distance (m) at which the two fluxes are matched (condensation and coagulation sinks)
+       zsigma_c2 = SQRT( zomega_c**2 + zomega_2c**2 )
+       zsigma_x2 = SQRT( zomega_x**2 + zomega_2x**2 )
+!
+!--    Coagulation coefficient in the continuum regime (m*m2/s, Eq. 17 in Kulmala et al., 2001)
+       z_k_c2 = 4.0_wp * pi * z_r_c2 * zdc_c2 / ( z_r_c2 / ( z_r_c2 + zsigma_c2 ) +                &
+               4.0_wp * zdc_c2 / ( zcv_c2 * z_r_c2 ) )
+       z_k_x2 = 4.0_wp * pi * z_r_x2 * zdc_x2 / ( z_r_x2 / ( z_r_x2 + zsigma_x2 ) +                &
+               4.0_wp * zdc_x2 / ( zcv_x2 * z_r_x2 ) )
+!
+!--    Coagulation sink (1/s, Eq. 16 in Kulmala et al., 2001)
+       zcoags_c = MAX( 1.0E-20_wp, SUM( z_k_c2 * paero(:)%numc ) )
+       zcoags_x = MAX( 1.0E-20_wp, SUM( z_k_x2 * paero(:)%numc ) )
+!
+!--    Parameter m for calculating the coagulation sink onto background particles (Eq. 5&6 in 
+!--    Lehtinen et al. 2007)
+       zm_para = LOG( zcoags_x / zcoags_c ) / LOG( reglim(1) / zdcrit )
+!
 !--    Parameter gamma for calculating the formation rate J of particles having
-!--    a diameter zdcrit < d < reglim(1) (Anttila et al. 2010, eq. 5)
-       zgamma = ( ( ( reglim(1) / zdcrit ) ** ( zm_para + 1.0_wp ) ) - 1.0_wp )&
-                / ( zm_para + 1.0_wp )     
-                
-       IF ( nj3 == 2 )  THEN   ! Coagulation sink
-!       
-!--       Formation rate J before iteration (#/m3s)                
-          zj3 = zjnuc * EXP( MIN( 0.0_wp, -zgamma * zdcrit * zCoagS_c /        &
-                ( zGRclust * 1.0E-9_wp / ( 60.0_wp ** 2.0_wp ) ) ) )
-                
-       ELSEIF ( nj3 == 3 )  THEN  ! Coagulation sink and self-coag.
-!--       IF polluted air... then the self-coagulation becomes important. 
-!--       Self-coagulation of small particles < 3 nm.
-!
-!--       "Effective" coagulation coefficient between freshly-nucleated 
-!--       particles:
-          zKeff = 5.0E-16_wp   ! cm3/s
-!          
-!--       zlambda parameter for "adjusting" the growth rate due to the 
-!--       self-coagulation
-          zlambda = 6.0_wp 
+!--    a diameter zdcrit < d < reglim(1) (Anttila et al. 2010, eq. 5 or Lehtinen et al.,2007, eq. 7)
+       zgamma = ( ( ( reglim(1) / zdcrit )**( zm_para + 1.0_wp ) ) - 1.0_wp ) / ( zm_para + 1.0_wp )
+
+       IF ( nj3 == 2 )  THEN   ! Lehtinen et al. (2007): coagulation sink
+!
+!--       Formation rate J before iteration (#/m3s)
+          zj3 = zjnuc * EXP( MIN( 0.0_wp, -zgamma * zdcrit * zcoags_c / ( z_gr_clust * 1.0E-9_wp / &
+                60.0_wp**2 ) ) )
+
+       ELSEIF ( nj3 == 3 )  THEN  ! Anttila et al. (2010): coagulation sink and self-coag.
+!
+!--       If air is polluted, the self-coagulation becomes important. Self-coagulation of small 
+!--       particles < 3 nm.
+!
+!--       "Effective" coagulation coefficient between freshly-nucleated particles:
+          z_k_eff = 5.0E-16_wp   ! m3/s
+!
+!--       zlambda parameter for "adjusting" the growth rate due to the self-coagulation
+          zlambda = 6.0_wp
+
           IF ( reglim(1) >= 10.0E-9_wp )  THEN   ! for particles >10 nm:
-             zKeff   = 5.0E-17_wp
+             z_k_eff   = 5.0E-17_wp
              zlambda = 3.0_wp
           ENDIF
-!          
+!
 !--       Initial values for coagulation sink and growth rate  (m/s)
-          zCoagStot = zCoagS_c
-          zGRtot = zGRclust * 1.0E-9_wp / 60.0_wp ** 2.0_wp 
-!          
+          zcoagstot = zcoags_c
+          z_gr_tot = z_gr_clust * 1.0E-9_wp / 60.0_wp**2
+!
 !--       Number of clusters/particles at the size range [d1,dx] (#/m3):
-          zNnuc = zjnuc / zCoagStot !< Initial guess 
-!          
+          z_n_nuc = zjnuc / zcoagstot !< Initial guess
+!
 !--       Coagulation sink and growth rate due to self-coagulation:
           DO  iteration = 1, 5
-             zCoagStot = zCoagS_c + zKeff * zNnuc * 1.0E-6_wp   ! (1/s)  
-             zGRtot = zGRclust * 1.0E-9_wp / ( 3600.0_wp ) +  1.5708E-6_wp *   &
-                      zlambda * zdcrit ** 3.0_wp * ( zNnuc * 1.0E-6_wp ) *     &
-                      zcv_c * avo * 1.0E-9_wp / 3600.0_wp 
-             zeta = - zCoagStot / ( ( zm_para + 1.0_wp ) * zGRtot * ( zdcrit **&
-                      zm_para ) )   ! Eq. 7b (Anttila) 
-             zNnuc =  zNnuc_tayl( zdcrit, reglim(1), zm_para, zjnuc, zeta,     &
-                      zGRtot )
+             zcoagstot = zcoags_c + z_k_eff * z_n_nuc * 1.0E-6_wp   ! (1/s, Anttila et al., eq. 1)
+             z_gr_tot = z_gr_clust * 2.77777777E-7_wp +  1.5708E-6_wp * zlambda * zdcrit**3 *      &
+                      ( z_n_nuc * 1.0E-6_wp ) * zcv_c * avo * 2.77777777E-7_wp ! (Eq. 3)
+             zeta = - zcoagstot / ( ( zm_para + 1.0_wp ) * z_gr_tot * ( zdcrit**zm_para ) ) ! (Eq. 7b)
+!
+!--          Calculate Eq. 7a (Taylor series for the number of particles between [d1,dx])
+             z_n_nuc =  z_n_nuc_tayl( zdcrit, reglim(1), zm_para, zjnuc, zeta, z_gr_tot )
           ENDDO
-!          
-!--       Calculate the final values with new zNnuc:	
-          zCoagStot = zCoagS_c + zKeff * zNnuc * 1.0E-6_wp   ! (1/s) 
-          zGRtot = zGRclust * 1.0E-9_wp / 3600.0_wp + 1.5708E-6_wp *  zlambda  &
-                   * zdcrit ** 3.0_wp * ( zNnuc * 1.0E-6_wp ) * zcv_c * avo *  &
-                   1.0E-9_wp / 3600.0_wp !< (m/s)
-          zj3 = zjnuc * EXP( MIN( 0.0_wp, -zgamma * zdcrit * zCoagStot /       &
-                zGRtot ) )   ! (Eq. 5a) (#/m3s)
-                
-       ENDIF
-       
+!
+!--       Calculate the final values with new z_n_nuc:
+          zcoagstot = zcoags_c + z_k_eff * z_n_nuc * 1.0E-6_wp   ! (1/s)
+          z_gr_tot = z_gr_clust * 1.0E-9_wp / 3600.0_wp + 1.5708E-6_wp *  zlambda * zdcrit**3 *    &
+                   ( z_n_nuc * 1.0E-6_wp ) * zcv_c * avo * 1.0E-9_wp / 3600.0_wp !< (m/s)
+          zj3 = zjnuc * EXP( MIN( 0.0_wp, -zgamma * zdcrit * zcoagstot / z_gr_tot ) ) ! (#/m3s, Eq. 5a)
+
+       ENDIF
     ENDIF
-!-- If J3 very small (< 1 #/cm3), neglect particle formation. In real atmosphere
-!-- this would mean that clusters form but coagulate to pre-existing particles 
-!-- who gain sulphate. Since CoagS ~ CS (4piD*CS'), we do *not* update H2SO4 
-!-- concentration here but let condensation take care of it.
-!-- Formation mass rate of molecules (molec/m3s) for 1: H2SO4 and 2: organic 
-!-- vapour
+!
+!-- If J3 very small (< 1 #/cm3), neglect particle formation. In real atmosphere this would mean
+!-- that clusters form but coagulate to pre-existing particles who gain sulphate. Since 
+!-- CoagS ~ CS (4piD*CS'), we do *not* update H2SO4 concentration here but let condensation take 
+!-- care of it. Formation mass rate of molecules (molec/m3s) for 1: H2SO4 and 2: organic vapour
     pj3n3(1) = zj3 * n3 * pxsa
     pj3n3(2) = zj3 * n3 * pxocnv
-                                  
-                         
+
  END SUBROUTINE nucleation
 
@@ -4555,126 +4713,109 @@
 ! ------------
 !> Calculate the nucleation rate and the size of critical clusters assuming 
-!> binary nucleation. 
+!> binary nucleation.
 !> Parametrisation according to Vehkamaki et al. (2002), J. Geophys. Res., 
 !> 107(D22), 4622. Called from subroutine nucleation. 
 !------------------------------------------------------------------------------!
- SUBROUTINE binnucl( pc_sa, ptemp, prh, pnuc_rate, pn_crit_sa, pn_crit_ocnv,   &
-                     pd_crit, pk_sa, pk_ocnv )
-                    
+ SUBROUTINE binnucl( pc_sa, ptemp, prh, pnuc_rate, pn_crit_sa, pn_crit_ocnv, pd_crit, pk_sa,       &
+                     pk_ocnv )
+
     IMPLICIT NONE
-!       
-!-- Input and output variables        
-    REAL(wp), INTENT(in) ::   pc_sa        !< H2SO4 conc. (#/cm3)
-    REAL(wp), INTENT(in) ::   prh          !< relative humidity [0-1]       
-    REAL(wp), INTENT(in) ::   ptemp        !< ambient temperature (K)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucleation rate (#/(m3 s))
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pd_crit      !< diameter of critical cluster (m)
-    REAL(wp), INTENT(out) ::  pk_sa        !< Lever: if pk_sa = 1, H2SO4 is
-                                           !< involved in nucleation. 
-    REAL(wp), INTENT(out) ::  pk_ocnv      !< Lever: if pk_ocnv = 1, organic
-                                           !< compounds are involved in
-                                           !< nucleation. 
-!-- Local variables
-    REAL(wp) ::  zx    !< mole fraction of sulphate in critical cluster
-    REAL(wp) ::  zntot !< number of molecules in critical cluster
-    REAL(wp) ::  zt    !< temperature
-    REAL(wp) ::  zpcsa !< sulfuric acid concentration
-    REAL(wp) ::  zrh   !< relative humidity
-    REAL(wp) ::  zma   !<
-    REAL(wp) ::  zmw   !<
-    REAL(wp) ::  zxmass!<
-    REAL(wp) ::  za    !<
-    REAL(wp) ::  zb    !<
-    REAL(wp) ::  zc    !<
-    REAL(wp) ::  zroo  !<
-    REAL(wp) ::  zm1   !<
-    REAL(wp) ::  zm2   !<
-    REAL(wp) ::  zv1   !<
-    REAL(wp) ::  zv2   !<
-    REAL(wp) ::  zcoll !<
-    
+
+    REAL(wp) ::  za      !<
+    REAL(wp) ::  zb      !<
+    REAL(wp) ::  zc      !<
+    REAL(wp) ::  zcoll   !<
+    REAL(wp) ::  zlogsa  !<  LOG( zpcsa )
+    REAL(wp) ::  zlogrh  !<  LOG( zrh )
+    REAL(wp) ::  zm1     !<
+    REAL(wp) ::  zm2     !<
+    REAL(wp) ::  zma     !<
+    REAL(wp) ::  zmw     !<
+    REAL(wp) ::  zntot   !< number of molecules in critical cluster
+    REAL(wp) ::  zpcsa   !< sulfuric acid concentration
+    REAL(wp) ::  zrh     !< relative humidity
+    REAL(wp) ::  zroo    !<
+    REAL(wp) ::  zt      !< temperature
+    REAL(wp) ::  zv1     !<
+    REAL(wp) ::  zv2     !<
+    REAL(wp) ::  zx      !< mole fraction of sulphate in critical cluster
+    REAL(wp) ::  zxmass  !<
+
+    REAL(wp), INTENT(in) ::   pc_sa   !< H2SO4 conc. (#/cm3)
+    REAL(wp), INTENT(in) ::   prh     !< relative humidity [0-1
+    REAL(wp), INTENT(in) ::   ptemp   !< ambient temperature (K)
+
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucleation rate (#/(m3 s))
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pd_crit       !< diameter of critical cluster (m)
+    REAL(wp), INTENT(out) ::  pk_sa         !< Lever: if pk_sa = 1, H2SO4 is involved in nucleation.
+    REAL(wp), INTENT(out) ::  pk_ocnv       !< Lever: if pk_ocnv = 1, organic compounds are involved
+
     pnuc_rate = 0.0_wp
     pd_crit   = 1.0E-9_wp
-
-!             
-!-- 1) Checking that we are in the validity range of the parameterization  
-    zt    = MAX( ptemp, 190.15_wp )
-    zt    = MIN( zt,    300.15_wp )
-    zpcsa = MAX( pc_sa, 1.0E4_wp  )
-    zpcsa = MIN( zpcsa, 1.0E11_wp ) 
-    zrh   = MAX( prh,   0.0001_wp )
-    zrh   = MIN( zrh,   1.0_wp    )
-!               
+!
+!-- 1) Checking that we are in the validity range of the parameterization
+    zpcsa  = MAX( pc_sa, 1.0E4_wp  )
+    zpcsa  = MIN( zpcsa, 1.0E11_wp )
+    zrh    = MAX( prh,   0.0001_wp )
+    zrh    = MIN( zrh,   1.0_wp    )
+    zt     = MAX( ptemp, 190.15_wp )
+    zt     = MIN( zt,    300.15_wp )
+
+    zlogsa = LOG( zpcsa )
+    zlogrh   = LOG( prh )
+!
 !-- 2) Mole fraction of sulphate in a critical cluster (Eq. 11)
-    zx = 0.7409967177282139_wp                                           &
-         - 0.002663785665140117_wp * zt                                  &
-         + 0.002010478847383187_wp * LOG( zrh )                          &
-         - 0.0001832894131464668_wp* zt * LOG( zrh )                     &
-         + 0.001574072538464286_wp * LOG( zrh ) ** 2                     &
-         - 0.00001790589121766952_wp * zt * LOG( zrh ) ** 2              &
-         + 0.0001844027436573778_wp * LOG( zrh ) ** 3                    &
-         - 1.503452308794887E-6_wp * zt * LOG( zrh ) ** 3                &
-         - 0.003499978417957668_wp * LOG( zpcsa )                        &
-         + 0.0000504021689382576_wp * zt * LOG( zpcsa )
-!                   
+    zx = 0.7409967177282139_wp                  - 0.002663785665140117_wp * zt +                   &
+         0.002010478847383187_wp * zlogrh       - 0.0001832894131464668_wp* zt * zlogrh +          &
+         0.001574072538464286_wp * zlogrh**2    - 0.00001790589121766952_wp * zt * zlogrh**2 +     &
+         0.0001844027436573778_wp * zlogrh**3   - 1.503452308794887E-6_wp * zt * zlogrh**3 -       &
+         0.003499978417957668_wp * zlogsa     + 0.0000504021689382576_wp * zt * zlogsa
+!
 !-- 3) Nucleation rate (Eq. 12)
-    pnuc_rate = 0.1430901615568665_wp                                    &
-        + 2.219563673425199_wp * zt                                      &
-        - 0.02739106114964264_wp * zt ** 2                               &
-        + 0.00007228107239317088_wp * zt ** 3                            &
-        + 5.91822263375044_wp / zx                                       &
-        + 0.1174886643003278_wp * LOG( zrh )                             &
-        + 0.4625315047693772_wp * zt * LOG( zrh )                        &
-        - 0.01180591129059253_wp * zt ** 2 * LOG( zrh )                  &
-        + 0.0000404196487152575_wp * zt ** 3 * LOG( zrh )                &
-        + ( 15.79628615047088_wp * LOG( zrh ) ) / zx                     &
-        - 0.215553951893509_wp * LOG( zrh ) ** 2                         &
-        - 0.0810269192332194_wp * zt * LOG( zrh ) ** 2                   &
-        + 0.001435808434184642_wp * zt ** 2 * LOG( zrh ) ** 2            &
-        - 4.775796947178588E-6_wp * zt ** 3 * LOG( zrh ) ** 2            &
-        - (2.912974063702185_wp * LOG( zrh ) ** 2 ) / zx                 &
-        - 3.588557942822751_wp * LOG( zrh ) ** 3                         &
-        + 0.04950795302831703_wp * zt * LOG( zrh ) ** 3                  &
-        - 0.0002138195118737068_wp * zt ** 2 * LOG( zrh ) ** 3           &
-        + 3.108005107949533E-7_wp * zt ** 3 * LOG( zrh ) ** 3            &
-        - ( 0.02933332747098296_wp * LOG( zrh ) ** 3 ) / zx              &
-        + 1.145983818561277_wp * LOG( zpcsa )                            &
-        - 0.6007956227856778_wp * zt * LOG( zpcsa )                      &
-        + 0.00864244733283759_wp * zt ** 2 * LOG( zpcsa )                &
-        - 0.00002289467254710888_wp * zt ** 3 * LOG( zpcsa )             &
-        - ( 8.44984513869014_wp * LOG( zpcsa ) ) / zx                    &
-        + 2.158548369286559_wp * LOG( zrh ) * LOG( zpcsa )               &
-        + 0.0808121412840917_wp * zt * LOG( zrh ) * LOG( zpcsa )         &
-        - 0.0004073815255395214_wp * zt ** 2 * LOG( zrh ) * LOG( zpcsa ) &
-        - 4.019572560156515E-7_wp * zt ** 3 * LOG( zrh ) * LOG( zpcsa )  & 
-        + ( 0.7213255852557236_wp * LOG( zrh ) * LOG( zpcsa ) ) / zx     &
-        + 1.62409850488771_wp * LOG( zrh ) ** 2 * LOG( zpcsa )           &
-        - 0.01601062035325362_wp * zt * LOG( zrh ) ** 2 * LOG( zpcsa )   &
-        + 0.00003771238979714162_wp*zt**2* LOG( zrh )**2 * LOG( zpcsa )  &
-        + 3.217942606371182E-8_wp * zt**3 * LOG( zrh )**2 * LOG( zpcsa ) &
-        - (0.01132550810022116_wp * LOG( zrh )**2 * LOG( zpcsa ) ) / zx  &
-        + 9.71681713056504_wp * LOG( zpcsa ) ** 2                        &
-        - 0.1150478558347306_wp * zt * LOG( zpcsa ) ** 2                 &
-        + 0.0001570982486038294_wp * zt ** 2 * LOG( zpcsa ) ** 2         &
-        + 4.009144680125015E-7_wp * zt ** 3 * LOG( zpcsa ) ** 2          &
-        + ( 0.7118597859976135_wp * LOG( zpcsa ) ** 2 ) / zx             &
-        - 1.056105824379897_wp * LOG( zrh ) * LOG( zpcsa ) ** 2          &
-        + 0.00903377584628419_wp * zt * LOG( zrh ) * LOG( zpcsa )**2     &
-        - 0.00001984167387090606_wp*zt**2*LOG( zrh )*LOG( zpcsa )**2     &
-        + 2.460478196482179E-8_wp * zt**3 * LOG( zrh ) * LOG( zpcsa )**2 &
-        - ( 0.05790872906645181_wp * LOG( zrh ) * LOG( zpcsa )**2 ) / zx &
-        - 0.1487119673397459_wp * LOG( zpcsa ) ** 3                      &
-        + 0.002835082097822667_wp * zt * LOG( zpcsa ) ** 3               &
-        - 9.24618825471694E-6_wp * zt ** 2 * LOG( zpcsa ) ** 3           &
-        + 5.004267665960894E-9_wp * zt ** 3 * LOG( zpcsa ) ** 3          &
-        - ( 0.01270805101481648_wp * LOG( zpcsa ) ** 3 ) / zx
-!           
+    pnuc_rate = 0.1430901615568665_wp + 2.219563673425199_wp * zt -                                &
+                0.02739106114964264_wp * zt**2 + 0.00007228107239317088_wp * zt**3 +               &
+                5.91822263375044_wp / zx + 0.1174886643003278_wp * zlogrh +                        &
+                0.4625315047693772_wp * zt * zlogrh - 0.01180591129059253_wp * zt**2 * zlogrh +    &
+                0.0000404196487152575_wp * zt**3 * zlogrh +                                        &
+                ( 15.79628615047088_wp * zlogrh ) / zx - 0.215553951893509_wp * zlogrh**2 -        &
+                0.0810269192332194_wp * zt * zlogrh**2 +                                           &
+                0.001435808434184642_wp * zt**2 * zlogrh**2 -                                      &
+                4.775796947178588E-6_wp * zt**3 * zlogrh**2 -                                      &
+                ( 2.912974063702185_wp * zlogrh**2 ) / zx - 3.588557942822751_wp * zlogrh**3 +     &
+                0.04950795302831703_wp * zt * zlogrh**3 -                                          &
+                0.0002138195118737068_wp * zt**2 * zlogrh**3 +                                     &
+                3.108005107949533E-7_wp * zt**3 * zlogrh**3 -                                      &
+                ( 0.02933332747098296_wp * zlogrh**3 ) / zx + 1.145983818561277_wp * zlogsa -      &
+                0.6007956227856778_wp * zt * zlogsa + 0.00864244733283759_wp * zt**2 * zlogsa -    &
+                0.00002289467254710888_wp * zt**3 * zlogsa -                                       &
+                ( 8.44984513869014_wp * zlogsa ) / zx + 2.158548369286559_wp * zlogrh * zlogsa +   &
+                0.0808121412840917_wp * zt * zlogrh * zlogsa -                                     &
+                0.0004073815255395214_wp * zt**2 * zlogrh * zlogsa -                               &
+                4.019572560156515E-7_wp * zt**3 * zlogrh * zlogsa +                                &
+                ( 0.7213255852557236_wp * zlogrh * zlogsa ) / zx +                                 &
+                1.62409850488771_wp * zlogrh**2 * zlogsa -                                         &
+                0.01601062035325362_wp * zt * zlogrh**2 * zlogsa +                                 &
+                0.00003771238979714162_wp*zt**2* zlogrh**2 * zlogsa +                              &
+                3.217942606371182E-8_wp * zt**3 * zlogrh**2 * zlogsa -                             &
+                ( 0.01132550810022116_wp * zlogrh**2 * zlogsa ) / zx +                             &
+                9.71681713056504_wp * zlogsa**2 - 0.1150478558347306_wp * zt * zlogsa**2 +         &
+                0.0001570982486038294_wp * zt**2 * zlogsa**2 +                                     &
+                4.009144680125015E-7_wp * zt**3 * zlogsa**2 +                                      &
+                ( 0.7118597859976135_wp * zlogsa**2 ) / zx -                                       &
+                1.056105824379897_wp * zlogrh * zlogsa**2 +                                        &
+                0.00903377584628419_wp * zt * zlogrh * zlogsa**2 -                                 &
+                0.00001984167387090606_wp * zt**2 * zlogrh * zlogsa**2 +                           &
+                2.460478196482179E-8_wp * zt**3 * zlogrh * zlogsa**2 -                             &
+                ( 0.05790872906645181_wp * zlogrh * zlogsa**2 ) / zx -                             &
+                0.1487119673397459_wp * zlogsa**3 + 0.002835082097822667_wp * zt * zlogsa**3 -     &
+                9.24618825471694E-6_wp * zt**2 * zlogsa**3 +                                       &
+                5.004267665960894E-9_wp * zt**3 * zlogsa**3 -                                      &
+                ( 0.01270805101481648_wp * zlogsa**3 ) / zx
+!
 !-- Nucleation rate in #/(cm3 s)
     pnuc_rate = EXP( pnuc_rate ) 
-!       
+!
 !-- Check the validity of parameterization
     IF ( pnuc_rate < 1.0E-7_wp )  THEN 
@@ -4682,62 +4823,49 @@
        pd_crit   = 1.0E-9_wp
     ENDIF
-!                
+!
 !-- 4) Total number of molecules in the critical cluster (Eq. 13)
-    zntot = - 0.002954125078716302_wp                                    &
-      - 0.0976834264241286_wp * zt                                       &
-      + 0.001024847927067835_wp * zt ** 2                                &
-      - 2.186459697726116E-6_wp * zt ** 3                                &
-      - 0.1017165718716887_wp / zx                                       &
-      - 0.002050640345231486_wp * LOG( zrh )                             &
-      - 0.007585041382707174_wp * zt * LOG( zrh )                        &
-      + 0.0001926539658089536_wp * zt ** 2 * LOG( zrh )                  &
-      - 6.70429719683894E-7_wp * zt ** 3 * LOG( zrh )                    &
-      - ( 0.2557744774673163_wp * LOG( zrh ) ) / zx                      &
-      + 0.003223076552477191_wp * LOG( zrh ) ** 2                        &
-      + 0.000852636632240633_wp * zt * LOG( zrh ) ** 2                   &
-      - 0.00001547571354871789_wp * zt ** 2 * LOG( zrh ) ** 2            &
-      + 5.666608424980593E-8_wp * zt ** 3 * LOG( zrh ) ** 2              &
-      + ( 0.03384437400744206_wp * LOG( zrh ) ** 2 ) / zx                &
-      + 0.04743226764572505_wp * LOG( zrh ) ** 3                         &
-      - 0.0006251042204583412_wp * zt * LOG( zrh ) ** 3                  &
-      + 2.650663328519478E-6_wp * zt ** 2 * LOG( zrh ) ** 3              &
-      - 3.674710848763778E-9_wp * zt ** 3 * LOG( zrh ) ** 3              &
-      - ( 0.0002672510825259393_wp * LOG( zrh ) ** 3 ) / zx              &
-      - 0.01252108546759328_wp * LOG( zpcsa )                            &
-      + 0.005806550506277202_wp * zt * LOG( zpcsa )                      &
-      - 0.0001016735312443444_wp * zt ** 2 * LOG( zpcsa )                &
-      + 2.881946187214505E-7_wp * zt ** 3 * LOG( zpcsa )                 &
-      + ( 0.0942243379396279_wp * LOG( zpcsa ) ) / zx                    &
-      - 0.0385459592773097_wp * LOG( zrh ) * LOG( zpcsa )                &
-      - 0.0006723156277391984_wp * zt * LOG( zrh ) * LOG( zpcsa )        &
-      + 2.602884877659698E-6_wp * zt ** 2 * LOG( zrh ) * LOG( zpcsa )    &
-      + 1.194163699688297E-8_wp * zt ** 3 * LOG( zrh ) * LOG( zpcsa )    &
-      - ( 0.00851515345806281_wp * LOG( zrh ) * LOG( zpcsa ) ) / zx      &
-      - 0.01837488495738111_wp * LOG( zrh ) ** 2 * LOG( zpcsa )          &
-      + 0.0001720723574407498_wp * zt * LOG( zrh ) ** 2 * LOG( zpcsa )   &
-      - 3.717657974086814E-7_wp * zt**2 * LOG( zrh )**2 * LOG( zpcsa )   &
-      - 5.148746022615196E-10_wp * zt**3 * LOG( zrh )**2 * LOG( zpcsa )  &
-      + ( 0.0002686602132926594_wp * LOG(zrh)**2 * LOG(zpcsa) ) / zx     &
-      - 0.06199739728812199_wp * LOG( zpcsa ) ** 2                       &
-      + 0.000906958053583576_wp * zt * LOG( zpcsa ) ** 2                 &
-      - 9.11727926129757E-7_wp * zt ** 2 * LOG( zpcsa ) ** 2             &
-      - 5.367963396508457E-9_wp * zt ** 3 * LOG( zpcsa ) ** 2            &
-      - ( 0.007742343393937707_wp * LOG( zpcsa ) ** 2 ) / zx             &
-      + 0.0121827103101659_wp * LOG( zrh ) * LOG( zpcsa ) ** 2           &
-      - 0.0001066499571188091_wp * zt * LOG( zrh ) * LOG( zpcsa ) ** 2   &
-      + 2.534598655067518E-7_wp * zt**2 * LOG( zrh ) * LOG( zpcsa )**2   &
-      - 3.635186504599571E-10_wp * zt**3 * LOG( zrh ) * LOG( zpcsa )**2  &
-      + ( 0.0006100650851863252_wp * LOG( zrh ) * LOG( zpcsa ) **2 )/ zx &
-      + 0.0003201836700403512_wp * LOG( zpcsa ) ** 3                     &
-      - 0.0000174761713262546_wp * zt * LOG( zpcsa ) ** 3                &
-      + 6.065037668052182E-8_wp * zt ** 2 * LOG( zpcsa ) ** 3            &
-      - 1.421771723004557E-11_wp * zt ** 3 * LOG( zpcsa ) ** 3           &
-      + ( 0.0001357509859501723_wp * LOG( zpcsa ) ** 3 ) / zx
+    zntot = - 0.002954125078716302_wp - 0.0976834264241286_wp * zt +                               &
+              0.001024847927067835_wp * zt**2 - 2.186459697726116E-6_wp * zt**3 -                  &
+              0.1017165718716887_wp / zx - 0.002050640345231486_wp * zlogrh -                      &
+              0.007585041382707174_wp * zt * zlogrh + 0.0001926539658089536_wp * zt**2 * zlogrh -  &
+              6.70429719683894E-7_wp * zt**3 * zlogrh - ( 0.2557744774673163_wp * zlogrh ) / zx +  &
+              0.003223076552477191_wp * zlogrh**2 + 0.000852636632240633_wp * zt * zlogrh**2 -     &
+              0.00001547571354871789_wp * zt**2 * zlogrh**2 +                                      &
+              5.666608424980593E-8_wp * zt**3 * zlogrh**2 +                                        &
+              ( 0.03384437400744206_wp * zlogrh**2 ) / zx +                                        &
+              0.04743226764572505_wp * zlogrh**3 - 0.0006251042204583412_wp * zt * zlogrh**3 +     &
+              2.650663328519478E-6_wp * zt**2 * zlogrh**3 -                                        &
+              3.674710848763778E-9_wp * zt**3 * zlogrh**3 -                                        &
+              ( 0.0002672510825259393_wp * zlogrh**3 ) / zx - 0.01252108546759328_wp * zlogsa +    &
+              0.005806550506277202_wp * zt * zlogsa - 0.0001016735312443444_wp * zt**2 * zlogsa +  &
+              2.881946187214505E-7_wp * zt**3 * zlogsa + ( 0.0942243379396279_wp * zlogsa ) / zx - &
+              0.0385459592773097_wp * zlogrh * zlogsa -                                            &
+              0.0006723156277391984_wp * zt * zlogrh * zlogsa  +                                   &
+              2.602884877659698E-6_wp * zt**2 * zlogrh * zlogsa +                                  &
+              1.194163699688297E-8_wp * zt**3 * zlogrh * zlogsa -                                  &
+              ( 0.00851515345806281_wp * zlogrh * zlogsa ) / zx -                                  &
+              0.01837488495738111_wp * zlogrh**2 * zlogsa +                                        &
+              0.0001720723574407498_wp * zt * zlogrh**2 * zlogsa -                                 &
+              3.717657974086814E-7_wp * zt**2 * zlogrh**2 * zlogsa -                               &
+              5.148746022615196E-10_wp * zt**3 * zlogrh**2 * zlogsa +                              &
+              ( 0.0002686602132926594_wp * zlogrh**2 * zlogsa ) / zx -                             &
+              0.06199739728812199_wp * zlogsa**2 + 0.000906958053583576_wp * zt * zlogsa**2 -      &
+              9.11727926129757E-7_wp * zt**2 * zlogsa**2 -                                         &
+              5.367963396508457E-9_wp * zt**3 * zlogsa**2 -                                        &
+              ( 0.007742343393937707_wp * zlogsa**2 ) / zx +                                       &
+              0.0121827103101659_wp * zlogrh * zlogsa**2 -                                         &
+              0.0001066499571188091_wp * zt * zlogrh * zlogsa**2 +                                 &
+              2.534598655067518E-7_wp * zt**2 * zlogrh * zlogsa**2 -                               &
+              3.635186504599571E-10_wp * zt**3 * zlogrh * zlogsa**2 +                              &
+              ( 0.0006100650851863252_wp * zlogrh * zlogsa **2 ) / zx +                            &
+              0.0003201836700403512_wp * zlogsa**3 - 0.0000174761713262546_wp * zt * zlogsa**3 +   &
+              6.065037668052182E-8_wp * zt**2 * zlogsa**3 -                                        &
+              1.421771723004557E-11_wp * zt**3 * zlogsa**3 +                                       &
+              ( 0.0001357509859501723_wp * zlogsa**3 ) / zx
     zntot = EXP( zntot )  ! in #
 !
 !-- 5) Size of the critical cluster pd_crit (m) (diameter) (Eq. 14)
     pn_crit_sa = zx * zntot
-    pd_crit    = 2.0E-9_wp * EXP( -1.6524245_wp + 0.42316402_wp  * zx +        &
-                 0.33466487_wp * LOG( zntot ) )
+    pd_crit = 2.0E-9_wp * EXP( -1.6524245_wp + 0.42316402_wp * zx + 0.33466487_wp * LOG( zntot ) )
 !
 !-- 6) Organic compounds not involved when binary nucleation is assumed
@@ -4745,47 +4873,47 @@
     pk_sa        = 1.0_wp   ! if = 1, H2SO4 involved in nucleation
     pk_ocnv      = 0.0_wp   ! if = 1, organic compounds involved
-!                
-!-- Set nucleation rate to collision rate                
+!
+!-- Set nucleation rate to collision rate
     IF ( pn_crit_sa < 4.0_wp ) THEN
-!       
+!
 !--    Volumes of the colliding objects
        zma    = 96.0_wp   ! molar mass of SO4 in g/mol
        zmw    = 18.0_wp   ! molar mass of water in g/mol
        zxmass = 1.0_wp    ! mass fraction of H2SO4
-       za = 0.7681724_wp + zxmass * ( 2.1847140_wp + zxmass * (     &
-            7.1630022_wp + zxmass * ( -44.31447_wp + zxmass * (     &
-            88.75606 + zxmass * ( -75.73729_wp + zxmass *           &
-            23.43228_wp ) ) ) ) )
-       zb = 1.808225E-3_wp + zxmass * ( -9.294656E-3_wp + zxmass *  &
-            ( -0.03742148_wp + zxmass * ( 0.2565321_wp + zxmass *   &
-            ( -0.5362872_wp + zxmass * ( 0.4857736 - zxmass *       &
-            0.1629592_wp ) ) ) ) )
-       zc = - 3.478524E-6_wp + zxmass * ( 1.335867E-5_wp + zxmass * &
-           ( 5.195706E-5_wp + zxmass * ( -3.717636E-4_wp + zxmass * &
-           ( 7.990811E-4_wp + zxmass * ( -7.458060E-4_wp + zxmass * &
-             2.58139E-4_wp ) ) ) ) )
-!             
+       za = 0.7681724_wp + zxmass * ( 2.1847140_wp + zxmass *                                      &
+                                      ( 7.1630022_wp + zxmass *                                    &
+                                        ( -44.31447_wp + zxmass *                                  &
+                                          ( 88.75606 + zxmass *                                    &
+                                            ( -75.73729_wp + zxmass * 23.43228_wp ) ) ) ) )
+       zb = 1.808225E-3_wp + zxmass * ( -9.294656E-3_wp + zxmass *                                 &
+                                        ( -0.03742148_wp + zxmass *                                &
+                                          ( 0.2565321_wp + zxmass *                                &
+                                            ( -0.5362872_wp + zxmass *                             &
+                                              ( 0.4857736 - zxmass * 0.1629592_wp ) ) ) ) )
+       zc = - 3.478524E-6_wp + zxmass * ( 1.335867E-5_wp + zxmass *                                &
+                                          ( 5.195706E-5_wp + zxmass *                              &
+                                            ( -3.717636E-4_wp + zxmass *                           &
+                                              ( 7.990811E-4_wp + zxmass *                          &
+                                                ( -7.458060E-4_wp + zxmass * 2.58139E-4_wp ) ) ) ) )
+!
 !--    Density for the sulphuric acid solution (Eq. 10 in Vehkamaki)
-       zroo = za + zt * ( zb + zc * zt )   ! g/cm^3
-       zroo = zroo * 1.0E+3_wp   ! kg/m^3
+       zroo = ( za + zt * ( zb + zc * zt ) ) * 1.0E+3_wp   ! (kg/m^3
        zm1  = 0.098_wp   ! molar mass of H2SO4 in kg/mol
        zm2  = zm1
-       zv1  = zm1 / avo / zroo   ! volume 
+       zv1  = zm1 / avo / zroo   ! volume
        zv2  = zv1
-!       
-!--    Collision rate 
-       zcoll =  zpcsa * zpcsa * ( 3.0_wp * pi / 4.0_wp ) ** ( 1.0_wp / 6.0_wp )&
-                * SQRT( 6.0_wp * argas * zt / zm1 + 6.0_wp * argas * zt / zm2 )&
-                * ( zv1 ** ( 1.0_wp / 3.0_wp ) + zv2 ** ( 1.0_wp /3.0_wp ) ) **&
-                2.0_wp * 1.0E+6_wp    ! m3 -> cm3
-
-       zcoll      = MIN( zcoll, 1.0E+10_wp )
+!
+!--    Collision rate
+       zcoll =  zpcsa * zpcsa * ( 3.0_wp * pi / 4.0_wp )**0.16666666_wp *                          &
+                SQRT( 6.0_wp * argas * zt / zm1 + 6.0_wp * argas * zt / zm2 ) *                    &
+                ( zv1**0.33333333_wp + zv2**0.33333333_wp )**2 * 1.0E+6_wp    ! m3 -> cm3
+       zcoll = MIN( zcoll, 1.0E+10_wp )
        pnuc_rate  = zcoll   ! (#/(cm3 s))
-       
-    ELSE             
-       pnuc_rate  = MIN( pnuc_rate, 1.0E+10_wp )                
-    ENDIF             
+
+    ELSE
+       pnuc_rate  = MIN( pnuc_rate, 1.0E+10_wp )
+    ENDIF
     pnuc_rate = pnuc_rate * 1.0E+6_wp   ! (#/(m3 s))
-       
+
  END SUBROUTINE binnucl
  
@@ -4794,204 +4922,163 @@
 ! ------------
 !> Calculate the nucleation rate and the size of critical clusters assuming
-!> ternary nucleation. Parametrisation according to: 
-!> Napari et al. (2002), J. Chem. Phys., 116, 4221-4227 and 
-!> Napari et al. (2002), J. Geophys. Res., 107(D19), AAC 6-1-ACC 6-6. 
-!> Called from subroutine nucleation. 
-!------------------------------------------------------------------------------!
- SUBROUTINE ternucl( pc_sa, pc_nh3, ptemp, prh, pnuc_rate, pn_crit_sa,         &
-                     pn_crit_ocnv, pd_crit, pk_sa, pk_ocnv )
-                     
+!> ternary nucleation. Parametrisation according to:
+!> Napari et al. (2002), J. Chem. Phys., 116, 4221-4227 and
+!> Napari et al. (2002), J. Geophys. Res., 107(D19), AAC 6-1-ACC 6-6.
+!------------------------------------------------------------------------------!
+ SUBROUTINE ternucl( pc_sa, pc_nh3, ptemp, prh, pnuc_rate, pn_crit_sa, pn_crit_ocnv, pd_crit,      &
+                     pk_sa, pk_ocnv )
+
     IMPLICIT NONE
-    
-!-- Input and output variables
-    REAL(wp), INTENT(in) ::   pc_nh3  !< ammonia mixing ratio (ppt)       
+
+    REAL(wp) ::  zlnj     !< logarithm of nucleation rate
+    REAL(wp) ::  zlognh3  !< LOG( pc_nh3 )
+    REAL(wp) ::  zlogrh   !< LOG( prh )
+    REAL(wp) ::  zlogsa   !< LOG( pc_sa )
+
+    REAL(wp), INTENT(in) ::   pc_nh3  !< ammonia mixing ratio (ppt)
     REAL(wp), INTENT(in) ::   pc_sa   !< H2SO4 conc. (#/cm3)
     REAL(wp), INTENT(in) ::   prh     !< relative humidity [0-1]
     REAL(wp), INTENT(in) ::   ptemp   !< ambient temperature (K)
-    REAL(wp), INTENT(out) ::  pd_crit !< diameter of critical 
-                                                  !< cluster (m) 
-    REAL(wp), INTENT(out) ::  pk_ocnv !< Lever: if pk_ocnv = 1,organic compounds 
-                                      !< are involved in nucleation                                                     
-    REAL(wp), INTENT(out) ::  pk_sa   !< Lever: if pk_sa = 1, H2SO4 is involved
-                                      !< in nucleation                                                      
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)                                                     
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucleation rate (#/(m3 s))
-!-- Local variables
-    REAL(wp) ::  zlnj !< logarithm of nucleation rate
-    
-!-- 1) Checking that we are in the validity range of the parameterization. 
+
+    REAL(wp), INTENT(out) ::  pd_crit  !< diameter of critical cluster (m)
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate in nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucleation rate (#/(m3 s))
+!
+!-- 1) Checking that we are in the validity range of the parameterization.
 !--    Validity of parameterization : DO NOT REMOVE!
     IF ( ptemp < 240.0_wp  .OR.  ptemp > 300.0_wp )  THEN
        message_string = 'Invalid input value: ptemp'
-       CALL message( 'salsa_mod: ternucl', 'SA0045', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0619', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( prh < 0.05_wp  .OR.  prh > 0.95_wp )  THEN
        message_string = 'Invalid input value: prh'
-       CALL message( 'salsa_mod: ternucl', 'SA0046', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0620', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( pc_sa < 1.0E+4_wp  .OR.  pc_sa > 1.0E+9_wp )  THEN
        message_string = 'Invalid input value: pc_sa'
-       CALL message( 'salsa_mod: ternucl', 'SA0047', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0621', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( pc_nh3 < 0.1_wp  .OR.  pc_nh3 > 100.0_wp )  THEN
        message_string = 'Invalid input value: pc_nh3'
-       CALL message( 'salsa_mod: ternucl', 'SA0048', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0622', 1, 2, 0, 6, 0 )
     ENDIF
+
+    zlognh3 = LOG( pc_nh3 )
+    zlogrh  = LOG( prh )
+    zlogsa  = LOG( pc_sa )
 !
 !-- 2) Nucleation rate (Eq. 7 in Napari et al., 2002: Parameterization of 
 !--    ternary nucleation of sulfuric acid - ammonia - water.
-    zlnj = - 84.7551114741543_wp                                               &
-           + 0.3117595133628944_wp * prh                                       &
-           + 1.640089605712946_wp * prh * ptemp                                &
-           - 0.003438516933381083_wp * prh * ptemp ** 2.0_wp                   &
-           - 0.00001097530402419113_wp * prh * ptemp ** 3.0_wp                 &
-           - 0.3552967070274677_wp / LOG( pc_sa )                              &
-           - ( 0.06651397829765026_wp * prh ) / LOG( pc_sa )                   &
-           - ( 33.84493989762471_wp * ptemp ) / LOG( pc_sa )                   &
-           - ( 7.823815852128623_wp * prh * ptemp ) / LOG( pc_sa)              &
-           + ( 0.3453602302090915_wp * ptemp ** 2.0_wp ) / LOG( pc_sa )        &
-           + ( 0.01229375748100015_wp * prh * ptemp ** 2.0_wp ) / LOG( pc_sa ) &
-           - ( 0.000824007160514956_wp *ptemp ** 3.0_wp ) / LOG( pc_sa )       &
-           + ( 0.00006185539100670249_wp * prh * ptemp ** 3.0_wp )             &
-             / LOG( pc_sa )                                                    &
-           + 3.137345238574998_wp * LOG( pc_sa )                               &
-           + 3.680240980277051_wp * prh * LOG( pc_sa )                         &
-           - 0.7728606202085936_wp * ptemp * LOG( pc_sa )                      &
-           - 0.204098217156962_wp * prh * ptemp * LOG( pc_sa )                 &
-           + 0.005612037586790018_wp * ptemp ** 2.0_wp * LOG( pc_sa )          &
-           + 0.001062588391907444_wp * prh * ptemp ** 2.0_wp * LOG( pc_sa )    &
-           - 9.74575691760229E-6_wp * ptemp ** 3.0_wp * LOG( pc_sa )           &
-           - 1.265595265137352E-6_wp * prh * ptemp ** 3.0_wp * LOG( pc_sa )    &
-           + 19.03593713032114_wp * LOG( pc_sa ) ** 2.0_wp                     &
-           - 0.1709570721236754_wp * ptemp * LOG( pc_sa ) ** 2.0_wp            &
-           + 0.000479808018162089_wp * ptemp ** 2.0_wp * LOG( pc_sa ) ** 2.0_wp&
-           - 4.146989369117246E-7_wp * ptemp ** 3.0_wp * LOG( pc_sa ) ** 2.0_wp&
-           + 1.076046750412183_wp * LOG( pc_nh3 )                              &
-           + 0.6587399318567337_wp * prh * LOG( pc_nh3 )                       &
-           + 1.48932164750748_wp * ptemp * LOG( pc_nh3 )                       & 
-           + 0.1905424394695381_wp * prh * ptemp * LOG( pc_nh3 )               &
-           - 0.007960522921316015_wp * ptemp ** 2.0_wp * LOG( pc_nh3 )         &
-           - 0.001657184248661241_wp * prh * ptemp ** 2.0_wp * LOG( pc_nh3 )   &
-           + 7.612287245047392E-6_wp * ptemp ** 3.0_wp * LOG( pc_nh3 )         &
-           + 3.417436525881869E-6_wp * prh * ptemp ** 3.0_wp * LOG( pc_nh3 )   &
-           + ( 0.1655358260404061_wp * LOG( pc_nh3 ) ) / LOG( pc_sa)           &
-           + ( 0.05301667612522116_wp * prh * LOG( pc_nh3 ) ) / LOG( pc_sa )   &
-           + ( 3.26622914116752_wp * ptemp * LOG( pc_nh3 ) ) / LOG( pc_sa )    &
-           - ( 1.988145079742164_wp * prh * ptemp * LOG( pc_nh3 ) )            &
-             / LOG( pc_sa )                                                    &
-           - ( 0.04897027401984064_wp * ptemp ** 2.0_wp * LOG( pc_nh3) )       &
-             / LOG( pc_sa )                                                    &
-           + ( 0.01578269253599732_wp * prh * ptemp ** 2.0_wp * LOG( pc_nh3 )  &
-             ) / LOG( pc_sa )                                                  &
-           + ( 0.0001469672236351303_wp * ptemp ** 3.0_wp * LOG( pc_nh3 ) )    &
-             / LOG( pc_sa )                                                    &
-           - ( 0.00002935642836387197_wp * prh * ptemp ** 3.0_wp *LOG( pc_nh3 )&
-             ) / LOG( pc_sa )                                                  &
-           + 6.526451177887659_wp * LOG( pc_sa ) * LOG( pc_nh3 )               & 
-           - 0.2580021816722099_wp * ptemp * LOG( pc_sa ) * LOG( pc_nh3 )      &
-           + 0.001434563104474292_wp * ptemp ** 2.0_wp * LOG( pc_sa )          &
-             * LOG( pc_nh3 )                                                   &
-           -  2.020361939304473E-6_wp * ptemp ** 3.0_wp * LOG( pc_sa )         &
-             * LOG( pc_nh3 )                                                   &
-           - 0.160335824596627_wp * LOG( pc_sa ) ** 2.0_wp * LOG( pc_nh3 )     &
-           +  0.00889880721460806_wp * ptemp * LOG( pc_sa ) ** 2.0_wp          &
-             * LOG( pc_nh3 )                                                   &
-           -  0.00005395139051155007_wp * ptemp ** 2.0_wp                      &
-             * LOG( pc_sa) ** 2.0_wp * LOG( pc_nh3 )                           &
-           +  8.39521718689596E-8_wp * ptemp ** 3.0_wp * LOG( pc_sa ) ** 2.0_wp&
-             * LOG( pc_nh3 )                                                   &
-           + 6.091597586754857_wp * LOG( pc_nh3 ) ** 2.0_wp                    &
-           + 8.5786763679309_wp * prh * LOG( pc_nh3 ) ** 2.0_wp                &
-           - 1.253783854872055_wp * ptemp * LOG( pc_nh3 ) ** 2.0_wp            &
-           - 0.1123577232346848_wp * prh * ptemp * LOG( pc_nh3 ) ** 2.0_wp     &
-           + 0.00939835595219825_wp * ptemp ** 2.0_wp * LOG( pc_nh3 ) ** 2.0_wp&
-           + 0.0004726256283031513_wp * prh * ptemp ** 2.0_wp                  &
-             * LOG( pc_nh3) ** 2.0_wp                                          &
-           - 0.00001749269360523252_wp * ptemp ** 3.0_wp                       &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           - 6.483647863710339E-7_wp * prh * ptemp ** 3.0_wp                   &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           + ( 0.7284285726576598_wp * LOG( pc_nh3 ) ** 2.0_wp ) / LOG( pc_sa )&
-           + ( 3.647355600846383_wp * ptemp * LOG( pc_nh3 ) ** 2.0_wp )        &
-             / LOG( pc_sa )                                                    &
-           - ( 0.02742195276078021_wp * ptemp ** 2.0_wp                        &
-             * LOG( pc_nh3) ** 2.0_wp ) / LOG( pc_sa )                         &
-           + ( 0.00004934777934047135_wp * ptemp ** 3.0_wp                     &
-             * LOG( pc_nh3 ) ** 2.0_wp ) / LOG( pc_sa )                        &
-           + 41.30162491567873_wp * LOG( pc_sa ) * LOG( pc_nh3 ) ** 2.0_wp     &
-           - 0.357520416800604_wp * ptemp * LOG( pc_sa )                       &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           + 0.000904383005178356_wp * ptemp ** 2.0_wp * LOG( pc_sa )          &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           - 5.737876676408978E-7_wp * ptemp ** 3.0_wp * LOG( pc_sa )          &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           - 2.327363918851818_wp * LOG( pc_sa ) ** 2.0_wp                     &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           + 0.02346464261919324_wp * ptemp * LOG( pc_sa ) ** 2.0_wp           &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           - 0.000076518969516405_wp * ptemp ** 2.0_wp                         &
-             * LOG( pc_sa ) ** 2.0_wp * LOG( pc_nh3 ) ** 2.0_wp                &
-           + 8.04589834836395E-8_wp * ptemp ** 3.0_wp * LOG( pc_sa ) ** 2.0_wp &
-             * LOG( pc_nh3 ) ** 2.0_wp                                         &
-           - 0.02007379204248076_wp * LOG( prh )                               &
-           - 0.7521152446208771_wp * ptemp * LOG( prh )                        &
-           + 0.005258130151226247_wp * ptemp ** 2.0_wp * LOG( prh )            &
-           - 8.98037634284419E-6_wp * ptemp ** 3.0_wp * LOG( prh )             &
-           + ( 0.05993213079516759_wp * LOG( prh ) ) / LOG( pc_sa )            &
-           + ( 5.964746463184173_wp * ptemp * LOG( prh ) ) / LOG( pc_sa )      &
-           - ( 0.03624322255690942_wp * ptemp ** 2.0_wp * LOG( prh ) )         &
-             / LOG( pc_sa )                                                    &
-           + ( 0.00004933369382462509_wp * ptemp ** 3.0_wp * LOG( prh ) )      &
-             / LOG( pc_sa )                                                    &
-           - 0.7327310805365114_wp * LOG( pc_nh3 ) * LOG( prh )                &
-           - 0.01841792282958795_wp * ptemp * LOG( pc_nh3 ) * LOG( prh )       &
-           + 0.0001471855981005184_wp * ptemp ** 2.0_wp * LOG( pc_nh3 )        &
-             * LOG( prh )                                                      &
-           - 2.377113195631848E-7_wp * ptemp ** 3.0_wp * LOG( pc_nh3 )         &
-             * LOG( prh )
+    zlnj = - 84.7551114741543_wp + 0.3117595133628944_wp * prh +                                   &
+           1.640089605712946_wp * prh * ptemp - 0.003438516933381083_wp * prh * ptemp**2 -         &
+           0.00001097530402419113_wp * prh * ptemp**3 - 0.3552967070274677_wp / zlogsa -           &
+           ( 0.06651397829765026_wp * prh ) / zlogsa - ( 33.84493989762471_wp * ptemp ) / zlogsa - &
+           ( 7.823815852128623_wp * prh * ptemp ) / zlogsa +                                       &
+           ( 0.3453602302090915_wp * ptemp**2 ) / zlogsa +                                         &
+           ( 0.01229375748100015_wp * prh * ptemp**2 ) / zlogsa -                                  &
+           ( 0.000824007160514956_wp *ptemp**3 ) / zlogsa +                                        &
+           ( 0.00006185539100670249_wp * prh * ptemp**3 ) / zlogsa +                               &
+           3.137345238574998_wp * zlogsa + 3.680240980277051_wp * prh * zlogsa -                   &
+           0.7728606202085936_wp * ptemp * zlogsa - 0.204098217156962_wp * prh * ptemp * zlogsa +  &
+           0.005612037586790018_wp * ptemp**2 * zlogsa +                                           &
+           0.001062588391907444_wp * prh * ptemp**2 * zlogsa -                                     &
+           9.74575691760229E-6_wp * ptemp**3 * zlogsa -                                            &
+           1.265595265137352E-6_wp * prh * ptemp**3 * zlogsa + 19.03593713032114_wp * zlogsa**2 -  &
+           0.1709570721236754_wp * ptemp * zlogsa**2 +                                             &
+           0.000479808018162089_wp * ptemp**2 * zlogsa**2 -                                        &
+           4.146989369117246E-7_wp * ptemp**3 * zlogsa**2 + 1.076046750412183_wp * zlognh3 +       &
+           0.6587399318567337_wp * prh * zlognh3 + 1.48932164750748_wp * ptemp * zlognh3 +         &
+           0.1905424394695381_wp * prh * ptemp * zlognh3 -                                         &
+           0.007960522921316015_wp * ptemp**2 * zlognh3 -                                          &
+           0.001657184248661241_wp * prh * ptemp**2 * zlognh3 +                                    &
+           7.612287245047392E-6_wp * ptemp**3 * zlognh3 +                                          &
+           3.417436525881869E-6_wp * prh * ptemp**3 * zlognh3 +                                    &
+           ( 0.1655358260404061_wp * zlognh3 ) / zlogsa +                                          &
+           ( 0.05301667612522116_wp * prh * zlognh3 ) / zlogsa +                                   &
+           ( 3.26622914116752_wp * ptemp * zlognh3 ) / zlogsa -                                    &
+           ( 1.988145079742164_wp * prh * ptemp * zlognh3 ) / zlogsa -                             &
+           ( 0.04897027401984064_wp * ptemp**2 * zlognh3 ) / zlogsa +                              &
+           ( 0.01578269253599732_wp * prh * ptemp**2 * zlognh3 ) / zlogsa +                        &
+           ( 0.0001469672236351303_wp * ptemp**3 * zlognh3 ) / zlogsa -                            &
+           ( 0.00002935642836387197_wp * prh * ptemp**3 *zlognh3 ) / zlogsa +                      &
+           6.526451177887659_wp * zlogsa * zlognh3 -                                               &
+           0.2580021816722099_wp * ptemp * zlogsa * zlognh3 +                                      &
+           0.001434563104474292_wp * ptemp**2 * zlogsa * zlognh3 -                                 &
+           2.020361939304473E-6_wp * ptemp**3 * zlogsa * zlognh3 -                                 &
+           0.160335824596627_wp * zlogsa**2 * zlognh3 +                                            &
+           0.00889880721460806_wp * ptemp * zlogsa**2 * zlognh3 -                                  &
+           0.00005395139051155007_wp * ptemp**2 * zlogsa**2 * zlognh3 +                            &
+           8.39521718689596E-8_wp * ptemp**3 * zlogsa**2 * zlognh3 +                               &
+           6.091597586754857_wp * zlognh3**2 + 8.5786763679309_wp * prh * zlognh3**2 -             &
+           1.253783854872055_wp * ptemp * zlognh3**2 -                                             &
+           0.1123577232346848_wp * prh * ptemp * zlognh3**2 +                                      &
+           0.00939835595219825_wp * ptemp**2 * zlognh3**2 +                                        &
+           0.0004726256283031513_wp * prh * ptemp**2 * zlognh3**2 -                                &
+           0.00001749269360523252_wp * ptemp**3 * zlognh3**2 -                                     &
+           6.483647863710339E-7_wp * prh * ptemp**3 * zlognh3**2 +                                 &
+           ( 0.7284285726576598_wp * zlognh3**2 ) / zlogsa +                                       &
+           ( 3.647355600846383_wp * ptemp * zlognh3**2 ) / zlogsa -                                &
+           ( 0.02742195276078021_wp * ptemp**2 * zlognh3**2 ) / zlogsa +                           &
+           ( 0.00004934777934047135_wp * ptemp**3 * zlognh3**2 ) / zlogsa +                        &
+           41.30162491567873_wp * zlogsa * zlognh3**2 -                                            &
+           0.357520416800604_wp * ptemp * zlogsa * zlognh3**2 +                                    &
+           0.000904383005178356_wp * ptemp**2 * zlogsa * zlognh3**2 -                              &
+           5.737876676408978E-7_wp * ptemp**3 * zlogsa * zlognh3**2 -                              &
+           2.327363918851818_wp * zlogsa**2 * zlognh3**2 +                                         &
+           0.02346464261919324_wp * ptemp * zlogsa**2 * zlognh3**2 -                               &
+           0.000076518969516405_wp * ptemp**2 * zlogsa**2 * zlognh3**2 +                           &
+           8.04589834836395E-8_wp * ptemp**3 * zlogsa**2 * zlognh3**2 -                            &
+           0.02007379204248076_wp * zlogrh - 0.7521152446208771_wp * ptemp * zlogrh +              &
+           0.005258130151226247_wp * ptemp**2 * zlogrh -                                           &
+           8.98037634284419E-6_wp * ptemp**3 * zlogrh +                                            &
+           ( 0.05993213079516759_wp * zlogrh ) / zlogsa +                                          &
+           ( 5.964746463184173_wp * ptemp * zlogrh ) / zlogsa -                                    &
+           ( 0.03624322255690942_wp * ptemp**2 * zlogrh ) / zlogsa +                               &
+           ( 0.00004933369382462509_wp * ptemp**3 * zlogrh ) / zlogsa -                            &
+           0.7327310805365114_wp * zlognh3 * zlogrh -                                              &
+           0.01841792282958795_wp * ptemp * zlognh3 * zlogrh +                                     &
+           0.0001471855981005184_wp * ptemp**2 * zlognh3 * zlogrh -                                &
+           2.377113195631848E-7_wp * ptemp**3 * zlognh3 * zlogrh
     pnuc_rate = EXP( zlnj )   ! (#/(cm3 s))
-!    
-!-- Check validity of parametrization             
-    IF ( pnuc_rate < 1.0E-5_wp )  THEN 
+!
+!-- Check validity of parametrization
+    IF ( pnuc_rate < 1.0E-5_wp )  THEN
        pnuc_rate = 0.0_wp
        pd_crit   = 1.0E-9_wp
     ELSEIF ( pnuc_rate > 1.0E6_wp )  THEN
        message_string = 'Invalid output value: nucleation rate > 10^6 1/cm3s'
-       CALL message( 'salsa_mod: ternucl', 'SA0049', 1, 2, 0, 6, 0 )
+       CALL message( 'salsa_mod: ternucl', 'PA0623', 1, 2, 0, 6, 0 )
     ENDIF
     pnuc_rate = pnuc_rate * 1.0E6_wp   ! (#/(m3 s))
-!             
+!
 !-- 3) Number of H2SO4 molecules in a critical cluster (Eq. 9)
-    pn_crit_sa = 38.16448247950508_wp + 0.7741058259731187_wp * zlnj +         &
-                 0.002988789927230632_wp * zlnj ** 2.0_wp -                    &
-                 0.3576046920535017_wp * ptemp -                               &
-                 0.003663583011953248_wp * zlnj * ptemp +                      &
-                 0.000855300153372776_wp * ptemp ** 2.0_wp
-!-- Kinetic limit: at least 2 H2SO4 molecules in a cluster                                 
-    pn_crit_sa = MAX( pn_crit_sa, 2.0E0_wp ) 
-!             
+    pn_crit_sa = 38.16448247950508_wp + 0.7741058259731187_wp * zlnj +                             &
+                 0.002988789927230632_wp * zlnj**2 - 0.3576046920535017_wp * ptemp -               &
+                 0.003663583011953248_wp * zlnj * ptemp + 0.000855300153372776_wp * ptemp**2
+!
+!-- Kinetic limit: at least 2 H2SO4 molecules in a cluster
+    pn_crit_sa = MAX( pn_crit_sa, 2.0E0_wp )
+!
 !-- 4) Size of the critical cluster in nm (Eq. 12)
-    pd_crit = 0.1410271086638381_wp - 0.001226253898894878_wp * zlnj -         &
-              7.822111731550752E-6_wp * zlnj ** 2.0_wp -                       &
-              0.001567273351921166_wp * ptemp -                                &
-              0.00003075996088273962_wp * zlnj * ptemp +                       &
-              0.00001083754117202233_wp * ptemp ** 2.0_wp  
+    pd_crit = 0.1410271086638381_wp - 0.001226253898894878_wp * zlnj -                             &
+              7.822111731550752E-6_wp * zlnj**2 - 0.001567273351921166_wp * ptemp -                &
+              0.00003075996088273962_wp * zlnj * ptemp + 0.00001083754117202233_wp * ptemp**2
     pd_crit = pd_crit * 2.0E-9_wp   ! Diameter in m
 !
 !-- 5) Organic compounds not involved when ternary nucleation assumed
-    pn_crit_ocnv = 0.0_wp 
+    pn_crit_ocnv = 0.0_wp
     pk_sa   = 1.0_wp
     pk_ocnv = 0.0_wp
-    
+
  END SUBROUTINE ternucl
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate the nucleation rate and the size of critical clusters assuming 
-!> kinetic nucleation. Each sulphuric acid molecule forms an (NH4)HSO4 molecule 
+!> Calculate the nucleation rate and the size of critical clusters assuming
+!> kinetic nucleation. Each sulphuric acid molecule forms an (NH4)HSO4 molecule
 !> in the atmosphere and two colliding (NH4)HSO4 molecules form a stable
 !> cluster. See Sihto et al. (2006), Atmos. Chem. Phys., 6(12), 4079-4091.
@@ -5003,32 +5090,29 @@
 !>  dens_abs = 1465  density of - " - [kg/m3]
 !------------------------------------------------------------------------------!
- SUBROUTINE kinnucl( pc_sa, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv,      &
-                     pk_sa, pk_ocnv ) 
-                     
+ SUBROUTINE kinnucl( pc_sa, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv, pk_sa, pk_ocnv )
+
     IMPLICIT NONE
-    
-!-- Input and output variables
-    REAL(wp), INTENT(in) ::  pc_sa     !< H2SO4 conc. (#/m3)
+
+    REAL(wp), INTENT(in) ::  pc_sa  !< H2SO4 conc. (#/m3)
+
     REAL(wp), INTENT(out) ::  pd_crit  !< critical diameter of clusters (m)
-    REAL(wp), INTENT(out) ::  pk_ocnv  !< Lever: if pk_ocnv = 1, organic 
-                                       !< compounds are involved in nucleation
-    REAL(wp), INTENT(out) ::  pk_sa    !< Lever: if pk_sa = 1, H2SO4 is involved
-                                       !< in nucleation 
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucl. rate (#/(m3 s))
-    
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate in nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 is participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucl. rate (#/(m3 s))
+!
 !-- Nucleation rate (#/(m3 s))
-    pnuc_rate = 5.0E-13_wp * pc_sa ** 2.0_wp * 1.0E+6_wp
+    pnuc_rate = 5.0E-13_wp * pc_sa**2.0_wp * 1.0E+6_wp
+!
 !-- Organic compounds not involved when kinetic nucleation is assumed.
     pn_crit_sa   = 2.0_wp
-    pn_crit_ocnv = 0.0_wp 
+    pn_crit_ocnv = 0.0_wp
     pk_sa        = 1.0_wp
-    pk_ocnv      = 0.0_wp             
+    pk_ocnv      = 0.0_wp
     pd_crit      = 7.9375E-10_wp   ! (m)
-    
+
  END SUBROUTINE kinnucl
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5038,32 +5122,30 @@
 !> See Riipinen et al. (2007), Atmos. Chem. Phys., 7(8), 1899-1914.
 !------------------------------------------------------------------------------!
- SUBROUTINE actnucl( psa_conc, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv,   &
-                     pk_sa, pk_ocnv, activ ) 
+ SUBROUTINE actnucl( psa_conc, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv, pk_sa, pk_ocnv, activ )
 
     IMPLICIT NONE
-    
-!-- Input and output variables
-    REAL(wp), INTENT(in) ::  psa_conc !< H2SO4 conc. (#/m3)
-    REAL(wp), INTENT(in) ::  activ    !<
-    REAL(wp), INTENT(out) ::  pd_crit !< critical diameter of clusters (m)
-    REAL(wp), INTENT(out) ::  pk_ocnv !< Lever: if pk_ocnv = 1, organic 
-                                      !< compounds are involved in nucleation
-    REAL(wp), INTENT(out) ::  pk_sa   !< Lever: if pk_sa = 1, H2SO4 is involved
-                                      !< in nucleation 
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucl. rate (#/(m3 s))
-    
-!-- act_coeff 1e-7 by default
+
+    REAL(wp), INTENT(in) ::  activ     !< activation coefficient (1e-7 by default)
+    REAL(wp), INTENT(in) ::  psa_conc  !< H2SO4 conc. (#/m3)
+
+    REAL(wp), INTENT(out) ::  pd_crit  !< critical diameter of clusters (m)
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate in nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucl. rate (#/(m3 s))
+!
+!-- Nucleation rate (#/(m3 s))
     pnuc_rate = activ * psa_conc   ! (#/(m3 s))
+!
 !-- Organic compounds not involved when kinetic nucleation is assumed.
     pn_crit_sa   = 2.0_wp
-    pn_crit_ocnv = 0.0_wp 
+    pn_crit_ocnv = 0.0_wp
     pk_sa        = 1.0_wp
     pk_ocnv      = 0.0_wp
     pd_crit      = 7.9375E-10_wp   ! (m)
+
  END SUBROUTINE actnucl
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5078,30 +5160,28 @@
 
     IMPLICIT NONE
-    
-!-- Input and output variables
+
+    REAL(wp) ::  a_org = 1.3E-7_wp  !< (1/s) (Paasonen et al. Table 4: median)
+
     REAL(wp), INTENT(in) ::  pc_org   !< organic vapour concentration (#/m3)
-    REAL(wp), INTENT(out) ::  pd_crit !< critical diameter of clusters (m)
-    REAL(wp), INTENT(out) ::  pk_ocnv !< Lever: if pk_ocnv = 1, organic 
-                                      !< compounds are involved in nucleation
-    REAL(wp), INTENT(out) ::  pk_sa !< Lever: if pk_sa = 1, H2SO4 is involved 
-                                    !< in nucleation 
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucl. rate (#/(m3 s))
-!-- Local variables
-    REAL(wp) ::  Aorg = 1.3E-7_wp !< (1/s) (Paasonen et al. Table 4: median)
-    
-!-- Homomolecular nuleation - which one?          
-    pnuc_rate = Aorg * pc_org 
+
+    REAL(wp), INTENT(out) ::  pd_crit  !< critical diameter of clusters (m)
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate in nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucl. rate (#/(m3 s))
+!
+!-- Homomolecular nuleation rate
+    pnuc_rate = a_org * pc_org
+!
 !-- H2SO4 not involved when pure organic nucleation is assumed.
     pn_crit_sa   = 0.0_wp
-    pn_crit_ocnv = 1.0_wp 
+    pn_crit_ocnv = 1.0_wp
     pk_sa        = 0.0_wp
     pk_ocnv      = 1.0_wp
     pd_crit      = 1.5E-9_wp   ! (m)
-    
+
  END SUBROUTINE orgnucl
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5111,36 +5191,33 @@
 !> See Paasonen et al. (2010), Atmos. Chem. Phys., 10, 11223-11242.
 !------------------------------------------------------------------------------!
- SUBROUTINE sumnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa,            &
-                     pn_crit_ocnv, pk_sa, pk_ocnv )
+ SUBROUTINE sumnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv, pk_sa, pk_ocnv )
 
     IMPLICIT NONE
-    
-!-- Input and output variables
+
+    REAL(wp) ::  a_s1 = 6.1E-7_wp   !< (1/s)
+    REAL(wp) ::  a_s2 = 0.39E-7_wp  !< (1/s) (Paasonen et al. Table 3.)
+
     REAL(wp), INTENT(in) ::  pc_org   !< organic vapour concentration (#/m3)
     REAL(wp), INTENT(in) ::  pc_sa    !< H2SO4 conc. (#/m3)
-    REAL(wp), INTENT(out) ::  pd_crit !< critical diameter of clusters (m)
-    REAL(wp), INTENT(out) ::  pk_ocnv !< Lever: if pk_ocnv = 1, organic 
-                                      !< compounds are involved in nucleation
-    REAL(wp), INTENT(out) ::  pk_sa   !< Lever: if pk_sa = 1, H2SO4 is involved
-                                      !< in nucleation 
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucl. rate (#/(m3 s))
-!-- Local variables
-    REAL(wp) ::  As1 = 6.1E-7_wp  !< (1/s)
-    REAL(wp) ::  As2 = 0.39E-7_wp !< (1/s) (Paasonen et al. Table 3.)
-    
+
+    REAL(wp), INTENT(out) ::  pd_crit  !< critical diameter of clusters (m)
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate in nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucl. rate (#/(m3 s))
+!
 !-- Nucleation rate  (#/m3/s)
-    pnuc_rate = As1 * pc_sa + As2 * pc_org 
-!-- Both Organic compounds and H2SO4 are involved when SUMnucleation is assumed.
+    pnuc_rate = a_s1 * pc_sa + a_s2 * pc_org
+!
+!-- Both organic compounds and H2SO4 are involved when sumnucleation is assumed.
     pn_crit_sa   = 1.0_wp
-    pn_crit_ocnv = 1.0_wp 
+    pn_crit_ocnv = 1.0_wp
     pk_sa        = 1.0_wp
-    pk_ocnv      = 1.0_wp           
+    pk_ocnv      = 1.0_wp
     pd_crit      = 1.5E-9_wp   ! (m)
-    
+
  END SUBROUTINE sumnucl
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5150,68 +5227,61 @@
 !> See Paasonen et al. (2010), Atmos. Chem. Phys., 10, 11223-11242.
 !------------------------------------------------------------------------------!
- SUBROUTINE hetnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa,            &
-                     pn_crit_ocnv, pk_sa, pk_ocnv )
+ SUBROUTINE hetnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv, pk_sa, pk_ocnv )
 
     IMPLICIT NONE
-    
-!-- Input and output variables
+
+    REAL(wp) ::  z_k_het = 4.1E-14_wp  !< (cm3/s) (Paasonen et al. Table 4: median)
+
     REAL(wp), INTENT(in) ::  pc_org   !< organic vapour concentration (#/m3)
     REAL(wp), INTENT(in) ::  pc_sa    !< H2SO4 conc. (#/m3)
-    REAL(wp), INTENT(out) ::  pd_crit !< critical diameter of clusters (m)
-    REAL(wp), INTENT(out) ::  pk_ocnv !< Lever: if pk_ocnv = 1, organic 
-                                      !< compounds are involved in nucleation
-    REAL(wp), INTENT(out) ::  pk_sa   !< Lever: if pk_sa = 1, H2SO4 is involved
-                                      !< in nucleation 
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucl. rate (#/(m3 s))
-!-- Local variables
-    REAL(wp) ::  zKhet = 4.1E-14_wp !< (cm3/s) (Paasonen et al. Table 4: median)
-    
+
+    REAL(wp), INTENT(out) ::  pd_crit  !< critical diameter of clusters (m)
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate in nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucl. rate (#/(m3 s))
+!
 !-- Nucleation rate (#/m3/s)
-    pnuc_rate = zKhet * pc_sa * pc_org * 1.0E6_wp 
-!-- Both Organic compounds and H2SO4 are involved when heteromolecular
+    pnuc_rate = z_k_het * pc_sa * pc_org * 1.0E6_wp
+!
+!-- Both organic compounds and H2SO4 are involved when heteromolecular
 !-- nucleation is assumed.
     pn_crit_sa   = 1.0_wp
-    pn_crit_ocnv = 1.0_wp 
+    pn_crit_ocnv = 1.0_wp
     pk_sa        = 1.0_wp
-    pk_ocnv      = 1.0_wp  
+    pk_ocnv      = 1.0_wp
     pd_crit      = 1.5E-9_wp   ! (m)
-    
+
  END SUBROUTINE hetnucl
+
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Takes into account the homomolecular nucleation of sulphuric acid H2SO4 with 
+!> Takes into account the homomolecular nucleation of sulphuric acid H2SO4 with
 !> both of the available vapours.
 !> See Paasonen et al. (2010), Atmos. Chem. Phys., 10, 11223-11242.
 !------------------------------------------------------------------------------!
- SUBROUTINE SAnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa,             &
-                    pn_crit_ocnv, pk_sa, pk_ocnv )
+ SUBROUTINE SAnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv, pk_sa, pk_ocnv )
 
     IMPLICIT NONE
-    
-!-- Input and output variables
+
+    REAL(wp) ::  z_k_sa1 = 1.1E-14_wp  !< (cm3/s)
+    REAL(wp) ::  z_k_sa2 = 3.2E-14_wp  !< (cm3/s) (Paasonen et al. Table 3.)
+
     REAL(wp), INTENT(in) ::  pc_org   !< organic vapour concentration (#/m3)
     REAL(wp), INTENT(in) ::  pc_sa    !< H2SO4 conc. (#/m3)
-    REAL(wp), INTENT(out) ::  pd_crit !< critical diameter of clusters (m)
-    REAL(wp), INTENT(out) ::  pk_ocnv !< Lever: if pk_ocnv = 1, organic 
-                                      !< compounds are involved in nucleation
-    REAL(wp), INTENT(out) ::  pk_sa   !< Lever: if pk_sa = 1, H2SO4 is involved
-                                      !< in nucleation 
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucleation rate (#/(m3 s))
-!-- Local variables
-    REAL(wp) ::  zKsa1 = 1.1E-14_wp !< (cm3/s)
-    REAL(wp) ::  zKsa2 = 3.2E-14_wp  !< (cm3/s) (Paasonen et al. Table 3.)
-    
+
+    REAL(wp), INTENT(out) ::  pd_crit  !< critical diameter of clusters (m)
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucleation rate (#/(m3 s))
+!
 !-- Nucleation rate (#/m3/s)
-    pnuc_rate = ( zKsa1 * pc_sa ** 2.0_wp + zKsa2 * pc_sa * pc_org ) * 1.0E+6_wp 
-!-- Both Organic compounds and H2SO4 are involved when SAnucleation is assumed.
+    pnuc_rate = ( z_k_sa1 * pc_sa**2 + z_k_sa2 * pc_sa * pc_org ) * 1.0E+6_wp
+!
+!-- Both organic compounds and H2SO4 are involved when SAnucleation is assumed.
     pn_crit_sa   = 3.0_wp
     pn_crit_ocnv = 1.0_wp 
@@ -5219,6 +5289,7 @@
     pk_ocnv      = 1.0_wp
     pd_crit      = 1.5E-9_wp   ! (m)
-    
+
  END SUBROUTINE SAnucl
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5228,65 +5299,62 @@
 !> See Paasonen et al. (2010), Atmos. Chem. Phys., 10, 11223-11242.
 !------------------------------------------------------------------------------!
- SUBROUTINE SAORGnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa,          &
-                       pn_crit_ocnv, pk_sa, pk_ocnv )
+ SUBROUTINE SAORGnucl( pc_sa, pc_org, pnuc_rate, pd_crit, pn_crit_sa, pn_crit_ocnv, pk_sa, pk_ocnv )
 
     IMPLICIT NONE
-    
-!-- Input and output variables
+
+    REAL(wp) ::  z_k_s1 = 1.4E-14_wp    !< (cm3/s])
+    REAL(wp) ::  z_k_s2 = 2.6E-14_wp    !< (cm3/s])
+    REAL(wp) ::  z_k_s3 = 0.037E-14_wp  !< (cm3/s]) (Paasonen et al. Table 3.)
+
     REAL(wp), INTENT(in) ::  pc_org   !< organic vapour concentration (#/m3)
     REAL(wp), INTENT(in) ::  pc_sa    !< H2SO4 conc. (#/m3)
-    REAL(wp), INTENT(out) ::  pd_crit !< critical diameter of clusters (m)
-    REAL(wp), INTENT(out) ::  pk_ocnv !< Lever: if pk_ocnv = 1, organic 
-                                      !< compounds are involved in nucleation
-    REAL(wp), INTENT(out) ::  pk_sa   !< Lever: if pk_sa = 1, H2SO4 is involved 
-                                      !< in nucleation 
-    REAL(wp), INTENT(out) ::  pn_crit_ocnv !< number of organic molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pn_crit_sa   !< number of H2SO4 molecules in 
-                                           !< cluster (#)
-    REAL(wp), INTENT(out) ::  pnuc_rate    !< nucl. rate (#/(m3 s))
-!-- Local variables
-    REAL(wp) ::  zKs1 = 1.4E-14_wp   !< (cm3/s])
-    REAL(wp) ::  zKs2 = 2.6E-14_wp   !< (cm3/s])
-    REAL(wp) ::  zKs3 = 0.037E-14_wp !< (cm3/s]) (Paasonen et al. Table 3.)
-    
-!-- Nucleation rate (#/m3/s)         
-    pnuc_rate = ( zKs1 * pc_sa **2 + zKs2 * pc_sa * pc_org + zKs3 *            &
-                  pc_org ** 2.0_wp ) * 1.0E+6_wp
+
+    REAL(wp), INTENT(out) ::  pd_crit  !< critical diameter of clusters (m)
+    REAL(wp), INTENT(out) ::  pk_ocnv  !< if pk_ocnv = 1, organic compounds participate in nucleation
+    REAL(wp), INTENT(out) ::  pk_sa    !< if pk_sa = 1, H2SO4 participate in nucleation
+    REAL(wp), INTENT(out) ::  pn_crit_ocnv  !< number of organic molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pn_crit_sa    !< number of H2SO4 molecules in cluster (#)
+    REAL(wp), INTENT(out) ::  pnuc_rate     !< nucl. rate (#/(m3 s))
+!
+!-- Nucleation rate (#/m3/s)
+    pnuc_rate = ( z_k_s1 * pc_sa**2 + z_k_s2 * pc_sa * pc_org + z_k_s3 * pc_org**2 ) * 1.0E+6_wp
+!
 !-- Organic compounds not involved when kinetic nucleation is assumed.
     pn_crit_sa   = 3.0_wp
-    pn_crit_ocnv = 3.0_wp 
+    pn_crit_ocnv = 3.0_wp
     pk_sa        = 1.0_wp
     pk_ocnv      = 1.0_wp
     pd_crit      = 1.5E-9_wp   ! (m)
- 
+
  END SUBROUTINE SAORGnucl
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Function zNnuc_tayl is connected to the calculation of self-coagualtion of 
+!> Function z_n_nuc_tayl is connected to the calculation of self-coagualtion of 
 !> small particles. It calculates number of the particles in the size range
 !> [zdcrit,dx] using Taylor-expansion (please note that the expansion is not 
 !> valid for certain rational numbers, e.g. -4/3 and -3/2)
 !------------------------------------------------------------------------------!
- FUNCTION zNnuc_tayl( d1, dx, zm_para, zjnuc_t, zeta, zGRtot ) 
+ FUNCTION z_n_nuc_tayl( d1, dx, zm_para, zjnuc_t, zeta, z_gr_tot )
+
     IMPLICIT NONE
-  
-    INTEGER(iwp) ::  i
-    REAL(wp) ::  d1
-    REAL(wp) ::  dx
-    REAL(wp) ::  zjnuc_t
-    REAL(wp) ::  zeta
-    REAL(wp) ::  term1
-    REAL(wp) ::  term2
-    REAL(wp) ::  term3
-    REAL(wp) ::  term4
-    REAL(wp) ::  term5
-    REAL(wp) ::  zNnuc_tayl
-    REAL(wp) ::  zGRtot
-    REAL(wp) ::  zm_para
-
-    zNnuc_tayl = 0.0_wp
+
+    INTEGER(iwp) ::  i !< running index
+
+    REAL(wp) ::  d1            !< lower diameter limit
+    REAL(wp) ::  dx            !< upper diameter limit
+    REAL(wp) ::  zjnuc_t       !< initial nucleation rate (1/s)
+    REAL(wp) ::  zeta          !< ratio of CS/GR (m) (condensation sink / growth rate)
+    REAL(wp) ::  term1         !<
+    REAL(wp) ::  term2         !<
+    REAL(wp) ::  term3         !<
+    REAL(wp) ::  term4         !<
+    REAL(wp) ::  term5         !<
+    REAL(wp) ::  z_n_nuc_tayl  !< final nucleation rate (1/s)
+    REAL(wp) ::  z_gr_tot      !< total growth rate (nm/h)
+    REAL(wp) ::  zm_para       !< m parameter in Lehtinen et al. (2007), Eq. 6
+
+    z_n_nuc_tayl = 0.0_wp
 
     DO  i = 0, 29
@@ -5296,17 +5364,14 @@
           term1 = term1 * REAL( i, SELECTED_REAL_KIND(12,307) )
        END IF
-       term2 = ( REAL( i, SELECTED_REAL_KIND(12,307) ) * ( zm_para + 1.0_wp    &
-               ) + 1.0_wp ) * term1
-       term3 = zeta ** i
+       term2 = ( REAL( i, SELECTED_REAL_KIND(12,307) ) * ( zm_para + 1.0_wp ) + 1.0_wp ) * term1
+       term3 = zeta**i
        term4 = term3 / term2
-       term5 = REAL( i, SELECTED_REAL_KIND(12,307) ) * ( zm_para + 1.0_wp )    &
-               + 1.0_wp
-       zNnuc_tayl = zNnuc_tayl + term4 * ( dx ** term5 - d1 ** term5 ) 
+       term5 = REAL( i, SELECTED_REAL_KIND(12,307) ) * ( zm_para + 1.0_wp ) + 1.0_wp
+       z_n_nuc_tayl = z_n_nuc_tayl + term4 * ( dx**term5 - d1**term5 )
     ENDDO
-    zNnuc_tayl = zNnuc_tayl * zjnuc_t * EXP( -zeta *                           &
-                   ( d1 ** ( zm_para + 1 ) ) ) / zGRtot
-                  
- END FUNCTION zNnuc_tayl
- 
+    z_n_nuc_tayl = z_n_nuc_tayl * zjnuc_t * EXP( -zeta * ( d1**( zm_para + 1 ) ) ) / z_gr_tot
+
+ END FUNCTION z_n_nuc_tayl
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5318,57 +5383,55 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE gpparth2o( paero, ptemp, ppres, pcs, pcw, ptstep )
-        
+
     IMPLICIT NONE
-!
-!-- Input and output variables  
-    REAL(wp), INTENT(in) ::  ppres  !< Air pressure (Pa)
-    REAL(wp), INTENT(in) ::  pcs    !< Water vapour saturation 
-                                             !< concentration (kg/m3)
-    REAL(wp), INTENT(in) ::  ptemp  !< Ambient temperature (K)  
-    REAL(wp), INTENT(in) ::  ptstep !< timestep (s)
-    REAL(wp), INTENT(inout) ::  pcw !< Water vapour concentration 
-                                                !< (kg/m3)
-    TYPE(t_section), INTENT(inout) ::  paero(nbins) !< Aerosol properties
-!-- Local variables
-    INTEGER(iwp) ::  b !< loop index
-    INTEGER(iwp) ::  nstr
-    REAL(wp) ::  adt     !< internal timestep in this subroutine
-    REAL(wp) ::  adtc(nbins) 
-    REAL(wp) ::  rhoair      
-    REAL(wp) ::  ttot       
-    REAL(wp) ::  zact    !< Water activity
-    REAL(wp) ::  zaelwc1 !< Current aerosol water content 
-    REAL(wp) ::  zaelwc2 !< New aerosol water content after 
-                                     !< equilibrium calculation     
-    REAL(wp) ::  zbeta   !< Transitional correction factor 
-    REAL(wp) ::  zcwc    !< Current water vapour mole concentration
-    REAL(wp) ::  zcwcae(nbins) !< Current water mole concentrations
-                               !< in aerosols
-    REAL(wp) ::  zcwint  !< Current and new water vapour mole concentrations
-    REAL(wp) ::  zcwintae(nbins) !< Current and new water mole concentrations
-                                 !< in aerosols
-    REAL(wp) ::  zcwn    !< New water vapour mole concentration
-    REAL(wp) ::  zcwnae(nbins) !< New water mole concentration in aerosols
-    REAL(wp) ::  zcwsurfae(nbins) !< Surface mole concentration
-    REAL(wp) ::  zcwtot  !< Total water mole concentration
-    REAL(wp) ::  zdfh2o
-    REAL(wp) ::  zhlp1
-    REAL(wp) ::  zhlp2
-    REAL(wp) ::  zhlp3       
-    REAL(wp) ::  zka(nbins)     !< Activity coefficient       
-    REAL(wp) ::  zkelvin(nbins) !< Kelvin effect
-    REAL(wp) ::  zknud
-    REAL(wp) ::  zmfph2o        !< mean free path of H2O gas molecule
-    REAL(wp) ::  zmtae(nbins)   !< Mass transfer coefficients
-    REAL(wp) ::  zrh            !< Relative humidity [0-1]      
-    REAL(wp) ::  zthcond       
-    REAL(wp) ::  zwsatae(nbins) !< Water saturation ratio above aerosols
+
+    INTEGER(iwp) ::  ib   !< loop index
+    INTEGER(iwp) ::  nstr !<
+
+    REAL(wp) ::  adt        !< internal timestep in this subroutine
+    REAL(wp) ::  rhoair     !< air density (kg/m3)
+    REAL(wp) ::  ttot       !< total time (s)
+    REAL(wp) ::  zact       !< Water activity
+    REAL(wp) ::  zaelwc1    !< Current aerosol water content (kg/m3)
+    REAL(wp) ::  zaelwc2    !< New aerosol water content after equilibrium calculation (kg/m3)
+    REAL(wp) ::  zbeta      !< Transitional correction factor
+    REAL(wp) ::  zcwc       !< Current water vapour mole concentration in aerosols (mol/m3)
+    REAL(wp) ::  zcwint     !< Current and new water vapour mole concentrations (mol/m3)
+    REAL(wp) ::  zcwn       !< New water vapour mole concentration (mol/m3)
+    REAL(wp) ::  zcwtot     !< Total water mole concentration (mol/m3)
+    REAL(wp) ::  zdfh2o     !< molecular diffusion coefficient (cm2/s) for water
+    REAL(wp) ::  zhlp1      !< intermediate variable to calculate the mass transfer coefficient
+    REAL(wp) ::  zhlp2      !< intermediate variable to calculate the mass transfer coefficient
+    REAL(wp) ::  zhlp3      !< intermediate variable to calculate the mass transfer coefficient
+    REAL(wp) ::  zknud      !< Knudsen number
+    REAL(wp) ::  zmfph2o    !< mean free path of H2O gas molecule
+    REAL(wp) ::  zrh        !< relative humidity [0-1]
+    REAL(wp) ::  zthcond    !< thermal conductivity of air (W/m/K)
+
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcwcae     !< Current water mole concentrations
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcwintae   !< Current and new aerosol water mole concentration
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcwnae     !< New water mole concentration in aerosols
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcwsurfae  !< Surface mole concentration
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zkelvin    !< Kelvin effect
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zmtae      !< Mass transfer coefficients
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zwsatae    !< Water saturation ratio above aerosols
+
+    REAL(wp), INTENT(in) ::  ppres   !< Air pressure (Pa)
+    REAL(wp), INTENT(in) ::  pcs     !< Water vapour saturation concentration (kg/m3)
+    REAL(wp), INTENT(in) ::  ptemp   !< Ambient temperature (K)
+    REAL(wp), INTENT(in) ::  ptstep  !< timestep (s)
+
+    REAL(wp), INTENT(inout) ::  pcw  !< Water vapour concentration (kg/m3)
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero  !< Aerosol properties
 !
 !-- Relative humidity [0-1]
     zrh = pcw / pcs
+!
 !-- Calculate the condensation only for 2a/2b aerosol bins
-    nstr = in2a
+    nstr = start_subrange_2a
+!
 !-- Save the current aerosol water content, 8 in paero is H2O
-    zaelwc1 = SUM( paero(in1a:fn2b)%volc(8) ) * arhoh2o
+    zaelwc1 = SUM( paero(start_subrange_1a:end_subrange_2b)%volc(8) ) * arhoh2o
 !
 !-- Equilibration:
@@ -5380,122 +5443,117 @@
        ENDIF
     ENDIF
-!                                        
+!
 !-- The new aerosol water content after equilibrium calculation
-    zaelwc2 = SUM( paero(in1a:fn2b)%volc(8) ) * arhoh2o
+    zaelwc2 = SUM( paero(start_subrange_1a:end_subrange_2b)%volc(8) ) * arhoh2o
+!
 !-- New water vapour mixing ratio (kg/m3)
     pcw = pcw - ( zaelwc2 - zaelwc1 ) * ppres * amdair / ( argas * ptemp )
-!                  
+!
 !-- Initialise variables
-    adtc(:)  = 0.0_wp
-    zcwc     = 0.0_wp
-    zcwcae   = 0.0_wp       
-    zcwint   = 0.0_wp
-    zcwintae = 0.0_wp       
-    zcwn     = 0.0_wp
-    zcwnae   = 0.0_wp
-    zhlp1    = 0.0_wp
-    zwsatae  = 0.0_wp    
-!          
+    zcwsurfae(:) = 0.0_wp
+    zhlp1        = 0.0_wp
+    zhlp2        = 0.0_wp
+    zhlp3        = 0.0_wp
+    zmtae(:)     = 0.0_wp
+    zwsatae(:)   = 0.0_wp
+!
 !-- Air:
 !-- Density (kg/m3)
     rhoair = amdair * ppres / ( argas * ptemp )
-!-- Thermal conductivity of air                       
+!
+!-- Thermal conductivity of air
     zthcond = 0.023807_wp + 7.1128E-5_wp * ( ptemp - 273.16_wp )
-!             
-!-- Water vapour: 
-!
+!
+!-- Water vapour:
 !-- Molecular diffusion coefficient (cm2/s) (eq.16.17)
-    zdfh2o = ( 5.0_wp / ( 16.0_wp * avo * rhoair * 1.0E-3_wp *                 &
-             ( 3.11E-8_wp ) ** 2.0_wp ) ) * SQRT( argas * 1.0E+7_wp * ptemp *  &
-             amdair * 1.0E+3_wp * ( amh2o + amdair ) * 1.0E+3_wp / ( 2.0_wp *  &
-             pi * amh2o * 1.0E+3_wp ) )
-    zdfh2o = zdfh2o * 1.0E-4   ! Unit change to m^2/s 
-!    
+    zdfh2o = ( 5.0_wp / ( 16.0_wp * avo * rhoair * 1.0E-3_wp * 3.11E-8_wp**2 ) ) * SQRT( argas *   &
+               1.0E+7_wp * ptemp * amdair * 1.0E+3_wp * ( amh2o + amdair ) * 1.0E+3_wp /           &
+               ( pi * amh2o * 2.0E+3_wp ) )
+    zdfh2o = zdfh2o * 1.0E-4   ! Unit change to m^2/s
+!
 !-- Mean free path (eq. 15.25 & 16.29)
-    zmfph2o = 3.0_wp * zdfh2o * SQRT( pi * amh2o / ( 8.0_wp * argas * ptemp ) ) 
-    zka = 1.0_wp   ! Assume activity coefficients as 1 for now.
-!    
-!-- Kelvin effect (eq. 16.33) 
-    zkelvin = 1.0_wp                   
-    zkelvin(1:nbins) = EXP( 4.0_wp * surfw0 * amh2o / ( argas * ptemp *        &
-                            arhoh2o * paero(1:nbins)%dwet) )
-!                           
-! --Aerosols:
-    zmtae(:)     = 0.0_wp   ! mass transfer coefficient
-    zcwsurfae(:) = 0.0_wp   ! surface mole concentrations
-    DO  b = 1, nbins
-       IF ( paero(b)%numc > nclim  .AND.  zrh > 0.98_wp )  THEN
-!       
+    zmfph2o = 3.0_wp * zdfh2o * SQRT( pi * amh2o / ( 8.0_wp * argas * ptemp ) )
+!
+!-- Kelvin effect (eq. 16.33)
+    zkelvin(:) = EXP( 4.0_wp * surfw0 * amh2o / ( argas * ptemp * arhoh2o * paero(:)%dwet) )
+
+    DO  ib = 1, nbins_aerosol
+       IF ( paero(ib)%numc > nclim  .AND.  zrh > 0.98_wp )  THEN
+!
 !--       Water activity
-          zact = acth2o( paero(b) )
-!          
+          zact = acth2o( paero(ib) )
+!
 !--       Saturation mole concentration over flat surface. Limit the super-
-!--       saturation to max 1.01 for the mass transfer. Experimental!          
-          zcwsurfae(b) = MAX( pcs, pcw / 1.01_wp ) * rhoair / amh2o
-!          
+!--       saturation to max 1.01 for the mass transfer. Experimental!
+          zcwsurfae(ib) = MAX( pcs, pcw / 1.01_wp ) * rhoair / amh2o
+!
 !--       Equilibrium saturation ratio
-          zwsatae(b) = zact * zkelvin(b)
-!          
+          zwsatae(ib) = zact * zkelvin(ib)
+!
 !--       Knudsen number (eq. 16.20)
-          zknud = 2.0_wp * zmfph2o / paero(b)%dwet
-!          
+          zknud = 2.0_wp * zmfph2o / paero(ib)%dwet
+!
 !--       Transitional correction factor (Fuks & Sutugin, 1971)
-          zbeta = ( zknud + 1.0_wp ) / ( 0.377_wp * zknud + 1.0_wp + 4.0_wp /  &
-                  ( 3.0_wp * massacc(b) ) * ( zknud + zknud ** 2.0_wp ) )
-!                  
+          zbeta = ( zknud + 1.0_wp ) / ( 0.377_wp * zknud + 1.0_wp + 4.0_wp /                      &
+                  ( 3.0_wp * massacc(ib) ) * ( zknud + zknud**2 ) )
+!
 !--       Mass transfer of H2O: Eq. 16.64 but here D^eff =  zdfh2o * zbeta
-          zhlp1 = paero(b)%numc * 2.0_wp * pi * paero(b)%dwet * zdfh2o *    &
-                  zbeta 
+          zhlp1 = paero(ib)%numc * 2.0_wp * pi * paero(ib)%dwet * zdfh2o * zbeta
+!
 !--       1st term on the left side of the denominator in eq. 16.55
-          zhlp2 = amh2o * zdfh2o * alv * zwsatae(b) * zcwsurfae(b) /         &
-                  ( zthcond * ptemp )
-!--       2nd term on the left side of the denominator in eq. 16.55                           
-          zhlp3 = ( (alv * amh2o ) / ( argas * ptemp ) ) - 1.0_wp
+          zhlp2 = amh2o * zdfh2o * alv * zwsatae(ib) * zcwsurfae(ib) / ( zthcond * ptemp )
+!
+!--       2nd term on the left side of the denominator in eq. 16.55
+          zhlp3 = ( ( alv * amh2o ) / ( argas * ptemp ) ) - 1.0_wp
+!
 !--       Full eq. 16.64: Mass transfer coefficient (1/s)
-          zmtae(b) = zhlp1 / ( zhlp2 * zhlp3 + 1.0_wp )
+          zmtae(ib) = zhlp1 / ( zhlp2 * zhlp3 + 1.0_wp )
        ENDIF
     ENDDO
 !
 !-- Current mole concentrations of water
-    zcwc = pcw * rhoair / amh2o   ! as vapour
-    zcwcae(1:nbins) = paero(1:nbins)%volc(8) * arhoh2o / amh2o   ! in aerosols
-    zcwtot = zcwc + SUM( zcwcae )   ! total water concentration
-    ttot = 0.0_wp
-    adtc = 0.0_wp
-    zcwintae = zcwcae   
-!             
+    zcwc        = pcw * rhoair / amh2o   ! as vapour
+    zcwcae(:)   = paero(:)%volc(8) * arhoh2o / amh2o   ! in aerosols
+    zcwtot      = zcwc + SUM( zcwcae )   ! total water concentration
+    zcwnae(:)   = 0.0_wp
+    zcwintae(:) = zcwcae(:)
+!
 !-- Substepping loop
     zcwint = 0.0_wp
+    ttot   = 0.0_wp
     DO  WHILE ( ttot < ptstep )
        adt = 2.0E-2_wp   ! internal timestep
-!       
+!
 !--    New vapour concentration: (eq. 16.71)
-       zhlp1 = zcwc + adt * ( SUM( zmtae(nstr:nbins) * zwsatae(nstr:nbins) *   &
-                                   zcwsurfae(nstr:nbins) ) )   ! numerator
-       zhlp2 = 1.0_wp + adt * ( SUM( zmtae(nstr:nbins) ) )   ! denomin.
+       zhlp1 = zcwc + adt * ( SUM( zmtae(nstr:nbins_aerosol) * zwsatae(nstr:nbins_aerosol) *       &
+                                   zcwsurfae(nstr:nbins_aerosol) ) )   ! numerator
+       zhlp2 = 1.0_wp + adt * ( SUM( zmtae(nstr:nbins_aerosol) ) )   ! denomin.
        zcwint = zhlp1 / zhlp2   ! new vapour concentration
        zcwint = MIN( zcwint, zcwtot )
        IF ( ANY( paero(:)%numc > nclim )  .AND. zrh > 0.98_wp )  THEN
-          DO  b = nstr, nbins
-             zcwintae(b) = zcwcae(b) + MIN( MAX( adt * zmtae(b) *           &
-                          ( zcwint - zwsatae(b) * zcwsurfae(b) ),            &
-                          -0.02_wp * zcwcae(b) ), 0.05_wp * zcwcae(b) )
-             zwsatae(b) = acth2o( paero(b), zcwintae(b) ) * zkelvin(b)
+          DO  ib = nstr, nbins_aerosol
+             zcwintae(ib) = zcwcae(ib) + MIN( MAX( adt * zmtae(ib) * ( zcwint - zwsatae(ib) *      &
+                                                   zcwsurfae(ib) ), -0.02_wp * zcwcae(ib) ),       &
+                                            0.05_wp * zcwcae(ib) )
+             zwsatae(ib) = acth2o( paero(ib), zcwintae(ib) ) * zkelvin(ib)
           ENDDO
        ENDIF
-       zcwintae(nstr:nbins) = MAX( zcwintae(nstr:nbins), 0.0_wp )
-!       
+       zcwintae(nstr:nbins_aerosol) = MAX( zcwintae(nstr:nbins_aerosol), 0.0_wp )
+!
 !--    Update vapour concentration for consistency
-       zcwint = zcwtot - SUM( zcwintae(1:nbins) )
+       zcwint = zcwtot - SUM( zcwintae(1:nbins_aerosol) )
+!
 !--    Update "old" values for next cycle
        zcwcae = zcwintae
 
        ttot = ttot + adt
-    ENDDO   ! ADT 
-    zcwn   = zcwint
-    zcwnae = zcwintae
-    pcw    = zcwn * amh2o / rhoair
-    paero(1:nbins)%volc(8) = MAX( 0.0_wp, zcwnae(1:nbins) * amh2o / arhoh2o )
-    
+
+    ENDDO   ! ADT
+
+    zcwn      = zcwint
+    zcwnae(:) = zcwintae(:)
+    pcw       = zcwn * amh2o / rhoair
+    paero(:)%volc(8) = MAX( 0.0_wp, zcwnae(:) * amh2o / arhoh2o )
+
  END SUBROUTINE gpparth2o
 
@@ -5504,21 +5562,20 @@
 ! ------------
 !> Calculates the activity coefficient of liquid water 
-!------------------------------------------------------------------------------!    
+!------------------------------------------------------------------------------!
  REAL(wp) FUNCTION acth2o( ppart, pcw )
-               
+
     IMPLICIT NONE
 
-    TYPE(t_section), INTENT(in) ::  ppart !< Aerosol properties of a bin 
-    REAL(wp), INTENT(in), OPTIONAL ::  pcw !< molar concentration of water 
-                                           !< (mol/m3)
-
-    REAL(wp) ::  zns !< molar concentration of solutes (mol/m3)
-    REAL(wp) ::  znw !< molar concentration of water (mol/m3)
-
-    zns = ( 3.0_wp * ( ppart%volc(1) * arhoh2so4 / amh2so4 ) +               &
-                     ( ppart%volc(2) * arhooc / amoc ) +                     &
-            2.0_wp * ( ppart%volc(5) * arhoss / amss ) +                     &
-                     ( ppart%volc(6) * arhohno3 / amhno3 ) +                 &
-                     ( ppart%volc(7) * arhonh3 / amnh3 ) )
+    REAL(wp) ::  zns  !< molar concentration of solutes (mol/m3)
+    REAL(wp) ::  znw  !< molar concentration of water (mol/m3)
+
+    REAL(wp), INTENT(in), OPTIONAL ::  pcw !< molar concentration of water (mol/m3)
+
+    TYPE(t_section), INTENT(in) ::  ppart !< Aerosol properties of a bin
+
+    zns = ( 3.0_wp * ( ppart%volc(1) * arhoh2so4 / amh2so4 ) + ( ppart%volc(2) * arhooc / amoc ) + &
+            2.0_wp * ( ppart%volc(5) * arhoss / amss ) + ( ppart%volc(6) * arhohno3 / amhno3 ) +   &
+            ( ppart%volc(7) * arhonh3 / amnh3 ) )
+
     IF ( PRESENT(pcw) ) THEN
        znw = pcw
@@ -5526,9 +5583,10 @@
        znw = ppart%volc(8) * arhoh2o / amh2o
     ENDIF
-!-- Activity = partial pressure of water vapour / 
-!--            sat. vapour pressure of water over a bulk liquid surface
+!
+!-- Activity = partial pressure of water vapour / sat. vapour pressure of water over a liquid surface
 !--          = molality * activity coefficient (Jacobson, 2005: eq. 17.20-21)
-!-- Assume activity coefficient of 1 for water 
+!-- Assume activity coefficient of 1 for water
     acth2o = MAX( 0.1_wp, znw / MAX( EPSILON( 1.0_wp ),( znw + zns ) ) )
+
  END FUNCTION acth2o
 
@@ -5543,179 +5601,155 @@
 !> Called from subroutine condensation. 
 !> Coded by:
-!> Harri Kokkola (FMI) 
+!> Harri Kokkola (FMI)
 !------------------------------------------------------------------------------! 
- SUBROUTINE gpparthno3( ppres, ptemp, paero, pghno3, pgnh3, pcw, pcs, pbeta,   &
-                        ptstep )
-               
+ SUBROUTINE gpparthno3( ppres, ptemp, paero, pghno3, pgnh3, pcw, pcs, pbeta, ptstep )
+
     IMPLICIT NONE
-!
-!-- Input and output variables 
-    REAL(wp), INTENT(in) ::  pbeta(nbins) !< transitional correction factor for
-                                          !< aerosols    
-    REAL(wp), INTENT(in) ::  ppres        !< ambient pressure (Pa) 
-    REAL(wp), INTENT(in) ::  pcs          !< water vapour saturation 
-                                          !< concentration (kg/m3)
-    REAL(wp), INTENT(in) ::  ptemp        !< ambient temperature (K)
-    REAL(wp), INTENT(in) ::  ptstep       !< time step (s)
-    REAL(wp), INTENT(inout) ::  pghno3    !< nitric acid concentration (#/m3)
-    REAL(wp), INTENT(inout) ::  pgnh3     !< ammonia conc. (#/m3)    
-    REAL(wp), INTENT(inout) ::  pcw       !< water vapour concentration (kg/m3)
-    TYPE(t_section), INTENT(inout) ::  paero(nbins) !< Aerosol properties
-!    
-!-- Local variables
-    INTEGER(iwp) ::  b              !< loop index
-    REAL(wp) ::  adt                !< timestep 
-    REAL(wp) ::  zachhso4ae(nbins)  !< Activity coefficients for HHSO4
-    REAL(wp) ::  zacnh3ae(nbins)    !< Activity coefficients for NH3
-    REAL(wp) ::  zacnh4hso2ae(nbins)!< Activity coefficients for NH4HSO2
-    REAL(wp) ::  zacno3ae(nbins)    !< Activity coefficients for HNO3
-    REAL(wp) ::  zcgnh3eqae(nbins)  !< Equilibrium gas concentration: NH3
-    REAL(wp) ::  zcgno3eqae(nbins)  !< Equilibrium gas concentration: HNO3
-    REAL(wp) ::  zcnh3c             !< Current NH3 gas concentration
-    REAL(wp) ::  zcnh3int           !< Intermediate NH3 gas concentration
-    REAL(wp) ::  zcnh3intae(nbins)  !< Intermediate NH3 aerosol concentration
-    REAL(wp) ::  zcnh3n             !< New NH3 gas concentration
-    REAL(wp) ::  zcnh3cae(nbins)    !< Current NH3 in aerosols
-    REAL(wp) ::  zcnh3nae(nbins)    !< New NH3 in aerosols 
-    REAL(wp) ::  zcnh3tot           !< Total NH3 concentration
-    REAL(wp) ::  zcno3c             !< Current HNO3 gas concentration
-    REAL(wp) ::  zcno3int           !< Intermediate HNO3 gas concentration
-    REAL(wp) ::  zcno3intae(nbins)  !< Intermediate HNO3 aerosol concentration
-    REAL(wp) ::  zcno3n             !< New HNO3 gas concentration                 
-    REAL(wp) ::  zcno3cae(nbins)    !< Current HNO3 in aerosols
-    REAL(wp) ::  zcno3nae(nbins)    !< New HNO3 in aerosols
-    REAL(wp) ::  zcno3tot           !< Total HNO3 concentration   
-    REAL(wp) ::  zdfvap             !< Diffusion coefficient for vapors
-    REAL(wp) ::  zhlp1              !< helping variable
-    REAL(wp) ::  zhlp2              !< helping variable    
-    REAL(wp) ::  zkelnh3ae(nbins)   !< Kelvin effects for NH3
-    REAL(wp) ::  zkelno3ae(nbins)   !< Kelvin effect for HNO3
-    REAL(wp) ::  zmolsae(nbins,7)   !< Ion molalities from pdfite
-    REAL(wp) ::  zmtnh3ae(nbins)    !< Mass transfer coefficients for NH3
-    REAL(wp) ::  zmtno3ae(nbins)    !< Mass transfer coefficients for HNO3
-    REAL(wp) ::  zrh                !< relative humidity
-    REAL(wp) ::  zsathno3ae(nbins)  !< HNO3 saturation ratio
-    REAL(wp) ::  zsatnh3ae(nbins)   !< NH3 saturation ratio = the partial 
-                                    !< pressure of a gas divided by its 
-                                    !< saturation vapor pressure over a surface
-!          
+
+    INTEGER(iwp) ::  ib  !< loop index
+
+    REAL(wp) ::  adt          !< timestep
+    REAL(wp) ::  zc_nh3_c     !< Current NH3 gas concentration
+    REAL(wp) ::  zc_nh3_int   !< Intermediate NH3 gas concentration
+    REAL(wp) ::  zc_nh3_n     !< New NH3 gas concentration
+    REAL(wp) ::  zc_nh3_tot   !< Total NH3 concentration
+    REAL(wp) ::  zc_hno3_c    !< Current HNO3 gas concentration
+    REAL(wp) ::  zc_hno3_int  !< Intermediate HNO3 gas concentration
+    REAL(wp) ::  zc_hno3_n    !< New HNO3 gas concentration
+    REAL(wp) ::  zc_hno3_tot  !< Total HNO3 concentration
+    REAL(wp) ::  zdfvap       !< Diffusion coefficient for vapors
+    REAL(wp) ::  zhlp1        !< intermediate variable
+    REAL(wp) ::  zhlp2        !< intermediate variable
+    REAL(wp) ::  zrh          !< relative humidity
+
+    REAL(wp), INTENT(in) ::  ppres      !< ambient pressure (Pa)
+    REAL(wp), INTENT(in) ::  pcs        !< water vapour saturation
+                                        !< concentration (kg/m3)
+    REAL(wp), INTENT(in) ::  ptemp      !< ambient temperature (K)
+    REAL(wp), INTENT(in) ::  ptstep     !< time step (s)
+
+    REAL(wp), INTENT(inout) ::  pghno3  !< nitric acid concentration (#/m3)
+    REAL(wp), INTENT(inout) ::  pgnh3   !< ammonia conc. (#/m3)
+    REAL(wp), INTENT(inout) ::  pcw     !< water vapour concentration (kg/m3)
+
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zac_hno3_ae     !< Activity coefficients for HNO3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zac_hhso4_ae    !< Activity coefficients for HHSO4
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zac_nh3_ae      !< Activity coefficients for NH3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zac_nh4hso2_ae  !< Activity coefficients for NH4HSO2
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcg_hno3_eq_ae  !< Equilibrium gas concentration: HNO3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zcg_nh3_eq_ae   !< Equilibrium gas concentration: NH3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zc_hno3_int_ae  !< Intermediate HNO3 aerosol concentration
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zc_hno3_c_ae    !< Current HNO3 in aerosols
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zc_hno3_n_ae    !< New HNO3 in aerosols
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zc_nh3_int_ae   !< Intermediate NH3 aerosol concentration
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zc_nh3_c_ae     !< Current NH3 in aerosols
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zc_nh3_n_ae     !< New NH3 in aerosols
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zkel_hno3_ae    !< Kelvin effect for HNO3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zkel_nh3_ae     !< Kelvin effects for NH3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zmt_hno3_ae     !< Mass transfer coefficients for HNO3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zmt_nh3_ae      !< Mass transfer coefficients for NH3
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zsat_hno3_ae    !< HNO3 saturation ratio over a surface
+    REAL(wp), DIMENSION(nbins_aerosol) ::  zsat_nh3_ae     !< NH3 saturation ratio over a surface
+
+    REAL(wp), DIMENSION(nbins_aerosol,maxspec) ::  zion_mols   !< Ion molalities from pdfite aerosols
+
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pbeta !< transitional correction factor for
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero !< Aerosol properties
+!
 !-- Initialise:
-    adt          = ptstep
-    zachhso4ae   = 0.0_wp
-    zacnh3ae     = 0.0_wp
-    zacnh4hso2ae = 0.0_wp
-    zacno3ae     = 0.0_wp
-    zcgnh3eqae   = 0.0_wp
-    zcgno3eqae   = 0.0_wp
-    zcnh3c       = 0.0_wp
-    zcnh3cae     = 0.0_wp
-    zcnh3int     = 0.0_wp
-    zcnh3intae   = 0.0_wp
-    zcnh3n       = 0.0_wp
-    zcnh3nae     = 0.0_wp
-    zcnh3tot     = 0.0_wp
-    zcno3c       = 0.0_wp
-    zcno3cae     = 0.0_wp  
-    zcno3int     = 0.0_wp
-    zcno3intae   = 0.0_wp
-    zcno3n       = 0.0_wp
-    zcno3nae     = 0.0_wp
-    zcno3tot     = 0.0_wp
-    zhlp1        = 0.0_wp
-    zhlp2        = 0.0_wp
-    zkelno3ae    = 1.0_wp   
-    zkelnh3ae    = 1.0_wp  
-    zmolsae      = 0.0_wp
-    zmtno3ae     = 0.0_wp
-    zmtnh3ae     = 0.0_wp
-    zrh          = 0.0_wp
-    zsatnh3ae    = 1.0_wp
-    zsathno3ae   = 1.0_wp
-!             
-!-- Diffusion coefficient (m2/s)             
-    zdfvap = 5.1111E-10_wp * ptemp ** 1.75_wp * ( p_0 + 1325.0_wp ) / ppres 
-!             
+    adt            = ptstep
+    zac_hhso4_ae   = 0.0_wp
+    zac_nh3_ae     = 0.0_wp
+    zac_nh4hso2_ae = 0.0_wp
+    zac_hno3_ae    = 0.0_wp
+    zcg_nh3_eq_ae  = 0.0_wp
+    zcg_hno3_eq_ae = 0.0_wp
+    zion_mols      = 0.0_wp
+    zsat_nh3_ae    = 1.0_wp
+    zsat_hno3_ae   = 1.0_wp
+!
+!-- Diffusion coefficient (m2/s)
+    zdfvap = 5.1111E-10_wp * ptemp**1.75_wp * ( p_0 + 1325.0_wp ) / ppres
+!
 !-- Kelvin effects (Jacobson (2005), eq. 16.33)
-    zkelno3ae(1:nbins) = EXP( 4.0_wp * surfw0 * amvhno3 / ( abo * ptemp *      &
-                              paero(1:nbins)%dwet ) ) 
-    zkelnh3ae(1:nbins) = EXP( 4.0_wp * surfw0 * amvnh3 / ( abo * ptemp *       &
-                              paero(1:nbins)%dwet ) )
-!                             
+    zkel_hno3_ae(1:nbins_aerosol) = EXP( 4.0_wp * surfw0 * amvhno3 /                               &
+                                    ( abo * ptemp * paero(1:nbins_aerosol)%dwet ) )
+    zkel_nh3_ae(1:nbins_aerosol) = EXP( 4.0_wp * surfw0 * amvnh3 /                                 &
+                                   ( abo * ptemp * paero(1:nbins_aerosol)%dwet ) )
+!
 !-- Current vapour mole concentrations (mol/m3)
-    zcno3c = pghno3 / avo            ! HNO3
-    zcnh3c = pgnh3 / avo             ! NH3
-!             
+    zc_hno3_c = pghno3 / avo  ! HNO3
+    zc_nh3_c = pgnh3 / avo   ! NH3
+!
 !-- Current particle mole concentrations (mol/m3)
-    zcno3cae(1:nbins) = paero(1:nbins)%volc(6) * arhohno3 / amhno3
-    zcnh3cae(1:nbins) = paero(1:nbins)%volc(7) * arhonh3 / amnh3
-!    
+    zc_hno3_c_ae(1:nbins_aerosol) = paero(1:nbins_aerosol)%volc(6) * arhohno3 / amhno3
+    zc_nh3_c_ae(1:nbins_aerosol) = paero(1:nbins_aerosol)%volc(7) * arhonh3 / amnh3
+!
 !-- Total mole concentrations: gas and particle phase
-    zcno3tot = zcno3c + SUM( zcno3cae(1:nbins) )
-    zcnh3tot = zcnh3c + SUM( zcnh3cae(1:nbins) )
-!   
+    zc_hno3_tot = zc_hno3_c + SUM( zc_hno3_c_ae(1:nbins_aerosol) )
+    zc_nh3_tot = zc_nh3_c + SUM( zc_nh3_c_ae(1:nbins_aerosol) )
+!
 !-- Relative humidity [0-1]
     zrh = pcw / pcs
-!    
+!
 !-- Mass transfer coefficients (Jacobson, Eq. 16.64)
-    zmtno3ae(1:nbins) = 2.0_wp * pi * paero(1:nbins)%dwet * zdfvap *           &
-                        paero(1:nbins)%numc * pbeta(1:nbins)
-    zmtnh3ae(1:nbins) = 2.0_wp * pi * paero(1:nbins)%dwet * zdfvap *           &
-                        paero(1:nbins)%numc * pbeta(1:nbins)
-
-!    
+    zmt_hno3_ae(:) = 2.0_wp * pi * paero(:)%dwet * zdfvap * paero(:)%numc * pbeta(:)
+    zmt_nh3_ae(:)  = 2.0_wp * pi * paero(:)%dwet * zdfvap * paero(:)%numc * pbeta(:)
+
+!
 !-- Get the equilibrium concentrations above aerosols
-    CALL NONHEquil( zrh, ptemp, paero, zcgno3eqae, zcgnh3eqae, zacno3ae,       &
-                    zacnh3ae, zacnh4hso2ae, zachhso4ae, zmolsae )
-    
-!
-!-- NH4/HNO3 saturation ratios for aerosols
-    CALL SVsat( ptemp, paero, zacno3ae, zacnh4hso2ae, zachhso4ae, zcgno3eqae,  &
-                zcno3cae, zcnh3cae, zkelno3ae, zkelnh3ae, zsathno3ae, zsatnh3ae )
-!    
-!-- Intermediate concentrations    
-    zhlp1 = SUM( zcno3cae(1:nbins) / ( 1.0_wp + adt * zmtno3ae(1:nbins) *      &
-            zsathno3ae(1:nbins) ) )
-    zhlp2 = SUM( zmtno3ae(1:nbins) / ( 1.0_wp + adt * zmtno3ae(1:nbins) *      &
-            zsathno3ae(1:nbins) ) )
-    zcno3int = ( zcno3tot - zhlp1 ) / ( 1.0_wp + adt * zhlp2 )
-
-    zhlp1 = SUM( zcnh3cae(1:nbins) / ( 1.0_wp + adt * zmtnh3ae(1:nbins) *      &
-            zsatnh3ae(1:nbins) ) )
-    zhlp2 = SUM( zmtnh3ae(1:nbins) / ( 1.0_wp + adt * zmtnh3ae(1:nbins) *      &
-            zsatnh3ae(1:nbins) ) )
-    zcnh3int = ( zcnh3tot - zhlp1 )/( 1.0_wp + adt * zhlp2 )
-
-    zcno3int = MIN(zcno3int, zcno3tot)
-    zcnh3int = MIN(zcnh3int, zcnh3tot)
-!
-!-- Calculate the new particle concentrations
-    zcno3intae = zcno3cae
-    zcnh3intae = zcnh3cae
-    DO  b = 1, nbins
-       zcno3intae(b) = ( zcno3cae(b) + adt * zmtno3ae(b) * zcno3int ) /     &
-            ( 1.0_wp + adt * zmtno3ae(b) * zsathno3ae(b) )
-       zcnh3intae(b) = ( zcnh3cae(b) + adt * zmtnh3ae(b) * zcnh3int ) /     &
-            ( 1.0_wp + adt * zmtnh3ae(b) * zsatnh3ae(b) )
+    CALL nitrate_ammonium_equilibrium( zrh, ptemp, paero, zcg_hno3_eq_ae, zcg_nh3_eq_ae,           &
+                                       zac_hno3_ae, zac_nh3_ae, zac_nh4hso2_ae, zac_hhso4_ae,      &
+                                       zion_mols )
+!
+!-- Calculate NH3 and HNO3 saturation ratios for aerosols
+    CALL nitrate_ammonium_saturation( ptemp, paero, zac_hno3_ae, zac_nh4hso2_ae, zac_hhso4_ae,     &
+                                      zcg_hno3_eq_ae, zc_hno3_c_ae, zc_nh3_c_ae, zkel_hno3_ae,     &
+                                      zkel_nh3_ae, zsat_hno3_ae, zsat_nh3_ae )
+!
+!-- Intermediate gas concentrations of HNO3 and NH3
+    zhlp1 = SUM( zc_hno3_c_ae(:) / ( 1.0_wp + adt * zmt_hno3_ae(:) * zsat_hno3_ae(:) ) )
+    zhlp2 = SUM( zmt_hno3_ae(:) / ( 1.0_wp + adt * zmt_hno3_ae(:) * zsat_hno3_ae(:) ) )
+    zc_hno3_int = ( zc_hno3_tot - zhlp1 ) / ( 1.0_wp + adt * zhlp2 )
+
+    zhlp1 = SUM( zc_nh3_c_ae(:) / ( 1.0_wp + adt * zmt_nh3_ae(:) * zsat_nh3_ae(:) ) )
+    zhlp2 = SUM( zmt_nh3_ae(:) / ( 1.0_wp + adt * zmt_nh3_ae(:) * zsat_nh3_ae(:) ) )
+    zc_nh3_int = ( zc_nh3_tot - zhlp1 )/( 1.0_wp + adt * zhlp2 )
+
+    zc_hno3_int = MIN( zc_hno3_int, zc_hno3_tot )
+    zc_nh3_int = MIN( zc_nh3_int, zc_nh3_tot )
+!
+!-- Calculate the new concentration on aerosol particles
+    zc_hno3_int_ae = zc_hno3_c_ae
+    zc_nh3_int_ae = zc_nh3_c_ae
+    DO  ib = 1, nbins_aerosol
+       zc_hno3_int_ae(ib) = ( zc_hno3_c_ae(ib) + adt * zmt_hno3_ae(ib) * zc_hno3_int ) /           &
+                            ( 1.0_wp + adt * zmt_hno3_ae(ib) * zsat_hno3_ae(ib) )
+       zc_nh3_int_ae(ib) = ( zc_nh3_c_ae(ib) + adt * zmt_nh3_ae(ib) * zc_nh3_int ) /               &
+                           ( 1.0_wp + adt * zmt_nh3_ae(ib) * zsat_nh3_ae(ib) )
     ENDDO
 
-    zcno3intae(1:nbins) = MAX( zcno3intae(1:nbins), 0.0_wp )
-    zcnh3intae(1:nbins) = MAX( zcnh3intae(1:nbins), 0.0_wp )
-
-    zcno3n   = zcno3int    ! Final molar gas concentration of HNO3
-    zcno3nae = zcno3intae  ! Final molar particle concentration of HNO3
-    
-    zcnh3n   = zcnh3int    ! Final molar gas concentration of NH3
-    zcnh3nae = zcnh3intae  ! Final molar particle concentration of NH3
-!
-!-- Model timestep reached - update the new arrays
-    pghno3 = zcno3n * avo
-    pgnh3  = zcnh3n * avo
-
-    DO  b = in1a, fn2b
-       paero(b)%volc(6) = zcno3nae(b) * amhno3 / arhohno3
-       paero(b)%volc(7) = zcnh3nae(b) * amnh3 / arhonh3
+    zc_hno3_int_ae(:) = MAX( zc_hno3_int_ae(:), 0.0_wp )
+    zc_nh3_int_ae(:) = MAX( zc_nh3_int_ae(:), 0.0_wp )
+!
+!-- Final molar gas concentration and molar particle concentration of HNO3
+    zc_hno3_n   = zc_hno3_int
+    zc_hno3_n_ae = zc_hno3_int_ae
+!
+!-- Final molar gas concentration and molar particle concentration of NH3
+    zc_nh3_n   = zc_nh3_int
+    zc_nh3_n_ae = zc_nh3_int_ae
+!
+!-- Model timestep reached - update the gas concentrations
+    pghno3 = zc_hno3_n * avo
+    pgnh3  = zc_nh3_n * avo
+!
+!-- Update the particle concentrations
+    DO  ib = start_subrange_1a, end_subrange_2b
+       paero(ib)%volc(6) = zc_hno3_n_ae(ib) * amhno3 / arhohno3
+       paero(ib)%volc(7) = zc_nh3_n_ae(ib) * amnh3 / arhonh3
     ENDDO
-    
-   
+
  END SUBROUTINE gpparthno3
 !------------------------------------------------------------------------------!
@@ -5724,82 +5758,80 @@
 !> Calculate the equilibrium concentrations above aerosols (reference?)
 !------------------------------------------------------------------------------!
- SUBROUTINE NONHEquil( prh, ptemp, ppart, pcgno3eq, pcgnh3eq, pgammano,        &
-                       pgammanh, pgammanh4hso2, pgammahhso4, pmols )
-    
+ SUBROUTINE nitrate_ammonium_equilibrium( prh, ptemp, ppart, pcg_hno3_eq, pcg_nh3_eq, pgamma_hno3, &
+                                          pgamma_nh4, pgamma_nh4hso2, pgamma_hhso4, pmols )
+
     IMPLICIT NONE
-    
+
+    INTEGER(iwp) ::  ib  !< loop index: aerosol bins
+
+    REAL(wp) ::  zhlp         !< intermediate variable
+    REAL(wp) ::  zp_hcl       !< Equilibrium vapor pressures (Pa) of HCl
+    REAL(wp) ::  zp_hno3      !< Equilibrium vapor pressures (Pa) of HNO3
+    REAL(wp) ::  zp_nh3       !< Equilibrium vapor pressures (Pa) of NH3
+    REAL(wp) ::  zwatertotal  !< Total water in particles (mol/m3)
+
     REAL(wp), INTENT(in) ::  prh    !< relative humidity
     REAL(wp), INTENT(in) ::  ptemp  !< ambient temperature (K)
-    
-    TYPE(t_section), INTENT(inout) ::  ppart(nbins) !< Aerosol properties
-!-- Equilibrium molar concentration above aerosols:
-    REAL(wp), INTENT(inout) ::  pcgnh3eq(nbins)      !< of NH3 
-    REAL(wp), INTENT(inout) ::  pcgno3eq(nbins)      !< of HNO3 
-                                                     !< Activity coefficients:
-    REAL(wp), INTENT(inout) ::  pgammahhso4(nbins)   !< HHSO4   
-    REAL(wp), INTENT(inout) ::  pgammanh(nbins)      !< NH3
-    REAL(wp), INTENT(inout) ::  pgammanh4hso2(nbins) !< NH4HSO2  
-    REAL(wp), INTENT(inout) ::  pgammano(nbins)      !< HNO3
-    REAL(wp), INTENT(inout) ::  pmols(nbins,7)       !< Ion molalities
-    
-    INTEGER(iwp) ::  b
-
-    REAL(wp) ::  zgammas(7)    !< Activity coefficients    
-    REAL(wp) ::  zhlp          !< Dummy variable
-    REAL(wp) ::  zions(7)      !< molar concentration of ion (mol/m3)
-    REAL(wp) ::  zphcl         !< Equilibrium vapor pressures (Pa??)    
-    REAL(wp) ::  zphno3        !< Equilibrium vapor pressures (Pa??)
-    REAL(wp) ::  zpnh3         !< Equilibrium vapor pressures (Pa??)
-    REAL(wp) ::  zwatertotal   !< Total water in particles (mol/m3) ???    
+
+    REAL(wp), DIMENSION(maxspec) ::  zgammas  !< Activity coefficients
+    REAL(wp), DIMENSION(maxspec) ::  zions    !< molar concentration of ion (mol/m3)
+
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(inout) ::  pcg_nh3_eq      !< equilibrium molar
+                                                                          !< concentration: of NH3
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(inout) ::  pcg_hno3_eq     !< of HNO3
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(inout) ::  pgamma_hhso4    !< activity coeff. of HHSO4
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(inout) ::  pgamma_nh4      !< activity coeff. of NH3
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(inout) ::  pgamma_nh4hso2  !< activity coeff. of NH4HSO2
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(inout) ::  pgamma_hno3     !< activity coeff. of HNO3
+
+    REAL(wp), DIMENSION(nbins_aerosol,maxspec), INTENT(inout) ::  pmols  !< Ion molalities
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  ppart  !< Aerosol properties
 
     zgammas     = 0.0_wp
     zhlp        = 0.0_wp
     zions       = 0.0_wp
-    zphcl       = 0.0_wp
-    zphno3      = 0.0_wp
-    zpnh3       = 0.0_wp
+    zp_hcl      = 0.0_wp
+    zp_hno3     = 0.0_wp
+    zp_nh3      = 0.0_wp
     zwatertotal = 0.0_wp
 
-    DO  b = 1, nbins
-    
-       IF ( ppart(b)%numc < nclim )  CYCLE
-!
-!--    2*H2SO4 + CL + NO3 - Na - NH4
-       zhlp = 2.0_wp * ppart(b)%volc(1) * arhoh2so4 / amh2so4 +               &
-              ppart(b)%volc(5) * arhoss / amss +                              &
-              ppart(b)%volc(6) * arhohno3 / amhno3 -                          &
-              ppart(b)%volc(5) * arhoss / amss -                              &
-              ppart(b)%volc(7) * arhonh3 / amnh3
-
-       zhlp = MAX( zhlp, 1.0E-30_wp )
+    DO  ib = 1, nbins_aerosol
+
+       IF ( ppart(ib)%numc < nclim )  CYCLE
+!
+!--    Ion molar concentrations: 2*H2SO4 + CL + NO3 - Na - NH4
+       zhlp = 2.0_wp * ppart(ib)%volc(1) * arhoh2so4 / amh2so4 + ppart(ib)%volc(5) * arhoss / amss &
+              + ppart(ib)%volc(6) * arhohno3 / amhno3 - ppart(ib)%volc(5) * arhoss / amss -        &
+              ppart(ib)%volc(7) * arhonh3 / amnh3
 
        zions(1) = zhlp                                   ! H+
-       zions(2) = ppart(b)%volc(7) * arhonh3 / amnh3     ! NH4+
-       zions(3) = ppart(b)%volc(5) * arhoss / amss       ! Na+
-       zions(4) = ppart(b)%volc(1) * arhoh2so4 / amh2so4 ! SO4(2-)
+       zions(2) = ppart(ib)%volc(7) * arhonh3 / amnh3     ! NH4+
+       zions(3) = ppart(ib)%volc(5) * arhoss / amss       ! Na+
+       zions(4) = ppart(ib)%volc(1) * arhoh2so4 / amh2so4 ! SO4(2-)
        zions(5) = 0.0_wp                                 ! HSO4-
-       zions(6) = ppart(b)%volc(6) * arhohno3 / amhno3   ! NO3-
-       zions(7) = ppart(b)%volc(5) * arhoss / amss       ! Cl-
-
-       zwatertotal = ppart(b)%volc(8) * arhoh2o / amh2o
+       zions(6) = ppart(ib)%volc(6) * arhohno3 / amhno3   ! NO3-
+       zions(7) = ppart(ib)%volc(5) * arhoss / amss       ! Cl-
+
+       zwatertotal = ppart(ib)%volc(8) * arhoh2o / amh2o
        IF ( zwatertotal > 1.0E-30_wp )  THEN
-          CALL inorganic_pdfite( prh, ptemp, zions, zwatertotal, zphno3, zphcl,&
-                                 zpnh3, zgammas, pmols(b,:) )
-       ENDIF
-!
-!--    Activity coefficients 
-       pgammano(b) = zgammas(1)           ! HNO3
-       pgammanh(b) = zgammas(3)           ! NH3 
-       pgammanh4hso2(b) = zgammas(6)      ! NH4HSO2
-       pgammahhso4(b) = zgammas(7)        ! HHSO4
+          CALL inorganic_pdfite( prh, ptemp, zions, zwatertotal, zp_hno3, zp_hcl, zp_nh3, zgammas, &
+                                 pmols(ib,:) )
+       ENDIF
+!
+!--    Activity coefficients
+       pgamma_hno3(ib)    = zgammas(1)  ! HNO3
+       pgamma_nh4(ib)     = zgammas(3)  ! NH3
+       pgamma_nh4hso2(ib) = zgammas(6)  ! NH4HSO2
+       pgamma_hhso4(ib)   = zgammas(7)  ! HHSO4
 !
 !--    Equilibrium molar concentrations (mol/m3) from equlibrium pressures (Pa)
-       pcgno3eq(b) = zphno3 / ( argas * ptemp )
-       pcgnh3eq(b) = zpnh3 / ( argas * ptemp )
+       pcg_hno3_eq(ib) = zp_hno3 / ( argas * ptemp )
+       pcg_nh3_eq(ib) = zp_nh3 / ( argas * ptemp )
 
     ENDDO
 
-  END SUBROUTINE NONHEquil
-  
+  END SUBROUTINE nitrate_ammonium_equilibrium
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5807,216 +5839,210 @@
 !> Calculate saturation ratios of NH4 and HNO3 for aerosols
 !------------------------------------------------------------------------------!
- SUBROUTINE SVsat( ptemp, ppart, pachno3, pacnh4hso2, pachhso4, pchno3eq,      &
-                   pchno3, pcnh3, pkelhno3, pkelnh3, psathno3, psatnh3 )
+ SUBROUTINE nitrate_ammonium_saturation( ptemp, ppart, pachno3, pacnh4hso2, pachhso4, pchno3eq,    &
+                                         pchno3, pc_nh3, pkelhno3, pkelnh3, psathno3, psatnh3 )
 
     IMPLICIT NONE
-    
+
+    INTEGER(iwp) :: ib   !< running index for aerosol bins
+
+    REAL(wp) ::  k_ll_h2o   !< equilibrium constants of equilibrium reactions:
+                            !< H2O(aq) <--> H+ + OH- (mol/kg)
+    REAL(wp) ::  k_ll_nh3   !< NH3(aq) + H2O(aq) <--> NH4+ + OH- (mol/kg)
+    REAL(wp) ::  k_gl_nh3   !< NH3(g) <--> NH3(aq) (mol/kg/atm)
+    REAL(wp) ::  k_gl_hno3  !< HNO3(g) <--> H+ + NO3- (mol2/kg2/atm)
+    REAL(wp) ::  zmol_no3   !< molality of NO3- (mol/kg)
+    REAL(wp) ::  zmol_h     !< molality of H+ (mol/kg)
+    REAL(wp) ::  zmol_so4   !< molality of SO4(2-) (mol/kg)
+    REAL(wp) ::  zmol_cl    !< molality of Cl- (mol/kg)
+    REAL(wp) ::  zmol_nh4   !< molality of NH4+ (mol/kg)
+    REAL(wp) ::  zmol_na    !< molality of Na+ (mol/kg)
+    REAL(wp) ::  zhlp1      !< intermediate variable
+    REAL(wp) ::  zhlp2      !< intermediate variable
+    REAL(wp) ::  zhlp3      !< intermediate variable
+    REAL(wp) ::  zxi        !< particle mole concentration ratio: (NH3+SS)/H2SO4
+    REAL(wp) ::  zt0        !< reference temp
+
+    REAL(wp), PARAMETER ::  a1 = -22.52_wp     !<
+    REAL(wp), PARAMETER ::  a2 = -1.50_wp      !<
+    REAL(wp), PARAMETER ::  a3 = 13.79_wp      !<
+    REAL(wp), PARAMETER ::  a4 = 29.17_wp      !<
+    REAL(wp), PARAMETER ::  b1 = 26.92_wp      !<
+    REAL(wp), PARAMETER ::  b2 = 26.92_wp      !<
+    REAL(wp), PARAMETER ::  b3 = -5.39_wp      !<
+    REAL(wp), PARAMETER ::  b4 = 16.84_wp      !<
+    REAL(wp), PARAMETER ::  K01 = 1.01E-14_wp  !<
+    REAL(wp), PARAMETER ::  K02 = 1.81E-5_wp   !<
+    REAL(wp), PARAMETER ::  K03 = 57.64_wp     !<
+    REAL(wp), PARAMETER ::  K04 = 2.51E+6_wp   !<
+
     REAL(wp), INTENT(in) ::  ptemp  !< ambient temperature (K)
-    
-    TYPE(t_section), INTENT(inout) ::  ppart(nbins) !< Aerosol properties
-!-- Activity coefficients
-    REAL(wp), INTENT(in) ::  pachhso4(nbins)   !<
-    REAL(wp), INTENT(in) ::  pacnh4hso2(nbins) !<
-    REAL(wp), INTENT(in) ::  pachno3(nbins)    !<
-    REAL(wp), INTENT(in) ::  pchno3eq(nbins) !< Equilibrium surface concentration
-                                             !< of HNO3
-    REAL(wp), INTENT(in) ::  pchno3(nbins)   !< Current particle mole 
-                                             !< concentration of HNO3 (mol/m3)
-    REAL(wp), INTENT(in) ::  pcnh3(nbins)    !< Current particle mole 
-                                             !< concentration of NH3 (mol/m3)
-    REAL(wp), INTENT(in) ::  pkelhno3(nbins) !< Kelvin effect for HNO3
-    REAL(wp), INTENT(in) ::  pkelnh3(nbins)  !< Kelvin effect for NH3
-!-- Saturation ratios
-    REAL(wp), INTENT(out) ::  psathno3(nbins) !<
-    REAL(wp), INTENT(out) ::  psatnh3(nbins)  !< 
-    
-    INTEGER :: b   !< running index for aerosol bins
-!-- Constants for calculating equilibrium constants:    
-    REAL(wp), PARAMETER ::  a1 = -22.52_wp     !< 
-    REAL(wp), PARAMETER ::  a2 = -1.50_wp      !< 
-    REAL(wp), PARAMETER ::  a3 = 13.79_wp      !< 
-    REAL(wp), PARAMETER ::  a4 = 29.17_wp      !< 
-    REAL(wp), PARAMETER ::  b1 = 26.92_wp      !< 
-    REAL(wp), PARAMETER ::  b2 = 26.92_wp      !< 
-    REAL(wp), PARAMETER ::  b3 = -5.39_wp      !< 
-    REAL(wp), PARAMETER ::  b4 = 16.84_wp      !< 
-    REAL(wp), PARAMETER ::  K01 = 1.01E-14_wp  !< 
-    REAL(wp), PARAMETER ::  K02 = 1.81E-5_wp   !< 
-    REAL(wp), PARAMETER ::  K03 = 57.64_wp     !< 
-    REAL(wp), PARAMETER ::  K04 = 2.51E+6_wp   !< 
-!-- Equilibrium constants of equilibrium reactions
-    REAL(wp) ::  KllH2O    !< H2O(aq) <--> H+ + OH- (mol/kg)
-    REAL(wp) ::  KllNH3    !< NH3(aq) + H2O(aq) <--> NH4+ + OH- (mol/kg)
-    REAL(wp) ::  KglNH3    !< NH3(g) <--> NH3(aq) (mol/kg/atm)
-    REAL(wp) ::  KglHNO3   !< HNO3(g) <--> H+ + NO3- (mol2/kg2/atm)
-    REAL(wp) ::  zmolno3   !< molality of NO3- (mol/kg)
-    REAL(wp) ::  zmolhp    !< molality of H+ (mol/kg)
-    REAL(wp) ::  zmolso4   !< molality of SO4(2-) (mol/kg)
-    REAL(wp) ::  zmolcl    !< molality of Cl (mol/kg)
-    REAL(wp) ::  zmolnh4   !< Molality of NH4 (mol/kg)
-    REAL(wp) ::  zmolna    !< Molality of Na (mol/kg)
-    REAL(wp) ::  zhlp1     !<
-    REAL(wp) ::  zhlp2     !<
-    REAL(wp) ::  zhlp3     !<
-    REAL(wp) ::  zxi       !<
-    REAL(wp) ::  zt0       !< Reference temp
-    
-    zhlp1   = 0.0_wp
-    zhlp2   = 0.0_wp 
-    zhlp3   = 0.0_wp
-    zmolcl  = 0.0_wp
-    zmolhp  = 0.0_wp
-    zmolna  = 0.0_wp
-    zmolnh4 = 0.0_wp
-    zmolno3 = 0.0_wp
-    zmolso4 = 0.0_wp
-    zt0     = 298.15_wp 
-    zxi     = 0.0_wp
-!
-!-- Calculates equlibrium rate constants based on Table B.7 in Jacobson (2005) 
-!-- K^ll_H20, K^ll_NH3, K^gl_NH3, K^gl_HNO3 
+
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pachhso4    !< activity coeff. of HHSO4
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pacnh4hso2  !< activity coeff. of NH4HSO2
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pachno3     !< activity coeff. of HNO3
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pchno3eq    !< eq. surface concentration: HNO3
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pchno3      !< current particle mole
+                                                                   !< concentration of HNO3 (mol/m3)
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pc_nh3      !< of NH3 (mol/m3)
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pkelhno3    !< Kelvin effect for HNO3
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(in) ::  pkelnh3     !< Kelvin effect for NH3
+
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(out) ::  psathno3 !< saturation ratio of HNO3
+    REAL(wp), DIMENSION(nbins_aerosol), INTENT(out) ::  psatnh3  !< saturation ratio of NH3
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  ppart  !< Aerosol properties
+
+    zmol_cl  = 0.0_wp
+    zmol_h   = 0.0_wp
+    zmol_na  = 0.0_wp
+    zmol_nh4 = 0.0_wp
+    zmol_no3 = 0.0_wp
+    zmol_so4 = 0.0_wp
+    zt0      = 298.15_wp
+    zxi      = 0.0_wp
+!
+!-- Calculates equlibrium rate constants based on Table B.7 in Jacobson (2005):
+!-- K^ll_H20, K^ll_NH3, K^gl_NH3, K^gl_HNO3
     zhlp1 = zt0 / ptemp
     zhlp2 = zhlp1 - 1.0_wp
     zhlp3 = 1.0_wp + LOG( zhlp1 ) - zhlp1
 
-    KllH2O = K01 * EXP( a1 * zhlp2 + b1 * zhlp3 )
-    KllNH3 = K02 * EXP( a2 * zhlp2 + b2 * zhlp3 )
-    KglNH3 = K03 * EXP( a3 * zhlp2 + b3 * zhlp3 )
-    KglHNO3 = K04 * EXP( a4 * zhlp2 + b4 * zhlp3 )
-
-    DO  b = 1, nbins
-
-       IF ( ppart(b)%numc > nclim  .AND.  ppart(b)%volc(8) > 1.0E-30_wp  )  THEN
-!
-!--       Molality of H+ and NO3- 
-          zhlp1 = pcnh3(b) * amnh3 + ppart(b)%volc(1) * arhoh2so4 +            &
-                  ppart(b)%volc(2) * arhooc + ppart(b)%volc(5) * arhoss +      &
-                  ppart(b)%volc(8) * arhoh2o
-          zmolno3 = pchno3(b) / zhlp1  !< mol/kg
-!
-!--       Particle mole concentration ratio: (NH3+SS)/H2SO4       
-          zxi = ( pcnh3(b) + ppart(b)%volc(5) * arhoss / amss ) /              &
-                ( ppart(b)%volc(1) * arhoh2so4 / amh2so4 )
-                
+    k_ll_h2o  = K01 * EXP( a1 * zhlp2 + b1 * zhlp3 )
+    k_ll_nh3  = K02 * EXP( a2 * zhlp2 + b2 * zhlp3 )
+    k_gl_nh3  = K03 * EXP( a3 * zhlp2 + b3 * zhlp3 )
+    k_gl_hno3 = K04 * EXP( a4 * zhlp2 + b4 * zhlp3 )
+
+    DO  ib = 1, nbins_aerosol
+
+       IF ( ppart(ib)%numc > nclim  .AND.  ppart(ib)%volc(8) > 1.0E-30_wp  )  THEN
+!
+!--       Molality of H+ and NO3-
+          zhlp1 = pc_nh3(ib) * amnh3 + ppart(ib)%volc(1) * arhoh2so4 + ppart(ib)%volc(2) * arhooc  &
+                  + ppart(ib)%volc(5) * arhoss + ppart(ib)%volc(8) * arhoh2o
+          zmol_no3 = pchno3(ib) / zhlp1  !< mol/kg
+!
+!--       Particle mole concentration ratio: (NH3+SS)/H2SO4
+          zxi = ( pc_nh3(ib) + ppart(ib)%volc(5) * arhoss / amss ) / ( ppart(ib)%volc(1) *         &
+                  arhoh2so4 / amh2so4 )
+
           IF ( zxi <= 2.0_wp )  THEN
 !
 !--          Molality of SO4(2-)
-             zhlp1 = pcnh3(b) * amnh3 + pchno3(b) * amhno3 +                   &
-                     ppart(b)%volc(2) * arhooc + ppart(b)%volc(5) * arhoss +   &
-                     ppart(b)%volc(8) * arhoh2o
-             zmolso4 = ( ppart(b)%volc(1) * arhoh2so4 / amh2so4 ) / zhlp1
+             zhlp1 = pc_nh3(ib) * amnh3 + pchno3(ib) * amhno3 + ppart(ib)%volc(2) * arhooc +       &
+                     ppart(ib)%volc(5) * arhoss + ppart(ib)%volc(8) * arhoh2o
+             zmol_so4 = ( ppart(ib)%volc(1) * arhoh2so4 / amh2so4 ) / zhlp1
 !
 !--          Molality of Cl-
-             zhlp1 = pcnh3(b) * amnh3 + pchno3(b) * amhno3 +                   &
-                     ppart(b)%volc(2) * arhooc + ppart(b)%volc(1) * arhoh2so4  &
-                     + ppart(b)%volc(8) * arhoh2o
-             zmolcl = ( ppart(b)%volc(5) * arhoss / amss ) / zhlp1
+             zhlp1 = pc_nh3(ib) * amnh3 + pchno3(ib) * amhno3 + ppart(ib)%volc(2) * arhooc +       &
+                     ppart(ib)%volc(1) * arhoh2so4 + ppart(ib)%volc(8) * arhoh2o
+             zmol_cl = ( ppart(ib)%volc(5) * arhoss / amss ) / zhlp1
 !
 !--          Molality of NH4+
-             zhlp1 =  pchno3(b) * amhno3 + ppart(b)%volc(1) * arhoh2so4 +      &
-                      ppart(b)%volc(2) * arhooc + ppart(b)%volc(5) * arhoss +  &
-                      ppart(b)%volc(8) * arhoh2o
-             zmolnh4 = pcnh3(b) / zhlp1
-!             
+             zhlp1 =  pchno3(ib) * amhno3 + ppart(ib)%volc(1) * arhoh2so4 + ppart(ib)%volc(2) *    &
+                      arhooc + ppart(ib)%volc(5) * arhoss + ppart(ib)%volc(8) * arhoh2o
+             zmol_nh4 = pc_nh3(ib) / zhlp1
+!
 !--          Molality of Na+
-             zmolna = zmolcl
+             zmol_na = zmol_cl
 !
 !--          Molality of H+
-             zmolhp = 2.0_wp * zmolso4 + zmolno3 + zmolcl - ( zmolnh4 + zmolna )
+             zmol_h = 2.0_wp * zmol_so4 + zmol_no3 + zmol_cl - ( zmol_nh4 + zmol_na )
 
           ELSE
 
-             zhlp2 = pkelhno3(b) * zmolno3 * pachno3(b) ** 2.0_wp
-!
-!--          Mona debugging
+             zhlp2 = pkelhno3(ib) * zmol_no3 * pachno3(ib)**2
+
              IF ( zhlp2 > 1.0E-30_wp )  THEN
-                zmolhp = KglHNO3 * pchno3eq(b) / zhlp2 ! Eq. 17.38
+                zmol_h = k_gl_hno3 * pchno3eq(ib) / zhlp2 ! Eq. 17.38
              ELSE
-                zmolhp = 0.0_wp
+                zmol_h = 0.0_wp
              ENDIF
 
           ENDIF
 
-          zhlp1 = ppart(b)%volc(8) * arhoh2o * argas * ptemp * KglHNO3
+          zhlp1 = ppart(ib)%volc(8) * arhoh2o * argas * ptemp * k_gl_hno3
 !
 !--       Saturation ratio for NH3 and for HNO3
-          IF ( zmolhp > 0.0_wp )  THEN
-             zhlp2 = pkelnh3(b) / ( zhlp1 * zmolhp )
-             zhlp3 = KllH2O / ( KllNH3 + KglNH3 )
-             psatnh3(b) = zhlp2 * ( ( pacnh4hso2(b) / pachhso4(b) ) **2.0_wp ) &
-                          * zhlp3
-             psathno3(b) = ( pkelhno3(b) * zmolhp * pachno3(b)**2.0_wp ) / zhlp1
+          IF ( zmol_h > 0.0_wp )  THEN
+             zhlp2 = pkelnh3(ib) / ( zhlp1 * zmol_h )
+             zhlp3 = k_ll_h2o / ( k_ll_nh3 + k_gl_nh3 )
+             psatnh3(ib) = zhlp2 * ( ( pacnh4hso2(ib) / pachhso4(ib) )**2 ) * zhlp3
+             psathno3(ib) = ( pkelhno3(ib) * zmol_h * pachno3(ib)**2 ) / zhlp1
           ELSE
-             psatnh3(b) = 1.0_wp
-             psathno3(b) = 1.0_wp
+             psatnh3(ib) = 1.0_wp
+             psathno3(ib) = 1.0_wp
           ENDIF
        ELSE
-          psatnh3(b) = 1.0_wp
-          psathno3(b) = 1.0_wp
+          psatnh3(ib) = 1.0_wp
+          psathno3(ib) = 1.0_wp
        ENDIF
 
     ENDDO
 
-  END SUBROUTINE SVsat
- 
+  END SUBROUTINE nitrate_ammonium_saturation
+
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Prototype module for calculating the water content of a mixed inorganic/
-!> organic particle + equilibrium water vapour pressure above the solution 
-!> (HNO3, HCL, NH3 and representative organic compounds. Efficient calculation 
-!> of the partitioning of species between gas and aerosol. Based in a chamber 
-!> study. 
-!
-!> Written by Dave Topping. Pure organic component properties predicted by Mark 
-!> Barley based on VOCs predicted in MCM simulations performed by Mike Jenkin. 
-!> Delivered by Gordon McFiggans as Deliverable D22 from WP1.4 in the EU FP6 
+!> organic particle + equilibrium water vapour pressure above the solution
+!> (HNO3, HCL, NH3 and representative organic compounds. Efficient calculation
+!> of the partitioning of species between gas and aerosol. Based in a chamber
+!> study.
+!
+!> Written by Dave Topping. Pure organic component properties predicted by Mark
+!> Barley based on VOCs predicted in MCM simulations performed by Mike Jenkin.
+!> Delivered by Gordon McFiggans as Deliverable D22 from WP1.4 in the EU FP6
 !> EUCAARI Integrated Project.
 !
-!> Queries concerning the use of this code through Gordon McFiggans, 
+!> REFERENCES
+!> Clegg et al. (1998) A Thermodynamic Model of the System H+-NH4+-Na+-SO42- -NO3--Cl--H2O at
+!>    298.15 K, J. Phys. Chem., 102A, 2155-2171.
+!> Clegg et al. (2001) Thermodynamic modelling of aqueous aerosols containing electrolytes and
+!>    dissolved organic compounds. Journal of Aerosol Science 2001;32(6):713-738.
+!> Topping et al. (2005a) A curved multi-component aerosol hygroscopicity model framework: Part 1 -
+!>    Inorganic compounds. Atmospheric Chemistry and Physics 2005;5:1205-1222.
+!> Topping et al. (2005b) A curved multi-component aerosol hygroscopicity model framework: Part 2 -
+!>    Including organic compounds. Atmospheric Chemistry and Physics 2005;5:1223-1242.
+!> Wagman et al. (1982). The NBS tables of chemical thermodynamic properties: selected values for
+!>    inorganic and Câ and Câ organic substances in SI units (book)
+!> Zaveri et al. (2005). A new method for multicomponent activity coefficients of electrolytes in
+!>    aqueous atmospheric aerosols, JGR, 110, D02201, 2005.
+!
+!> Queries concerning the use of this code through Gordon McFiggans,
 !> g.mcfiggans@manchester.ac.uk,
-!> Ownership: D. Topping, Centre for Atmospheric Sciences, University of 
+!> Ownership: D. Topping, Centre for Atmospheric Sciences, University of
 !> Manchester, 2007
 !
 !> Rewritten to PALM by Mona Kurppa, UHel, 2017
 !------------------------------------------------------------------------------!
- SUBROUTINE inorganic_pdfite( RH, temp, ions, water_total, Press_HNO3,         &
-                               Press_HCL, Press_NH3, gamma_out, mols_out )
-    
+ SUBROUTINE inorganic_pdfite( rh, temp, ions, water_total, press_hno3, press_hcl, press_nh3,       &
+                              gamma_out, mols_out )
+
     IMPLICIT NONE
-    
-    REAL(wp), DIMENSION(:) ::  gamma_out !< Activity coefficient for calculating 
-                                         !< the non-ideal dissociation constants
-                                         !< 1: HNO3, 2: HCL, 3: NH4+/H+ (NH3)
-                                         !< 4: HHSO4**2/H2SO4, 
-                                         !< 5: H2SO4**3/HHSO4**2
-                                         !< 6: NH4HSO2, 7: HHSO4
-    REAL(wp), DIMENSION(:) ::  ions      !< ion molarities (mol/m3)
-                                         !< 1: H+, 2: NH4+, 3: Na+, 4: SO4(2-),
-                                         !< 5: HSO4-, 6: NO3-, 7: Cl-
-    REAL(wp), DIMENSION(7) ::  ions_mol  !< ion molalities (mol/kg)
-                                         !< 1: H+, 2: NH4+, 3: Na+, 4: SO4(2-), 
-                                         !< 5: HSO4-, 6: NO3-, 7: Cl-
-    REAL(wp), DIMENSION(:) ::  mols_out  !< ion molality output (mol/kg)
-                                         !< 1: H+, 2: NH4+, 3: Na+, 4: SO4(2-),
-                                         !< 5: HSO4-, 6: NO3-, 7: Cl-
+
+    INTEGER(iwp) ::  binary_case
+    INTEGER(iwp) ::  full_complexity
+
+    REAL(wp) ::  a                         !< auxiliary variable
     REAL(wp) ::  act_product               !< ionic activity coef. product:
-                                           !< = (gamma_h2so4**3d0) / 
-                                           !<   (gamma_hhso4**2d0)       
-    REAL(wp) ::  ammonium_chloride         !< 
-    REAL(wp) ::  ammonium_chloride_eq_frac !<                          
-    REAL(wp) ::  ammonium_nitrate          !< 
-    REAL(wp) ::  ammonium_nitrate_eq_frac  !<       
-    REAL(wp) ::  ammonium_sulphate         !<  
+                                           !< = (gamma_h2so4**3d0) / gamma_hhso4**2d0)
+    REAL(wp) ::  ammonium_chloride         !<
+    REAL(wp) ::  ammonium_chloride_eq_frac !<
+    REAL(wp) ::  ammonium_nitrate          !<
+    REAL(wp) ::  ammonium_nitrate_eq_frac  !<
+    REAL(wp) ::  ammonium_sulphate         !<
     REAL(wp) ::  ammonium_sulphate_eq_frac !<
-    REAL(wp) ::  binary_h2so4              !< binary H2SO4 activity coeff.       
+    REAL(wp) ::  b                         !< auxiliary variable
+    REAL(wp) ::  binary_h2so4              !< binary H2SO4 activity coeff.
     REAL(wp) ::  binary_hcl                !< binary HCL activity coeff.
-    REAL(wp) ::  binary_hhso4              !< binary HHSO4 activity coeff.     
+    REAL(wp) ::  binary_hhso4              !< binary HHSO4 activity coeff.
     REAL(wp) ::  binary_hno3               !< binary HNO3 activity coeff.
-    REAL(wp) ::  binary_nh4hso4            !< binary NH4HSO4 activity coeff.    
+    REAL(wp) ::  binary_nh4hso4            !< binary NH4HSO4 activity coeff.
+    REAL(wp) ::  c                         !< auxiliary variable
     REAL(wp) ::  charge_sum                !< sum of ionic charges
-    REAL(wp) ::  gamma_h2so4               !< activity coefficient       
+    REAL(wp) ::  gamma_h2so4               !< activity coefficient
     REAL(wp) ::  gamma_hcl                 !< activity coefficient
-    REAL(wp) ::  gamma_hhso4               !< activity coeffient       
+    REAL(wp) ::  gamma_hhso4               !< activity coeffient
     REAL(wp) ::  gamma_hno3                !< activity coefficient
     REAL(wp) ::  gamma_nh3                 !< activity coefficient
@@ -6024,235 +6050,208 @@
     REAL(wp) ::  h_out                     !<
     REAL(wp) ::  h_real                    !< new hydrogen ion conc.
-    REAL(wp) ::  H2SO4_hcl                 !< contribution of H2SO4       
-    REAL(wp) ::  H2SO4_hno3                !< contribution of H2SO4
-    REAL(wp) ::  H2SO4_nh3                 !< contribution of H2SO4
-    REAL(wp) ::  H2SO4_nh4hso4             !< contribution of H2SO4       
-    REAL(wp) ::  HCL_h2so4                 !< contribution of HCL        
-    REAL(wp) ::  HCL_hhso4                 !< contribution of HCL        
-    REAL(wp) ::  HCL_hno3                  !< contribution of HCL
-    REAL(wp) ::  HCL_nh3                   !< contribution of HCL
-    REAL(wp) ::  HCL_nh4hso4               !< contribution of HCL 
-    REAL(wp) ::  henrys_temp_dep           !< temperature dependence of 
-                                           !< Henry's Law       
-    REAL(wp) ::  HNO3_h2so4                !< contribution of HNO3       
-    REAL(wp) ::  HNO3_hcl                  !< contribution of HNO3
-    REAL(wp) ::  HNO3_hhso4                !< contribution of HNO3
-    REAL(wp) ::  HNO3_nh3                  !< contribution of HNO3
-    REAL(wp) ::  HNO3_nh4hso4              !< contribution of HNO3
-    REAL(wp) ::  hso4_out                  !< 
+    REAL(wp) ::  h2so4_hcl                 !< contribution of H2SO4
+    REAL(wp) ::  h2so4_hno3                !< contribution of H2SO4
+    REAL(wp) ::  h2so4_nh3                 !< contribution of H2SO4
+    REAL(wp) ::  h2so4_nh4hso4             !< contribution of H2SO4
+    REAL(wp) ::  hcl_h2so4                 !< contribution of HCL
+    REAL(wp) ::  hcl_hhso4                 !< contribution of HCL
+    REAL(wp) ::  hcl_hno3                  !< contribution of HCL
+    REAL(wp) ::  hcl_nh4hso4               !< contribution of HCL
+    REAL(wp) ::  henrys_temp_dep           !< temperature dependence of Henry's Law
+    REAL(wp) ::  hno3_h2so4                !< contribution of HNO3
+    REAL(wp) ::  hno3_hcl                  !< contribution of HNO3
+    REAL(wp) ::  hno3_hhso4                !< contribution of HNO3
+    REAL(wp) ::  hno3_nh3                  !< contribution of HNO3
+    REAL(wp) ::  hno3_nh4hso4              !< contribution of HNO3
+    REAL(wp) ::  hso4_out                  !<
     REAL(wp) ::  hso4_real                 !< new bisulphate ion conc.
     REAL(wp) ::  hydrochloric_acid         !<
     REAL(wp) ::  hydrochloric_acid_eq_frac !<
-    REAL(wp) ::  Kh                        !< equilibrium constant for H+       
-    REAL(wp) ::  K_hcl                     !< equilibrium constant of HCL       
-    REAL(wp) ::  K_hno3                    !< equilibrium constant of HNO3
-    REAL(wp) ::  Knh4                      !< equilibrium constant for NH4+
-    REAL(wp) ::  Kw                        !< equil. const. for water_surface  
-    REAL(wp) ::  Ln_h2so4_act              !< gamma_h2so4 = EXP(Ln_h2so4_act) 
-    REAL(wp) ::  Ln_HCL_act                !< gamma_hcl = EXP( Ln_HCL_act )
-    REAL(wp) ::  Ln_hhso4_act              !< gamma_hhso4 = EXP(Ln_hhso4_act) 
-    REAL(wp) ::  Ln_HNO3_act               !< gamma_hno3 = EXP( Ln_HNO3_act )
-    REAL(wp) ::  Ln_NH4HSO4_act            !< gamma_nh4hso4 = 
-                                           !< EXP( Ln_NH4HSO4_act )
-    REAL(wp) ::  molality_ratio_nh3        !< molality ratio of NH3 
-                                           !< (NH4+ and H+) 
-    REAL(wp) ::  Na2SO4_h2so4              !< contribution of Na2SO4                                              
-    REAL(wp) ::  Na2SO4_hcl                !< contribution of Na2SO4 
-    REAL(wp) ::  Na2SO4_hhso4              !< contribution of Na2SO4        
-    REAL(wp) ::  Na2SO4_hno3               !< contribution of Na2SO4
-    REAL(wp) ::  Na2SO4_nh3                !< contribution of Na2SO4
-    REAL(wp) ::  Na2SO4_nh4hso4            !< contribution of Na2SO4       
-    REAL(wp) ::  NaCl_h2so4                !< contribution of NaCl       
-    REAL(wp) ::  NaCl_hcl                  !< contribution of NaCl
-    REAL(wp) ::  NaCl_hhso4                !< contribution of NaCl       
-    REAL(wp) ::  NaCl_hno3                 !< contribution of NaCl
-    REAL(wp) ::  NaCl_nh3                  !< contribution of NaCl
-    REAL(wp) ::  NaCl_nh4hso4              !< contribution of NaCl       
-    REAL(wp) ::  NaNO3_h2so4               !< contribution of NaNO3       
-    REAL(wp) ::  NaNO3_hcl                 !< contribution of NaNO3
-    REAL(wp) ::  NaNO3_hhso4               !< contribution of NaNO3       
-    REAL(wp) ::  NaNO3_hno3                !< contribution of NaNO3
-    REAL(wp) ::  NaNO3_nh3                 !< contribution of NaNO3  
-    REAL(wp) ::  NaNO3_nh4hso4             !< contribution of NaNO3       
-    REAL(wp) ::  NH42SO4_h2so4             !< contribution of NH42SO4       
-    REAL(wp) ::  NH42SO4_hcl               !< contribution of NH42SO4
-    REAL(wp) ::  NH42SO4_hhso4             !< contribution of NH42SO4       
-    REAL(wp) ::  NH42SO4_hno3              !< contribution of NH42SO4
-    REAL(wp) ::  NH42SO4_nh3               !< contribution of NH42SO4
-    REAL(wp) ::  NH42SO4_nh4hso4           !< contribution of NH42SO4
-    REAL(wp) ::  NH4Cl_h2so4               !< contribution of NH4Cl       
-    REAL(wp) ::  NH4Cl_hcl                 !< contribution of NH4Cl
-    REAL(wp) ::  NH4Cl_hhso4               !< contribution of NH4Cl       
-    REAL(wp) ::  NH4Cl_hno3                !< contribution of NH4Cl
-    REAL(wp) ::  NH4Cl_nh3                 !< contribution of NH4Cl
-    REAL(wp) ::  NH4Cl_nh4hso4             !< contribution of NH4Cl       
-    REAL(wp) ::  NH4NO3_h2so4              !< contribution of NH4NO3
-    REAL(wp) ::  NH4NO3_hcl                !< contribution of NH4NO3
-    REAL(wp) ::  NH4NO3_hhso4              !< contribution of NH4NO3
-    REAL(wp) ::  NH4NO3_hno3               !< contribution of NH4NO3
-    REAL(wp) ::  NH4NO3_nh3                !< contribution of NH4NO3
-    REAL(wp) ::  NH4NO3_nh4hso4            !< contribution of NH4NO3       
+    REAL(wp) ::  k_h                       !< equilibrium constant for H+
+    REAL(wp) ::  k_hcl                     !< equilibrium constant of HCL
+    REAL(wp) ::  k_hno3                    !< equilibrium constant of HNO3
+    REAL(wp) ::  k_nh4                     !< equilibrium constant for NH4+
+    REAL(wp) ::  k_h2o                     !< equil. const. for water_surface
+    REAL(wp) ::  ln_h2so4_act              !< gamma_h2so4 = EXP(ln_h2so4_act)
+    REAL(wp) ::  ln_HCL_act                !< gamma_hcl = EXP( ln_HCL_act )
+    REAL(wp) ::  ln_hhso4_act              !< gamma_hhso4 = EXP(ln_hhso4_act)
+    REAL(wp) ::  ln_hno3_act               !< gamma_hno3 = EXP( ln_hno3_act )
+    REAL(wp) ::  ln_nh4hso4_act            !< gamma_nh4hso4 = EXP( ln_nh4hso4_act )
+    REAL(wp) ::  molality_ratio_nh3        !< molality ratio of NH3 (NH4+ and H+)
+    REAL(wp) ::  na2so4_h2so4              !< contribution of Na2SO4
+    REAL(wp) ::  na2so4_hcl                !< contribution of Na2SO4
+    REAL(wp) ::  na2so4_hhso4              !< contribution of Na2SO4
+    REAL(wp) ::  na2so4_hno3               !< contribution of Na2SO4
+    REAL(wp) ::  na2so4_nh3                !< contribution of Na2SO4
+    REAL(wp) ::  na2so4_nh4hso4            !< contribution of Na2SO4
+    REAL(wp) ::  nacl_h2so4                !< contribution of NaCl
+    REAL(wp) ::  nacl_hcl                  !< contribution of NaCl
+    REAL(wp) ::  nacl_hhso4                !< contribution of NaCl
+    REAL(wp) ::  nacl_hno3                 !< contribution of NaCl
+    REAL(wp) ::  nacl_nh3                  !< contribution of NaCl
+    REAL(wp) ::  nacl_nh4hso4              !< contribution of NaCl
+    REAL(wp) ::  nano3_h2so4               !< contribution of NaNO3
+    REAL(wp) ::  nano3_hcl                 !< contribution of NaNO3
+    REAL(wp) ::  nano3_hhso4               !< contribution of NaNO3
+    REAL(wp) ::  nano3_hno3                !< contribution of NaNO3
+    REAL(wp) ::  nano3_nh3                 !< contribution of NaNO3
+    REAL(wp) ::  nano3_nh4hso4             !< contribution of NaNO3
+    REAL(wp) ::  nh42so4_h2so4             !< contribution of NH42SO4
+    REAL(wp) ::  nh42so4_hcl               !< contribution of NH42SO4
+    REAL(wp) ::  nh42so4_hhso4             !< contribution of NH42SO4
+    REAL(wp) ::  nh42so4_hno3              !< contribution of NH42SO4
+    REAL(wp) ::  nh42so4_nh3               !< contribution of NH42SO4
+    REAL(wp) ::  nh42so4_nh4hso4           !< contribution of NH42SO4
+    REAL(wp) ::  nh4cl_h2so4               !< contribution of NH4Cl
+    REAL(wp) ::  nh4cl_hcl                 !< contribution of NH4Cl
+    REAL(wp) ::  nh4cl_hhso4               !< contribution of NH4Cl
+    REAL(wp) ::  nh4cl_hno3                !< contribution of NH4Cl
+    REAL(wp) ::  nh4cl_nh3                 !< contribution of NH4Cl
+    REAL(wp) ::  nh4cl_nh4hso4             !< contribution of NH4Cl
+    REAL(wp) ::  nh4no3_h2so4              !< contribution of NH4NO3
+    REAL(wp) ::  nh4no3_hcl                !< contribution of NH4NO3
+    REAL(wp) ::  nh4no3_hhso4              !< contribution of NH4NO3
+    REAL(wp) ::  nh4no3_hno3               !< contribution of NH4NO3
+    REAL(wp) ::  nh4no3_nh3                !< contribution of NH4NO3
+    REAL(wp) ::  nh4no3_nh4hso4            !< contribution of NH4NO3
     REAL(wp) ::  nitric_acid               !<
     REAL(wp) ::  nitric_acid_eq_frac       !< Equivalent fractions
-    REAL(wp) ::  Press_HCL                 !< partial pressure of HCL        
-    REAL(wp) ::  Press_HNO3                !< partial pressure of HNO3
-    REAL(wp) ::  Press_NH3                 !< partial pressure of NH3        
-    REAL(wp) ::  RH                        !< relative humidity [0-1]
+    REAL(wp) ::  press_hcl                 !< partial pressure of HCL
+    REAL(wp) ::  press_hno3                !< partial pressure of HNO3
+    REAL(wp) ::  press_nh3                 !< partial pressure of NH3
+    REAL(wp) ::  rh                        !< relative humidity [0-1]
+    REAL(wp) ::  root1                     !< auxiliary variable
+    REAL(wp) ::  root2                     !< auxiliary variable
+    REAL(wp) ::  so4_out                   !<
+    REAL(wp) ::  so4_real                  !< new sulpate ion concentration
+    REAL(wp) ::  sodium_chloride           !<
+    REAL(wp) ::  sodium_chloride_eq_frac   !<
+    REAL(wp) ::  sodium_nitrate            !<
+    REAL(wp) ::  sodium_nitrate_eq_frac    !<
+    REAL(wp) ::  sodium_sulphate           !<
+    REAL(wp) ::  sodium_sulphate_eq_frac   !<
+    REAL(wp) ::  solutes                   !<
+    REAL(wp) ::  sulphuric_acid            !<
+    REAL(wp) ::  sulphuric_acid_eq_frac    !<
     REAL(wp) ::  temp                      !< temperature
-    REAL(wp) ::  so4_out                   !< 
-    REAL(wp) ::  so4_real                  !< new sulpate ion concentration       
-    REAL(wp) ::  sodium_chloride           !<
-    REAL(wp) ::  sodium_chloride_eq_frac   !<   
-    REAL(wp) ::  sodium_nitrate            !<
-    REAL(wp) ::  sodium_nitrate_eq_frac    !<    
-    REAL(wp) ::  sodium_sulphate           !<
-    REAL(wp) ::  sodium_sulphate_eq_frac   !<       
-    REAL(wp) ::  solutes                   !<
-    REAL(wp) ::  sulphuric_acid            !<       
-    REAL(wp) ::  sulphuric_acid_eq_frac    !< 
     REAL(wp) ::  water_total               !<
-    
-    REAL(wp) ::  a !< auxiliary variable 
-    REAL(wp) ::  b !< auxiliary variable
-    REAL(wp) ::  c !< auxiliary variable 
-    REAL(wp) ::  root1 !< auxiliary variable 
-    REAL(wp) ::  root2 !< auxiliary variable
-
-    INTEGER(iwp) ::  binary_case
-    INTEGER(iwp) ::  full_complexity
-!       
+
+    REAL(wp), DIMENSION(:) ::  gamma_out !< Activity coefficient for calculating the non-ideal
+                                         !< dissociation constants
+                                         !< 1: HNO3, 2: HCL, 3: NH4+/H+ (NH3), 4: HHSO4**2/H2SO4,
+                                         !< 5: H2SO4**3/HHSO4**2, 6: NH4HSO2, 7: HHSO4
+    REAL(wp), DIMENSION(:) ::  ions      !< ion molarities (mol/m3): 1: H+, 2: NH4+, 3: Na+, 
+                                         !< 4: SO4(2-), 5: HSO4-, 6: NO3-, 7: Cl-
+    REAL(wp), DIMENSION(7) ::  ions_mol  !< ion molalities (mol/kg): 1: H+, 2: NH4+, 3: Na+, 
+                                         !< 4: SO4(2-), 5: HSO4-, 6: NO3-, 7: Cl-
+    REAL(wp), DIMENSION(:) ::  mols_out  !< ion molality output (mol/kg): 1: H+, 2: NH4+, 3: Na+, 
+                                         !< 4: SO4(2-), 5: HSO4-, 6: NO3-, 7: Cl-
+!
 !-- Value initialisation
-    binary_h2so4    = 0.0_wp   
-    binary_hcl      = 0.0_wp  
-    binary_hhso4    = 0.0_wp  
-    binary_hno3     = 0.0_wp  
-    binary_nh4hso4  = 0.0_wp  
-    henrys_temp_dep = ( 1.0_wp / temp - 1.0_wp / 298.0_wp )
-    HCL_hno3        = 1.0_wp
-    H2SO4_hno3      = 1.0_wp
-    NH42SO4_hno3    = 1.0_wp
-    NH4NO3_hno3     = 1.0_wp
-    NH4Cl_hno3      = 1.0_wp
-    Na2SO4_hno3     = 1.0_wp
-    NaNO3_hno3      = 1.0_wp
-    NaCl_hno3       = 1.0_wp
-    HNO3_hcl        = 1.0_wp
-    H2SO4_hcl       = 1.0_wp
-    NH42SO4_hcl     = 1.0_wp
-    NH4NO3_hcl      = 1.0_wp
-    NH4Cl_hcl       = 1.0_wp
-    Na2SO4_hcl      = 1.0_wp 
-    NaNO3_hcl       = 1.0_wp
-    NaCl_hcl        = 1.0_wp
-    HNO3_nh3        = 1.0_wp
-    HCL_nh3         = 1.0_wp
-    H2SO4_nh3       = 1.0_wp 
-    NH42SO4_nh3     = 1.0_wp 
-    NH4NO3_nh3      = 1.0_wp
-    NH4Cl_nh3       = 1.0_wp
-    Na2SO4_nh3      = 1.0_wp
-    NaNO3_nh3       = 1.0_wp
-    NaCl_nh3        = 1.0_wp
-    HNO3_hhso4      = 1.0_wp 
-    HCL_hhso4       = 1.0_wp
-    NH42SO4_hhso4   = 1.0_wp
-    NH4NO3_hhso4    = 1.0_wp
-    NH4Cl_hhso4     = 1.0_wp
-    Na2SO4_hhso4    = 1.0_wp
-    NaNO3_hhso4     = 1.0_wp
-    NaCl_hhso4      = 1.0_wp
-    HNO3_h2so4      = 1.0_wp
-    HCL_h2so4       = 1.0_wp
-    NH42SO4_h2so4   = 1.0_wp 
-    NH4NO3_h2so4    = 1.0_wp
-    NH4Cl_h2so4     = 1.0_wp
-    Na2SO4_h2so4    = 1.0_wp
-    NaNO3_h2so4     = 1.0_wp
-    NaCl_h2so4      = 1.0_wp
+    binary_h2so4    = 0.0_wp
+    binary_hcl      = 0.0_wp
+    binary_hhso4    = 0.0_wp
+    binary_hno3     = 0.0_wp
+    binary_nh4hso4  = 0.0_wp
+    henrys_temp_dep = ( 1.0_wp / temp - 0.0033557_wp ) ! 1/T - 1/298 K
+    hcl_hno3        = 1.0_wp
+    h2so4_hno3      = 1.0_wp
+    nh42so4_hno3    = 1.0_wp
+    nh4no3_hno3     = 1.0_wp
+    nh4cl_hno3      = 1.0_wp
+    na2so4_hno3     = 1.0_wp
+    nano3_hno3      = 1.0_wp
+    nacl_hno3       = 1.0_wp
+    hno3_hcl        = 1.0_wp
+    h2so4_hcl       = 1.0_wp
+    nh42so4_hcl     = 1.0_wp
+    nh4no3_hcl      = 1.0_wp
+    nh4cl_hcl       = 1.0_wp
+    na2so4_hcl      = 1.0_wp
+    nano3_hcl       = 1.0_wp
+    nacl_hcl        = 1.0_wp
+    hno3_nh3        = 1.0_wp
+    h2so4_nh3       = 1.0_wp
+    nh42so4_nh3     = 1.0_wp
+    nh4no3_nh3      = 1.0_wp
+    nh4cl_nh3       = 1.0_wp
+    na2so4_nh3      = 1.0_wp
+    nano3_nh3       = 1.0_wp
+    nacl_nh3        = 1.0_wp
+    hno3_hhso4      = 1.0_wp
+    hcl_hhso4       = 1.0_wp
+    nh42so4_hhso4   = 1.0_wp
+    nh4no3_hhso4    = 1.0_wp
+    nh4cl_hhso4     = 1.0_wp
+    na2so4_hhso4    = 1.0_wp
+    nano3_hhso4     = 1.0_wp
+    nacl_hhso4      = 1.0_wp
+    hno3_h2so4      = 1.0_wp
+    hcl_h2so4       = 1.0_wp
+    nh42so4_h2so4   = 1.0_wp
+    nh4no3_h2so4    = 1.0_wp
+    nh4cl_h2so4     = 1.0_wp
+    na2so4_h2so4    = 1.0_wp
+    nano3_h2so4     = 1.0_wp
+    nacl_h2so4      = 1.0_wp
+!
 !-- New NH3 variables
-    HNO3_nh4hso4    = 1.0_wp 
-    HCL_nh4hso4     = 1.0_wp
-    H2SO4_nh4hso4   = 1.0_wp
-    NH42SO4_nh4hso4 = 1.0_wp 
-    NH4NO3_nh4hso4  = 1.0_wp
-    NH4Cl_nh4hso4   = 1.0_wp
-    Na2SO4_nh4hso4  = 1.0_wp
-    NaNO3_nh4hso4   = 1.0_wp
-    NaCl_nh4hso4    = 1.0_wp
+    hno3_nh4hso4    = 1.0_wp
+    hcl_nh4hso4     = 1.0_wp
+    h2so4_nh4hso4   = 1.0_wp
+    nh42so4_nh4hso4 = 1.0_wp
+    nh4no3_nh4hso4  = 1.0_wp
+    nh4cl_nh4hso4   = 1.0_wp
+    na2so4_nh4hso4  = 1.0_wp
+    nano3_nh4hso4   = 1.0_wp
+    nacl_nh4hso4    = 1.0_wp
 !
 !-- Juha Tonttila added
     mols_out   = 0.0_wp
-    Press_HNO3 = 0.0_wp
-    Press_HCL  = 0.0_wp
-    Press_NH3  = 0.0_wp !< Initialising vapour pressure over the
-                        !< multicomponent particle
-    gamma_out  = 1.0_wp !< i.e. don't alter the ideal mixing ratios if 
-                        !< there's nothing there.
-!       
+    press_hno3 = 0.0_wp  !< Initialising vapour pressures over the
+    press_hcl  = 0.0_wp  !< multicomponent particle
+    press_nh3  = 0.0_wp
+    gamma_out  = 1.0_wp  !< i.e. don't alter the ideal mixing ratios if there's nothing there.
+!
 !-- 1) - COMPOSITION DEFINITIONS
 !
 !-- a) Inorganic ion pairing:
-!-- In order to calculate the water content, which is also used in 
-!-- calculating vapour pressures, one needs to pair the anions and cations 
-!-- for use in the ZSR mixing rule. The equation provided by Clegg et al. 
-!-- (2001) is used for ion pairing. The solutes chosen comprise of 9 
-!-- inorganic salts and acids which provide a pairing between each anion and
-!-- cation: (NH4)2SO4, NH4NO3, NH4Cl, Na2SO4, NaNO3, NaCl, H2SO4, HNO3, HCL.  
-!-- The organic compound is treated as a seperate solute.
+!-- In order to calculate the water content, which is also used in calculating vapour pressures, one
+!-- needs to pair the anions and cations for use in the ZSR mixing rule. The equation provided by
+!-- Clegg et al. (2001) is used for ion pairing. The solutes chosen comprise of 9 inorganic salts
+!-- and acids which provide a pairing between each anion and cation: (NH4)2SO4, NH4NO3, NH4Cl,
+!-- Na2SO4, NaNO3, NaCl, H2SO4, HNO3, HCL. The organic compound is treated as a seperate solute.
 !-- Ions: 1: H+, 2: NH4+, 3: Na+, 4: SO4(2-), 5: HSO4-, 6: NO3-, 7: Cl-
 !
-    charge_sum = ions(1) + ions(2) + ions(3) + 2.0_wp * ions(4) + ions(5) +    &
-                 ions(6) + ions(7)
-    nitric_acid       = 0.0_wp   ! HNO3
-    nitric_acid       = ( 2.0_wp * ions(1) * ions(6) *                         &
-                        ( ( 1.0_wp / 1.0_wp ) ** 0.5_wp ) ) / ( charge_sum )
-    hydrochloric_acid = 0.0_wp   ! HCL 
-    hydrochloric_acid = ( 2.0_wp * ions(1) * ions(7) *                         &
-                        ( ( 1.0_wp / 1.0_wp ) ** 0.5_wp ) ) / ( charge_sum )
-    sulphuric_acid    = 0.0_wp   ! H2SO4
-    sulphuric_acid    = ( 2.0_wp * ions(1) * ions(4) *                         &
-                        ( ( 2.0_wp / 2.0_wp ) ** 0.5_wp ) ) / ( charge_sum )
-    ammonium_sulphate = 0.0_wp   ! (NH4)2SO4
-    ammonium_sulphate = ( 2.0_wp * ions(2) * ions(4) *                         &
-                        ( ( 2.0_wp / 2.0_wp ) ** 0.5_wp ) ) / ( charge_sum ) 
-    ammonium_nitrate  = 0.0_wp   ! NH4NO3
-    ammonium_nitrate  = ( 2.0_wp * ions(2) * ions(6) *                         &
-                        ( ( 1.0_wp / 1.0_wp ) ** 0.5_wp ) ) / ( charge_sum )
-    ammonium_chloride = 0.0_wp   ! NH4Cl
-    ammonium_chloride = ( 2.0_wp * ions(2) * ions(7) *                         &
-                        ( ( 1.0_wp / 1.0_wp ) ** 0.5_wp ) ) / ( charge_sum )    
-    sodium_sulphate   = 0.0_wp   ! Na2SO4
-    sodium_sulphate   = ( 2.0_wp * ions(3) * ions(4) *                         &
-                        ( ( 2.0_wp / 2.0_wp ) ** 0.5_wp ) ) / ( charge_sum )
-    sodium_nitrate    = 0.0_wp   ! NaNO3
-    sodium_nitrate    = ( 2.0_wp * ions(3) *ions(6) *                          &
-                        ( ( 1.0_wp / 1.0_wp ) ** 0.5_wp ) ) / ( charge_sum )
-    sodium_chloride   = 0.0_wp   ! NaCl
-    sodium_chloride   = ( 2.0_wp * ions(3) * ions(7) *                         &
-                        ( ( 1.0_wp / 1.0_wp ) ** 0.5_wp ) ) / ( charge_sum )
+    charge_sum = ions(1) + ions(2) + ions(3) + 2.0_wp * ions(4) + ions(5) + ions(6) + ions(7)
+    nitric_acid       = ( 2.0_wp * ions(1) * ions(6) ) / charge_sum
+    hydrochloric_acid = ( 2.0_wp * ions(1) * ions(7) ) / charge_sum
+    sulphuric_acid    = ( 2.0_wp * ions(1) * ions(4) ) / charge_sum
+    ammonium_sulphate = ( 2.0_wp * ions(2) * ions(4) ) / charge_sum
+    ammonium_nitrate  = ( 2.0_wp * ions(2) * ions(6) ) / charge_sum
+    ammonium_chloride = ( 2.0_wp * ions(2) * ions(7) ) / charge_sum
+    sodium_sulphate   = ( 2.0_wp * ions(3) * ions(4) ) / charge_sum
+    sodium_nitrate    = ( 2.0_wp * ions(3) * ions(6) ) / charge_sum
+    sodium_chloride   = ( 2.0_wp * ions(3) * ions(7) ) / charge_sum
     solutes = 0.0_wp
-    solutes = 3.0_wp * sulphuric_acid +   2.0_wp * hydrochloric_acid +         &
-              2.0_wp * nitric_acid +      3.0_wp * ammonium_sulphate +         &
-              2.0_wp * ammonium_nitrate + 2.0_wp * ammonium_chloride +         &
-              3.0_wp * sodium_sulphate +  2.0_wp * sodium_nitrate +            &
-              2.0_wp * sodium_chloride
-
-! 
+    solutes = 3.0_wp * sulphuric_acid    + 2.0_wp * hydrochloric_acid + 2.0_wp * nitric_acid +     &
+              3.0_wp * ammonium_sulphate + 2.0_wp * ammonium_nitrate + 2.0_wp * ammonium_chloride +&
+              3.0_wp * sodium_sulphate   + 2.0_wp * sodium_nitrate   + 2.0_wp * sodium_chloride
+!
 !-- b) Inorganic equivalent fractions:
-!-- These values are calculated so that activity coefficients can be 
-!-- expressed by a linear additive rule, thus allowing more efficient
-!-- calculations and future expansion (see more detailed description below)               
-    nitric_acid_eq_frac       = 2.0_wp * nitric_acid / ( solutes )
-    hydrochloric_acid_eq_frac = 2.0_wp * hydrochloric_acid / ( solutes )
-    sulphuric_acid_eq_frac    = 3.0_wp * sulphuric_acid / ( solutes )
-    ammonium_sulphate_eq_frac = 3.0_wp * ammonium_sulphate / ( solutes )
-    ammonium_nitrate_eq_frac  = 2.0_wp * ammonium_nitrate / ( solutes )
-    ammonium_chloride_eq_frac = 2.0_wp * ammonium_chloride / ( solutes )
-    sodium_sulphate_eq_frac   = 3.0_wp * sodium_sulphate / ( solutes )
-    sodium_nitrate_eq_frac    = 2.0_wp * sodium_nitrate / ( solutes )
-    sodium_chloride_eq_frac   = 2.0_wp * sodium_chloride / ( solutes )
+!-- These values are calculated so that activity coefficients can be expressed by a linear additive
+!-- rule, thus allowing more efficient calculations and future expansion (see more detailed
+!-- description below)
+    nitric_acid_eq_frac       = 2.0_wp * nitric_acid / solutes
+    hydrochloric_acid_eq_frac = 2.0_wp * hydrochloric_acid / solutes
+    sulphuric_acid_eq_frac    = 3.0_wp * sulphuric_acid / solutes
+    ammonium_sulphate_eq_frac = 3.0_wp * ammonium_sulphate / solutes
+    ammonium_nitrate_eq_frac  = 2.0_wp * ammonium_nitrate / solutes
+    ammonium_chloride_eq_frac = 2.0_wp * ammonium_chloride / solutes
+    sodium_sulphate_eq_frac   = 3.0_wp * sodium_sulphate / solutes
+    sodium_nitrate_eq_frac    = 2.0_wp * sodium_nitrate / solutes
+    sodium_chloride_eq_frac   = 2.0_wp * sodium_chloride / solutes
 !
 !-- Inorganic ion molalities
-    ions_mol(:) = 0.0_wp
     ions_mol(1) = ions(1) / ( water_total * 18.01528E-3_wp )   ! H+
     ions_mol(2) = ions(2) / ( water_total * 18.01528E-3_wp )   ! NH4+
@@ -6263,218 +6262,193 @@
     ions_mol(7) = ions(7) / ( water_total * 18.01528E-3_wp )   ! Cl-
 
-!--    ***
-!-- At this point we may need to introduce a method for prescribing H+ when
-!-- there is no 'real' value for H+..i.e. in the sulphate poor domain
-!-- This will give a value for solve quadratic proposed by Zaveri et al. 2005
+!-- ***
+!-- At this point we may need to introduce a method for prescribing H+ when there is no 'real' value
+!-- for H+..i.e. in the sulphate poor domain. This will give a value for solve quadratic proposed by
+!-- Zaveri et al. 2005
 !
 !-- 2) - WATER CALCULATION
 !
-!-- a) The water content is calculated using the ZSR rule with solute 
-!-- concentrations calculated using 1a above. Whilst the usual approximation of
-!-- ZSR relies on binary data consisting of 5th or higher order polynomials, in
-!-- this code 4 different RH regimes are used, each housing cubic equations for 
-!-- the water associated with each solute listed above. Binary water contents 
-!-- for inorganic components were calculated using AIM online (Clegg et al 
-!-- 1998). The water associated with the organic compound is calculated assuming
-!-- ideality and that aw = RH.
-!
-!-- b) Molality of each inorganic ion and organic solute (initial input) is
-!-- calculated for use in vapour pressure calculation. 
+!-- a) The water content is calculated using the ZSR rule with solute concentrations calculated
+!-- using 1a above. Whilst the usual approximation of ZSR relies on binary data consisting of 5th or
+!-- higher order polynomials, in this code 4 different RH regimes are used, each housing cubic
+!-- equations for the water associated with each solute listed above. Binary water contents for
+!-- inorganic components were calculated using AIM online (Clegg et al 1998). The water associated
+!-- with the organic compound is calculated assuming ideality and that aw = RH.
+!
+!-- b) Molality of each inorganic ion and organic solute (initial input) is calculated for use in
+!-- vapour pressure calculation.
 !
 !-- 3) - BISULPHATE ION DISSOCIATION CALCULATION
 !
-!-- The dissociation of the bisulphate ion is calculated explicitly. A solution
-!-- to the equilibrium equation between the bisulphate ion, hydrogen ion and 
-!-- sulphate ion is found using tabulated equilibrium constants (referenced). It
-!-- is necessary to calculate the activity coefficients of HHSO4 and H2SO4 in a
-!-- non-iterative manner. These are calculated using the same format as 
-!-- described in 4) below, where both activity coefficients were fit to the 
-!-- output from ADDEM (Topping et al 2005a,b) covering an extensive composition
-!-- space, providing the activity coefficients and bisulphate ion dissociation 
-!-- as a function of equivalent mole fractions and relative humidity.
-!
-!-- NOTE: the flags "binary_case" and "full_complexity" are not used in this 
-!-- prototype. They are used for simplification of the fit expressions when 
-!-- using limited composition regions. This section of code calculates the 
-!-- bisulphate ion concentration
+!-- The dissociation of the bisulphate ion is calculated explicitly. A solution to the equilibrium
+!-- equation between the bisulphate ion, hydrogen ion and sulphate ion is found using tabulated
+!-- equilibrium constants (referenced). It is necessary to calculate the activity coefficients of
+!-- HHSO4 and H2SO4 in a non-iterative manner. These are calculated using the same format as
+!-- described in 4) below, where both activity coefficients were fit to the output from ADDEM
+!-- (Topping et al 2005a,b) covering an extensive composition space, providing the activity
+!-- coefficients and bisulphate ion dissociation as a function of equivalent mole fractions and
+!-- relative humidity.
+!
+!-- NOTE: the flags "binary_case" and "full_complexity" are not used in this prototype. They are
+!-- used for simplification of the fit expressions when using limited composition regions. This
+!-- section of code calculates the bisulphate ion concentration.
 !
     IF ( ions(1) > 0.0_wp .AND. ions(4) > 0.0_wp ) THEN
-!       
+!
 !--    HHSO4:
        binary_case = 1
-       IF ( RH > 0.1_wp  .AND.  RH < 0.9_wp )  THEN
-          binary_hhso4 = - 4.9521_wp * ( RH**3 ) + 9.2881_wp * ( RH**2 ) -     &
-                           10.777_wp * RH + 6.0534_wp
-       ELSEIF ( RH >= 0.9_wp  .AND.  RH < 0.955_wp )  THEN
-          binary_hhso4 = - 6.3777_wp * RH + 5.962_wp
-       ELSEIF ( RH >= 0.955_wp  .AND.  RH < 0.99_wp )  THEN
-          binary_hhso4 = 2367.2_wp * ( RH**3 ) - 6849.7_wp * ( RH**2 ) +       &
-                         6600.9_wp * RH - 2118.7_wp    
-       ELSEIF ( RH >= 0.99_wp  .AND.  RH < 0.9999_wp )  THEN
-          binary_hhso4 = 3E-7_wp * ( RH**5 ) - 2E-5_wp * ( RH**4 ) +           &
-                         0.0004_wp * ( RH**3 ) - 0.0035_wp * ( RH**2 ) +       &
-                         0.0123_wp * RH - 0.3025_wp
-       ENDIF
-       
+       IF ( rh > 0.1_wp  .AND.  rh < 0.9_wp )  THEN
+          binary_hhso4 = -4.9521_wp * rh**3 + 9.2881_wp * rh**2 - 10.777_wp * rh + 6.0534_wp
+       ELSEIF ( rh >= 0.9_wp  .AND.  rh < 0.955_wp )  THEN
+          binary_hhso4 = -6.3777_wp * rh + 5.962_wp
+       ELSEIF ( rh >= 0.955_wp  .AND.  rh < 0.99_wp )  THEN
+          binary_hhso4 = 2367.2_wp * rh**3 - 6849.7_wp * rh**2 + 6600.9_wp * rh - 2118.7_wp
+       ELSEIF ( rh >= 0.99_wp  .AND.  rh < 0.9999_wp )  THEN
+          binary_hhso4 = 3E-7_wp * rh**5 - 2E-5_wp * rh**4 + 0.0004_wp * rh**3 - 0.0035_wp * rh**2 &
+                         + 0.0123_wp * rh - 0.3025_wp
+       ENDIF
+
        IF ( nitric_acid > 0.0_wp )  THEN
-          HNO3_hhso4 = - 4.2204_wp * ( RH**4 ) + 12.193_wp * ( RH**3 ) -       &
-                         12.481_wp * ( RH**2 ) + 6.459_wp * RH - 1.9004_wp
-       ENDIF
-       
+          hno3_hhso4 = -4.2204_wp * rh**4 + 12.193_wp * rh**3 - 12.481_wp * rh**2 + 6.459_wp * rh  &
+                       - 1.9004_wp
+       ENDIF
+
        IF ( hydrochloric_acid > 0.0_wp )  THEN
-          HCL_hhso4 = - 54.845_wp * ( RH**7 ) + 209.54_wp * ( RH**6 ) -        &
-                        336.59_wp * ( RH**5 ) + 294.21_wp * ( RH**4 ) -        &
-                        150.07_wp * ( RH**3 ) + 43.767_wp * ( RH**2 ) -        &
-                        6.5495_wp * RH + 0.60048_wp
-       ENDIF
-       
+          hcl_hhso4 = -54.845_wp * rh**7 + 209.54_wp * rh**6 - 336.59_wp * rh**5 + 294.21_wp *     &
+                      rh**4 - 150.07_wp * rh**3 + 43.767_wp * rh**2 - 6.5495_wp * rh + 0.60048_wp
+       ENDIF
+
        IF ( ammonium_sulphate > 0.0_wp )  THEN
-          NH42SO4_hhso4 = 16.768_wp * ( RH**3 ) - 28.75_wp * ( RH**2 ) +       &
-                          20.011_wp * RH - 8.3206_wp
-       ENDIF
-       
+          nh42so4_hhso4 = 16.768_wp * rh**3 - 28.75_wp * rh**2 + 20.011_wp * rh - 8.3206_wp
+       ENDIF
+
        IF ( ammonium_nitrate > 0.0_wp )  THEN
-          NH4NO3_hhso4 = - 17.184_wp * ( RH**4 ) + 56.834_wp * ( RH**3 ) -     &
-                           65.765_wp * ( RH**2 ) + 35.321_wp * RH - 9.252_wp
-       ENDIF
-       
+          nh4no3_hhso4 = -17.184_wp * rh**4 + 56.834_wp * rh**3 - 65.765_wp * rh**2 +              &
+                         35.321_wp * rh - 9.252_wp
+       ENDIF
+
        IF (ammonium_chloride > 0.0_wp )  THEN
-          IF ( RH < 0.2_wp .AND. RH >= 0.1_wp )  THEN
-             NH4Cl_hhso4 = 3.2809_wp * RH - 2.0637_wp
-          ELSEIF ( RH >= 0.2_wp .AND. RH < 0.99_wp )  THEN
-             NH4Cl_hhso4 = - 1.2981_wp * ( RH**3 ) + 4.7461_wp * ( RH**2 ) -   &
-                             2.3269_wp * RH - 1.1259_wp
+          IF ( rh < 0.2_wp .AND. rh >= 0.1_wp )  THEN
+             nh4cl_hhso4 = 3.2809_wp * rh - 2.0637_wp
+          ELSEIF ( rh >= 0.2_wp .AND. rh < 0.99_wp )  THEN
+             nh4cl_hhso4 = -1.2981_wp * rh**3 + 4.7461_wp * rh**2 - 2.3269_wp * rh - 1.1259_wp
           ENDIF
        ENDIF
-       
+
        IF ( sodium_sulphate > 0.0_wp )  THEN
-          Na2SO4_hhso4 = 118.87_wp * ( RH**6 ) - 358.63_wp * ( RH**5 ) +       &
-                         435.85_wp * ( RH**4 ) - 272.88_wp * ( RH**3 ) +       &
-                         94.411_wp * ( RH**2 ) - 18.21_wp * RH + 0.45935_wp
-       ENDIF
-       
+          na2so4_hhso4 = 118.87_wp * rh**6 - 358.63_wp * rh**5 + 435.85_wp * rh**4 - 272.88_wp *   &
+                         rh**3 + 94.411_wp * rh**2 - 18.21_wp * rh + 0.45935_wp
+       ENDIF
+
        IF ( sodium_nitrate > 0.0_wp )  THEN
-          IF ( RH < 0.2_wp  .AND.  RH >= 0.1_wp )  THEN
-             NaNO3_hhso4 = 4.8456_wp * RH - 2.5773_wp    
-          ELSEIF ( RH >= 0.2_wp  .AND.  RH < 0.99_wp )  THEN
-             NaNO3_hhso4 = 0.5964_wp * ( RH**3 ) - 0.38967_wp * ( RH**2 ) +    &
-                           1.7918_wp * RH - 1.9691_wp 
+          IF ( rh < 0.2_wp  .AND.  rh >= 0.1_wp )  THEN
+             nano3_hhso4 = 4.8456_wp * rh - 2.5773_wp
+          ELSEIF ( rh >= 0.2_wp  .AND.  rh < 0.99_wp )  THEN
+             nano3_hhso4 = 0.5964_wp * rh**3 - 0.38967_wp * rh**2 + 1.7918_wp * rh - 1.9691_wp
           ENDIF
        ENDIF
-       
+
        IF ( sodium_chloride > 0.0_wp )  THEN
-          IF ( RH < 0.2_wp )  THEN
-             NaCl_hhso4 = 0.51995_wp * RH - 1.3981_wp
-          ELSEIF ( RH >= 0.2_wp  .AND.  RH < 0.99_wp )  THEN
-             NaCl_hhso4 = 1.6539_wp * RH - 1.6101_wp
+          IF ( rh < 0.2_wp )  THEN
+             nacl_hhso4 = 0.51995_wp * rh - 1.3981_wp
+          ELSEIF ( rh >= 0.2_wp  .AND.  rh < 0.99_wp )  THEN
+             nacl_hhso4 = 1.6539_wp * rh - 1.6101_wp
           ENDIF
        ENDIF
-       
-       Ln_hhso4_act = binary_hhso4 +                                           &
-                      nitric_acid_eq_frac       * HNO3_hhso4 +                 &
-                      hydrochloric_acid_eq_frac * HCL_hhso4 +                  &
-                      ammonium_sulphate_eq_frac * NH42SO4_hhso4 +              &
-                      ammonium_nitrate_eq_frac  * NH4NO3_hhso4 +               &
-                      ammonium_chloride_eq_frac * NH4Cl_hhso4 +                &
-                      sodium_sulphate_eq_frac   * Na2SO4_hhso4 +               &
-                      sodium_nitrate_eq_frac    * NaNO3_hhso4 +                &
-                      sodium_chloride_eq_frac   * NaCl_hhso4
-       gamma_hhso4 = EXP( Ln_hhso4_act )   ! molal activity coefficient of HHSO4
+
+       ln_hhso4_act = binary_hhso4 + nitric_acid_eq_frac * hno3_hhso4 +                            &
+                      hydrochloric_acid_eq_frac * hcl_hhso4 +                                      &
+                      ammonium_sulphate_eq_frac * nh42so4_hhso4 +                                  &
+                      ammonium_nitrate_eq_frac  * nh4no3_hhso4 +                                   &
+                      ammonium_chloride_eq_frac * nh4cl_hhso4 +                                    &
+                      sodium_sulphate_eq_frac   * na2so4_hhso4 +                                   &
+                      sodium_nitrate_eq_frac * nano3_hhso4 + sodium_chloride_eq_frac   * nacl_hhso4
+
+       gamma_hhso4 = EXP( ln_hhso4_act )   ! molal activity coefficient of HHSO4
 
 !--    H2SO4 (sulphuric acid):
-       IF ( RH >= 0.1_wp  .AND.  RH < 0.9_wp )  THEN
-          binary_h2so4 = 2.4493_wp * ( RH**2 ) - 6.2326_wp * RH + 2.1763_wp
-       ELSEIF ( RH >= 0.9_wp  .AND.  RH < 0.98 )  THEN
-          binary_h2so4 = 914.68_wp * ( RH**3 ) - 2502.3_wp * ( RH**2 ) +       &
-                         2281.9_wp * RH - 695.11_wp
-       ELSEIF ( RH >= 0.98  .AND.  RH < 0.9999 )  THEN
-          binary_h2so4 = 3E-8_wp * ( RH**4 ) - 5E-6_wp * ( RH**3 ) +           &
-                       0.0003_wp * ( RH**2 ) - 0.0022_wp * RH - 1.1305_wp
-       ENDIF
-       
+       IF ( rh >= 0.1_wp  .AND.  rh < 0.9_wp )  THEN
+          binary_h2so4 = 2.4493_wp * rh**2 - 6.2326_wp * rh + 2.1763_wp
+       ELSEIF ( rh >= 0.9_wp  .AND.  rh < 0.98 )  THEN
+          binary_h2so4 = 914.68_wp * rh**3 - 2502.3_wp * rh**2 + 2281.9_wp * rh - 695.11_wp
+       ELSEIF ( rh >= 0.98  .AND.  rh < 0.9999 )  THEN
+          binary_h2so4 = 3.0E-8_wp * rh**4 - 5E-6_wp * rh**3 + 0.0003_wp * rh**2 - 0.0022_wp *     &
+                         rh - 1.1305_wp
+       ENDIF
+
        IF ( nitric_acid > 0.0_wp )  THEN
-          HNO3_h2so4 = - 16.382_wp * ( RH**5 ) + 46.677_wp * ( RH**4 ) -       &
-                         54.149_wp * ( RH**3 ) + 34.36_wp * ( RH**2 ) -        &
-                         12.54_wp * RH + 2.1368_wp
-       ENDIF
-       
+          hno3_h2so4 = - 16.382_wp * rh**5 + 46.677_wp * rh**4 - 54.149_wp * rh**3 + 34.36_wp *    &
+                         rh**2 - 12.54_wp * rh + 2.1368_wp
+       ENDIF
+
        IF ( hydrochloric_acid > 0.0_wp )  THEN
-          HCL_h2so4 = - 14.409_wp * ( RH**5 ) + 42.804_wp * ( RH**4 ) -        &
-                         47.24_wp * ( RH**3 ) + 24.668_wp * ( RH**2 ) -        &
-                        5.8015_wp * RH + 0.084627_wp
-       ENDIF
-       
+          hcl_h2so4 = - 14.409_wp * rh**5 + 42.804_wp * rh**4 - 47.24_wp * rh**3 + 24.668_wp *     &
+                        rh**2 - 5.8015_wp * rh + 0.084627_wp
+       ENDIF
+
        IF ( ammonium_sulphate > 0.0_wp )  THEN
-          NH42SO4_h2so4 = 66.71_wp * ( RH**5 ) - 187.5_wp * ( RH**4 ) +        &
-                         210.57_wp * ( RH**3 ) - 121.04_wp * ( RH**2 ) +       &
-                         39.182_wp * RH - 8.0606_wp
-       ENDIF
-       
+          nh42so4_h2so4 = 66.71_wp * rh**5 - 187.5_wp * rh**4 + 210.57_wp * rh**3 - 121.04_wp *    &
+                          rh**2 + 39.182_wp * rh - 8.0606_wp
+       ENDIF
+
        IF ( ammonium_nitrate > 0.0_wp )  THEN
-          NH4NO3_h2so4 = - 22.532_wp * ( RH**4 ) + 66.615_wp * ( RH**3 ) -     &
-                           74.647_wp * ( RH**2 ) + 37.638_wp * RH - 6.9711_wp 
-       ENDIF
-       
+          nh4no3_h2so4 = - 22.532_wp * rh**4 + 66.615_wp * rh**3 - 74.647_wp * rh**2 + 37.638_wp * &
+                         rh - 6.9711_wp
+       ENDIF
+
        IF ( ammonium_chloride > 0.0_wp )  THEN
-          IF ( RH >= 0.1_wp  .AND.  RH < 0.2_wp )  THEN
-             NH4Cl_h2so4 = - 0.32089_wp * RH + 0.57738_wp
-          ELSEIF ( RH >= 0.2_wp  .AND.  RH < 0.9_wp )  THEN
-             NH4Cl_h2so4 = 18.089_wp * ( RH**5 ) - 51.083_wp * ( RH**4 ) +     &
-                            50.32_wp * ( RH**3 ) - 17.012_wp * ( RH**2 ) -     &
-                          0.93435_wp * RH + 1.0548_wp
-          ELSEIF ( RH >= 0.9_wp  .AND.  RH < 0.99_wp )  THEN
-             NH4Cl_h2so4 = - 1.5749_wp * RH + 1.7002_wp
+          IF ( rh >= 0.1_wp  .AND.  rh < 0.2_wp )  THEN
+             nh4cl_h2so4 = - 0.32089_wp * rh + 0.57738_wp
+          ELSEIF ( rh >= 0.2_wp  .AND.  rh < 0.9_wp )  THEN
+             nh4cl_h2so4 = 18.089_wp * rh**5 - 51.083_wp * rh**4 + 50.32_wp * rh**3 - 17.012_wp *  &
+                           rh**2 - 0.93435_wp * rh + 1.0548_wp
+          ELSEIF ( rh >= 0.9_wp  .AND.  rh < 0.99_wp )  THEN
+             nh4cl_h2so4 = - 1.5749_wp * rh + 1.7002_wp
           ENDIF
        ENDIF
-       
+
        IF ( sodium_sulphate > 0.0_wp )  THEN
-          Na2SO4_h2so4 = 29.843_wp * ( RH**4 ) - 69.417_wp * ( RH**3 ) +       &
-                         61.507_wp * ( RH**2 ) - 29.874_wp * RH + 7.7556_wp
-       ENDIF
-       
+          na2so4_h2so4 = 29.843_wp * rh**4 - 69.417_wp * rh**3 + 61.507_wp * rh**2 - 29.874_wp *   &
+                         rh + 7.7556_wp
+       ENDIF
+
        IF ( sodium_nitrate > 0.0_wp )  THEN
-          NaNO3_h2so4 = - 122.37_wp * ( RH**6 ) + 427.43_wp * ( RH**5 ) -      &
-                          604.68_wp * ( RH**4 ) + 443.08_wp * ( RH**3 ) -      &
-                          178.61_wp * ( RH**2 ) + 37.242_wp * RH - 1.9564_wp
-       ENDIF
-       
+          nano3_h2so4 = - 122.37_wp * rh**6 + 427.43_wp * rh**5 - 604.68_wp * rh**4 + 443.08_wp *  &
+                        rh**3 - 178.61_wp * rh**2 + 37.242_wp * rh - 1.9564_wp
+       ENDIF
+
        IF ( sodium_chloride > 0.0_wp )  THEN
-          NaCl_h2so4 = - 40.288_wp * ( RH**5 ) + 115.61_wp * ( RH**4 ) -       &
-                         129.99_wp * ( RH**3 ) + 72.652_wp * ( RH**2 ) -       &
-                         22.124_wp * RH + 4.2676_wp
-       ENDIF
-       
-       Ln_h2so4_act = binary_h2so4 +                                           &
-                      nitric_acid_eq_frac       * HNO3_h2so4 +                 &
-                      hydrochloric_acid_eq_frac * HCL_h2so4 +                  &
-                      ammonium_sulphate_eq_frac * NH42SO4_h2so4 +              &
-                      ammonium_nitrate_eq_frac  * NH4NO3_h2so4 +               &
-                      ammonium_chloride_eq_frac * NH4Cl_h2so4 +                &
-                      sodium_sulphate_eq_frac   * Na2SO4_h2so4 +               &
-                      sodium_nitrate_eq_frac    * NaNO3_h2so4 +                &
-                      sodium_chloride_eq_frac   * NaCl_h2so4                     
-
-       gamma_h2so4 = EXP( Ln_h2so4_act )    ! molal activity coefficient 
-!          
+          nacl_h2so4 = - 40.288_wp * rh**5 + 115.61_wp * rh**4 - 129.99_wp * rh**3 + 72.652_wp *   &
+                       rh**2 - 22.124_wp * rh + 4.2676_wp
+       ENDIF
+
+       ln_h2so4_act = binary_h2so4 + nitric_acid_eq_frac * hno3_h2so4 +                            &
+                      hydrochloric_acid_eq_frac * hcl_h2so4 +                                      &
+                      ammonium_sulphate_eq_frac * nh42so4_h2so4 +                                  &
+                      ammonium_nitrate_eq_frac  * nh4no3_h2so4 +                                   &
+                      ammonium_chloride_eq_frac * nh4cl_h2so4 +                                    &
+                      sodium_sulphate_eq_frac * na2so4_h2so4 +                                     &
+                      sodium_nitrate_eq_frac * nano3_h2so4 + sodium_chloride_eq_frac * nacl_h2so4
+
+       gamma_h2so4 = EXP( ln_h2so4_act )    ! molal activity coefficient 
+!
 !--    Export activity coefficients
        IF ( gamma_h2so4 > 1.0E-10_wp )  THEN
-          gamma_out(4) = ( gamma_hhso4**2.0_wp ) / gamma_h2so4
+          gamma_out(4) = gamma_hhso4**2 / gamma_h2so4
        ENDIF
        IF ( gamma_hhso4 > 1.0E-10_wp )  THEN
-          gamma_out(5) = ( gamma_h2so4**3.0_wp ) / ( gamma_hhso4**2.0_wp )
+          gamma_out(5) = gamma_h2so4**3 / gamma_hhso4**2
        ENDIF
 !
 !--    Ionic activity coefficient product
-       act_product = ( gamma_h2so4**3.0_wp ) / ( gamma_hhso4**2.0_wp )
+       act_product = gamma_h2so4**3 / gamma_hhso4**2
 !
 !--    Solve the quadratic equation (i.e. x in ax**2 + bx + c = 0)
        a = 1.0_wp
-       b = - 1.0_wp * ( ions(4) + ions(1) + ( ( water_total * 18.0E-3_wp ) /   &
-          ( 99.0_wp * act_product ) ) )
+       b = -1.0_wp * ( ions(4) + ions(1) + ( ( water_total * 18.0E-3_wp ) /                        &
+           ( 99.0_wp * act_product ) ) )
        c = ions(4) * ions(1)
-       root1 = ( ( -1.0_wp * b ) + ( ( ( b**2 ) - 4.0_wp * a * c )**0.5_wp     &
-               ) ) / ( 2 * a )
-       root2 = ( ( -1.0_wp * b ) - ( ( ( b**2 ) - 4.0_wp * a * c) **0.5_wp     &
-               ) ) / ( 2 * a )
+       root1 = ( ( -1.0_wp * b ) + ( ( ( b**2 ) - 4.0_wp * a * c )**0.5_wp ) ) / ( 2.0_wp * a )
+       root2 = ( ( -1.0_wp * b ) - ( ( ( b**2 ) - 4.0_wp * a * c) **0.5_wp ) ) / ( 2.0_wp * a )
 
        IF ( root1 > ions(1)  .OR.  root1 < 0.0_wp )  THEN
@@ -6485,15 +6459,10 @@
           root2 = 0.0_wp
        ENDIF
-!          
+!
 !--    Calculate the new hydrogen ion, bisulphate ion and sulphate ion 
 !--    concentration
-       hso4_real = 0.0_wp
        h_real    = ions(1)
        so4_real  = ions(4)
-       IF ( root1 == 0.0_wp )  THEN
-          hso4_real = root2
-       ELSEIF ( root2 == 0.0_wp )  THEN
-          hso4_real = root1
-       ENDIF
+       hso4_real = MAX( root1, root2 )
        h_real   = ions(1) - hso4_real
        so4_real = ions(4) - hso4_real
@@ -6507,6 +6476,6 @@
        hso4_out = hso4_real
        so4_out  = so4_real
-       
-    ELSEIF ( ions(1) == 0.0_wp  .OR.  ions(4) == 0.0_wp )  THEN
+
+    ELSE
        h_out    = ions(1)
        hso4_out = 0.0_wp
@@ -6517,374 +6486,311 @@
 !-- 4) ACTIVITY COEFFICIENTS -for vapour pressures of HNO3,HCL and NH3
 !
-!-- This section evaluates activity coefficients and vapour pressures using the
-!-- water content calculated above) for each inorganic condensing species: 
-!-- a - HNO3, b - NH3, c - HCL.
-!-- The following procedure is used:
-!-- Zaveri et al (2005) found that one could express the variation of activity
-!-- coefficients linearly in log-space if equivalent mole fractions were used. 
-!-- So, by a taylor series expansion LOG( activity coefficient ) = 
-!--    LOG( binary activity coefficient at a given RH ) + 
-!--    (equivalent mole fraction compound A) * 
-!--    ('interaction' parameter between A and condensing species) + 
-!--    equivalent mole fraction compound B) * 
-!--    ('interaction' parameter between B and condensing species). 
-!-- Here, the interaction parameters have been fit to ADDEM by searching the 
-!-- whole compositon space and fit usign the Levenberg-Marquardt non-linear 
-!-- least squares algorithm.
-!
-!-- They are given as a function of RH and vary with complexity ranging from 
-!-- linear to 5th order polynomial expressions, the binary activity coefficients
-!-- were calculated using AIM online.
-!-- NOTE: for NH3, no binary activity coefficient was used and the data were fit
-!-- to the ratio of the activity coefficients for the ammonium and hydrogen 
-!-- ions. Once the activity coefficients are obtained the vapour pressure can be
-!-- easily calculated using tabulated equilibrium constants (referenced). This 
-!-- procedure differs from that of Zaveri et al (2005) in that it is not assumed
-!-- one can carry behaviour from binary mixtures in multicomponent systems. To
-!-- this end we have fit the 'interaction' parameters explicitly to a general 
-!-- inorganic equilibrium model (ADDEM - Topping et al. 2005a,b). Such 
-!-- parameters take into account bisulphate ion dissociation and water content.
-!-- This also allows us to consider one regime for all composition space, rather
-!-- than defining sulphate rich and sulphate poor regimes
-!-- NOTE: The flags "binary_case" and "full_complexity" are not used in this 
-!-- prototype. They are used for simplification of the fit expressions when 
-!-- using limited composition regions.
+!-- This section evaluates activity coefficients and vapour pressures using the water content 
+!-- calculated above) for each inorganic condensing species: a - HNO3, b - NH3, c - HCL.
+!-- The following procedure is used: Zaveri et al (2005) found that one could express the variation 
+!-- of activity coefficients linearly in log-space if equivalent mole fractions were used.
+!-- So, by a taylor series expansion LOG( activity coefficient ) =
+!--    LOG( binary activity coefficient at a given RH ) +
+!--    (equivalent mole fraction compound A) *
+!--    ('interaction' parameter between A and condensing species) +
+!--    equivalent mole fraction compound B) *
+!--    ('interaction' parameter between B and condensing species).
+!-- Here, the interaction parameters have been fit to ADDEM by searching the whole compositon space
+!-- and fit usign the Levenberg-Marquardt non-linear least squares algorithm.
+!
+!-- They are given as a function of RH and vary with complexity ranging from linear to 5th order
+!-- polynomial expressions, the binary activity coefficients were calculated using AIM online.
+!-- NOTE: for NH3, no binary activity coefficient was used and the data were fit to the ratio of the
+!-- activity coefficients for the ammonium and hydrogen ions. Once the activity coefficients are
+!-- obtained the vapour pressure can be easily calculated using tabulated equilibrium constants
+!-- (referenced). This procedure differs from that of Zaveri et al (2005) in that it is not assumed
+!-- one can carry behaviour from binary mixtures in multicomponent systems. To this end we have fit
+!-- the 'interaction' parameters explicitly to a general inorganic equilibrium model
+!-- (ADDEM - Topping et al. 2005a,b). Such parameters take into account bisulphate ion dissociation
+!-- and water content. This also allows us to consider one regime for all composition space, rather
+!-- than defining sulphate rich and sulphate poor regimes.
+!-- NOTE: The flags "binary_case" and "full_complexity" are not used in this prototype. They are
+!-- used for simplification of the fit expressions when using limited composition regions.
 !
 !-- a) - ACTIVITY COEFF/VAPOUR PRESSURE - HNO3
     IF ( ions(1) > 0.0_wp  .AND.  ions(6) > 0.0_wp )  THEN
        binary_case = 1
-       IF ( RH > 0.1_wp  .AND.  RH < 0.98_wp )  THEN
+       IF ( rh > 0.1_wp  .AND.  rh < 0.98_wp )  THEN
           IF ( binary_case == 1 )  THEN
-             binary_hno3 = 1.8514_wp * ( RH**3 ) - 4.6991_wp * ( RH**2 ) +     &
-                           1.5514_wp * RH + 0.90236_wp
+             binary_hno3 = 1.8514_wp * rh**3 - 4.6991_wp * rh**2 + 1.5514_wp * rh + 0.90236_wp
           ELSEIF ( binary_case == 2 )  THEN
-             binary_hno3 = - 1.1751_wp * ( RH**2 ) - 0.53794_wp * RH +         &
-                             1.2808_wp
+             binary_hno3 = - 1.1751_wp * ( rh**2 ) - 0.53794_wp * rh + 1.2808_wp
           ENDIF
-       ELSEIF ( RH >= 0.98_wp  .AND.  RH < 0.9999_wp )  THEN
-          binary_hno3 = 1244.69635941351_wp * ( RH**3 ) -                      &
-                        2613.93941099991_wp * ( RH**2 ) +                      &
-                        1525.0684974546_wp * RH -155.946764059316_wp
-       ENDIF
-!          
+       ELSEIF ( rh >= 0.98_wp  .AND.  rh < 0.9999_wp )  THEN
+          binary_hno3 = 1244.69635941351_wp * rh**3 - 2613.93941099991_wp * rh**2 +                &
+                        1525.0684974546_wp * rh -155.946764059316_wp
+       ENDIF
+!
 !--    Contributions from other solutes
        full_complexity = 1
        IF ( hydrochloric_acid > 0.0_wp )  THEN   ! HCL
-          IF ( full_complexity == 1  .OR.  RH < 0.4_wp )  THEN
-             HCL_hno3 = 16.051_wp * ( RH**4 ) - 44.357_wp * ( RH**3 ) +        &
-                        45.141_wp * ( RH**2 ) - 21.638_wp * RH + 4.8182_wp
-          ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-             HCL_hno3 = - 1.5833_wp * RH + 1.5569_wp
+          IF ( full_complexity == 1  .OR.  rh < 0.4_wp )  THEN
+             hcl_hno3 = 16.051_wp * rh**4 - 44.357_wp * rh**3 + 45.141_wp * rh**2 - 21.638_wp *    &
+                        rh + 4.8182_wp
+          ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+             hcl_hno3 = - 1.5833_wp * rh + 1.5569_wp
           ENDIF
        ENDIF
-       
+
        IF ( sulphuric_acid > 0.0_wp )  THEN   ! H2SO4
-          IF ( full_complexity == 1  .OR.  RH < 0.4_wp )  THEN
-             H2SO4_hno3 = - 3.0849_wp * ( RH**3 ) + 5.9609_wp * ( RH**2 ) -    &
-                             4.468_wp * RH + 1.5658_wp
-          ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-             H2SO4_hno3 = - 0.93473_wp * RH + 0.9363_wp
+          IF ( full_complexity == 1  .OR.  rh < 0.4_wp )  THEN
+             h2so4_hno3 = - 3.0849_wp * rh**3 + 5.9609_wp * rh**2 - 4.468_wp * rh + 1.5658_wp
+          ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+             h2so4_hno3 = - 0.93473_wp * rh + 0.9363_wp
           ENDIF
        ENDIF
-       
+
        IF ( ammonium_sulphate > 0.0_wp )  THEN   ! NH42SO4
-          NH42SO4_hno3 = 16.821_wp * ( RH**3 ) - 28.391_wp * ( RH**2 ) +       &
-                         18.133_wp * RH - 6.7356_wp
-       ENDIF
-       
+          nh42so4_hno3 = 16.821_wp * rh**3 - 28.391_wp * rh**2 + 18.133_wp * rh - 6.7356_wp
+       ENDIF
+
        IF ( ammonium_nitrate > 0.0_wp )  THEN   ! NH4NO3
-          NH4NO3_hno3 = 11.01_wp * ( RH**3 ) - 21.578_wp * ( RH**2 ) +         &
-                       14.808_wp * RH - 4.2593_wp
-       ENDIF
-       
+          nh4no3_hno3 = 11.01_wp * rh**3 - 21.578_wp * rh**2 + 14.808_wp * rh - 4.2593_wp
+       ENDIF
+
        IF ( ammonium_chloride > 0.0_wp )  THEN   ! NH4Cl
-          IF ( full_complexity == 1  .OR.  RH <= 0.4_wp )  THEN
-             NH4Cl_hno3 = - 1.176_wp * ( RH**3 ) + 5.0828_wp * ( RH**2 ) -     &
-                           3.8792_wp * RH - 0.05518_wp
-          ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-             NH4Cl_hno3 = 2.6219_wp * ( RH**2 ) - 2.2609_wp * RH - 0.38436_wp
+          IF ( full_complexity == 1  .OR.  rh <= 0.4_wp )  THEN
+             nh4cl_hno3 = - 1.176_wp * rh**3 + 5.0828_wp * rh**2 - 3.8792_wp * rh - 0.05518_wp
+          ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+             nh4cl_hno3 = 2.6219_wp * rh**2 - 2.2609_wp * rh - 0.38436_wp
           ENDIF
        ENDIF
-       
+
        IF ( sodium_sulphate > 0.0_wp )  THEN   ! Na2SO4
-          Na2SO4_hno3 = 35.504_wp * ( RH**4 ) - 80.101_wp * ( RH**3 ) +        &
-                        67.326_wp * ( RH**2 ) - 28.461_wp * RH + 5.6016_wp
-       ENDIF
-       
+          na2so4_hno3 = 35.504_wp * rh**4 - 80.101_wp * rh**3 + 67.326_wp * rh**2 - 28.461_wp *    &
+                        rh + 5.6016_wp
+       ENDIF
+
        IF ( sodium_nitrate > 0.0_wp )  THEN   ! NaNO3
-          IF ( full_complexity == 1 .OR. RH <= 0.4_wp ) THEN
-             NaNO3_hno3 = 23.659_wp * ( RH**5 ) - 66.917_wp * ( RH**4 ) +      &
-                          74.686_wp * ( RH**3 ) - 40.795_wp * ( RH**2 ) +      &
-                          10.831_wp * RH - 1.4701_wp
-          ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-             NaNO3_hno3 = 14.749_wp * ( RH**4 ) - 35.237_wp * ( RH**3 ) +      &
-                          31.196_wp * ( RH**2 ) - 12.076_wp * RH + 1.3605_wp
+          IF ( full_complexity == 1 .OR. rh <= 0.4_wp ) THEN
+             nano3_hno3 = 23.659_wp * rh**5 - 66.917_wp * rh**4 + 74.686_wp * rh**3 - 40.795_wp *  &
+                          rh**2 + 10.831_wp * rh - 1.4701_wp
+          ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+             nano3_hno3 = 14.749_wp * rh**4 - 35.237_wp * rh**3 + 31.196_wp * rh**2 - 12.076_wp *  &
+                          rh + 1.3605_wp
           ENDIF
        ENDIF
-       
+
        IF ( sodium_chloride > 0.0_wp )  THEN   ! NaCl
-          IF ( full_complexity == 1  .OR.  RH <= 0.4_wp )  THEN
-             NaCl_hno3 = 13.682_wp * ( RH**4 ) - 35.122_wp * ( RH**3 ) +       &
-                         33.397_wp * ( RH**2 ) - 14.586_wp * RH + 2.6276_wp
-          ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-             NaCl_hno3 = 1.1882_wp * ( RH**3 ) - 1.1037_wp * ( RH**2 ) -       &
-                         0.7642_wp * RH + 0.6671_wp
+          IF ( full_complexity == 1  .OR.  rh <= 0.4_wp )  THEN
+             nacl_hno3 = 13.682_wp * rh**4 - 35.122_wp * rh**3 + 33.397_wp * rh**2 - 14.586_wp *   &
+                         rh + 2.6276_wp
+          ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+             nacl_hno3 = 1.1882_wp * rh**3 - 1.1037_wp * rh**2 - 0.7642_wp * rh + 0.6671_wp
           ENDIF
        ENDIF
-       
-       Ln_HNO3_act = binary_hno3 +                                             &
-                     hydrochloric_acid_eq_frac * HCL_hno3 +                    &
-                     sulphuric_acid_eq_frac    * H2SO4_hno3 +                  &
-                     ammonium_sulphate_eq_frac * NH42SO4_hno3 +                &
-                     ammonium_nitrate_eq_frac  * NH4NO3_hno3 +                 &
-                     ammonium_chloride_eq_frac * NH4Cl_hno3 +                  &
-                     sodium_sulphate_eq_frac   * Na2SO4_hno3 +                 &
-                     sodium_nitrate_eq_frac    * NaNO3_hno3 +                  &
-                     sodium_chloride_eq_frac   * NaCl_hno3
-
-       gamma_hno3   = EXP( Ln_HNO3_act )   ! Molal activity coefficient of HNO3
+
+       ln_hno3_act = binary_hno3 + hydrochloric_acid_eq_frac * hcl_hno3 +                          &
+                     sulphuric_acid_eq_frac    * h2so4_hno3 +                                      &
+                     ammonium_sulphate_eq_frac * nh42so4_hno3 +                                    &
+                     ammonium_nitrate_eq_frac  * nh4no3_hno3 +                                     &
+                     ammonium_chloride_eq_frac * nh4cl_hno3 +                                      &
+                     sodium_sulphate_eq_frac * na2so4_hno3 +                                       &
+                     sodium_nitrate_eq_frac * nano3_hno3 + sodium_chloride_eq_frac   * nacl_hno3
+
+       gamma_hno3   = EXP( ln_hno3_act )   ! Molal activity coefficient of HNO3
        gamma_out(1) = gamma_hno3
 !
 !--    Partial pressure calculation
-!--    K_hno3 = 2.51 * ( 10**6 )  
-!--    K_hno3 = 2.628145923d6 !< calculated by AIM online (Clegg et al 1998)
-!--    after Chameides (1984) (and NIST database)
-       K_hno3     = 2.6E6_wp * EXP( 8700.0_wp * henrys_temp_dep) 
-       Press_HNO3 = ( ions_mol(1) * ions_mol(6) * ( gamma_hno3**2 ) ) /        &
-                      K_hno3
+!--    k_hno3 = 2.51 * ( 10**6 )
+!--    k_hno3 = 2.628145923d6 !< calculated by AIM online (Clegg et al 1998) after Chameides (1984)
+       k_hno3     = 2.6E6_wp * EXP( 8700.0_wp * henrys_temp_dep )
+       press_hno3 = ( ions_mol(1) * ions_mol(6) * ( gamma_hno3**2 ) ) / k_hno3
     ENDIF
-!       
+!
 !-- b) - ACTIVITY COEFF/VAPOUR PRESSURE - NH3
 !-- Follow the two solute approach of Zaveri et al. (2005)
-    IF ( ions(2) > 0.0_wp  .AND.  ions_mol(1) > 0.0_wp )  THEN 
+    IF ( ions(2) > 0.0_wp  .AND.  ions_mol(1) > 0.0_wp )  THEN
+!
 !--    NH4HSO4:
-       binary_nh4hso4 = 56.907_wp * ( RH**6 ) - 155.32_wp * ( RH**5 ) +        &
-                        142.94_wp * ( RH**4 ) - 32.298_wp * ( RH**3 ) -        &
-                        27.936_wp * ( RH**2 ) + 19.502_wp * RH - 4.2618_wp
+       binary_nh4hso4 = 56.907_wp * rh**6 - 155.32_wp * rh**5 + 142.94_wp * rh**4 - 32.298_wp *    &
+                        rh**3 - 27.936_wp * rh**2 + 19.502_wp * rh - 4.2618_wp
        IF ( nitric_acid > 0.0_wp)  THEN   ! HNO3
-          HNO3_nh4hso4 = 104.8369_wp * ( RH**8 ) - 288.8923_wp * ( RH**7 ) +   &
-                         129.3445_wp * ( RH**6 ) + 373.0471_wp * ( RH**5 ) -   &
-                         571.0385_wp * ( RH**4 ) + 326.3528_wp * ( RH**3 ) -   &
-                           74.169_wp * ( RH**2 ) - 2.4999_wp * RH + 3.17_wp
-       ENDIF
-       
-       IF ( hydrochloric_acid > 0.0_wp)  THEN   ! HCL 
-          HCL_nh4hso4 = - 7.9133_wp * ( RH**8 ) + 126.6648_wp * ( RH**7 ) -    &
-                        460.7425_wp * ( RH**6 ) + 731.606_wp  * ( RH**5 ) -    &
-                        582.7467_wp * ( RH**4 ) + 216.7197_wp * ( RH**3 ) -   &
-                         11.3934_wp * ( RH**2 ) - 17.7728_wp  * RH + 5.75_wp
-       ENDIF
-       
+          hno3_nh4hso4 = 104.8369_wp * rh**8 - 288.8923_wp * rh**7 + 129.3445_wp * rh**6 +         &
+                         373.0471_wp * rh**5 - 571.0385_wp * rh**4 + 326.3528_wp * rh**3 -         &
+                         74.169_wp * rh**2 - 2.4999_wp * rh + 3.17_wp
+       ENDIF
+
+       IF ( hydrochloric_acid > 0.0_wp)  THEN   ! HCL
+          hcl_nh4hso4 = - 7.9133_wp * rh**8 + 126.6648_wp * rh**7 - 460.7425_wp * rh**6 +          &
+                         731.606_wp * rh**5 - 582.7467_wp * rh**4 + 216.7197_wp * rh**3 -          &
+                         11.3934_wp * rh**2 - 17.7728_wp  * rh + 5.75_wp
+       ENDIF
+
        IF ( sulphuric_acid > 0.0_wp)  THEN   ! H2SO4
-          H2SO4_nh4hso4 = 195.981_wp * ( RH**8 ) - 779.2067_wp * ( RH**7 ) +   &
-                        1226.3647_wp * ( RH**6 ) - 964.0261_wp * ( RH**5 ) +   &
-                         391.7911_wp * ( RH**4 ) - 84.1409_wp  * ( RH**3 ) +   &
-                          20.0602_wp * ( RH**2 ) - 10.2663_wp  * RH + 3.5817_wp
-       ENDIF
-       
+          h2so4_nh4hso4 = 195.981_wp * rh**8 - 779.2067_wp * rh**7 + 1226.3647_wp * rh**6 -        &
+                         964.0261_wp * rh**5 + 391.7911_wp * rh**4 - 84.1409_wp  * rh**3 +         &
+                          20.0602_wp * rh**2 - 10.2663_wp  * rh + 3.5817_wp
+       ENDIF
+
        IF ( ammonium_sulphate > 0.0_wp)  THEN   ! NH42SO4
-          NH42SO4_nh4hso4 = 617.777_wp * ( RH**8 ) - 2547.427_wp * ( RH**7 )   &
-                        + 4361.6009_wp * ( RH**6 ) - 4003.162_wp * ( RH**5 )   &
-                        + 2117.8281_wp * ( RH**4 ) - 640.0678_wp * ( RH**3 )   &
-                        + 98.0902_wp   * ( RH**2 ) - 2.2615_wp  * RH - 2.3811_wp
-       ENDIF
-       
+          nh42so4_nh4hso4 = 617.777_wp * rh**8 -  2547.427_wp * rh**7 + 4361.6009_wp * rh**6 -     &
+                           4003.162_wp * rh**5 + 2117.8281_wp * rh**4 - 640.0678_wp * rh**3 +      &
+                            98.0902_wp * rh**2 -    2.2615_wp * rh - 2.3811_wp
+       ENDIF
+
        IF ( ammonium_nitrate > 0.0_wp)  THEN   ! NH4NO3
-          NH4NO3_nh4hso4 = - 104.4504_wp * ( RH**8 ) + 539.5921_wp *           &
-                ( RH**7 ) - 1157.0498_wp * ( RH**6 ) + 1322.4507_wp *          &
-                ( RH**5 ) - 852.2475_wp * ( RH**4 ) + 298.3734_wp *            &
-                ( RH**3 ) - 47.0309_wp * ( RH**2 ) + 1.297_wp * RH -           &
-                0.8029_wp
-       ENDIF
-       
+          nh4no3_nh4hso4 = - 104.4504_wp * rh**8 + 539.5921_wp * rh**7 - 1157.0498_wp * rh**6 +    &
+                            1322.4507_wp * rh**5 - 852.2475_wp * rh**4 + 298.3734_wp * rh**3 -     &
+                              47.0309_wp * rh**2 +    1.297_wp * rh - 0.8029_wp
+       ENDIF
+
        IF ( ammonium_chloride > 0.0_wp)  THEN   ! NH4Cl
-          NH4Cl_nh4hso4 = 258.1792_wp * ( RH**8 ) - 1019.3777_wp *             &
-             ( RH**7 ) + 1592.8918_wp * ( RH**6 ) - 1221.0726_wp *             &
-             ( RH**5 ) + 442.2548_wp * ( RH**4 ) - 43.6278_wp *                &
-             ( RH**3 ) - 7.5282_wp * ( RH**2 ) - 3.8459_wp * RH + 2.2728_wp
-       ENDIF
-       
+          nh4cl_nh4hso4 = 258.1792_wp * rh**8 - 1019.3777_wp * rh**7 + 1592.8918_wp * rh**6 -      &
+                         1221.0726_wp * rh**5 +  442.2548_wp * rh**4 -   43.6278_wp * rh**3 -      &
+                            7.5282_wp * rh**2 -    3.8459_wp * rh + 2.2728_wp
+       ENDIF
+
        IF ( sodium_sulphate > 0.0_wp)  THEN   ! Na2SO4
-          Na2SO4_nh4hso4 = 225.4238_wp * ( RH**8 ) - 732.4113_wp *             &
-               ( RH**7 ) + 843.7291_wp * ( RH**6 ) - 322.7328_wp *             &
-               ( RH**5 ) - 88.6252_wp * ( RH**4 ) + 72.4434_wp *               &
-               ( RH**3 ) + 22.9252_wp * ( RH**2 ) - 25.3954_wp * RH +          &
-               4.6971_wp
-       ENDIF
-       
+          na2so4_nh4hso4 = 225.4238_wp * rh**8 - 732.4113_wp * rh**7 + 843.7291_wp * rh**6 -       &
+                           322.7328_wp * rh**5 -  88.6252_wp * rh**4 +  72.4434_wp * rh**3 +       &
+                            22.9252_wp * rh**2 -  25.3954_wp * rh + 4.6971_wp
+       ENDIF
+
        IF ( sodium_nitrate > 0.0_wp)  THEN   ! NaNO3
-          NaNO3_nh4hso4 = 96.1348_wp * ( RH**8 ) - 341.6738_wp * ( RH**7 ) +   &
-                         406.5314_wp * ( RH**6 ) - 98.5777_wp * ( RH**5 ) -    &
-                         172.8286_wp * ( RH**4 ) + 149.3151_wp * ( RH**3 ) -   &
-                          38.9998_wp * ( RH**2 ) - 0.2251 * RH + 0.4953_wp
-       ENDIF
-       
+          nano3_nh4hso4 = 96.1348_wp * rh**8 - 341.6738_wp * rh**7 + 406.5314_wp * rh**6 -         &
+                          98.5777_wp * rh**5 - 172.8286_wp * rh**4 + 149.3151_wp * rh**3 -         &
+                          38.9998_wp * rh**2 -   0.2251_wp * rh + 0.4953_wp
+       ENDIF
+
        IF ( sodium_chloride > 0.0_wp)  THEN   ! NaCl
-          NaCl_nh4hso4 = 91.7856_wp * ( RH**8 ) - 316.6773_wp * ( RH**7 ) +    &
-                        358.2703_wp * ( RH**6 ) - 68.9142 * ( RH**5 ) -        &
-                        156.5031_wp * ( RH**4 ) + 116.9592_wp * ( RH**3 ) -    &
-                        22.5271_wp * ( RH**2 ) - 3.7716_wp * RH + 1.56_wp
-       ENDIF
-
-       Ln_NH4HSO4_act = binary_nh4hso4 +                                       &
-                        nitric_acid_eq_frac       * HNO3_nh4hso4 +             &
-                        hydrochloric_acid_eq_frac * HCL_nh4hso4 +              &
-                        sulphuric_acid_eq_frac    * H2SO4_nh4hso4 +            &  
-                        ammonium_sulphate_eq_frac * NH42SO4_nh4hso4 +          &
-                        ammonium_nitrate_eq_frac  * NH4NO3_nh4hso4 +           &
-                        ammonium_chloride_eq_frac * NH4Cl_nh4hso4 +            &
-                        sodium_sulphate_eq_frac   * Na2SO4_nh4hso4 +           & 
-                        sodium_nitrate_eq_frac    * NaNO3_nh4hso4 +            &
-                        sodium_chloride_eq_frac   * NaCl_nh4hso4
-  
-       gamma_nh4hso4 = EXP( Ln_NH4HSO4_act ) ! molal act. coefficient of NH4HSO4
+          nacl_nh4hso4 = 91.7856_wp * rh**8 - 316.6773_wp * rh**7 + 358.2703_wp * rh**6 -          &
+                         68.9142_wp * rh**5 - 156.5031_wp * rh**4 + 116.9592_wp * rh**3 -          &
+                         22.5271_wp * rh**2 - 3.7716_wp * rh + 1.56_wp
+       ENDIF
+
+       ln_nh4hso4_act = binary_nh4hso4 + nitric_acid_eq_frac * hno3_nh4hso4 +                      &
+                        hydrochloric_acid_eq_frac * hcl_nh4hso4 +                                  &
+                        sulphuric_acid_eq_frac * h2so4_nh4hso4 +                                   &
+                        ammonium_sulphate_eq_frac * nh42so4_nh4hso4 +                              &
+                        ammonium_nitrate_eq_frac * nh4no3_nh4hso4 +                                &
+                        ammonium_chloride_eq_frac * nh4cl_nh4hso4 +                                &
+                        sodium_sulphate_eq_frac * na2so4_nh4hso4 +                                 &
+                        sodium_nitrate_eq_frac * nano3_nh4hso4 +                                   &
+                        sodium_chloride_eq_frac * nacl_nh4hso4
+
+       gamma_nh4hso4 = EXP( ln_nh4hso4_act ) ! molal act. coefficient of NH4HSO4
+!
 !--    Molal activity coefficient of NO3-
        gamma_out(6)  = gamma_nh4hso4
-!--    Molal activity coefficient of NH4+        
-       gamma_nh3     = ( gamma_nh4hso4**2 ) / ( gamma_hhso4**2 )   
+!
+!--    Molal activity coefficient of NH4+
+       gamma_nh3     = gamma_nh4hso4**2 / gamma_hhso4**2
        gamma_out(3)  = gamma_nh3
-!        
-!--    This actually represents the ratio of the ammonium to hydrogen ion 
-!--    activity coefficients (see Zaveri paper) - multiply this by the ratio 
-!--    of the ammonium to hydrogen ion molality and the ratio of appropriate 
-!--    equilibrium constants
+!
+!--    This actually represents the ratio of the ammonium to hydrogen ion activity coefficients
+!--    (see Zaveri paper) - multiply this by the ratio of the ammonium to hydrogen ion molality and
+!--    the ratio of appropriate equilibrium constants
 !
 !--    Equilibrium constants
-!--    Kh = 57.64d0    ! Zaveri et al. (2005)
-       Kh = 5.8E1_wp * EXP( 4085.0_wp * henrys_temp_dep )   ! after Chameides 
-!                                                   ! (1984) (and NIST database)
-!--    Knh4 = 1.81E-5_wp    ! Zaveri et al. (2005)
-       Knh4 = 1.7E-5_wp * EXP( -4325.0_wp * henrys_temp_dep )   ! Chameides 
-                                                                ! (1984)
-!--    Kw = 1.01E-14_wp    ! Zaveri et al (2005)
-       Kw = 1.E-14_wp * EXP( -6716.0_wp * henrys_temp_dep )   ! Chameides 
-                                                              ! (1984)
+!--    k_h = 57.64d0    ! Zaveri et al. (2005)
+       k_h = 5.8E1_wp * EXP( 4085.0_wp * henrys_temp_dep )   ! after Chameides (1984)
+!--    k_nh4 = 1.81E-5_wp    ! Zaveri et al. (2005)
+       k_nh4 = 1.7E-5_wp * EXP( -4325.0_wp * henrys_temp_dep )   ! Chameides (1984)
+!--    k_h2o = 1.01E-14_wp    ! Zaveri et al (2005)
+       k_h2o = 1.E-14_wp * EXP( -6716.0_wp * henrys_temp_dep )   ! Chameides (1984)
 !
        molality_ratio_nh3 = ions_mol(2) / ions_mol(1)
-!--    Partial pressure calculation       
-       Press_NH3 = molality_ratio_nh3 * gamma_nh3 * ( Kw / ( Kh * Knh4 ) )
-    
+!
+!--    Partial pressure calculation
+       press_nh3 = molality_ratio_nh3 * gamma_nh3 * ( k_h2o / ( k_h * k_nh4 ) )
+
     ENDIF
-!       
+!
 !-- c) - ACTIVITY COEFF/VAPOUR PRESSURE - HCL
     IF ( ions(1) > 0.0_wp  .AND.  ions(7) > 0.0_wp )  THEN
        binary_case = 1
-       IF ( RH > 0.1_wp  .AND.  RH < 0.98 )  THEN
+       IF ( rh > 0.1_wp  .AND.  rh < 0.98 )  THEN
           IF ( binary_case == 1 )  THEN
-             binary_hcl = - 5.0179_wp * ( RH**3 ) + 9.8816_wp * ( RH**2 ) -    &
-                            10.789_wp * RH + 5.4737_wp
+             binary_hcl = - 5.0179_wp * rh**3 + 9.8816_wp * rh**2 - 10.789_wp * rh + 5.4737_wp
           ELSEIF ( binary_case == 2 )  THEN
-             binary_hcl = - 4.6221_wp * RH + 4.2633_wp
+             binary_hcl = - 4.6221_wp * rh + 4.2633_wp
           ENDIF
-       ELSEIF ( RH >= 0.98_wp  .AND.  RH < 0.9999_wp )  THEN
-          binary_hcl = 775.6111008626_wp * ( RH**3 ) - 2146.01320888771_wp *   &
-                     ( RH**2 ) + 1969.01979670259_wp *  RH - 598.878230033926_wp
+       ELSEIF ( rh >= 0.98_wp  .AND.  rh < 0.9999_wp )  THEN
+          binary_hcl = 775.6111008626_wp * rh**3 - 2146.01320888771_wp * rh**2 +                   &
+                       1969.01979670259_wp *  rh - 598.878230033926_wp
        ENDIF
     ENDIF
-    
+
     IF ( nitric_acid > 0.0_wp )  THEN   ! HNO3
-       IF ( full_complexity == 1  .OR.  RH <= 0.4_wp )  THEN
-          HNO3_hcl = 9.6256_wp * ( RH**4 ) - 26.507_wp * ( RH**3 ) +           &
-                     27.622_wp * ( RH**2 ) - 12.958_wp * RH + 2.2193_wp
-       ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-          HNO3_hcl = 1.3242_wp * ( RH**2 ) - 1.8827_wp * RH + 0.55706_wp
+       IF ( full_complexity == 1  .OR.  rh <= 0.4_wp )  THEN
+          hno3_hcl = 9.6256_wp * rh**4 - 26.507_wp * rh**3 + 27.622_wp * rh**2 - 12.958_wp * rh +  &
+                     2.2193_wp
+       ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+          hno3_hcl = 1.3242_wp * rh**2 - 1.8827_wp * rh + 0.55706_wp
        ENDIF
     ENDIF
-    
+
     IF ( sulphuric_acid > 0.0_wp )  THEN   ! H2SO4
-       IF ( full_complexity == 1  .OR.  RH <= 0.4 )  THEN
-          H2SO4_hcl = 1.4406_wp * ( RH**3 ) - 2.7132_wp * ( RH**2 ) +          &
-                       1.014_wp * RH + 0.25226_wp
-       ELSEIF ( full_complexity == 0 .AND. RH > 0.4_wp ) THEN
-          H2SO4_hcl = 0.30993_wp * ( RH**2 ) - 0.99171_wp * RH + 0.66913_wp
+       IF ( full_complexity == 1  .OR.  rh <= 0.4 )  THEN
+          h2so4_hcl = 1.4406_wp * rh**3 - 2.7132_wp * rh**2 + 1.014_wp * rh + 0.25226_wp
+       ELSEIF ( full_complexity == 0 .AND. rh > 0.4_wp ) THEN
+          h2so4_hcl = 0.30993_wp * rh**2 - 0.99171_wp * rh + 0.66913_wp
        ENDIF
     ENDIF
-    
+
     IF ( ammonium_sulphate > 0.0_wp )  THEN   ! NH42SO4
-       NH42SO4_hcl = 22.071_wp * ( RH**3 ) - 40.678_wp * ( RH**2 ) +           &
-                     27.893_wp * RH - 9.4338_wp
+       nh42so4_hcl = 22.071_wp * rh**3 - 40.678_wp * rh**2 + 27.893_wp * rh - 9.4338_wp
     ENDIF
-    
+
     IF ( ammonium_nitrate > 0.0_wp )  THEN   ! NH4NO3
-       NH4NO3_hcl = 19.935_wp * ( RH**3 ) - 42.335_wp * ( RH**2 ) +            &
-                    31.275_wp * RH - 8.8675_wp
+       nh4no3_hcl = 19.935_wp * rh**3 - 42.335_wp * rh**2 + 31.275_wp * rh - 8.8675_wp
     ENDIF
-    
+
     IF ( ammonium_chloride > 0.0_wp )  THEN   ! NH4Cl
-       IF ( full_complexity == 1  .OR.  RH <= 0.4_wp )  THEN
-          NH4Cl_hcl = 2.8048_wp * ( RH**3 ) - 4.3182_wp * ( RH**2 ) +          &
-                      3.1971_wp * RH - 1.6824_wp
-       ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-          NH4Cl_hcl = 1.2304_wp * ( RH**2 ) - 0.18262_wp * RH - 1.0643_wp
+       IF ( full_complexity == 1  .OR.  rh <= 0.4_wp )  THEN
+          nh4cl_hcl = 2.8048_wp * rh**3 - 4.3182_wp * rh**2 + 3.1971_wp * rh - 1.6824_wp
+       ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+          nh4cl_hcl = 1.2304_wp * rh**2 - 0.18262_wp * rh - 1.0643_wp
        ENDIF
     ENDIF
-    
+
     IF ( sodium_sulphate > 0.0_wp )  THEN   ! Na2SO4
-       Na2SO4_hcl = 36.104_wp * ( RH**4 ) - 78.658_wp * ( RH**3 ) +            &
-                    63.441_wp * ( RH**2 ) - 26.727_wp * RH + 5.7007_wp
+       na2so4_hcl = 36.104_wp * rh**4 - 78.658_wp * rh**3 + 63.441_wp * rh**2 - 26.727_wp * rh +   &
+                    5.7007_wp
     ENDIF
-    
+
     IF ( sodium_nitrate > 0.0_wp )  THEN   ! NaNO3
-       IF ( full_complexity == 1  .OR.  RH <= 0.4_wp )  THEN
-          NaNO3_hcl = 54.471_wp * ( RH**5 ) - 159.42_wp * ( RH**4 ) +          &
-                      180.25_wp * ( RH**3 ) - 98.176_wp * ( RH**2 ) +          &
-                      25.309_wp * RH - 2.4275_wp
-       ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-          NaNO3_hcl = 21.632_wp * ( RH**4 ) - 53.088_wp * ( RH**3 ) +          &
-                      47.285_wp * ( RH**2 ) - 18.519_wp * RH + 2.6846_wp
+       IF ( full_complexity == 1  .OR.  rh <= 0.4_wp )  THEN
+          nano3_hcl = 54.471_wp * rh**5 - 159.42_wp * rh**4 + 180.25_wp * rh**3 - 98.176_wp * rh**2&
+                      + 25.309_wp * rh - 2.4275_wp
+       ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+          nano3_hcl = 21.632_wp * rh**4 - 53.088_wp * rh**3 + 47.285_wp * rh**2 - 18.519_wp * rh   &
+                      + 2.6846_wp
        ENDIF
     ENDIF
-    
+
     IF ( sodium_chloride > 0.0_wp )  THEN   ! NaCl
-       IF ( full_complexity == 1  .OR.  RH <= 0.4_wp )  THEN
-          NaCl_hcl = 5.4138_wp * ( RH**4 ) - 12.079_wp * ( RH**3 ) +           &
-                      9.627_wp * ( RH**2 ) - 3.3164_wp * RH + 0.35224_wp
-       ELSEIF ( full_complexity == 0  .AND.  RH > 0.4_wp )  THEN
-          NaCl_hcl = 2.432_wp * ( RH**3 ) - 4.3453_wp * ( RH**2 ) +            &
-                    2.3834_wp * RH - 0.4762_wp
+       IF ( full_complexity == 1  .OR.  rh <= 0.4_wp )  THEN
+          nacl_hcl = 5.4138_wp * rh**4 - 12.079_wp * rh**3 + 9.627_wp * rh**2 - 3.3164_wp * rh +   &
+                     0.35224_wp
+       ELSEIF ( full_complexity == 0  .AND.  rh > 0.4_wp )  THEN
+          nacl_hcl = 2.432_wp * rh**3 - 4.3453_wp * rh**2 + 2.3834_wp * rh - 0.4762_wp
        ENDIF
     ENDIF
-              
-    Ln_HCL_act = binary_hcl +                                                  &
-                 nitric_acid_eq_frac       * HNO3_hcl +                        &
-                 sulphuric_acid_eq_frac    * H2SO4_hcl +                       &
-                 ammonium_sulphate_eq_frac * NH42SO4_hcl +                     &
-                 ammonium_nitrate_eq_frac  * NH4NO3_hcl +                      &
-                 ammonium_chloride_eq_frac * NH4Cl_hcl +                       &
-                 sodium_sulphate_eq_frac   * Na2SO4_hcl +                      &
-                 sodium_nitrate_eq_frac    * NaNO3_hcl +                       &
-                 sodium_chloride_eq_frac   * NaCl_hcl
-
-     gamma_hcl    = EXP( Ln_HCL_act )   ! Molal activity coefficient
+
+    ln_HCL_act = binary_hcl + nitric_acid_eq_frac * hno3_hcl + sulphuric_acid_eq_frac * h2so4_hcl +&
+                 ammonium_sulphate_eq_frac * nh42so4_hcl + ammonium_nitrate_eq_frac * nh4no3_hcl + &
+                 ammonium_chloride_eq_frac * nh4cl_hcl + sodium_sulphate_eq_frac * na2so4_hcl +    &
+                 sodium_nitrate_eq_frac    * nano3_hcl + sodium_chloride_eq_frac   * nacl_hcl
+
+     gamma_hcl    = EXP( ln_HCL_act )   ! Molal activity coefficient
      gamma_out(2) = gamma_hcl
-!     
+!
 !--  Equilibrium constant after Wagman et al. (1982) (and NIST database)
-     K_hcl = 2E6_wp * EXP( 9000.0_wp * henrys_temp_dep )   
-                                                    
-     Press_HCL = ( ions_mol(1) * ions_mol(7) * ( gamma_hcl**2 ) ) / K_hcl
+     k_hcl = 2E6_wp * EXP( 9000.0_wp * henrys_temp_dep )
+
+     press_hcl = ( ions_mol(1) * ions_mol(7) * gamma_hcl**2 ) / k_hcl
 !
 !-- 5) Ion molility output
     mols_out = ions_mol
-!
-!-- REFERENCES
-!-- Clegg et al. (1998) A Thermodynamic Model of the System 
-!--    H+-NH4+-Na+-SO42- -NO3--Cl--H2O at 298.15 K, J. Phys. Chem., 102A,      
-!--    2155-2171. 
-!-- Clegg et al. (2001) Thermodynamic modelling of aqueous aerosols containing 
-!--    electrolytes and dissolved organic compounds. Journal of Aerosol Science 
-!--    2001;32(6):713-738.
-!-- Topping et al. (2005a) A curved multi-component aerosol hygroscopicity model 
-!--    framework: Part 1 - Inorganic compounds. Atmospheric Chemistry and 
-!--    Physics 2005;5:1205-1222.
-!-- Topping et al. (2005b) A curved multi-component aerosol hygroscopicity model 
-!--    framework: Part 2 - Including organic compounds. Atmospheric Chemistry 
-!--    and Physics 2005;5:1223-1242.
-!-- Wagman et al. (1982). The NBS tables of chemical thermodynamic properties: 
-!--    selected values for inorganic and Câ and Câ organic substances in SI 
-!--    units (book)
-!-- Zaveri et al. (2005). A new method for multicomponent activity coefficients 
-!--    of electrolytes in aqueous atmospheric aerosols, JGR, 110, D02201, 2005.
+
  END SUBROUTINE inorganic_pdfite
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -6899,31 +6805,28 @@
 !
 !> Moving-centre method minimises numerical diffusion. 
-!------------------------------------------------------------------------------!      
+!------------------------------------------------------------------------------!
  SUBROUTINE distr_update( paero )
-    
+
     IMPLICIT NONE
 
-!-- Input and output variables
-    TYPE(t_section), INTENT(inout) ::  paero(fn2b) !< Aerosols particle 
-                                    !< size distribution and properties
-!-- Local variables
-    INTEGER(iwp) ::  b !< loop index
-    INTEGER(iwp) ::  mm !< loop index
-    INTEGER(iwp) ::  counti
-    LOGICAL  ::  within_bins !< logical (particle belongs to the bin?)    
-    REAL(wp) ::  znfrac !< number fraction to be moved to the larger bin
-    REAL(wp) ::  zvfrac !< volume fraction to be moved to the larger bin
-    REAL(wp) ::  zVexc  !< Volume in the grown bin which exceeds the bin 
-                        !< upper limit    
-    REAL(wp) ::  zVihi  !< particle volume at the high end of the bin    
-    REAL(wp) ::  zVilo  !< particle volume at the low end of the bin     
-    REAL(wp) ::  zvpart !< particle volume (m3)    
-    REAL(wp) ::  zVrat  !< volume ratio of a size bin
-    
-    zvpart = 0.0_wp
-    zvfrac = 0.0_wp
-
+    INTEGER(iwp) ::  ib      !< loop index
+    INTEGER(iwp) ::  mm      !< loop index
+    INTEGER(iwp) ::  counti  !< number of while loops
+
+    LOGICAL  ::  within_bins !< logical (particle belongs to the bin?)
+
+    REAL(wp) ::  znfrac  !< number fraction to be moved to the larger bin
+    REAL(wp) ::  zvfrac  !< volume fraction to be moved to the larger bin
+    REAL(wp) ::  zVexc   !< Volume in the grown bin which exceeds the bin upper limit
+    REAL(wp) ::  zVihi   !< particle volume at the high end of the bin
+    REAL(wp) ::  zVilo   !< particle volume at the low end of the bin
+    REAL(wp) ::  zvpart  !< particle volume (m3)
+    REAL(wp) ::  zVrat   !< volume ratio of a size bin
+
+    TYPE(t_section), DIMENSION(nbins_aerosol), INTENT(inout) ::  paero !< aerosol properties
+
+    zvpart      = 0.0_wp
+    zvfrac      = 0.0_wp
     within_bins = .FALSE.
-    
 !
 !-- Check if the volume of the bin is within bin limits after update
@@ -6931,94 +6834,96 @@
     DO  WHILE ( .NOT. within_bins )
        within_bins = .TRUE.
-
-       DO  b = fn2b-1, in1a, -1
+!
+!--    Loop from larger to smaller size bins
+       DO  ib = end_subrange_2b-1, start_subrange_1a, -1
           mm = 0
-          IF ( paero(b)%numc > nclim )  THEN
-
+          IF ( paero(ib)%numc > nclim )  THEN
              zvpart = 0.0_wp
              zvfrac = 0.0_wp
 
-             IF ( b == fn2a )  CYCLE 
+             IF ( ib == end_subrange_2a )  CYCLE
 !
 !--          Dry volume
-             zvpart = SUM( paero(b)%volc(1:7) ) / paero(b)%numc 
+             zvpart = SUM( paero(ib)%volc(1:7) ) / paero(ib)%numc
 !
 !--          Smallest bin cannot decrease
-             IF ( paero(b)%vlolim > zvpart  .AND.  b == in1a ) CYCLE
+             IF ( paero(ib)%vlolim > zvpart  .AND.  ib == start_subrange_1a ) CYCLE
 !
 !--          Decreasing bins
-             IF ( paero(b)%vlolim > zvpart )  THEN
-                mm = b - 1
-                IF ( b == in2b )  mm = fn1a    ! 2b goes to 1a
-               
-                paero(mm)%numc = paero(mm)%numc + paero(b)%numc
-                paero(b)%numc = 0.0_wp
-                paero(mm)%volc(:) = paero(mm)%volc(:) + paero(b)%volc(:) 
-                paero(b)%volc(:) = 0.0_wp
+             IF ( paero(ib)%vlolim > zvpart )  THEN
+                mm = ib - 1
+                IF ( ib == start_subrange_2b )  mm = end_subrange_1a    ! 2b goes to 1a
+
+                paero(mm)%numc = paero(mm)%numc + paero(ib)%numc
+                paero(ib)%numc = 0.0_wp
+                paero(mm)%volc(:) = paero(mm)%volc(:) + paero(ib)%volc(:)
+                paero(ib)%volc(:) = 0.0_wp
                 CYCLE
              ENDIF
 !
-!--          If size bin has not grown, cycle
-!--          Changed by Mona: compare to the arithmetic mean volume, as done 
-!--          originally. Now particle volume is derived from the geometric mean 
-!--          diameter, not arithmetic (see SUBROUTINE set_sizebins).
-             IF ( zvpart <= api6 * ( ( aero(b)%vhilim + aero(b)%vlolim ) /     &
-                  ( 2.0_wp * api6 ) ) )  CYCLE  
-             IF ( ABS( zvpart - api6 * paero(b)%dmid ** 3.0_wp ) < &
-                  1.0E-35_wp )  CYCLE  ! Mona: to avoid precision problems
-!                   
+!--          If size bin has not grown, cycle.
+!--          Changed by Mona: compare to the arithmetic mean volume, as done originally. Now 
+!--          particle volume is derived from the geometric mean diameter, not arithmetic (see 
+!--          SUBROUTINE set_sizebins).
+             IF ( zvpart <= api6 * ( ( aero(ib)%vhilim + aero(ib)%vlolim ) / ( 2.0_wp * api6 ) ) ) &
+             CYCLE
+!
+!--          Avoid precision problems
+             IF ( ABS( zvpart - api6 * paero(ib)%dmid**3 ) < 1.0E-35_wp )  CYCLE
+!
 !--          Volume ratio of the size bin
-             zVrat = paero(b)%vhilim / paero(b)%vlolim
+             zVrat = paero(ib)%vhilim / paero(ib)%vlolim
+!
 !--          Particle volume at the low end of the bin
              zVilo = 2.0_wp * zvpart / ( 1.0_wp + zVrat )
+!
 !--          Particle volume at the high end of the bin
              zVihi = zVrat * zVilo
+!
 !--          Volume in the grown bin which exceeds the bin upper limit
-             zVexc = 0.5_wp * ( zVihi + paero(b)%vhilim )
+             zVexc = 0.5_wp * ( zVihi + paero(ib)%vhilim )
+!
 !--          Number fraction to be moved to the larger bin
-             znfrac = MIN( 1.0_wp, ( zVihi - paero(b)%vhilim) /                &
-                           ( zVihi - zVilo ) )
+             znfrac = MIN( 1.0_wp, ( zVihi - paero(ib)%vhilim) / ( zVihi - zVilo ) )
+!
 !--          Volume fraction to be moved to the larger bin
              zvfrac = MIN( 0.99_wp, znfrac * zVexc / zvpart )
              IF ( zvfrac < 0.0_wp )  THEN
                 message_string = 'Error: zvfrac < 0'
-                CALL message( 'salsa_mod: distr_update', 'SA0050',             &
-                              1, 2, 0, 6, 0 )
+                CALL message( 'salsa_mod: distr_update', 'PA0624', 1, 2, 0, 6, 0 )
              ENDIF
 !
 !--          Update bin
-             mm = b + 1
+             mm = ib + 1
+!
 !--          Volume (cm3/cm3)
-             paero(mm)%volc(:) = paero(mm)%volc(:) + znfrac * paero(b)%numc *  &
-                                 zVexc * paero(b)%volc(:) /                    &
-                                 SUM( paero(b)%volc(1:7) )
-             paero(b)%volc(:) = paero(b)%volc(:) - znfrac * paero(b)%numc *    &
-                                 zVexc * paero(b)%volc(:) /                    &
-                                 SUM( paero(b)%volc(1:7) )
+             paero(mm)%volc(:) = paero(mm)%volc(:) + znfrac * paero(ib)%numc * zVexc *             &
+                                 paero(ib)%volc(:) / SUM( paero(ib)%volc(:) )
+             paero(ib)%volc(:) = paero(ib)%volc(:) - znfrac * paero(ib)%numc * zVexc *             &
+                                 paero(ib)%volc(:) / SUM( paero(ib)%volc(:) )
 
 !--          Number concentration (#/m3)
-             paero(mm)%numc = paero(mm)%numc + znfrac * paero(b)%numc
-             paero(b)%numc = paero(b)%numc * ( 1.0_wp - znfrac )
+             paero(mm)%numc = paero(mm)%numc + znfrac * paero(ib)%numc
+             paero(ib)%numc = paero(ib)%numc * ( 1.0_wp - znfrac )
 
           ENDIF     ! nclim
-          
-          IF ( paero(b)%numc > nclim )   THEN
-             zvpart = SUM( paero(b)%volc(1:7) ) / paero(b)%numc 
-             within_bins = ( paero(b)%vlolim < zvpart  .AND.                  &
-                             zvpart < paero(b)%vhilim )
+
+          IF ( paero(ib)%numc > nclim )   THEN
+             zvpart = SUM( paero(ib)%volc(:) ) / paero(ib)%numc
+             within_bins = ( paero(ib)%vlolim < zvpart  .AND. zvpart < paero(ib)%vhilim )
           ENDIF
 
-       ENDDO ! - b
+       ENDDO ! - ib
 
        counti = counti + 1
        IF ( counti > 100 )  THEN
           message_string = 'Error: Aerosol bin update not converged'
-          CALL message( 'salsa_mod: distr_update', 'SA0051', 1, 2, 0, 6, 0 )
-       ENDIF 
+          CALL message( 'salsa_mod: distr_update', 'PA0625', 1, 2, 0, 6, 0 )
+       ENDIF
 
     ENDDO ! - within bins
-    
+
  END SUBROUTINE distr_update
-      
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -7030,29 +6935,29 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE salsa_diagnostics( i, j )
- 
+
     USE cpulog,                                                                &
         ONLY:  cpu_log, log_point_s
 
     IMPLICIT NONE
-    
+
+    INTEGER(iwp) ::  ib   !<
+    INTEGER(iwp) ::  ic   !<
+    INTEGER(iwp) ::  icc  !<
+    INTEGER(iwp) ::  ig   !<
+    INTEGER(iwp) ::  k    !<
+
     INTEGER(iwp), INTENT(in) ::  i  !<
-    INTEGER(iwp), INTENT(in) ::  j  !<    
-
-    INTEGER(iwp) ::  b !<
-    INTEGER(iwp) ::  c  !< 
-    INTEGER(iwp) ::  gt  !< 
-    INTEGER(iwp) ::  k  !<
-    INTEGER(iwp) ::  nc !<
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  flag         !< flag to mask topography
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  flag_zddry   !< flag to mask zddry
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_adn       !< air density (kg/m3)    
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_p         !< pressure
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_t         !< temperature (K)    
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  mcsum        !< sum of mass concentration
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  ppm_to_nconc !< Conversion factor 
-                                                    !< from ppm to #/m3 
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  zddry  !<
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  zvol   !<
-    
+    INTEGER(iwp), INTENT(in) ::  j  !<
+
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  flag          !< flag to mask topography
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  flag_zddry    !< flag to mask zddry
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_adn        !< air density (kg/m3)
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_p          !< pressure
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  in_t          !< temperature (K)
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  mcsum         !< sum of mass concentration
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  ppm_to_nconc  !< Conversion factor: ppm to #/m3
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  zddry         !< particle dry diameter
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  zvol          !< particle volume
+
     flag_zddry   = 0.0_wp
     in_adn       = 0.0_wp
@@ -7062,10 +6967,9 @@
     zddry        = 0.0_wp
     zvol         = 0.0_wp
-    
+
     CALL cpu_log( log_point_s(94), 'salsa diagnostics ', 'start' )
-
-!             
+!
 !-- Calculate thermodynamic quantities needed in SALSA
-    CALL salsa_thrm_ij( i, j, p_ij=in_p, temp_ij=in_t, adn_ij=in_adn )       
+    CALL salsa_thrm_ij( i, j, p_ij=in_p, temp_ij=in_t, adn_ij=in_adn )
 !
 !-- Calculate conversion factors for gas concentrations
@@ -7073,193 +6977,313 @@
 !
 !-- Predetermine flag to mask topography
-    flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(:,j,i), 0 ) ) 
-    
-    DO  b = 1, nbins   ! aerosol size bins
-!             
-!--    Remove negative values 
-       aerosol_number(b)%conc(:,j,i) = MAX( nclim,                             &
-                                       aerosol_number(b)%conc(:,j,i) ) * flag
-       mcsum = 0.0_wp   ! total mass concentration 
-       DO  c = 1, ncc_tot
-!             
-!--       Remove negative concentrations 
-          aerosol_mass((c-1)*nbins+b)%conc(:,j,i) = MAX( mclim,                &
-                                     aerosol_mass((c-1)*nbins+b)%conc(:,j,i) ) &
-                                     * flag
-          mcsum = mcsum + aerosol_mass((c-1)*nbins+b)%conc(:,j,i) * flag
-       ENDDO         
-!                
-!--    Check that number and mass concentration match qualitatively 
-       IF ( ANY ( aerosol_number(b)%conc(:,j,i) > nclim  .AND.                 &
-                  mcsum <= 0.0_wp ) )                                          &
-       THEN
+    flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(:,j,i), 0 ) )
+
+    DO  ib = 1, nbins_aerosol   ! aerosol size bins
+!
+!--    Remove negative values
+       aerosol_number(ib)%conc(:,j,i) = MAX( nclim, aerosol_number(ib)%conc(:,j,i) ) * flag
+!
+!--    Calculate total mass concentration per bin
+       mcsum = 0.0_wp
+       DO  ic = 1, ncomponents_mass
+          icc = ( ic - 1 ) * nbins_aerosol + ib
+          mcsum = mcsum + aerosol_mass(icc)%conc(:,j,i) * flag
+       ENDDO
+!
+!--    Check that number and mass concentration match qualitatively
+       IF ( ANY ( aerosol_number(ib)%conc(:,j,i) > nclim  .AND. mcsum <= 0.0_wp ) )  THEN
           DO  k = nzb+1, nzt
-             IF ( aerosol_number(b)%conc(k,j,i) > nclim  .AND.                 &
-               mcsum(k) <= 0.0_wp ) &
-             THEN
-                aerosol_number(b)%conc(k,j,i) = nclim * flag(k)
-                DO  c = 1, ncc_tot
-                   aerosol_mass((c-1)*nbins+b)%conc(k,j,i) = mclim * flag(k)
+             IF ( aerosol_number(ib)%conc(k,j,i) > nclim  .AND. mcsum(k) <= 0.0_wp )  THEN
+                aerosol_number(ib)%conc(k,j,i) = nclim * flag(k)
+                DO  ic = 1, ncomponents_mass
+                   icc = ( ic - 1 ) * nbins_aerosol + ib
+                   aerosol_mass(icc)%conc(k,j,i) = mclim * flag(k)
                 ENDDO
              ENDIF
           ENDDO
        ENDIF
-!             
+!
 !--    Update aerosol particle radius
-       CALL bin_mixrat( 'dry', b, i, j, zvol )
+       CALL bin_mixrat( 'dry', ib, i, j, zvol )
        zvol = zvol / arhoh2so4    ! Why on sulphate?
-!                   
-!--    Particles smaller then 0.1 nm diameter are set to zero 
-       zddry = ( zvol / MAX( nclim, aerosol_number(b)%conc(:,j,i) ) / api6 )** &
-               ( 1.0_wp / 3.0_wp )
-       flag_zddry = MERGE( 1.0_wp, 0.0_wp, ( zddry < 1.0E-10_wp  .AND.         &
-                                       aerosol_number(b)%conc(:,j,i) > nclim ) )
-!                   
+!
+!--    Particles smaller then 0.1 nm diameter are set to zero
+       zddry = ( zvol / MAX( nclim, aerosol_number(ib)%conc(:,j,i) ) / api6 )**0.33333333_wp
+       flag_zddry = MERGE( 1.0_wp, 0.0_wp, ( zddry < 1.0E-10_wp  .AND.                             &
+                           aerosol_number(ib)%conc(:,j,i) > nclim ) )
+!
 !--    Volatile species to the gas phase
-       IF ( is_used( prtcl, 'SO4' ) .AND. lscndgas )  THEN
-          nc = get_index( prtcl, 'SO4' )
-          c = ( nc - 1 ) * nbins + b                      
+       IF ( index_so4 > 0 .AND. lscndgas )  THEN
+          ic = ( index_so4 - 1 ) * nbins_aerosol + ib
           IF ( salsa_gases_from_chem )  THEN
-             chem_species( gas_index_chem(1) )%conc(:,j,i) =                   &
-                               chem_species( gas_index_chem(1) )%conc(:,j,i) + &
-                               aerosol_mass(c)%conc(:,j,i) * avo * flag *      &
-                               flag_zddry / ( amh2so4 * ppm_to_nconc ) 
+             ig = gas_index_chem(1)
+             chem_species(ig)%conc(:,j,i) = chem_species(ig)%conc(:,j,i) +                         &
+                                            aerosol_mass(ic)%conc(:,j,i) * avo * flag_zddry /      &
+                                            ( amh2so4 * ppm_to_nconc ) * flag
           ELSE
-             salsa_gas(1)%conc(:,j,i) = salsa_gas(1)%conc(:,j,i) +             &
-                                        aerosol_mass(c)%conc(:,j,i) / amh2so4 *&
-                                        avo * flag * flag_zddry
+             salsa_gas(1)%conc(:,j,i) = salsa_gas(1)%conc(:,j,i) + aerosol_mass(ic)%conc(:,j,i) /  &
+                                        amh2so4 * avo * flag_zddry * flag
           ENDIF
        ENDIF
-       IF ( is_used( prtcl, 'OC' )  .AND.  lscndgas )  THEN
-          nc = get_index( prtcl, 'OC' )
-          c = ( nc - 1 ) * nbins + b
+       IF ( index_oc > 0  .AND.  lscndgas )  THEN
+          ic = ( index_oc - 1 ) * nbins_aerosol + ib
           IF ( salsa_gases_from_chem )  THEN
-             chem_species( gas_index_chem(5) )%conc(:,j,i) =                   &
-                               chem_species( gas_index_chem(5) )%conc(:,j,i) + &
-                               aerosol_mass(c)%conc(:,j,i) * avo * flag *      &
-                               flag_zddry / ( amoc * ppm_to_nconc ) 
-          ELSE                         
-             salsa_gas(5)%conc(:,j,i) = salsa_gas(5)%conc(:,j,i) + &
-                                        aerosol_mass(c)%conc(:,j,i) / amoc *   &
-                                        avo * flag * flag_zddry
+             ig = gas_index_chem(5)
+             chem_species(ig)%conc(:,j,i) = chem_species(ig)%conc(:,j,i) +                         &
+                                            aerosol_mass(ic)%conc(:,j,i) * avo * flag_zddry /      &
+                                            ( amoc * ppm_to_nconc ) * flag
+          ELSE
+             salsa_gas(5)%conc(:,j,i) = salsa_gas(5)%conc(:,j,i) + aerosol_mass(ic)%conc(:,j,i) /  &
+                                        amoc * avo * flag_zddry * flag
           ENDIF
        ENDIF
-       IF ( is_used( prtcl, 'NO' )  .AND.  lscndgas )  THEN
-          nc = get_index( prtcl, 'NO' )
-          c = ( nc - 1 ) * nbins + b                      
+       IF ( index_no > 0  .AND.  lscndgas )  THEN
+          ic = ( index_no - 1 ) * nbins_aerosol + ib
           IF ( salsa_gases_from_chem )  THEN
-                chem_species( gas_index_chem(2) )%conc(:,j,i) =                &
-                               chem_species( gas_index_chem(2) )%conc(:,j,i) + &
-                               aerosol_mass(c)%conc(:,j,i) * avo * flag *      &
-                               flag_zddry / ( amhno3 * ppm_to_nconc )                   
+             ig = gas_index_chem(2)
+             chem_species(ig)%conc(:,j,i) = chem_species(ig)%conc(:,j,i) +                         &
+                                            aerosol_mass(ic)%conc(:,j,i) * avo * flag_zddry /      &
+                                            ( amhno3 * ppm_to_nconc ) *flag
           ELSE
-             salsa_gas(2)%conc(:,j,i) = salsa_gas(2)%conc(:,j,i) +             &
-                                        aerosol_mass(c)%conc(:,j,i) / amhno3 * &
-                                        avo * flag * flag_zddry
+             salsa_gas(2)%conc(:,j,i) = salsa_gas(2)%conc(:,j,i) + aerosol_mass(ic)%conc(:,j,i) /  &
+                                        amhno3 * avo * flag_zddry * flag
           ENDIF
        ENDIF
-       IF ( is_used( prtcl, 'NH' )  .AND.  lscndgas )  THEN
-          nc = get_index( prtcl, 'NH' )
-          c = ( nc - 1 ) * nbins + b                      
+       IF ( index_nh > 0  .AND.  lscndgas )  THEN
+          ic = ( index_nh - 1 ) * nbins_aerosol + ib
           IF ( salsa_gases_from_chem )  THEN
-                chem_species( gas_index_chem(3) )%conc(:,j,i) =                &
-                               chem_species( gas_index_chem(3) )%conc(:,j,i) + &
-                               aerosol_mass(c)%conc(:,j,i) * avo * flag *      &
-                               flag_zddry / ( amnh3 * ppm_to_nconc )                         
+             ig = gas_index_chem(3)
+             chem_species(ig)%conc(:,j,i) = chem_species(ig)%conc(:,j,i) +                         &
+                                            aerosol_mass(ic)%conc(:,j,i) * avo * flag_zddry /      &
+                                            ( amnh3 * ppm_to_nconc ) *flag
           ELSE
-             salsa_gas(3)%conc(:,j,i) = salsa_gas(3)%conc(:,j,i) +             &
-                                        aerosol_mass(c)%conc(:,j,i) / amnh3 *  &
-                                        avo * flag * flag_zddry
+             salsa_gas(3)%conc(:,j,i) = salsa_gas(3)%conc(:,j,i) + aerosol_mass(ic)%conc(:,j,i) /  &
+                                        amnh3 * avo * flag_zddry *flag
           ENDIF
        ENDIF
-!                      
+!
 !--    Mass and number to zero (insoluble species and water are lost)
-       DO  c = 1, ncc_tot
-          aerosol_mass((c-1)*nbins+b)%conc(:,j,i) = MERGE( mclim * flag,       &
-                                      aerosol_mass((c-1)*nbins+b)%conc(:,j,i), &
-                                      flag_zddry > 0.0_wp )
+       DO  ic = 1, ncomponents_mass
+          icc = ( ic - 1 ) * nbins_aerosol + ib
+          aerosol_mass(icc)%conc(:,j,i) = MERGE( mclim * flag, aerosol_mass(icc)%conc(:,j,i),      &
+                                                 flag_zddry > 0.0_wp )
        ENDDO
-       aerosol_number(b)%conc(:,j,i) = MERGE( nclim * flag,                    &
-                                              aerosol_number(b)%conc(:,j,i),   &
-                                              flag_zddry > 0.0_wp )       
-       Ra_dry(:,j,i,b) = MAX( 1.0E-10_wp, 0.5_wp * zddry )      
-       
+       aerosol_number(ib)%conc(:,j,i) = MERGE( nclim, aerosol_number(ib)%conc(:,j,i),              &
+                                               flag_zddry > 0.0_wp )
+       ra_dry(:,j,i,ib) = MAX( 1.0E-10_wp, 0.5_wp * zddry )
+
     ENDDO
     IF ( .NOT. salsa_gases_from_chem )  THEN
-       DO  gt = 1, ngast
-          salsa_gas(gt)%conc(:,j,i) = MAX( nclim, salsa_gas(gt)%conc(:,j,i) )  &
-                                      * flag
+       DO  ig = 1, ngases_salsa
+          salsa_gas(ig)%conc(:,j,i) = MAX( nclim, salsa_gas(ig)%conc(:,j,i) ) * flag
        ENDDO
     ENDIF
-    
+
     CALL cpu_log( log_point_s(94), 'salsa diagnostics ', 'stop' )
 
  END SUBROUTINE salsa_diagnostics
 
- 
-! 
+!
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate the tendencies for aerosol number and mass concentrations. 
+!> Calculate the prognostic equation for aerosol number and mass, and gas
+!> concentrations. Cache-optimized.
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_prognostic_equations_ij( i, j, i_omp_start, tn )
+
+    USE control_parameters,                                                                        &
+        ONLY:  time_since_reference_point
+
+    USE salsa_util_mod,                                                                            &
+        ONLY:  sums_salsa_ws_l
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  i            !<
+    INTEGER(iwp) ::  i_omp_start  !<
+    INTEGER(iwp) ::  ib           !< loop index for aerosol number bin OR gas index
+    INTEGER(iwp) ::  ic           !< loop index for aerosol mass bin
+    INTEGER(iwp) ::  icc          !< (c-1)*nbins_aerosol+b
+    INTEGER(iwp) ::  ig           !< loop index for salsa gases
+    INTEGER(iwp) ::  j            !<
+    INTEGER(iwp) ::  tn           !<
+
+    LOGICAL ::  sedim  !< calculate sedimentation only for aerosols (number and mass)
+
+    IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
+!
+!--    Aerosol number
+       DO  ib = 1, nbins_aerosol
+          sums_salsa_ws_l = aerosol_number(ib)%sums_ws_l
+          CALL salsa_tendency( 'aerosol_number', aerosol_number(ib)%conc_p, aerosol_number(ib)%conc,&
+                               aerosol_number(ib)%tconc_m, i, j, i_omp_start, tn, ib, ib,          &
+                               aerosol_number(ib)%flux_s, aerosol_number(ib)%diss_s,               &
+                               aerosol_number(ib)%flux_l, aerosol_number(ib)%diss_l,               &
+                               aerosol_number(ib)%init, sedim )
+          aerosol_number(ib)%sums_ws_l = sums_salsa_ws_l
+!
+!--       Aerosol mass
+          DO  ic = 1, ncomponents_mass
+             icc = ( ic - 1 ) * nbins_aerosol + ib
+             sums_salsa_ws_l = aerosol_mass(icc)%sums_ws_l
+             CALL salsa_tendency( 'aerosol_mass', aerosol_mass(icc)%conc_p, aerosol_mass(icc)%conc,&
+                                  aerosol_mass(icc)%tconc_m, i, j, i_omp_start, tn, ib, ic,        &
+                                  aerosol_mass(icc)%flux_s, aerosol_mass(icc)%diss_s,              &
+                                  aerosol_mass(icc)%flux_l, aerosol_mass(icc)%diss_l,              &
+                                  aerosol_mass(icc)%init, sedim )
+             aerosol_mass(icc)%sums_ws_l = sums_salsa_ws_l
+
+          ENDDO  ! ic
+       ENDDO  ! ib
+!
+!--    Gases
+       IF ( .NOT. salsa_gases_from_chem )  THEN
+
+          DO  ig = 1, ngases_salsa
+             sums_salsa_ws_l = salsa_gas(ig)%sums_ws_l
+             CALL salsa_tendency( 'salsa_gas', salsa_gas(ig)%conc_p, salsa_gas(ig)%conc,           &
+                                  salsa_gas(ig)%tconc_m, i, j, i_omp_start, tn, ig, ig,            &
+                                  salsa_gas(ig)%flux_s, salsa_gas(ig)%diss_s, salsa_gas(ig)%flux_l,&
+                                  salsa_gas(ig)%diss_l, salsa_gas(ig)%init, sedim )
+             salsa_gas(ig)%sums_ws_l = sums_salsa_ws_l
+
+          ENDDO  ! ig
+
+       ENDIF
+
+    ENDIF
+
+ END SUBROUTINE salsa_prognostic_equations_ij
+!
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Calculate the prognostic equation for aerosol number and mass, and gas
+!> concentrations. Cache-optimized.
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_prognostic_equations()
+
+    USE control_parameters,                                                                        &
+        ONLY:  time_since_reference_point
+
+    USE salsa_util_mod,                                                                            &
+        ONLY:  sums_salsa_ws_l
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  ib           !< loop index for aerosol number bin OR gas index
+    INTEGER(iwp) ::  ic           !< loop index for aerosol mass bin
+    INTEGER(iwp) ::  icc          !< (c-1)*nbins_aerosol+b
+    INTEGER(iwp) ::  ig           !< loop index for salsa gases
+
+    LOGICAL ::  sedim  !< calculate sedimentation only for aerosols (number and mass)
+
+    IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
+!
+!--    Aerosol number
+       DO  ib = 1, nbins_aerosol
+          sums_salsa_ws_l = aerosol_number(ib)%sums_ws_l
+          CALL salsa_tendency( 'aerosol_number', aerosol_number(ib)%conc_p, aerosol_number(ib)%conc,&
+                               aerosol_number(ib)%tconc_m, ib, ib, aerosol_number(ib)%init, sedim )
+          aerosol_number(ib)%sums_ws_l = sums_salsa_ws_l
+!
+!--       Aerosol mass
+          DO  ic = 1, ncomponents_mass
+             icc = ( ic - 1 ) * nbins_aerosol + ib
+             sums_salsa_ws_l = aerosol_mass(icc)%sums_ws_l
+             CALL salsa_tendency( 'aerosol_mass', aerosol_mass(icc)%conc_p, aerosol_mass(icc)%conc,&
+                                  aerosol_mass(icc)%tconc_m, ib, ic, aerosol_mass(icc)%init, sedim )
+             aerosol_mass(icc)%sums_ws_l = sums_salsa_ws_l
+
+          ENDDO  ! ic
+       ENDDO  ! ib
+!
+!--    Gases
+       IF ( .NOT. salsa_gases_from_chem )  THEN
+
+          DO  ig = 1, ngases_salsa
+             sums_salsa_ws_l = salsa_gas(ig)%sums_ws_l
+             CALL salsa_tendency( 'salsa_gas', salsa_gas(ig)%conc_p, salsa_gas(ig)%conc,           &
+                                  salsa_gas(ig)%tconc_m, ig, ig, salsa_gas(ig)%init, sedim )
+             salsa_gas(ig)%sums_ws_l = sums_salsa_ws_l
+
+          ENDDO  ! ig
+
+       ENDIF
+
+    ENDIF
+
+ END SUBROUTINE salsa_prognostic_equations
+!
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Tendencies for aerosol number and mass and gas concentrations.
 !> Cache-optimized.
-!------------------------------------------------------------------------------! 
- SUBROUTINE salsa_tendency_ij( id, rs_p, rs, trs_m, i, j, i_omp_start, tn, b,  &
-                               c, flux_s, diss_s, flux_l, diss_l, rs_init )
-    
-    USE advec_ws,                                                              &
-        ONLY:  advec_s_ws 
-    USE advec_s_pw_mod,                                                        &
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_tendency_ij( id, rs_p, rs, trs_m, i, j, i_omp_start, tn, ib, ic, flux_s, diss_s, &
+                               flux_l, diss_l, rs_init, do_sedimentation )
+
+    USE advec_ws,                                                                                  &
+        ONLY:  advec_s_ws
+
+    USE advec_s_pw_mod,                                                                            &
         ONLY:  advec_s_pw
-    USE advec_s_up_mod,                                                        &
+
+    USE advec_s_up_mod,                                                                            &
         ONLY:  advec_s_up
-    USE arrays_3d,                                                             &
+
+    USE arrays_3d,                                                                                 &
         ONLY:  ddzu, rdf_sc, tend
-    USE diffusion_s_mod,                                                       &
+
+    USE diffusion_s_mod,                                                                           &
         ONLY:  diffusion_s
-    USE indices,                                                               &
+
+    USE indices,                                                                                   &
         ONLY:  wall_flags_0
-    USE pegrid,                                                                &
+
+    USE pegrid,                                                                                    &
         ONLY:  threads_per_task
-    USE surface_mod,                                                           &
-        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
-                                 surf_usm_v
-    
+
+    USE surface_mod,                                                                               &
+        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h, surf_usm_v
+
     IMPLICIT NONE
-    
-    CHARACTER (LEN = *) ::  id
-    INTEGER(iwp) ::  b   !< bin index in derived type aerosol_size_bin    
-    INTEGER(iwp) ::  c   !< bin index in derived type aerosol_size_bin    
-    INTEGER(iwp) ::  i   !<
-    INTEGER(iwp) ::  i_omp_start !<
-    INTEGER(iwp) ::  j   !<
-    INTEGER(iwp) ::  k   !< 
-    INTEGER(iwp) ::  nc  !< (c-1)*nbins+b
-    INTEGER(iwp) ::  tn  !<
+
+    CHARACTER(LEN = *) ::  id  !<
+
+    INTEGER(iwp) ::  i            !<
+    INTEGER(iwp) ::  i_omp_start  !<
+    INTEGER(iwp) ::  ib           !< loop index for aerosol number bin OR gas index
+    INTEGER(iwp) ::  ic           !< loop index for aerosol mass bin
+    INTEGER(iwp) ::  icc          !< (c-1)*nbins_aerosol+b
+    INTEGER(iwp) ::  j            !<
+    INTEGER(iwp) ::  k            !<
+    INTEGER(iwp) ::  tn           !<
+
+    LOGICAL ::  do_sedimentation  !<
+
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  rs_init  !<
+
+    REAL(wp), DIMENSION(nzb+1:nzt,0:threads_per_task-1) ::  diss_s  !<
+    REAL(wp), DIMENSION(nzb+1:nzt,0:threads_per_task-1) ::  flux_s  !<
+
     REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn,0:threads_per_task-1) ::  diss_l  !<
-    REAL(wp), DIMENSION(nzb+1:nzt,0:threads_per_task-1)         ::  diss_s  !<
     REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn,0:threads_per_task-1) ::  flux_l  !<
-    REAL(wp), DIMENSION(nzb+1:nzt,0:threads_per_task-1)         ::  flux_s  !< 
-    REAL(wp), DIMENSION(nzb:nzt+1)                              ::  rs_init !<
-    REAL(wp), DIMENSION(:,:,:), POINTER                         ::  rs_p    !< 
-    REAL(wp), DIMENSION(:,:,:), POINTER                         ::  rs      !<
-    REAL(wp), DIMENSION(:,:,:), POINTER                         ::  trs_m   !<
-    
-    nc = (c-1)*nbins+b    
+
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  rs_p    !<
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  rs      !<
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  trs_m   !<
+
+    icc = ( ic - 1 ) * nbins_aerosol + ib
 !
 !-- Tendency-terms for reactive scalar
     tend(:,j,i) = 0.0_wp
-    
-    IF ( id == 'aerosol_number'  .AND.  lod_aero == 3 )  THEN
-       tend(:,j,i) = tend(:,j,i) + aerosol_number(b)%source(:,j,i)
-    ELSEIF ( id == 'aerosol_mass'  .AND.  lod_aero == 3 )  THEN
-       tend(:,j,i) = tend(:,j,i) + aerosol_mass(nc)%source(:,j,i)
-    ENDIF
-!    
+!
 !-- Advection terms
     IF ( timestep_scheme(1:5) == 'runge' )  THEN
        IF ( ws_scheme_sca )  THEN
-          CALL advec_s_ws( i, j, rs, id, flux_s, diss_s, flux_l, diss_l,       &
-                           i_omp_start, tn )
+          CALL advec_s_ws( i, j, rs, id, flux_s, diss_s, flux_l, diss_l, i_omp_start, tn )
        ELSE
           CALL advec_s_pw( i, j, rs )
@@ -7269,67 +7293,53 @@
     ENDIF
 !
-!-- Diffusion terms    
-    IF ( id == 'aerosol_number' )  THEN
-       CALL diffusion_s( i, j, rs,                   surf_def_h(0)%answs(:,b), &
-                           surf_def_h(1)%answs(:,b), surf_def_h(2)%answs(:,b), &
-                           surf_lsm_h%answs(:,b),    surf_usm_h%answs(:,b),    &
-                           surf_def_v(0)%answs(:,b), surf_def_v(1)%answs(:,b), &
-                           surf_def_v(2)%answs(:,b), surf_def_v(3)%answs(:,b), &
-                           surf_lsm_v(0)%answs(:,b), surf_lsm_v(1)%answs(:,b), &
-                           surf_lsm_v(2)%answs(:,b), surf_lsm_v(3)%answs(:,b), &
-                           surf_usm_v(0)%answs(:,b), surf_usm_v(1)%answs(:,b), &
-                           surf_usm_v(2)%answs(:,b), surf_usm_v(3)%answs(:,b) )
-!
-!--    Sedimentation for aerosol number and mass
-       IF ( lsdepo )  THEN
-          tend(nzb+1:nzt,j,i) = tend(nzb+1:nzt,j,i) - MAX( 0.0_wp,             &
-                         ( rs(nzb+2:nzt+1,j,i) * sedim_vd(nzb+2:nzt+1,j,i,b) - &
-                           rs(nzb+1:nzt,j,i) * sedim_vd(nzb+1:nzt,j,i,b) ) *   &
-                         ddzu(nzb+1:nzt) ) * MERGE( 1.0_wp, 0.0_wp,            &
-                         BTEST( wall_flags_0(nzb:nzt-1,j,i), 0 ) )
-       ENDIF
-       
-    ELSEIF ( id == 'aerosol_mass' )  THEN
-       CALL diffusion_s( i, j, rs,                  surf_def_h(0)%amsws(:,nc), & 
-                         surf_def_h(1)%amsws(:,nc), surf_def_h(2)%amsws(:,nc), &
-                         surf_lsm_h%amsws(:,nc),    surf_usm_h%amsws(:,nc),    &
-                         surf_def_v(0)%amsws(:,nc), surf_def_v(1)%amsws(:,nc), &
-                         surf_def_v(2)%amsws(:,nc), surf_def_v(3)%amsws(:,nc), &
-                         surf_lsm_v(0)%amsws(:,nc), surf_lsm_v(1)%amsws(:,nc), &
-                         surf_lsm_v(2)%amsws(:,nc), surf_lsm_v(3)%amsws(:,nc), &
-                         surf_usm_v(0)%amsws(:,nc), surf_usm_v(1)%amsws(:,nc), &
-                         surf_usm_v(2)%amsws(:,nc), surf_usm_v(3)%amsws(:,nc) ) 
-!
-!--    Sedimentation for aerosol number and mass
-       IF ( lsdepo )  THEN
-          tend(nzb+1:nzt,j,i) = tend(nzb+1:nzt,j,i) - MAX( 0.0_wp,             &
-                         ( rs(nzb+2:nzt+1,j,i) * sedim_vd(nzb+2:nzt+1,j,i,b) - &
-                           rs(nzb+1:nzt,j,i) * sedim_vd(nzb+1:nzt,j,i,b) ) *   &
-                         ddzu(nzb+1:nzt) ) * MERGE( 1.0_wp, 0.0_wp,            &
-                         BTEST( wall_flags_0(nzb:nzt-1,j,i), 0 ) )
-       ENDIF                         
-    ELSEIF ( id == 'salsa_gas' )  THEN
-       CALL diffusion_s( i, j, rs,                   surf_def_h(0)%gtsws(:,b), &
-                           surf_def_h(1)%gtsws(:,b), surf_def_h(2)%gtsws(:,b), &
-                           surf_lsm_h%gtsws(:,b),    surf_usm_h%gtsws(:,b),    &
-                           surf_def_v(0)%gtsws(:,b), surf_def_v(1)%gtsws(:,b), &
-                           surf_def_v(2)%gtsws(:,b), surf_def_v(3)%gtsws(:,b), &
-                           surf_lsm_v(0)%gtsws(:,b), surf_lsm_v(1)%gtsws(:,b), &
-                           surf_lsm_v(2)%gtsws(:,b), surf_lsm_v(3)%gtsws(:,b), &
-                           surf_usm_v(0)%gtsws(:,b), surf_usm_v(1)%gtsws(:,b), &
-                           surf_usm_v(2)%gtsws(:,b), surf_usm_v(3)%gtsws(:,b) ) 
+!-- Diffusion terms
+    SELECT CASE ( id )
+       CASE ( 'aerosol_number' )
+          CALL diffusion_s( i, j, rs, surf_def_h(0)%answs(:,ib),                                   &
+                                      surf_def_h(1)%answs(:,ib), surf_def_h(2)%answs(:,ib),        &
+                                      surf_lsm_h%answs(:,ib),    surf_usm_h%answs(:,ib),           &
+                                      surf_def_v(0)%answs(:,ib), surf_def_v(1)%answs(:,ib),        &
+                                      surf_def_v(2)%answs(:,ib), surf_def_v(3)%answs(:,ib),        &
+                                      surf_lsm_v(0)%answs(:,ib), surf_lsm_v(1)%answs(:,ib),        &
+                                      surf_lsm_v(2)%answs(:,ib), surf_lsm_v(3)%answs(:,ib),        &
+                                      surf_usm_v(0)%answs(:,ib), surf_usm_v(1)%answs(:,ib),        &
+                                      surf_usm_v(2)%answs(:,ib), surf_usm_v(3)%answs(:,ib) )
+       CASE ( 'aerosol_mass' )
+          CALL diffusion_s( i, j, rs, surf_def_h(0)%amsws(:,icc),                                  &
+                                      surf_def_h(1)%amsws(:,icc), surf_def_h(2)%amsws(:,icc),      &
+                                      surf_lsm_h%amsws(:,icc),    surf_usm_h%amsws(:,icc),         &
+                                      surf_def_v(0)%amsws(:,icc), surf_def_v(1)%amsws(:,icc),      &
+                                      surf_def_v(2)%amsws(:,icc), surf_def_v(3)%amsws(:,icc),      &
+                                      surf_lsm_v(0)%amsws(:,icc), surf_lsm_v(1)%amsws(:,icc),      &
+                                      surf_lsm_v(2)%amsws(:,icc), surf_lsm_v(3)%amsws(:,icc),      &
+                                      surf_usm_v(0)%amsws(:,icc), surf_usm_v(1)%amsws(:,icc),      &
+                                      surf_usm_v(2)%amsws(:,icc), surf_usm_v(3)%amsws(:,icc) )
+       CASE ( 'salsa_gas' )
+          CALL diffusion_s( i, j, rs, surf_def_h(0)%gtsws(:,ib),                                   &
+                                      surf_def_h(1)%gtsws(:,ib), surf_def_h(2)%gtsws(:,ib),        &
+                                      surf_lsm_h%gtsws(:,ib), surf_usm_h%gtsws(:,ib),              &
+                                      surf_def_v(0)%gtsws(:,ib), surf_def_v(1)%gtsws(:,ib),        &
+                                      surf_def_v(2)%gtsws(:,ib), surf_def_v(3)%gtsws(:,ib),        &
+                                      surf_lsm_v(0)%gtsws(:,ib), surf_lsm_v(1)%gtsws(:,ib),        &
+                                      surf_lsm_v(2)%gtsws(:,ib), surf_lsm_v(3)%gtsws(:,ib),        &
+                                      surf_usm_v(0)%gtsws(:,ib), surf_usm_v(1)%gtsws(:,ib),        &
+                                      surf_usm_v(2)%gtsws(:,ib), surf_usm_v(3)%gtsws(:,ib) )
+    END SELECT
+!
+!-- Sedimentation for aerosol number and mass
+    IF ( lsdepo  .AND.  do_sedimentation )  THEN
+       tend(nzb+1:nzt,j,i) = tend(nzb+1:nzt,j,i) - MAX( 0.0_wp,                                    &
+                             ( rs(nzb+2:nzt+1,j,i) * sedim_vd(nzb+2:nzt+1,j,i,ib) -                &
+                               rs(nzb+1:nzt,j,i) * sedim_vd(nzb+1:nzt,j,i,ib) ) * ddzu(nzb+1:nzt) )&
+                             * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(nzb:nzt-1,j,i), 0 ) )
     ENDIF
 !
 !-- Prognostic equation for a scalar
     DO  k = nzb+1, nzt
-       rs_p(k,j,i) = rs(k,j,i) +  ( dt_3d  * ( tsc(2) * tend(k,j,i) +          &
-                                               tsc(3) * trs_m(k,j,i) )         &
-                                             - tsc(5) * rdf_sc(k)              &
-                                           * ( rs(k,j,i) - rs_init(k) ) )      &
-                                  * MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_0(k,j,i), 0 ) )
-       IF ( rs_p(k,j,i) < 0.0_wp )  rs_p(k,j,i) = 0.1_wp * rs(k,j,i) 
+       rs_p(k,j,i) = rs(k,j,i) + ( dt_3d * ( tsc(2) * tend(k,j,i) + tsc(3) * trs_m(k,j,i) )        &
+                                           - tsc(5) * rdf_sc(k) * ( rs(k,j,i) - rs_init(k) ) )     &
+                                 * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+       IF ( rs_p(k,j,i) < 0.0_wp )  rs_p(k,j,i) = 0.1_wp * rs(k,j,i)
     ENDDO
-
 !
 !-- Calculate tendencies for the next Runge-Kutta step
@@ -7339,6 +7349,5 @@
              trs_m(k,j,i) = tend(k,j,i)
           ENDDO
-       ELSEIF ( intermediate_timestep_count < &
-                intermediate_timestep_count_max )  THEN
+       ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
           DO  k = nzb+1, nzt
              trs_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * trs_m(k,j,i)
@@ -7346,57 +7355,54 @@
        ENDIF
     ENDIF
- 
+
  END SUBROUTINE salsa_tendency_ij
- 
-! 
+!
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate the tendencies for aerosol number and mass concentrations. 
+!> Calculate the tendencies for aerosol number and mass concentrations.
 !> Vector-optimized.
-!------------------------------------------------------------------------------! 
- SUBROUTINE salsa_tendency( id, rs_p, rs, trs_m, b, c, rs_init )
-    
-    USE advec_ws,                                                              &
-        ONLY:  advec_s_ws 
-    USE advec_s_pw_mod,                                                        &
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_tendency( id, rs_p, rs, trs_m, ib, ic, rs_init, do_sedimentation )
+
+    USE advec_ws,                                                                                  &
+        ONLY:  advec_s_ws
+    USE advec_s_pw_mod,                                                                            &
         ONLY:  advec_s_pw
-    USE advec_s_up_mod,                                                        &
+    USE advec_s_up_mod,                                                                            &
         ONLY:  advec_s_up
-    USE arrays_3d,                                                             &
-        ONLY:  ddzu, hyp, pt, rdf_sc, tend
-    USE diffusion_s_mod,                                                       &
+    USE arrays_3d,                                                                                 &
+        ONLY:  ddzu, rdf_sc, tend
+    USE diffusion_s_mod,                                                                           &
         ONLY:  diffusion_s
-    USE indices,                                                               &
+    USE indices,                                                                                   &
         ONLY:  wall_flags_0
-    USE surface_mod,                                                           &
-        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
-                                 surf_usm_v
-    
+    USE surface_mod,                                                                               &
+        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h, surf_usm_v
+
     IMPLICIT NONE
-    
-    CHARACTER (LEN = *) ::  id
-    INTEGER(iwp) ::  b   !< bin index in derived type aerosol_size_bin    
-    INTEGER(iwp) ::  c   !< bin index in derived type aerosol_size_bin    
-    INTEGER(iwp) ::  i   !<
-    INTEGER(iwp) ::  j   !<
-    INTEGER(iwp) ::  k   !< 
-    INTEGER(iwp) ::  nc  !< (c-1)*nbins+b
-    REAL(wp), DIMENSION(nzb:nzt+1)                              ::  rs_init !<
-    REAL(wp), DIMENSION(:,:,:), POINTER                         ::  rs_p    !< 
-    REAL(wp), DIMENSION(:,:,:), POINTER                         ::  rs      !<
-    REAL(wp), DIMENSION(:,:,:), POINTER                         ::  trs_m   !<
-    
-    nc = (c-1)*nbins+b    
+
+    CHARACTER(LEN = *) ::  id
+
+    INTEGER(iwp) ::  ib           !< loop index for aerosol number bin OR gas index
+    INTEGER(iwp) ::  ic           !< loop index for aerosol mass bin
+    INTEGER(iwp) ::  icc  !< (c-1)*nbins_aerosol+b
+    INTEGER(iwp) ::  i    !<
+    INTEGER(iwp) ::  j    !<
+    INTEGER(iwp) ::  k    !<
+
+    LOGICAL ::  do_sedimentation  !<
+
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  rs_init !<
+
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  rs_p    !<
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  rs      !<
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  trs_m   !<
+
+    icc = ( ic - 1 ) * nbins_aerosol + ib
 !
 !-- Tendency-terms for reactive scalar
     tend = 0.0_wp
-    
-    IF ( id == 'aerosol_number'  .AND.  lod_aero == 3 )  THEN
-       tend = tend + aerosol_number(b)%source
-    ELSEIF ( id == 'aerosol_mass'  .AND.  lod_aero == 3 )  THEN
-       tend = tend + aerosol_mass(nc)%source
-    ENDIF
-!    
+!
 !-- Advection terms
     IF ( timestep_scheme(1:5) == 'runge' )  THEN
@@ -7410,67 +7416,57 @@
     ENDIF
 !
-!-- Diffusion terms    
-    IF ( id == 'aerosol_number' )  THEN
-       CALL diffusion_s(   rs,                       surf_def_h(0)%answs(:,b), &
-                           surf_def_h(1)%answs(:,b), surf_def_h(2)%answs(:,b), &
-                           surf_lsm_h%answs(:,b),    surf_usm_h%answs(:,b),    &
-                           surf_def_v(0)%answs(:,b), surf_def_v(1)%answs(:,b), &
-                           surf_def_v(2)%answs(:,b), surf_def_v(3)%answs(:,b), &
-                           surf_lsm_v(0)%answs(:,b), surf_lsm_v(1)%answs(:,b), &
-                           surf_lsm_v(2)%answs(:,b), surf_lsm_v(3)%answs(:,b), &
-                           surf_usm_v(0)%answs(:,b), surf_usm_v(1)%answs(:,b), &
-                           surf_usm_v(2)%answs(:,b), surf_usm_v(3)%answs(:,b) )                                 
-    ELSEIF ( id == 'aerosol_mass' )  THEN
-       CALL diffusion_s( rs,                        surf_def_h(0)%amsws(:,nc), & 
-                         surf_def_h(1)%amsws(:,nc), surf_def_h(2)%amsws(:,nc), &
-                         surf_lsm_h%amsws(:,nc),    surf_usm_h%amsws(:,nc),    &
-                         surf_def_v(0)%amsws(:,nc), surf_def_v(1)%amsws(:,nc), &
-                         surf_def_v(2)%amsws(:,nc), surf_def_v(3)%amsws(:,nc), &
-                         surf_lsm_v(0)%amsws(:,nc), surf_lsm_v(1)%amsws(:,nc), &
-                         surf_lsm_v(2)%amsws(:,nc), surf_lsm_v(3)%amsws(:,nc), &
-                         surf_usm_v(0)%amsws(:,nc), surf_usm_v(1)%amsws(:,nc), &
-                         surf_usm_v(2)%amsws(:,nc), surf_usm_v(3)%amsws(:,nc) )                         
-    ELSEIF ( id == 'salsa_gas' )  THEN
-       CALL diffusion_s(   rs,                       surf_def_h(0)%gtsws(:,b), &
-                           surf_def_h(1)%gtsws(:,b), surf_def_h(2)%gtsws(:,b), &
-                           surf_lsm_h%gtsws(:,b),    surf_usm_h%gtsws(:,b),    &
-                           surf_def_v(0)%gtsws(:,b), surf_def_v(1)%gtsws(:,b), &
-                           surf_def_v(2)%gtsws(:,b), surf_def_v(3)%gtsws(:,b), &
-                           surf_lsm_v(0)%gtsws(:,b), surf_lsm_v(1)%gtsws(:,b), &
-                           surf_lsm_v(2)%gtsws(:,b), surf_lsm_v(3)%gtsws(:,b), &
-                           surf_usm_v(0)%gtsws(:,b), surf_usm_v(1)%gtsws(:,b), &
-                           surf_usm_v(2)%gtsws(:,b), surf_usm_v(3)%gtsws(:,b) ) 
-    ENDIF
+!-- Diffusion terms
+    SELECT CASE ( id )
+       CASE ( 'aerosol_number' )
+          CALL diffusion_s( rs, surf_def_h(0)%answs(:,ib),                                         &
+                                surf_def_h(1)%answs(:,ib), surf_def_h(2)%answs(:,ib),              &
+                                surf_lsm_h%answs(:,ib),    surf_usm_h%answs(:,ib),                 &
+                                surf_def_v(0)%answs(:,ib), surf_def_v(1)%answs(:,ib),              &
+                                surf_def_v(2)%answs(:,ib), surf_def_v(3)%answs(:,ib),              &
+                                surf_lsm_v(0)%answs(:,ib), surf_lsm_v(1)%answs(:,ib),              &
+                                surf_lsm_v(2)%answs(:,ib), surf_lsm_v(3)%answs(:,ib),              &
+                                surf_usm_v(0)%answs(:,ib), surf_usm_v(1)%answs(:,ib),              &
+                                surf_usm_v(2)%answs(:,ib), surf_usm_v(3)%answs(:,ib) )
+       CASE ( 'aerosol_mass' )
+          CALL diffusion_s( rs, surf_def_h(0)%amsws(:,icc),                                        &
+                                surf_def_h(1)%amsws(:,icc), surf_def_h(2)%amsws(:,icc),            &
+                                surf_lsm_h%amsws(:,icc),    surf_usm_h%amsws(:,icc),               &
+                                surf_def_v(0)%amsws(:,icc), surf_def_v(1)%amsws(:,icc),            &
+                                surf_def_v(2)%amsws(:,icc), surf_def_v(3)%amsws(:,icc),            &
+                                surf_lsm_v(0)%amsws(:,icc), surf_lsm_v(1)%amsws(:,icc),            &
+                                surf_lsm_v(2)%amsws(:,icc), surf_lsm_v(3)%amsws(:,icc),            &
+                                surf_usm_v(0)%amsws(:,icc), surf_usm_v(1)%amsws(:,icc),            &
+                                surf_usm_v(2)%amsws(:,icc), surf_usm_v(3)%amsws(:,icc) )
+       CASE ( 'salsa_gas' )
+          CALL diffusion_s( rs, surf_def_h(0)%gtsws(:,ib),                                         &
+                                surf_def_h(1)%gtsws(:,ib), surf_def_h(2)%gtsws(:,ib),              &
+                                surf_lsm_h%gtsws(:,ib),    surf_usm_h%gtsws(:,ib),                 &
+                                surf_def_v(0)%gtsws(:,ib), surf_def_v(1)%gtsws(:,ib),              &
+                                surf_def_v(2)%gtsws(:,ib), surf_def_v(3)%gtsws(:,ib),              &
+                                surf_lsm_v(0)%gtsws(:,ib), surf_lsm_v(1)%gtsws(:,ib),              &
+                                surf_lsm_v(2)%gtsws(:,ib), surf_lsm_v(3)%gtsws(:,ib),              &
+                                surf_usm_v(0)%gtsws(:,ib), surf_usm_v(1)%gtsws(:,ib),              &
+                                surf_usm_v(2)%gtsws(:,ib), surf_usm_v(3)%gtsws(:,ib) )
+    END SELECT
 !
 !-- Prognostic equation for a scalar
     DO  i = nxl, nxr
        DO  j = nys, nyn
-          IF ( id == 'salsa_gas'  .AND.  lod_gases == 3 )  THEN
-             tend(:,j,i) = tend(:,j,i) + salsa_gas(b)%source(:,j,i) *          &
-                           for_ppm_to_nconc * hyp(:) / pt(:,j,i) * ( hyp(:) /  &
-                           100000.0_wp )**0.286_wp ! ppm to #/m3
-          ELSEIF ( id == 'aerosol_mass'  .OR.  id == 'aerosol_number')  THEN
-!
-!--          Sedimentation for aerosol number and mass
-             IF ( lsdepo )  THEN
-                tend(nzb+1:nzt,j,i) = tend(nzb+1:nzt,j,i) - MAX( 0.0_wp,       &
-                         ( rs(nzb+2:nzt+1,j,i) * sedim_vd(nzb+2:nzt+1,j,i,b) - &
-                           rs(nzb+1:nzt,j,i) * sedim_vd(nzb+1:nzt,j,i,b) ) *   &
-                         ddzu(nzb+1:nzt) ) * MERGE( 1.0_wp, 0.0_wp,            &
-                         BTEST( wall_flags_0(nzb:nzt-1,j,i), 0 ) )
-             ENDIF  
+!
+!--       Sedimentation for aerosol number and mass
+          IF ( lsdepo  .AND.  do_sedimentation )  THEN
+             tend(nzb+1:nzt,j,i) = tend(nzb+1:nzt,j,i) - MAX( 0.0_wp, ( rs(nzb+2:nzt+1,j,i) *      &
+                                   sedim_vd(nzb+2:nzt+1,j,i,ib) - rs(nzb+1:nzt,j,i) *              &
+                                   sedim_vd(nzb+1:nzt,j,i,ib) ) * ddzu(nzb+1:nzt) ) *              &
+                                   MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(nzb:nzt-1,j,i), 0 ) )
           ENDIF
           DO  k = nzb+1, nzt
-             rs_p(k,j,i) = rs(k,j,i) +  ( dt_3d  * ( tsc(2) * tend(k,j,i) +    &
-                                                     tsc(3) * trs_m(k,j,i) )   &
-                                                   - tsc(5) * rdf_sc(k)        &
-                                                 * ( rs(k,j,i) - rs_init(k) ) )&
-                                        * MERGE( 1.0_wp, 0.0_wp,               &
-                                          BTEST( wall_flags_0(k,j,i), 0 ) )
-             IF ( rs_p(k,j,i) < 0.0_wp )  rs_p(k,j,i) = 0.1_wp * rs(k,j,i) 
+             rs_p(k,j,i) = rs(k,j,i) +  ( dt_3d  * ( tsc(2) * tend(k,j,i) + tsc(3) * trs_m(k,j,i) )&
+                                                  - tsc(5) * rdf_sc(k) * ( rs(k,j,i) - rs_init(k) )&
+                                        ) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+             IF ( rs_p(k,j,i) < 0.0_wp )  rs_p(k,j,i) = 0.1_wp * rs(k,j,i)
           ENDDO
        ENDDO
     ENDDO
-
 !
 !-- Calculate tendencies for the next Runge-Kutta step
@@ -7484,11 +7480,9 @@
              ENDDO
           ENDDO
-       ELSEIF ( intermediate_timestep_count < &
-                intermediate_timestep_count_max )  THEN
+       ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
           DO  i = nxl, nxr
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   trs_m(k,j,i) =  -9.5625_wp * tend(k,j,i)                    &
-                                   + 5.3125_wp * trs_m(k,j,i)
+                   trs_m(k,j,i) =  -9.5625_wp * tend(k,j,i) + 5.3125_wp * trs_m(k,j,i)
                 ENDDO
              ENDDO
@@ -7496,175 +7490,216 @@
        ENDIF
     ENDIF
- 
+
  END SUBROUTINE salsa_tendency
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Boundary conditions for prognostic variables in SALSA
-!------------------------------------------------------------------------------! 
+!------------------------------------------------------------------------------!
  SUBROUTINE salsa_boundary_conds
- 
-    USE surface_mod,                                                           &
+
+    USE arrays_3d,                                                                                 &
+        ONLY:  dzu
+
+    USE surface_mod,                                                                               &
         ONLY :  bc_h
 
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  b  !< index for aerosol size bins    
-    INTEGER(iwp) ::  c  !< index for chemical compounds in aerosols
-    INTEGER(iwp) ::  g  !< idex for gaseous compounds
-    INTEGER(iwp) ::  i  !< grid index x direction
-    INTEGER(iwp) ::  j  !< grid index y direction
-    INTEGER(iwp) ::  k  !< grid index y direction
-    INTEGER(iwp) ::  kb !< variable to set respective boundary value, depends on
-                        !< facing.
-    INTEGER(iwp) ::  l  !< running index boundary type, for up- and downward- 
-                        !< facing walls
-    INTEGER(iwp) ::  m  !< running index surface elements
-    
-!
-!-- Surface conditions: 
-    IF ( ibc_salsa_b == 0 )  THEN   ! Dirichlet 
-!    
-!--    Run loop over all non-natural and natural walls. Note, in wall-datatype
-!--    the k coordinate belongs to the atmospheric grid point, therefore, set
-!--    s_p at k-1 
- 
-       DO  l = 0, 1
-!
-!--       Set kb, for upward-facing surfaces value at topography top (k-1) is 
-!--       set, for downward-facing surfaces at topography bottom (k+1)
-          kb = MERGE ( -1, 1, l == 0 )
-          !$OMP PARALLEL PRIVATE( b, c, g, i, j, k )
-          !$OMP DO
-          DO  m = 1, bc_h(l)%ns
-          
-             i = bc_h(l)%i(m)
-             j = bc_h(l)%j(m)
-             k = bc_h(l)%k(m)
-             
-             DO  b = 1, nbins
-                aerosol_number(b)%conc_p(k+kb,j,i) =                           &
-                                                aerosol_number(b)%conc(k+kb,j,i)
-                DO  c = 1, ncc_tot
-                   aerosol_mass((c-1)*nbins+b)%conc_p(k+kb,j,i) =              &
-                                      aerosol_mass((c-1)*nbins+b)%conc(k+kb,j,i)
+    INTEGER(iwp) ::  i    !< grid index x direction
+    INTEGER(iwp) ::  ib   !< index for aerosol size bins
+    INTEGER(iwp) ::  ic   !< index for chemical compounds in aerosols
+    INTEGER(iwp) ::  icc  !< additional index for chemical compounds in aerosols
+    INTEGER(iwp) ::  ig   !< idex for gaseous compounds
+    INTEGER(iwp) ::  j    !< grid index y direction
+    INTEGER(iwp) ::  k    !< grid index y direction
+    INTEGER(iwp) ::  kb   !< variable to set respective boundary value, depends on facing.
+    INTEGER(iwp) ::  l    !< running index boundary type, for up- and downward-facing walls
+    INTEGER(iwp) ::  m    !< running index surface elements
+
+    IF ( time_since_reference_point >= skip_time_do_salsa )  THEN
+
+!
+!--    Surface conditions:
+       IF ( ibc_salsa_b == 0 )  THEN   ! Dirichlet
+!
+!--       Run loop over all non-natural and natural walls. Note, in wall-datatype the k coordinate 
+!--       belongs to the atmospheric grid point, therefore, set s_p at k-1
+          DO  l = 0, 1
+!
+!--          Set kb, for upward-facing surfaces value at topography top (k-1) is 
+!--          set, for downward-facing surfaces at topography bottom (k+1)
+             kb = MERGE ( -1, 1, l == 0 )
+             !$OMP PARALLEL PRIVATE( ib, ic, icc, ig, i, j, k )
+             !$OMP DO
+             DO  m = 1, bc_h(l)%ns
+
+                i = bc_h(l)%i(m)
+                j = bc_h(l)%j(m)
+                k = bc_h(l)%k(m)
+
+                DO  ib = 1, nbins_aerosol
+                   aerosol_number(ib)%conc_p(k+kb,j,i) = aerosol_number(ib)%conc(k+kb,j,i)
+                   DO  ic = 1, ncomponents_mass
+                      icc = ( ic - 1 ) * nbins_aerosol + ib
+                      aerosol_mass(icc)%conc_p(k+kb,j,i) = aerosol_mass(icc)%conc(k+kb,j,i)
+                   ENDDO
                 ENDDO
+                IF ( .NOT. salsa_gases_from_chem )  THEN
+                   DO  ig = 1, ngases_salsa
+                      salsa_gas(ig)%conc_p(k+kb,j,i) = salsa_gas(ig)%conc(k+kb,j,i)
+                   ENDDO
+                ENDIF
+
              ENDDO
-             IF ( .NOT. salsa_gases_from_chem )  THEN
-                DO  g = 1, ngast
-                   salsa_gas(g)%conc_p(k+kb,j,i) = salsa_gas(g)%conc(k+kb,j,i)
+             !$OMP END PARALLEL
+
+          ENDDO
+
+       ELSE   ! Neumann
+
+          DO l = 0, 1
+!
+!--          Set kb, for upward-facing surfaces value at topography top (k-1) is 
+!--          set, for downward-facing surfaces at topography bottom (k+1)
+             kb = MERGE( -1, 1, l == 0 )
+             !$OMP PARALLEL PRIVATE( ib, ic, icc, ig, i, j, k )
+             !$OMP DO
+             DO  m = 1, bc_h(l)%ns
+
+                i = bc_h(l)%i(m)
+                j = bc_h(l)%j(m)
+                k = bc_h(l)%k(m)
+
+                DO  ib = 1, nbins_aerosol
+                   aerosol_number(ib)%conc_p(k+kb,j,i) = aerosol_number(ib)%conc_p(k,j,i)
+                   DO  ic = 1, ncomponents_mass
+                      icc = ( ic - 1 ) * nbins_aerosol + ib
+                      aerosol_mass(icc)%conc_p(k+kb,j,i) = aerosol_mass(icc)%conc_p(k,j,i)
+                   ENDDO
                 ENDDO
-             ENDIF
-             
+                IF ( .NOT. salsa_gases_from_chem ) THEN
+                   DO  ig = 1, ngases_salsa
+                      salsa_gas(ig)%conc_p(k+kb,j,i) = salsa_gas(ig)%conc_p(k,j,i)
+                   ENDDO
+                ENDIF
+
+             ENDDO
+             !$OMP END PARALLEL
           ENDDO
-          !$OMP END PARALLEL
-          
-       ENDDO
-    
-    ELSE   ! Neumann
-    
-       DO l = 0, 1
-!
-!--       Set kb, for upward-facing surfaces value at topography top (k-1) is 
-!--       set, for downward-facing surfaces at topography bottom (k+1)       
-          kb = MERGE( -1, 1, l == 0 )
-          !$OMP PARALLEL PRIVATE( b, c, g, i, j, k )
-          !$OMP DO
-          DO  m = 1, bc_h(l)%ns
-             
-             i = bc_h(l)%i(m)
-             j = bc_h(l)%j(m)
-             k = bc_h(l)%k(m)
-             
-             DO  b = 1, nbins
-                aerosol_number(b)%conc_p(k+kb,j,i) =                           &
-                                                 aerosol_number(b)%conc_p(k,j,i)
-                DO  c = 1, ncc_tot
-                   aerosol_mass((c-1)*nbins+b)%conc_p(k+kb,j,i) =              &
-                                       aerosol_mass((c-1)*nbins+b)%conc_p(k,j,i)
-                ENDDO
+
+       ENDIF
+!
+!--   Top boundary conditions:
+       IF ( ibc_salsa_t == 0 )  THEN   ! Dirichlet
+
+          DO  ib = 1, nbins_aerosol
+             aerosol_number(ib)%conc_p(nzt+1,:,:) = aerosol_number(ib)%conc(nzt+1,:,:)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                aerosol_mass(icc)%conc_p(nzt+1,:,:) = aerosol_mass(icc)%conc(nzt+1,:,:)
              ENDDO
-             IF ( .NOT. salsa_gases_from_chem ) THEN
-                DO  g = 1, ngast
-                   salsa_gas(g)%conc_p(k+kb,j,i) = salsa_gas(g)%conc_p(k,j,i)
-                ENDDO
-             ENDIF
-                
           ENDDO
-          !$OMP END PARALLEL
-       ENDDO
-     
-    ENDIF
-
-!
-!--Top boundary conditions:
-    IF ( ibc_salsa_t == 0 )  THEN   ! Dirichlet 
-   
-       DO  b = 1, nbins
-          aerosol_number(b)%conc_p(nzt+1,:,:) =                                &
-                                               aerosol_number(b)%conc(nzt+1,:,:)
-          DO  c = 1, ncc_tot
-             aerosol_mass((c-1)*nbins+b)%conc_p(nzt+1,:,:) =                   &
-                                     aerosol_mass((c-1)*nbins+b)%conc(nzt+1,:,:)
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                salsa_gas(ig)%conc_p(nzt+1,:,:) = salsa_gas(ig)%conc(nzt+1,:,:)
+             ENDDO
+          ENDIF
+
+       ELSEIF ( ibc_salsa_t == 1 )  THEN   ! Neumann
+
+          DO  ib = 1, nbins_aerosol
+             aerosol_number(ib)%conc_p(nzt+1,:,:) = aerosol_number(ib)%conc_p(nzt,:,:)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                aerosol_mass(icc)%conc_p(nzt+1,:,:) = aerosol_mass(icc)%conc_p(nzt,:,:)
+             ENDDO
           ENDDO
-       ENDDO
-       IF ( .NOT. salsa_gases_from_chem )  THEN
-          DO  g = 1, ngast
-             salsa_gas(g)%conc_p(nzt+1,:,:) = salsa_gas(g)%conc(nzt+1,:,:)
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                salsa_gas(ig)%conc_p(nzt+1,:,:) = salsa_gas(ig)%conc_p(nzt,:,:)
+             ENDDO
+          ENDIF
+
+       ELSEIF ( ibc_salsa_t == 2 )  THEN   ! nested
+
+          DO  ib = 1, nbins_aerosol
+             aerosol_number(ib)%conc_p(nzt+1,:,:) = aerosol_number(ib)%conc_p(nzt,:,:) +              &
+                                                    bc_an_t_val(ib) * dzu(nzt+1)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                aerosol_mass(icc)%conc_p(nzt+1,:,:) = aerosol_mass(icc)%conc_p(nzt,:,:) +             &
+                                                      bc_am_t_val(icc) * dzu(nzt+1)
+             ENDDO
           ENDDO
-       ENDIF
-       
-    ELSEIF ( ibc_salsa_t == 1 )  THEN   ! Neumann 
-    
-       DO  b = 1, nbins
-          aerosol_number(b)%conc_p(nzt+1,:,:) =                                &
-                                               aerosol_number(b)%conc_p(nzt,:,:)
-          DO  c = 1, ncc_tot
-             aerosol_mass((c-1)*nbins+b)%conc_p(nzt+1,:,:) =                   &
-                                     aerosol_mass((c-1)*nbins+b)%conc_p(nzt,:,:)
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                salsa_gas(ig)%conc_p(nzt+1,:,:) = salsa_gas(ig)%conc_p(nzt,:,:) +                     &
+                                                  bc_gt_t_val(ig) * dzu(nzt+1)
+             ENDDO
+          ENDIF
+
+       ENDIF
+!
+!--    Lateral boundary conditions at the outflow
+       IF ( bc_radiation_s )  THEN
+          DO  ib = 1, nbins_aerosol
+             aerosol_number(ib)%conc_p(:,nys-1,:) = aerosol_number(ib)%conc_p(:,nys,:)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                aerosol_mass(icc)%conc_p(:,nys-1,:) = aerosol_mass(icc)%conc_p(:,nys,:)
+             ENDDO
           ENDDO
-       ENDDO
-       IF ( .NOT. salsa_gases_from_chem )  THEN
-          DO  g = 1, ngast
-             salsa_gas(g)%conc_p(nzt+1,:,:) = salsa_gas(g)%conc_p(nzt,:,:)
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                salsa_gas(ig)%conc_p(:,nys-1,:) = salsa_gas(ig)%conc_p(:,nys,:)
+             ENDDO
+          ENDIF
+
+       ELSEIF ( bc_radiation_n )  THEN
+          DO  ib = 1, nbins_aerosol
+             aerosol_number(ib)%conc_p(:,nyn+1,:) = aerosol_number(ib)%conc_p(:,nyn,:)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                aerosol_mass(icc)%conc_p(:,nyn+1,:) = aerosol_mass(icc)%conc_p(:,nyn,:)
+             ENDDO
           ENDDO
-       ENDIF
-       
-    ENDIF
-!
-!-- Lateral boundary conditions at the outflow    
-    IF ( bc_radiation_s )  THEN
-       DO  b = 1, nbins
-          aerosol_number(b)%conc_p(:,nys-1,:) = aerosol_number(b)%conc_p(:,nys,:)
-          DO  c = 1, ncc_tot
-             aerosol_mass((c-1)*nbins+b)%conc_p(:,nys-1,:) =                   &
-                                     aerosol_mass((c-1)*nbins+b)%conc_p(:,nys,:)
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                salsa_gas(ig)%conc_p(:,nyn+1,:) = salsa_gas(ig)%conc_p(:,nyn,:)
+             ENDDO
+          ENDIF
+
+       ELSEIF ( bc_radiation_l )  THEN
+          DO  ib = 1, nbins_aerosol
+             aerosol_number(ib)%conc_p(:,:,nxl-1) = aerosol_number(ib)%conc_p(:,:,nxl)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                aerosol_mass(icc)%conc_p(:,:,nxl-1) = aerosol_mass(icc)%conc_p(:,:,nxl)
+             ENDDO
           ENDDO
-       ENDDO
-    ELSEIF ( bc_radiation_n )  THEN
-       DO  b = 1, nbins
-          aerosol_number(b)%conc_p(:,nyn+1,:) = aerosol_number(b)%conc_p(:,nyn,:)
-          DO  c = 1, ncc_tot
-             aerosol_mass((c-1)*nbins+b)%conc_p(:,nyn+1,:) =                   &
-                                     aerosol_mass((c-1)*nbins+b)%conc_p(:,nyn,:)
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                salsa_gas(ig)%conc_p(:,:,nxl-1) = salsa_gas(ig)%conc_p(:,:,nxl)
+             ENDDO
+          ENDIF
+
+       ELSEIF ( bc_radiation_r )  THEN
+          DO  ib = 1, nbins_aerosol
+             aerosol_number(ib)%conc_p(:,:,nxr+1) = aerosol_number(ib)%conc_p(:,:,nxr)
+             DO  ic = 1, ncomponents_mass
+                icc = ( ic - 1 ) * nbins_aerosol + ib
+                aerosol_mass(icc)%conc_p(:,:,nxr+1) = aerosol_mass(icc)%conc_p(:,:,nxr)
+             ENDDO
           ENDDO
-       ENDDO
-    ELSEIF ( bc_radiation_l )  THEN
-       DO  b = 1, nbins
-          aerosol_number(b)%conc_p(:,nxl-1,:) = aerosol_number(b)%conc_p(:,nxl,:)
-          DO  c = 1, ncc_tot
-             aerosol_mass((c-1)*nbins+b)%conc_p(:,nxl-1,:) =                   &
-                                     aerosol_mass((c-1)*nbins+b)%conc_p(:,nxl,:)
-          ENDDO
-       ENDDO
-    ELSEIF ( bc_radiation_r )  THEN
-       DO  b = 1, nbins
-          aerosol_number(b)%conc_p(:,nxr+1,:) = aerosol_number(b)%conc_p(:,nxr,:)
-          DO  c = 1, ncc_tot
-             aerosol_mass((c-1)*nbins+b)%conc_p(:,nxr+1,:) =                   &
-                                     aerosol_mass((c-1)*nbins+b)%conc_p(:,nxr,:)
-          ENDDO
-       ENDDO
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
+                salsa_gas(ig)%conc_p(:,:,nxr+1) = salsa_gas(ig)%conc_p(:,:,nxr)
+             ENDDO
+          ENDIF
+
+       ENDIF
+
     ENDIF
 
@@ -7675,19 +7710,22 @@
 ! ------------
 ! Undoing of the previously done cyclic boundary conditions.
-!------------------------------------------------------------------------------! 
+!------------------------------------------------------------------------------!
  SUBROUTINE salsa_boundary_conds_decycle ( sq, sq_init )
 
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  boundary !< 
-    INTEGER(iwp) ::  ee !<
-    INTEGER(iwp) ::  copied !< 
-    INTEGER(iwp) ::  i  !<
-    INTEGER(iwp) ::  j  !<
-    INTEGER(iwp) ::  k  !<
-    INTEGER(iwp) ::  ss !<
-    REAL(wp), DIMENSION(nzb:nzt+1) ::  sq_init
-    REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sq
-    REAL(wp) ::  flag !< flag to mask topography grid points
+    INTEGER(iwp) ::  boundary  !<
+    INTEGER(iwp) ::  ee        !<
+    INTEGER(iwp) ::  copied    !<
+    INTEGER(iwp) ::  i         !<
+    INTEGER(iwp) ::  j         !<
+    INTEGER(iwp) ::  k         !<
+    INTEGER(iwp) ::  ss        !<
+
+    REAL(wp) ::  flag  !< flag to mask topography grid points
+
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  sq_init  !< initial concentration profile
+
+    REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sq  !< concentration array
 
     flag = 0.0_wp
@@ -7695,10 +7733,10 @@
 !-- Left and right boundaries
     IF ( decycle_lr  .AND.  ( bc_lr_cyc  .OR. bc_lr == 'nested' ) )  THEN
-    
+
        DO  boundary = 1, 2
 
           IF ( decycle_method(boundary) == 'dirichlet' )  THEN
-!    
-!--          Initial profile is copied to ghost and first three layers          
+!
+!--          Initial profile is copied to ghost and first three layers
              ss = 1
              ee = 0
@@ -7710,19 +7748,18 @@
                 ee = nxrg
              ENDIF
-             
+
              DO  i = ss, ee
                 DO  j = nysg, nyng
-                   DO  k = nzb+1, nzt             
-                      flag = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,i), 0 ) )
+                   DO  k = nzb+1, nzt
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq_init(k) * flag
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           ELSEIF ( decycle_method(boundary) == 'neumann' )  THEN
 !
-!--          The value at the boundary is copied to the ghost layers to simulate
-!--          an outlet with zero gradient
+!--          The value at the boundary is copied to the ghost layers to simulate an outlet with
+!--          zero gradient
              ss = 1
              ee = 0
@@ -7736,34 +7773,31 @@
                 copied = nxr
              ENDIF
-             
+
               DO  i = ss, ee
                 DO  j = nysg, nyng
-                   DO  k = nzb+1, nzt             
-                      flag = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,i), 0 ) )
+                   DO  k = nzb+1, nzt
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq(k,j,copied) * flag
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           ELSE
-             WRITE(message_string,*)                                           &
-                                 'unknown decycling method: decycle_method (', &
-                     boundary, ') ="' // TRIM( decycle_method(boundary) ) // '"'
-             CALL message( 'salsa_boundary_conds_decycle', 'SA0029',           &
-                           1, 2, 0, 6, 0 )
+             WRITE(message_string,*) 'unknown decycling method: decycle_method (', boundary,       &
+                                     ') ="' // TRIM( decycle_method(boundary) ) // '"'
+             CALL message( 'salsa_boundary_conds_decycle', 'PA0626', 1, 2, 0, 6, 0 )
           ENDIF
        ENDDO
     ENDIF
-    
+
 !
 !-- South and north boundaries
      IF ( decycle_ns  .AND.  ( bc_ns_cyc  .OR. bc_ns == 'nested' ) )  THEN
-    
+
        DO  boundary = 3, 4
 
           IF ( decycle_method(boundary) == 'dirichlet' )  THEN
-!    
-!--          Initial profile is copied to ghost and first three layers          
+!
+!--          Initial profile is copied to ghost and first three layers
              ss = 1
              ee = 0
@@ -7775,19 +7809,18 @@
                 ee = nyng
              ENDIF
-             
+
              DO  i = nxlg, nxrg
                 DO  j = ss, ee
-                   DO  k = nzb+1, nzt             
-                      flag = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,i), 0 ) )
+                   DO  k = nzb+1, nzt
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq_init(k) * flag
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           ELSEIF ( decycle_method(boundary) == 'neumann' )  THEN
 !
-!--          The value at the boundary is copied to the ghost layers to simulate
-!--          an outlet with zero gradient
+!--          The value at the boundary is copied to the ghost layers to simulate an outlet with 
+!--          zero gradient
              ss = 1
              ee = 0
@@ -7801,25 +7834,22 @@
                 copied = nyn
              ENDIF
-             
+
               DO  i = nxlg, nxrg
                 DO  j = ss, ee
-                   DO  k = nzb+1, nzt             
-                      flag = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,i), 0 ) )
+                   DO  k = nzb+1, nzt
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq(k,copied,i) * flag
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           ELSE
-             WRITE(message_string,*)                                           &
-                                 'unknown decycling method: decycle_method (', &
-                     boundary, ') ="' // TRIM( decycle_method(boundary) ) // '"'
-             CALL message( 'salsa_boundary_conds_decycle', 'SA0030',           &
-                           1, 2, 0, 6, 0 )
+             WRITE(message_string,*) 'unknown decycling method: decycle_method (', boundary,       &
+                                     ') ="' // TRIM( decycle_method(boundary) ) // '"'
+             CALL message( 'salsa_boundary_conds_decycle', 'PA0627', 1, 2, 0, 6, 0 )
           ENDIF
        ENDDO
-    ENDIF   
- 
+    ENDIF
+
  END SUBROUTINE salsa_boundary_conds_decycle
 
@@ -7834,31 +7864,61 @@
 
     IMPLICIT NONE
-    
-    CHARACTER(len=*), INTENT(in) ::  itype !< 'dry' or 'wet'
+
+    CHARACTER(len=*), INTENT(in) ::  itype  !< 'dry' or 'wet'
+
+    INTEGER(iwp) ::  ic                 !< loop index for mass bin number
+    INTEGER(iwp) ::  iend               !< end index: include water or not
+
     INTEGER(iwp), INTENT(in) ::  ibin   !< index of the chemical component
     INTEGER(iwp), INTENT(in) ::  i      !< loop index for x-direction
-    INTEGER(iwp), INTENT(in) ::  j      !< loop index for y-direction 
-    REAL(wp), DIMENSION(:), INTENT(out) ::  mconc     !< total dry or wet mass 
-                                                      !< concentration
-                                                      
-    INTEGER(iwp) ::  c                  !< loop index for mass bin number
-    INTEGER(iwp) ::  iend               !< end index: include water or not     
-    
+    INTEGER(iwp), INTENT(in) ::  j      !< loop index for y-direction
+
+    REAL(wp), DIMENSION(:), INTENT(out) ::  mconc  !< total dry or wet mass concentration
+
 !-- Number of components 
     IF ( itype == 'dry' )  THEN
-       iend = get_n_comp( prtcl ) - 1 
+       iend = prtcl%ncomp - 1 
     ELSE IF ( itype == 'wet' )  THEN
-       iend = get_n_comp( prtcl ) 
+       iend = prtcl%ncomp
     ELSE
-       STOP 1 ! "INFO for Developer: please use the message routine to pass the output string" bin_mixrat: Error in itype
+       message_string = 'Error in itype!'
+       CALL message( 'salsa_mod: bin_mixrat', 'PA0628', 2, 2, 0, 6, 0 )
     ENDIF
 
     mconc = 0.0_wp
-    
-    DO c = ibin, iend*nbins+ibin, nbins !< every nbins'th element
-       mconc = mconc + aerosol_mass(c)%conc(:,j,i)
+
+    DO  ic = ibin, iend*nbins_aerosol+ibin, nbins_aerosol !< every nbins'th element
+       mconc = mconc + aerosol_mass(ic)%conc(:,j,i)
     ENDDO
-    
- END SUBROUTINE bin_mixrat 
+
+ END SUBROUTINE bin_mixrat
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Sets surface fluxes
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_emission_update
+
+    USE control_parameters,                                                                        &
+        ONLY:  time_since_reference_point
+
+    IMPLICIT NONE
+
+    IF ( time_since_reference_point >= skip_time_do_salsa  )  THEN
+
+       IF ( next_aero_emission_update <= time_since_reference_point )  THEN
+          CALL salsa_emission_setup( .FALSE. )
+       ENDIF
+
+       IF ( next_gas_emission_update <= time_since_reference_point )  THEN
+          IF ( salsa_emission_mode == 'read_from_file'  .AND.  .NOT. salsa_gases_from_chem )  THEN
+             CALL salsa_gas_emission_setup( .FALSE. )
+          ENDIF
+       ENDIF
+
+    ENDIF
+
+ END SUBROUTINE salsa_emission_update
 
 !------------------------------------------------------------------------------!
@@ -7866,488 +7926,699 @@
 !> ------------
 !> Define aerosol fluxes: constant or read from a from file
-!------------------------------------------------------------------------------! 
- SUBROUTINE salsa_set_source
- 
- !   USE date_and_time_mod,                                                     &
- !       ONLY:  index_dd, index_hh, index_mm
+!> @todo - Emission stack height is not used yet. For default mode, emissions
+!>         are assumed to occur on upward facing horizontal surfaces.
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_emission_setup( init )
+
+    USE control_parameters,                                                                        &
+        ONLY:  time_since_reference_point
+
+    USE date_and_time_mod,                                                                         &
+        ONLY:  day_of_month, hour_of_day, index_dd, index_hh, index_mm, month_of_year,             &
+               time_default_indices, time_utc_init
+
+    USE netcdf_data_input_mod,                                                                     &
+        ONLY:  check_existence, get_attribute, get_variable, inquire_num_variables,                &
+               inquire_variable_names, netcdf_data_input_get_dimension_length, open_read_file
+
+    USE surface_mod,                                                                               &
+        ONLY:  surf_def_h, surf_lsm_h, surf_usm_h
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=80) ::  daytype = 'workday'  !< default day type
+    CHARACTER(LEN=25) ::  in_name              !< name of a gas in the input file
+    CHARACTER(LEN=25) ::  mod_name             !< name in the input file
+
+    INTEGER(iwp) ::  ib        !< loop index: aerosol number bins
+    INTEGER(iwp) ::  ic        !< loop index: aerosol chemical components
+    INTEGER(iwp) ::  id_salsa  !< NetCDF id of aerosol emission input file
+    INTEGER(iwp) ::  in        !< loop index: emission category
+    INTEGER(iwp) ::  inn       !< loop index
+    INTEGER(iwp) ::  ss        !< loop index
+
+    INTEGER(iwp), DIMENSION(maxspec) ::  cc_i2m   !<
+
+    LOGICAL  ::  netcdf_extend = .FALSE.  !< NetCDF input file exists
+
+    LOGICAL, INTENT(in) ::  init  !< if .TRUE. --> initialisation call
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  nsect_emission  !< sectional number emission
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  source_array  !< temporary source array
+
+!
+!-- Allocate source arrays:
+    DO  ib = 1, nbins_aerosol
+       IF ( init )  ALLOCATE( aerosol_number(ib)%source(nys:nyn,nxl:nxr) )
+       aerosol_number(ib)%source = 0.0_wp
+    ENDDO
+
+    DO  ic = 1, ncomponents_mass * nbins_aerosol
+       IF ( init )  ALLOCATE( aerosol_mass(ic)%source(nys:nyn,nxl:nxr) )
+       aerosol_mass(ic)%source = 0.0_wp
+    ENDDO
+
+!
+!-- Define emissions:
+
+    SELECT CASE ( salsa_emission_mode )
+
+       CASE ( 'uniform' )
+
+          IF ( init )  THEN  ! Do only once
+!
+!-           Form a sectional size distribution for the emissions
+             ALLOCATE( nsect_emission(1:nbins_aerosol),                                            &
+                       source_array(nys:nyn,nxl:nxr,1:nbins_aerosol) )
+!
+!--          Precalculate a size distribution for the emission based on the mean diameter, standard
+!--          deviation and number concentration per each log-normal mode
+             CALL size_distribution( surface_aerosol_flux, aerosol_flux_dpg, aerosol_flux_sigmag,  &
+                                     nsect_emission )
+             DO  ib = 1, nbins_aerosol
+                source_array(:,:,ib) = nsect_emission(ib)
+             ENDDO
+!
+!--          Check which chemical components are used
+             cc_i2m = 0
+             IF ( index_so4 > 0 ) cc_i2m(1) = index_so4
+             IF ( index_oc > 0 )  cc_i2m(2) = index_oc
+             IF ( index_bc > 0 )  cc_i2m(3) = index_bc
+             IF ( index_du > 0 )  cc_i2m(4) = index_du
+             IF ( index_ss > 0 )  cc_i2m(5) = index_ss
+             IF ( index_no > 0 )  cc_i2m(6) = index_no
+             IF ( index_nh > 0 )  cc_i2m(7) = index_nh
+!
+!--          Normalise mass fractions so that their sum is 1
+             aerosol_flux_mass_fracs_a = aerosol_flux_mass_fracs_a /                               &
+                                         SUM( aerosol_flux_mass_fracs_a(1:ncc ) )
+!
+!--          Set uniform fluxes of default horizontal surfaces
+             CALL set_flux( surf_def_h(0), cc_i2m, aerosol_flux_mass_fracs_a, source_array )
+!
+!--          Subrange 2b:
+             IF ( SUM( aerosol_flux_mass_fracs_b ) > 0.0_wp )  THEN
+                CALL location_message( '   salsa_emission_setup: emissions are soluble!', .TRUE. )
+             ENDIF
+
+             DEALLOCATE( nsect_emission, source_array )
+          ENDIF
+
+       CASE ( 'parameterized' )
+!
+!--       TO DO
+
+       CASE ( 'read_from_file' )
+!
+!--       Reset surface fluxes
+          surf_def_h(0)%answs = 0.0_wp
+          surf_def_h(0)%amsws = 0.0_wp
+          surf_lsm_h%answs = 0.0_wp
+          surf_lsm_h%amsws = 0.0_wp
+          surf_usm_h%answs = 0.0_wp
+          surf_usm_h%amsws = 0.0_wp
+
 #if defined( __netcdf )
-    USE NETCDF
-    
-    USE netcdf_data_input_mod,                                                 &
-        ONLY:  get_attribute, get_variable,                                    &
-               netcdf_data_input_get_dimension_length, open_read_file
-    
-    USE surface_mod,                                                           &
-        ONLY:  surf_def_h, surf_lsm_h, surf_usm_h
- 
-    IMPLICIT NONE
-    
-    INTEGER(iwp), PARAMETER ::  ndm = 3  !< number of default modes
-    INTEGER(iwp), PARAMETER ::  ndc = 4  !< number of default categories
-    
-    CHARACTER (LEN=10) ::  unita !< Unit of aerosol fluxes
-    CHARACTER (LEN=10) ::  unitg !< Unit of gaseous fluxes
-    INTEGER(iwp) ::  b           !< loop index: aerosol number bins
-    INTEGER(iwp) ::  c           !< loop index: aerosol chemical components
-    INTEGER(iwp) ::  ee          !< loop index: end
-    INTEGER(iwp), ALLOCATABLE, DIMENSION(:) ::  eci !< emission category index
-    INTEGER(iwp) ::  g           !< loop index: gaseous tracers
-    INTEGER(iwp) ::  i           !< loop index: x-direction   
-    INTEGER(iwp) ::  id_faero    !< NetCDF id of aerosol source input file 
-    INTEGER(iwp) ::  id_fchem    !< NetCDF id of aerosol source input file                              
-    INTEGER(iwp) ::  id_sa       !< NetCDF id of variable: source   
-    INTEGER(iwp) ::  j           !< loop index: y-direction
-    INTEGER(iwp) ::  k           !< loop index: z-direction
-    INTEGER(iwp) ::  n_dt        !< number of time steps in the emission file
-    INTEGER(iwp) ::  nc_stat     !< local variable for storing the result of 
-                                 !< netCDF calls for error message handling
-    INTEGER(iwp) ::  nb_file     !< Number of grid-points in file (bins)                                  
-    INTEGER(iwp) ::  ncat        !< Number of emission categories 
-    INTEGER(iwp) ::  ng_file     !< Number of grid-points in file (gases)  
-    INTEGER(iwp) ::  nz_file     !< number of grid-points in file     
-    INTEGER(iwp) ::  n           !< loop index
-    INTEGER(iwp) ::  ni          !< loop index
-    INTEGER(iwp) ::  ss          !< loop index
-    LOGICAL  ::  netcdf_extend = .FALSE. !< Flag indicating wether netcdf 
-                                         !< topography input file or not   
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:)   :: dum_var_4d !< variable for 
-                                                              !< temporary data                                        
-    REAL(wp) ::  fillval         !< fill value 
-    REAL(wp) ::  flag            !< flag to mask topography grid points
-    REAL(wp), DIMENSION(nbins) ::  nsect_emission  !< sectional emission (lod1)
-    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  pm_emission  !< aerosol mass 
-                                                             !< emission (lod1)
-    REAL(wp), DIMENSION(nbins) ::  source_ijka !< aerosol source at (k,j,i)
-!
-!-- The default size distribution and mass composition per emission category:
-!-- 1 = traffic, 2 = road dust, 3 = wood combustion, 4 = other 
-!-- Mass fractions: H2SO4, OC, BC, DU, SS, HNO3, NH3
-!    CHARACTER(LEN=15), DIMENSION(ndc) ::  cat_name_table = &!< emission category
-!                                         (/'road traffic   ','road dust      ',&
-!                                           'wood combustion','other          '/)
-    REAL(wp), DIMENSION(ndc) ::  avg_density        !< average density
-    REAL(wp), DIMENSION(ndc) ::  conversion_factor  !< unit conversion factor  
-                                                    !< for aerosol emissions 
-    REAL(wp), DIMENSION(ndm), PARAMETER ::  dpg_table = & !< mean diameter (mum)
-                                            (/ 13.5E-3_wp, 1.4_wp, 5.4E-2_wp/)
-    REAL(wp), DIMENSION(ndm) ::  ntot_table                                       
-    REAL(wp), DIMENSION(maxspec,ndc), PARAMETER ::  mass_fraction_table =      &
-       RESHAPE( (/ 0.04_wp, 0.48_wp, 0.48_wp, 0.0_wp,  0.0_wp, 0.0_wp, 0.0_wp, &
-                   0.0_wp,  0.05_wp, 0.0_wp,  0.95_wp, 0.0_wp, 0.0_wp, 0.0_wp, &
-                   0.0_wp,  0.5_wp,  0.5_wp,  0.0_wp,  0.0_wp, 0.0_wp, 0.0_wp, &
-                   0.0_wp,  0.5_wp,  0.5_wp,  0.0_wp,  0.0_wp, 0.0_wp, 0.0_wp  &
-                /), (/maxspec,ndc/) )         
-    REAL(wp), DIMENSION(ndm,ndc), PARAMETER ::  PMfrac_table = & !< rel. mass
-                                     RESHAPE( (/ 0.016_wp, 0.000_wp, 0.984_wp, &
-                                                 0.000_wp, 1.000_wp, 0.000_wp, &
-                                                 0.000_wp, 0.000_wp, 1.000_wp, &
-                                                 1.000_wp, 0.000_wp, 1.000_wp  &
-                                              /), (/ndm,ndc/) )                                   
-    REAL(wp), DIMENSION(ndm), PARAMETER ::  sigmag_table = &     !< mode std
-                                            (/1.6_wp, 1.4_wp, 1.7_wp/) 
-    avg_density    = 1.0_wp
-    nb_file        = 0
-    ng_file        = 0
-    nsect_emission = 0.0_wp
-    nz_file        = 0
-    source_ijka    = 0.0_wp
-!
-!-- First gases, if needed:
-    IF ( .NOT. salsa_gases_from_chem )  THEN    
-!       
-!--    Read sources from PIDS_CHEM      
-       INQUIRE( FILE='PIDS_CHEM' // TRIM( coupling_char ), EXIST=netcdf_extend )
-       IF ( .NOT. netcdf_extend )  THEN
-          message_string = 'Input file '// TRIM( 'PIDS_CHEM' ) //              &
-                           TRIM( coupling_char ) // ' for SALSA missing!'
-          CALL message( 'salsa_mod: salsa_set_source', 'SA0027', 1, 2, 0, 6, 0 )                
-       ENDIF   ! netcdf_extend  
-       
-       CALL location_message( '    salsa_set_source: NOTE! Gaseous emissions'//&
-               ' should be provided with following emission indices:'//        &
-               ' 1=H2SO4, 2=HNO3, 3=NH3, 4=OCNV, 5=OCSV', .TRUE. )
-       CALL location_message( '    salsa_set_source: No time dependency for '//&
-                              'gaseous emissions. Use emission_values '//      &
-                              'directly.', .TRUE. )
-!
-!--    Open PIDS_CHEM in read-only mode 
-       CALL open_read_file( 'PIDS_CHEM' // TRIM( coupling_char ), id_fchem )
-!
-!--    Inquire the level of detail (lod)
-       CALL get_attribute( id_fchem, 'lod', lod_gases, .FALSE.,                &
-                           "emission_values" ) 
-                           
-       IF ( lod_gases == 2 )  THEN
-!                              
-!--       Index of gaseous compounds
-          CALL netcdf_data_input_get_dimension_length( id_fchem, ng_file,      &
-                                                       "nspecies" )  
-          IF ( ng_file < 5 )  THEN
-             message_string = 'Some gaseous emissions missing.'
-             CALL message( 'salsa_mod: salsa_set_source', 'SA0041',            &
-                           1, 2, 0, 6, 0 )
-          ENDIF       
-!
-!--       Get number of emission categories  
-          CALL netcdf_data_input_get_dimension_length( id_fchem, ncat, "ncat" )       
-!
-!--       Inquire the unit of gaseous fluxes
-          CALL get_attribute( id_fchem, 'units', unitg, .FALSE.,               &
-                              "emission_values")       
-!
-!--       Inquire the fill value 
-          CALL get_attribute( id_fchem, '_FillValue', fillval, .FALSE.,        &
-                              "emission_values" )
-!        
-!--       Read surface emission data (x,y) PE-wise   
-          ALLOCATE( dum_var_4d(ng_file,ncat,nys:nyn,nxl:nxr) )      
-          CALL get_variable( id_fchem, 'emission_values', dum_var_4d, nxl, nxr,&
-                             nys, nyn, 0, ncat-1, 0, ng_file-1 )
-          DO  g = 1, ngast
-             ALLOCATE( salsa_gas(g)%source(ncat,nys:nyn,nxl:nxr) )
-             salsa_gas(g)%source = 0.0_wp
-             salsa_gas(g)%source = salsa_gas(g)%source + dum_var_4d(g,:,:,:)
-          ENDDO                   
-!   
-!--       Set surface fluxes of gaseous compounds on horizontal surfaces.
-!--       Set fluxes only for either default, land or urban surface.
-          IF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
-             CALL set_gas_flux( surf_def_h(0), ncat, unitg  )
-          ELSE
-             CALL set_gas_flux( surf_lsm_h, ncat, unitg  )
-             CALL set_gas_flux( surf_usm_h, ncat, unitg  )
+          IF ( init )  THEN
+!
+!--          Check existence of PIDS_SALSA file
+             INQUIRE( FILE = input_file_salsa // TRIM( coupling_char ), EXIST = netcdf_extend )
+             IF ( .NOT. netcdf_extend )  THEN
+                message_string = 'Input file '// TRIM( input_file_salsa ) //  TRIM( coupling_char )&
+                                 // ' missing!'
+                CALL message( 'salsa_emission_setup', 'PA0629', 1, 2, 0, 6, 0 )
+             ENDIF
+!
+!--          Open file in read-only mode
+             CALL open_read_file( input_file_salsa // TRIM( coupling_char ), id_salsa )
+!
+!--          Read the index and name of chemical components
+             CALL netcdf_data_input_get_dimension_length( id_salsa, aero_emission_att%ncc,         &
+                                                          'composition_index' )
+             ALLOCATE( aero_emission_att%cc_index(1:aero_emission_att%ncc) )
+             CALL get_variable( id_salsa, 'composition_index', aero_emission_att%cc_index )
+             CALL get_variable( id_salsa, 'composition_name', aero_emission_att%cc_name,           &
+                                aero_emission_att%ncc )
+!
+!--          Find the corresponding chemical components in the model
+             aero_emission_att%cc_input_to_model = 0
+             DO  ic = 1, aero_emission_att%ncc
+                in_name = aero_emission_att%cc_name(ic)
+                SELECT CASE ( TRIM( in_name ) )
+                   CASE ( 'H2SO4', 'h2so4', 'SO4', 'so4' )
+                      aero_emission_att%cc_input_to_model(1) = ic
+                   CASE ( 'OC', 'oc', 'organics' )
+                      aero_emission_att%cc_input_to_model(2) = ic
+                   CASE ( 'BC', 'bc' )
+                      aero_emission_att%cc_input_to_model(3) = ic
+                   CASE ( 'DU', 'du' )
+                      aero_emission_att%cc_input_to_model(4) = ic
+                   CASE ( 'SS', 'ss' )
+                      aero_emission_att%cc_input_to_model(5) = ic
+                   CASE ( 'HNO3', 'hno3', 'NO', 'no' )
+                      aero_emission_att%cc_input_to_model(6) = ic
+                   CASE ( 'NH3', 'nh3', 'NH', 'nh' )
+                      aero_emission_att%cc_input_to_model(7) = ic
+                END SELECT
+
+             ENDDO
+
+             IF ( SUM( aero_emission_att%cc_input_to_model ) == 0 )  THEN
+                message_string = 'None of the aerosol chemical components in ' // TRIM(            &
+                                 input_file_salsa ) // ' correspond to the ones applied in SALSA.'
+                CALL message( 'salsa_emission_setup', 'PA0630', 1, 2, 0, 6, 0 )
+             ENDIF
+!
+!--          Inquire the fill value
+             CALL get_attribute( id_salsa, '_FillValue', aero_emission%fill, .FALSE.,              &
+                                 'aerosol_emission_values' )
+!
+!--          Inquire units of emissions
+             CALL get_attribute( id_salsa, 'units', aero_emission_att%units, .FALSE.,              &
+                                 'aerosol_emission_values' )
+!
+!--          Inquire the level of detail (lod)
+             CALL get_attribute( id_salsa, 'lod', aero_emission_att%lod, .FALSE.,                  &
+                                 'aerosol_emission_values' )
+!
+!--          Variable names
+             CALL inquire_num_variables( id_salsa, aero_emission_att%num_vars )
+             ALLOCATE( aero_emission_att%var_names(1:aero_emission_att%num_vars) )
+             CALL inquire_variable_names( id_salsa, aero_emission_att%var_names )
+
+!
+!--          Read different emission information depending on the level of detail of emissions:
+
+!
+!--          Default mode:
+             IF ( aero_emission_att%lod == 1 )  THEN
+!
+!--             Unit conversion factor: convert to SI units (kg/m2/s)
+                IF ( aero_emission_att%units == 'kg/m2/yr' )  THEN
+                   aero_emission_att%conversion_factor = 1.0_wp / 3600.0_wp
+                ELSEIF ( aero_emission_att%units == 'g/m2/yr' )  THEN
+                   aero_emission_att%conversion_factor = 0.001_wp / 3600.0_wp
+                ELSE
+                   message_string = 'unknown unit for aerosol emissions: ' //                      &
+                                    TRIM( aero_emission_att%units ) // ' (lod1)'
+                   CALL message( 'salsa_emission_setup','PA0631', 1, 2, 0, 6, 0 )
+                ENDIF
+!
+!--             Get number of emission categories and allocate emission arrays
+                CALL netcdf_data_input_get_dimension_length( id_salsa, aero_emission_att%ncat,     &
+                                                             'ncat' )
+                ALLOCATE( aero_emission_att%cat_index(1:aero_emission_att%ncat),                   &
+                          aero_emission_att%rho(1:aero_emission_att%ncat),                         &
+                          aero_emission_att%time_factor(1:aero_emission_att%ncat) )
+!
+!--             Get emission category names and indices
+                CALL get_variable( id_salsa, 'emission_category_name', aero_emission_att%cat_name, &
+                                   aero_emission_att%ncat)
+                CALL get_variable( id_salsa, 'emission_category_index', aero_emission_att%cat_index )
+!
+!--             Find corresponding emission categories
+                DO  in = 1, aero_emission_att%ncat
+                   in_name = aero_emission_att%cat_name(in)
+                   DO  ss = 1, def_modes%ndc
+                      mod_name = def_modes%cat_name_table(ss)
+                      IF ( TRIM( in_name(1:4) ) == TRIM( mod_name(1:4 ) ) )  THEN
+                         def_modes%cat_input_to_model(ss) = in
+                      ENDIF
+                   ENDDO
+                ENDDO
+
+                IF ( SUM( def_modes%cat_input_to_model ) == 0 )  THEN
+                   message_string = 'None of the emission categories in ' //  TRIM(                &
+                                    input_file_salsa ) // ' match with the ones in the model.'
+                   CALL message( 'salsa_emission_setup', 'PA0632', 1, 2, 0, 6, 0 )
+                ENDIF
+!
+!--             Emission time factors: Find check whether emission time factors are given for each
+!--             hour of year OR based on month, day and hour
+!
+!--             For each hour of year:
+                IF ( check_existence( aero_emission_att%var_names, 'nhoursyear' ) )  THEN
+                   CALL netcdf_data_input_get_dimension_length( id_salsa, aero_emission_att%nhoursyear,&
+                                                                'nhoursyear' )
+                   ALLOCATE( aero_emission_att%etf(1:aero_emission_att%ncat,                       &
+                                                   1:aero_emission_att%nhoursyear) )
+                   CALL get_variable( id_salsa, 'emission_time_factors', aero_emission_att%etf,    &
+                                    0, aero_emission_att%nhoursyear-1, 0, aero_emission_att%ncat-1 )
+!
+!--             Based on the month, day and hour:
+                ELSEIF ( check_existence( aero_emission_att%var_names, 'nmonthdayhour' ) )  THEN
+                   CALL netcdf_data_input_get_dimension_length( id_salsa,                          &
+                                                                aero_emission_att%nmonthdayhour,   &
+                                                                'nmonthdayhour' )
+                   ALLOCATE( aero_emission_att%etf(1:aero_emission_att%ncat,                       &
+                                                   1:aero_emission_att%nmonthdayhour) )
+                   CALL get_variable( id_salsa, 'emission_time_factors', aero_emission_att%etf,    &
+                                 0, aero_emission_att%nmonthdayhour-1, 0, aero_emission_att%ncat-1 )
+                ELSE
+                   message_string = 'emission_time_factors should be given for each nhoursyear ' //&
+                                    'OR nmonthdayhour'
+                   CALL message( 'salsa_emission_setup','PA0633', 1, 2, 0, 6, 0 )
+                ENDIF
+!
+!--             Next emission update
+                next_aero_emission_update = MOD( time_utc_init, 3600.0_wp ) - 3600.0_wp
+!
+!--             Get chemical composition (i.e. mass fraction of different species) in aerosols
+                ALLOCATE( aero_emission%def_mass_fracs(1:aero_emission_att%ncat,                   &
+                                                       1:aero_emission_att%ncc) )
+                aero_emission%def_mass_fracs = 0.0_wp
+                CALL get_variable( id_salsa, 'emission_mass_fracs', aero_emission%def_mass_fracs,  &
+                                   0, aero_emission_att%ncc-1, 0, aero_emission_att%ncat-1 )
+!
+!--             If the chemical component is not activated, set its mass fraction to 0 to avoid
+!--             inbalance between number and mass flux
+                cc_i2m = aero_emission_att%cc_input_to_model
+                IF ( index_so4 < 0  .AND.  cc_i2m(1) /= 0 )                                        &
+                                                  aero_emission%def_mass_fracs(:,cc_i2m(1)) = 0.0_wp
+                IF ( index_oc  < 0  .AND.  cc_i2m(2) /= 0 )                                        &
+                                                  aero_emission%def_mass_fracs(:,cc_i2m(2)) = 0.0_wp
+                IF ( index_bc  < 0  .AND.  cc_i2m(3) /= 0 )                                        &
+                                                  aero_emission%def_mass_fracs(:,cc_i2m(3)) = 0.0_wp
+                IF ( index_du  < 0  .AND.  cc_i2m(4) /= 0 )                                        &
+                                                  aero_emission%def_mass_fracs(:,cc_i2m(4)) = 0.0_wp
+                IF ( index_ss  < 0  .AND.  cc_i2m(5) /= 0 )                                        &
+                                                  aero_emission%def_mass_fracs(:,cc_i2m(5)) = 0.0_wp
+                IF ( index_no  < 0  .AND.  cc_i2m(6) /= 0 )                                        &
+                                                  aero_emission%def_mass_fracs(:,cc_i2m(6)) = 0.0_wp
+                IF ( index_nh  < 0  .AND.  cc_i2m(7) /= 0 )                                        &
+                                                  aero_emission%def_mass_fracs(:,cc_i2m(7)) = 0.0_wp
+!
+!--             Then normalise the mass fraction so that SUM = 1
+                DO  in = 1, aero_emission_att%ncat
+                   aero_emission%def_mass_fracs(in,:) = aero_emission%def_mass_fracs(in,:) /       &
+                                                       SUM( aero_emission%def_mass_fracs(in,:) )
+                ENDDO
+!
+!--             Calculate average mass density (kg/m3)
+                aero_emission_att%rho = 0.0_wp
+
+                IF ( cc_i2m(1) /= 0 )  aero_emission_att%rho = aero_emission_att%rho +  arhoh2so4 *&
+                                                           aero_emission%def_mass_fracs(:,cc_i2m(1))
+                IF ( cc_i2m(2) /= 0 )  aero_emission_att%rho = aero_emission_att%rho + arhooc *    &
+                                                           aero_emission%def_mass_fracs(:,cc_i2m(2))
+                IF ( cc_i2m(3) /= 0 )  aero_emission_att%rho = aero_emission_att%rho + arhobc *    &
+                                                           aero_emission%def_mass_fracs(:,cc_i2m(3))
+                IF ( cc_i2m(4) /= 0 )  aero_emission_att%rho = aero_emission_att%rho + arhodu *    &
+                                                           aero_emission%def_mass_fracs(:,cc_i2m(4))
+                IF ( cc_i2m(5) /= 0 )  aero_emission_att%rho = aero_emission_att%rho + arhoss *    &
+                                                           aero_emission%def_mass_fracs(:,cc_i2m(5))
+                IF ( cc_i2m(6) /= 0 )  aero_emission_att%rho = aero_emission_att%rho + arhohno3 *  &
+                                                           aero_emission%def_mass_fracs(:,cc_i2m(6))
+                IF ( cc_i2m(7) /= 0 )  aero_emission_att%rho = aero_emission_att%rho + arhonh3 *   &
+                                                           aero_emission%def_mass_fracs(:,cc_i2m(7))
+!
+!--             Allocate and read surface emission data (in total PM)
+                ALLOCATE( aero_emission%def_data(nys:nyn,nxl:nxr,1:aero_emission_att%ncat) )
+                CALL get_variable( id_salsa, 'aerosol_emission_values', aero_emission%def_data,    &
+                                   0, aero_emission_att%ncat-1, nxl, nxr, nys, nyn )
+
+!
+!--          Pre-processed mode
+             ELSEIF ( aero_emission_att%lod == 2 )  THEN
+!
+!--             Unit conversion factor: convert to SI units (#/m2/s)
+                IF ( aero_emission_att%units == '#/m2/s' )  THEN
+                   aero_emission_att%conversion_factor = 1.0_wp
+                ELSE
+                   message_string = 'unknown unit for aerosol emissions: ' //                      &
+                                    TRIM( aero_emission_att%units )
+                   CALL message( 'salsa_emission_setup','PA0634', 1, 2, 0, 6, 0 )
+                ENDIF
+!
+!--             Number of aerosol size bins in the emission data
+                CALL netcdf_data_input_get_dimension_length( id_salsa, aero_emission_att%nbins,    &
+                                                             'Dmid' )
+                IF ( aero_emission_att%nbins /= nbins_aerosol )  THEN
+                   message_string = 'The number of size bins in aerosol input data does not ' //   &
+                                    'correspond to the model set-up'
+                   CALL message( 'salsa_emission_setup','PA0635', 1, 2, 0, 6, 0 )
+                ENDIF
+!
+!--             Number of time steps in the emission data
+                CALL netcdf_data_input_get_dimension_length( id_salsa, aero_emission_att%nt, 'time')
+!
+!--             Allocate bin diameters, time and mass fraction array
+                ALLOCATE( aero_emission_att%dmid(1:nbins_aerosol),                                 &
+                          aero_emission_att%time(1:aero_emission_att%nt),                          &
+                          aero_emission%preproc_mass_fracs(1:aero_emission_att%ncc) )
+!
+!--             Read mean diameters
+                CALL get_variable( id_salsa, 'Dmid', aero_emission_att%dmid )
+!
+!--             Check whether the sectional representation of the aerosol size distribution conform
+!--             to the one applied in the model
+                IF ( ANY( ABS( ( aero(1:nbins_aerosol)%dmid - aero_emission_att%dmid ) /           &
+                               aero(1:nbins_aerosol)%dmid ) > 0.1_wp )  )  THEN
+                   message_string = 'Mean diameters of size bins in ' // TRIM( input_file_salsa )  &
+                                    // ' do not match with the ones in the model.'
+                   CALL message( 'salsa_emission_setup','PA0636', 1, 2, 0, 6, 0 )
+                ENDIF
+!
+!--             Read time stamps:
+                CALL get_variable( id_salsa, 'time', aero_emission_att%time )
+!
+!--             Read emission mass fractions
+                CALL get_variable( id_salsa, 'emission_mass_fracs', aero_emission%preproc_mass_fracs )
+!
+!--             If the chemical component is not activated, set its mass fraction to 0
+                cc_i2m = aero_emission_att%cc_input_to_model
+                IF ( index_so4 < 0  .AND.  cc_i2m(1) /= 0 )                                        &
+                   aero_emission%preproc_mass_fracs(cc_i2m(1)) = 0.0_wp
+                IF ( index_oc  < 0  .AND.  cc_i2m(2) /= 0 )                                        &
+                   aero_emission%preproc_mass_fracs(cc_i2m(2)) = 0.0_wp
+                IF ( index_bc  < 0  .AND.  cc_i2m(3) /= 0 )                                        &
+                   aero_emission%preproc_mass_fracs(cc_i2m(3)) = 0.0_wp
+                IF ( index_du  < 0  .AND.  cc_i2m(4) /= 0 )                                        &
+                   aero_emission%preproc_mass_fracs(cc_i2m(4)) = 0.0_wp
+                IF ( index_ss  < 0  .AND.  cc_i2m(5) /= 0 )                                        &
+                   aero_emission%preproc_mass_fracs(cc_i2m(5)) = 0.0_wp
+                IF ( index_no  < 0  .AND.  cc_i2m(6) /= 0 )                                        &
+                   aero_emission%preproc_mass_fracs(cc_i2m(6)) = 0.0_wp
+                IF ( index_nh  < 0  .AND.  cc_i2m(7) /= 0 )                                        &
+                   aero_emission%preproc_mass_fracs(cc_i2m(7)) = 0.0_wp
+!
+!--             Then normalise the mass fraction so that SUM = 1
+                aero_emission%preproc_mass_fracs = aero_emission%preproc_mass_fracs /              &
+                                                   SUM( aero_emission%preproc_mass_fracs )
+
+             ELSE
+                message_string = 'Unknown lod for aerosol_emission_values.'
+                CALL message( 'salsa_emission','PA0637', 1, 2, 0, 6, 0 )
+             ENDIF
+
+          ENDIF  ! init
+!
+!--       Define and set current emission values:
+!
+!--       Default type emissions (aerosol emission given as total mass emission per year):
+          IF ( aero_emission_att%lod == 1 )  THEN
+!
+!--          Emission time factors for each emission category at current time step
+             IF ( aero_emission_att%nhoursyear > aero_emission_att%nmonthdayhour )  THEN
+!
+!--             Get the index of the current hour
+                CALL time_default_indices( month_of_year, day_of_month, hour_of_day, index_hh )
+                aero_emission_att%time_factor = aero_emission_att%etf(:,index_hh)
+
+             ELSEIF ( aero_emission_att%nhoursyear < aero_emission_att%nmonthdayhour )  THEN
+!
+!--             Get the index of current hour (index_hh) (TODO: Now "workday" is always assumed.
+!--             Needs to be calculated.)
+                CALL time_default_indices( daytype, month_of_year, day_of_month, hour_of_day,      &
+                                           index_mm, index_dd, index_hh )
+                aero_emission_att%time_factor = aero_emission_att%etf(:,index_mm) *                &
+                                                aero_emission_att%etf(:,index_dd) *                &
+                                                aero_emission_att%etf(:,index_hh)
+             ENDIF
+
+!
+!--          Create a sectional number size distribution for emissions
+             ALLOCATE( nsect_emission(1:nbins_aerosol),source_array(nys:nyn,nxl:nxr,1:nbins_aerosol) )
+             DO  in = 1, aero_emission_att%ncat
+
+                inn = def_modes%cat_input_to_model(in)
+!
+!--             Calculate the number concentration (1/m3) of a log-normal size distribution 
+!--             following Jacobson (2005): Eq 13.25.
+                def_modes%ntot_table = 6.0_wp * def_modes%pm_frac_table(:,inn) / ( pi *            &
+                                       ( def_modes%dpg_table )**3 *  EXP( 4.5_wp *                 &
+                                       LOG( def_modes%sigmag_table )**2 ) )
+!
+!--             Sectional size distibution (1/m3) from a log-normal one
+                CALL size_distribution( def_modes%ntot_table, def_modes%dpg_table,                 &
+                                        def_modes%sigmag_table, nsect_emission )
+
+                source_array = 0.0_wp
+                DO  ib = 1, nbins_aerosol
+                   source_array(:,:,ib) = aero_emission%def_data(:,:,in) *                         &
+                                          aero_emission_att%conversion_factor /                    &
+                                          aero_emission_att%rho(in) * nsect_emission(ib) *         &
+                                          aero_emission_att%time_factor(in)
+                ENDDO
+!
+!--             Set surface fluxes of aerosol number and mass on horizontal surfaces. Set fluxes
+!--             only for either default, land or urban surface.
+                IF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
+                   CALL set_flux( surf_def_h(0), aero_emission_att%cc_input_to_model,              &
+                                  aero_emission%def_mass_fracs(in,:), source_array )
+                ELSE
+                   CALL set_flux( surf_usm_h, aero_emission_att%cc_input_to_model,                 &
+                                  aero_emission%def_mass_fracs(in,:), source_array )
+                   CALL set_flux( surf_lsm_h, aero_emission_att%cc_input_to_model,                 &
+                                  aero_emission%def_mass_fracs(in,:), source_array )
+                ENDIF
+             ENDDO
+!
+!--          The next emission update is again after one hour
+             next_aero_emission_update = next_aero_emission_update + 3600.0_wp
+
+
+             DEALLOCATE( source_array )
+!
+!--       Pre-processed:
+          ELSEIF ( aero_emission_att%lod == 2 )  THEN
+!
+!--          Obtain time index for current input starting at 0.
+!--          @todo: At the moment emission data and simulated time correspond to each other.
+             aero_emission_att%tind = MINLOC( ABS( aero_emission_att%time -                        &
+                                                   time_since_reference_point ), DIM = 1 ) - 1
+!
+!--          Allocate the data input array always before reading in the data and deallocate after
+             ALLOCATE( aero_emission%preproc_data(nys:nyn,nxl:nxr,1:nbins_aerosol) )
+!
+!--          Read in the next time step
+             CALL get_variable( id_salsa, 'aerosol_emission_values', aero_emission%preproc_data,&
+                                aero_emission_att%tind, 0, nbins_aerosol-1, nxl, nxr, nys, nyn )
+!
+!--          Set surface fluxes of aerosol number and mass on horizontal surfaces. Set fluxes only
+!--          for either default, land and urban surface.
+             IF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
+                CALL set_flux( surf_def_h(0), aero_emission_att%cc_input_to_model,                 &
+                               aero_emission%preproc_mass_fracs, aero_emission%preproc_data )
+             ELSE
+                CALL set_flux( surf_usm_h, aero_emission_att%cc_input_to_model,                    &
+                               aero_emission%preproc_mass_fracs, aero_emission%preproc_data )
+                CALL set_flux( surf_lsm_h, aero_emission_att%cc_input_to_model,                    &
+                               aero_emission%preproc_mass_fracs, aero_emission%preproc_data )
+             ENDIF
+!
+!--          Determine the next emission update
+             next_aero_emission_update = aero_emission_att%time(aero_emission_att%tind+2)
+
+             DEALLOCATE( aero_emission%preproc_data )
+
           ENDIF
-          
-          DEALLOCATE( dum_var_4d )
-          DO  g = 1, ngast
-             DEALLOCATE( salsa_gas(g)%source )
-          ENDDO
-       ELSE
-          message_string = 'Input file PIDS_CHEM needs to have lod = 2 when '//&
-                           'SALSA is applied but not the chemistry module!'
-          CALL message( 'salsa_mod: salsa_set_source', 'SA0039', 1, 2, 0, 6, 0 )    
-       ENDIF             
-    ENDIF 
-!       
-!-- Read sources from PIDS_SALSA        
-    INQUIRE( FILE='PIDS_SALSA' // TRIM( coupling_char ), EXIST=netcdf_extend )
-    IF ( .NOT. netcdf_extend )  THEN
-       message_string = 'Input file '// TRIM( 'PIDS_SALSA' ) //                &
-                         TRIM( coupling_char ) // ' for SALSA missing!'
-       CALL message( 'salsa_mod: salsa_set_source', 'SA0034', 1, 2, 0, 6, 0 )                
-    ENDIF   ! netcdf_extend      
-!
-!-- Open file in read-only mode     
-    CALL open_read_file( 'PIDS_SALSA' // TRIM( coupling_char ), id_faero )
-!
-!-- Get number of emission categories and their indices       
-    CALL netcdf_data_input_get_dimension_length( id_faero, ncat, "ncat" ) 
-!
-!-- Get emission category indices
-    ALLOCATE( eci(1:ncat) )
-    CALL get_variable( id_faero, 'emission_category_index', eci ) 
-!
-!-- Inquire the level of detail (lod)
-    CALL get_attribute( id_faero, 'lod', lod_aero, .FALSE.,                    &
-                        "aerosol_emission_values" ) 
-                            
-    IF ( lod_aero < 3  .AND.  ibc_salsa_b  == 0 ) THEN
-       message_string = 'lod1/2 for aerosol emissions requires '//             &
-                        'bc_salsa_b = "Neumann"'
-       CALL message( 'salsa_mod: salsa_set_source','SA0025', 1, 2, 0, 6, 0 )
-    ENDIF
-!
-!-- Inquire the fill value 
-    CALL get_attribute( id_faero, '_FillValue', fillval, .FALSE.,              &
-                        "aerosol_emission_values" )
-!
-!-- Aerosol chemical composition:
-    ALLOCATE( emission_mass_fracs(1:ncat,1:maxspec) )
-    emission_mass_fracs = 0.0_wp
-!-- Chemical composition: 1: H2SO4 (sulphuric acid), 2: OC (organic carbon), 
-!--                       3: BC (black carbon), 4: DU (dust),  
-!--                       5: SS (sea salt),     6: HNO3 (nitric acid), 
-!--                       7: NH3 (ammonia)
-    DO  n = 1, ncat
-       IF  ( lod_aero < 2 )  THEN
-          emission_mass_fracs(n,:) = mass_fraction_table(:,n)
-       ELSE
-          CALL get_variable( id_faero, "emission_mass_fracs",                  &
-                             emission_mass_fracs(n,:) )
-       ENDIF 
-!
-!--    If the chemical component is not activated, set its mass fraction to 0
-!--    to avoid inbalance between number and mass flux
-       IF ( iso4 < 0 )  emission_mass_fracs(n,1) = 0.0_wp
-       IF ( ioc  < 0 )  emission_mass_fracs(n,2) = 0.0_wp
-       IF ( ibc  < 0 )  emission_mass_fracs(n,3) = 0.0_wp
-       IF ( idu  < 0 )  emission_mass_fracs(n,4) = 0.0_wp
-       IF ( iss  < 0 )  emission_mass_fracs(n,5) = 0.0_wp
-       IF ( ino  < 0 )  emission_mass_fracs(n,6) = 0.0_wp
-       IF ( inh  < 0 )  emission_mass_fracs(n,7) = 0.0_wp
-!--    Then normalise the mass fraction so that SUM = 1                   
-       emission_mass_fracs(n,:) = emission_mass_fracs(n,:) /                   &
-                                  SUM( emission_mass_fracs(n,:) )
-    ENDDO
-    
-    IF ( lod_aero > 1 )  THEN
-!
-!--    Aerosol geometric mean diameter  
-       CALL netcdf_data_input_get_dimension_length( id_faero, nb_file, 'Dmid' )     
-       IF ( nb_file /= nbins )  THEN
-          message_string = 'The number of size bins in aerosol input data '//  &
-                           'does not correspond to the model set-up'
-          CALL message( 'salsa_mod: salsa_set_source','SA0040', 1, 2, 0, 6, 0 )
-       ENDIF
-    ENDIF
-
-    IF ( lod_aero < 3 )  THEN
-       CALL location_message( '    salsa_set_source: No time dependency for '//&
-                             'aerosol emissions. Use aerosol_emission_values'//&
-                             ' directly.', .TRUE. )
-!
-!--    Allocate source arrays 
-       DO  b = 1, nbins
-          ALLOCATE( aerosol_number(b)%source(1:ncat,nys:nyn,nxl:nxr) )
-          aerosol_number(b)%source = 0.0_wp
-       ENDDO 
-       DO  c = 1, ncc_tot*nbins
-          ALLOCATE( aerosol_mass(c)%source(1:ncat,nys:nyn,nxl:nxr) )
-          aerosol_mass(c)%source = 0.0_wp
-       ENDDO
-       
-       IF ( lod_aero == 1 )  THEN
-          DO  n = 1, ncat
-             avg_density(n) = emission_mass_fracs(n,1) * arhoh2so4 +           &
-                              emission_mass_fracs(n,2) * arhooc +              &
-                              emission_mass_fracs(n,3) * arhobc +              &
-                              emission_mass_fracs(n,4) * arhodu +              &
-                              emission_mass_fracs(n,5) * arhoss +              &
-                              emission_mass_fracs(n,6) * arhohno3 +            &
-                              emission_mass_fracs(n,7) * arhonh3
-          ENDDO    
-!
-!--       Emission unit
-          CALL get_attribute( id_faero, 'units', unita, .FALSE.,               &
-                              "aerosol_emission_values")
-          conversion_factor = 1.0_wp
-          IF  ( unita == 'kg/m2/yr' )  THEN
-             conversion_factor = 3.170979e-8_wp / avg_density
-          ELSEIF  ( unita == 'g/m2/yr' )  THEN
-             conversion_factor = 3.170979e-8_wp * 1.0E-3_wp / avg_density
-          ELSEIF  ( unita == 'kg/m2/s' )  THEN
-             conversion_factor = 1.0_wp / avg_density
-          ELSEIF  ( unita == 'g/m2/s' )  THEN
-             conversion_factor = 1.0E-3_wp / avg_density
-          ELSE 
-             message_string = 'unknown unit for aerosol emissions: '           &
-                              // TRIM( unita ) // ' (lod1)'
-             CALL message( 'salsa_mod: salsa_set_source','SA0035',             &
-                           1, 2, 0, 6, 0 )
-          ENDIF
-!        
-!--       Read surface emission data (x,y) PE-wise  
-          ALLOCATE( pm_emission(ncat,nys:nyn,nxl:nxr) )
-          CALL get_variable( id_faero, 'aerosol_emission_values', pm_emission, &
-                             nxl, nxr, nys, nyn, 0, ncat-1 )
-          DO  ni = 1, SIZE( eci )
-             n = eci(ni)
-!
-!--          Calculate the number concentration of a log-normal size 
-!--          distribution following Jacobson (2005): Eq 13.25.
-             ntot_table = 6.0_wp * PMfrac_table(:,n) / ( pi * dpg_table**3 *   &
-                          EXP( 4.5_wp * LOG( sigmag_table )**2 ) ) * 1.0E+12_wp
-!                          
-!--          Sectional size distibution from a log-normal one                          
-             CALL size_distribution( ntot_table, dpg_table, sigmag_table,      &
-                                     nsect_emission )
-             DO  b = 1, nbins
-                aerosol_number(b)%source(ni,:,:) =                             &
-                                    aerosol_number(b)%source(ni,:,:) +         &
-                                    pm_emission(ni,:,:) * conversion_factor(n) &
-                                    * nsect_emission(b) 
-             ENDDO
-          ENDDO
-       ELSEIF ( lod_aero == 2 )  THEN             
-!        
-!--       Read surface emission data (x,y) PE-wise   
-          ALLOCATE( dum_var_4d(nb_file,ncat,nys:nyn,nxl:nxr) )
-          CALL get_variable( id_faero, 'aerosol_emission_values', dum_var_4d,  &
-                             nxl, nxr, nys, nyn, 0, ncat-1, 0, nb_file-1 )
-          DO  b = 1, nbins
-             aerosol_number(b)%source = dum_var_4d(b,:,:,:)
-          ENDDO
-          DEALLOCATE( dum_var_4d )
-       ENDIF
-!   
-!--    Set surface fluxes of aerosol number and mass on horizontal surfaces.
-!--    Set fluxes only for either default, land or urban surface.
-       IF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
-          CALL set_flux( surf_def_h(0), ncat )
-       ELSE
-          CALL set_flux( surf_usm_h, ncat )
-          CALL set_flux( surf_lsm_h, ncat )
-       ENDIF
-          
-    ELSEIF ( lod_aero == 3 )  THEN
-!
-!--    Inquire aerosol emission rate per bin (#/(m3s))
-       nc_stat = NF90_INQ_VARID( id_faero, "aerosol_emission_values", id_sa )
-  
-!
-!--    Emission time step
-       CALL netcdf_data_input_get_dimension_length( id_faero, n_dt,            &
-                                                    'dt_emission' ) 
-       IF ( n_dt > 1 )  THEN
-          CALL location_message( '    salsa_set_source: hourly emission data'//&
-                                 ' provided but currently the value of the '// &
-                                 ' first hour is applied.', .TRUE. )
-       ENDIF
-!
-!--    Allocate source arrays 
-       DO  b = 1, nbins
-          ALLOCATE( aerosol_number(b)%source(nzb:nzt+1,nys:nyn,nxl:nxr) )
-          aerosol_number(b)%source = 0.0_wp
-       ENDDO
-       DO  c = 1, ncc_tot*nbins
-          ALLOCATE( aerosol_mass(c)%source(nzb:nzt+1,nys:nyn,nxl:nxr) )
-          aerosol_mass(c)%source = 0.0_wp
-       ENDDO
-!
-!--    Get dimension of z-axis:      
-       CALL netcdf_data_input_get_dimension_length( id_faero, nz_file, 'z' )
-!        
-!--    Read surface emission data (x,y) PE-wise             
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
-             DO  k = 0, nz_file-1
-!
-!--             Predetermine flag to mask topography                                 
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i), 0 ))
-!                                             
-!--             No sources inside buildings !                                          
-                IF ( flag == 0.0_wp )  CYCLE                          
-! 
-!--             Read volume source:
-                nc_stat = NF90_GET_VAR( id_faero, id_sa, source_ijka,          &
-                                        start = (/ i+1, j+1, k+1, 1, 1 /),     &
-                                        count = (/ 1, 1, 1, 1, nb_file /) )
-                IF ( nc_stat /= NF90_NOERR )  THEN
-                   message_string = 'error in aerosol emissions: lod3'
-                   CALL message( 'salsa_mod: salsa_set_source','SA0038', 1, 2, &
-                                 0, 6, 0 )
+
+#else
+          message_string = 'salsa_emission_mode = "read_from_file", but preprocessor directive ' //&
+                           ' __netcdf is not used in compiling!'
+          CALL message( 'salsa_emission_setup', 'PA0638', 1, 2, 0, 6, 0 )
+
+#endif
+       CASE DEFAULT
+          message_string = 'unknown salsa_emission_mode: ' // TRIM( salsa_emission_mode )
+          CALL message( 'salsa_emission_setup', 'PA0639', 1, 2, 0, 6, 0 )
+
+    END SELECT
+
+    CONTAINS
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Sets the aerosol flux to aerosol arrays in 2a and 2b.
+!------------------------------------------------------------------------------!
+    SUBROUTINE set_flux( surface, cc_i_mod, mass_fracs, source_array )
+
+       USE arrays_3d,                                                                              &
+           ONLY:  rho_air_zw
+
+       USE surface_mod,                                                                            &
+           ONLY:  surf_type
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i   !< loop index
+       INTEGER(iwp) ::  ib  !< loop index
+       INTEGER(iwp) ::  ic  !< loop index
+       INTEGER(iwp) ::  j   !< loop index
+       INTEGER(iwp) ::  k   !< loop index
+       INTEGER(iwp) ::  m   !< running index for surface elements
+
+       INTEGER(iwp), DIMENSION(:) ::  cc_i_mod   !< index of chemical component in the input data
+
+       REAL(wp) ::  so4_oc  !< mass fraction between SO4 and OC in 1a
+
+       REAL(wp), DIMENSION(:), INTENT(in) ::  mass_fracs  !< mass fractions of chemical components
+
+       REAL(wp), DIMENSION(nys:nyn,nxl:nxr,1:nbins_aerosol), INTENT(inout) ::  source_array  !<
+
+       TYPE(surf_type), INTENT(inout) :: surface  !< respective surface type
+
+       so4_oc = 0.0_wp
+
+       DO  m = 1, surface%ns
+!
+!--       Get indices of respective grid point
+          i = surface%i(m)
+          j = surface%j(m)
+          k = surface%k(m)
+
+          DO  ib = 1, nbins_aerosol
+             IF ( source_array(j,i,ib) < nclim )  THEN
+                source_array(j,i,ib) = 0.0_wp
+             ENDIF
+!
+!--          Set mass fluxes.  First bins include only SO4 and/or OC.
+             IF ( ib <= end_subrange_1a )  THEN
+!
+!--             Both sulphate and organic carbon
+                IF ( index_so4 > 0  .AND.  index_oc > 0 )  THEN
+
+                   ic = ( index_so4 - 1 ) * nbins_aerosol + ib
+                   so4_oc = mass_fracs(cc_i_mod(1)) / ( mass_fracs(cc_i_mod(1)) +                  &
+                                                        mass_fracs(cc_i_mod(2)) )
+                   surface%amsws(m,ic) = surface%amsws(m,ic) + so4_oc * source_array(j,i,ib)       &
+                                         * api6 * aero(ib)%dmid**3 * arhoh2so4 * rho_air_zw(k-1)
+                   aerosol_mass(ic)%source(j,i) = aerosol_mass(ic)%source(j,i) + surface%amsws(m,ic)
+
+                   ic = ( index_oc - 1 ) * nbins_aerosol + ib
+                   surface%amsws(m,ic) = surface%amsws(m,ic) + ( 1-so4_oc ) * source_array(j,i,ib) &
+                                         * api6 * aero(ib)%dmid**3 * arhooc * rho_air_zw(k-1)
+                   aerosol_mass(ic)%source(j,i) = aerosol_mass(ic)%source(j,i) + surface%amsws(m,ic)
+!
+!--             Only sulphates
+                ELSEIF ( index_so4 > 0  .AND.  index_oc < 0 )  THEN
+                   ic = ( index_so4 - 1 ) * nbins_aerosol + ib
+                   surface%amsws(m,ic) = surface%amsws(m,ic) + source_array(j,i,ib) * api6 *       &
+                                         aero(ib)%dmid**3 * arhoh2so4 * rho_air_zw(k-1)
+                   aerosol_mass(ic)%source(j,i) = aerosol_mass(ic)%source(j,i) + surface%amsws(m,ic)
+!
+!--             Only organic carbon
+                ELSEIF ( index_so4 < 0  .AND.  index_oc > 0 )  THEN
+                   ic = ( index_oc - 1 ) * nbins_aerosol + ib
+                   surface%amsws(m,ic) = surface%amsws(m,ic) + source_array(j,i,ib) * api6 *       &
+                                         aero(ib)%dmid**3 * arhooc * rho_air_zw(k-1)
+                   aerosol_mass(ic)%source(j,i) = aerosol_mass(ic)%source(j,i) + surface%amsws(m,ic)
                 ENDIF
-!       
-!--             Set mass fluxes.  First bins include only SO4 and/or OC. Call 
-!--             subroutine set_mass_source for larger bins.                            
-!
-!--             Sulphate and organic carbon
-                IF ( iso4 > 0  .AND.  ioc > 0 ) THEN                 
-!--                First sulphate:                     
-                   ss = ( iso4 - 1 ) * nbins + in1a   ! start
-                   ee = ( iso4 - 1 ) * nbins + fn1a   ! end
-                   b = in1a            
-                   DO  c = ss, ee
-                      IF ( source_ijka(b) /= fillval )                         &
-                      aerosol_mass(c)%source(k,j,i) =                          &
-                         aerosol_mass(c)%source(k,j,i) +                       &
-                         emission_mass_fracs(1,1) / ( emission_mass_fracs(1,1) &
-                         + emission_mass_fracs(1,2) ) * source_ijka(b) *       &
-                         aero(b)%core * arhoh2so4 
-                      b = b+1
-                   ENDDO                  
-!--                Then organic carbon:                      
-                   ss = ( ioc - 1 ) * nbins + in1a   ! start
-                   ee = ( ioc - 1 ) * nbins + fn1a   ! end 
-                   b = in1a
-                   DO  c = ss, ee 
-                      IF ( source_ijka(b) /= fillval )                         &
-                      aerosol_mass(c)%source(k,j,i) =                          &
-                         aerosol_mass(c)%source(k,j,i) +                       &
-                         emission_mass_fracs(1,2) / ( emission_mass_fracs(1,1) &
-                         + emission_mass_fracs(1,2) ) * source_ijka(b) *       &
-                         aero(b)%core * arhooc 
-                      b = b+1
-                   ENDDO
-                   
-                   CALL set_mass_source( k, j, i, iso4,                        &
-                                        emission_mass_fracs(1,1), arhoh2so4,   &
-                                        source_ijka, fillval )
-                   CALL set_mass_source( k, j, i, ioc, emission_mass_fracs(1,2),&
-                                         arhooc, source_ijka, fillval )                      
-!--             Only sulphate:                                             
-                ELSEIF ( iso4 > 0  .AND.  ioc < 0 ) THEN                    
-                   ss = ( iso4 - 1 ) * nbins + in1a   ! start
-                   ee = ( iso4 - 1 ) * nbins + fn1a   ! end
-                   b = in1a            
-                   DO  c = ss, ee
-                      IF ( source_ijka(b) /= fillval )                         &
-                      aerosol_mass(c)%source(k,j,i) =                          &
-                         aerosol_mass(c)%source(k,j,i) + source_ijka(b) *      &
-                         aero(b)%core * arhoh2so4 
-                      b = b+1
-                   ENDDO 
-                   CALL set_mass_source( k, j, i, iso4,                        &
-                                        emission_mass_fracs(1,1), arhoh2so4,   &
-                                        source_ijka, fillval )    
-!--             Only organic carbon:                                            
-                ELSEIF ( iso4 < 0  .AND.  ioc > 0 ) THEN                    
-                   ss = ( ioc - 1 ) * nbins + in1a   ! start
-                   ee = ( ioc - 1 ) * nbins + fn1a   ! end 
-                   b = in1a
-                   DO  c = ss, ee 
-                      IF ( source_ijka(b) /= fillval )                         &
-                      aerosol_mass(c)%source(k,j,i) =                          &
-                         aerosol_mass(c)%source(k,j,i) + source_ijka(b)  *     &
-                         aero(b)%core * arhooc 
-                      b = b+1
-                   ENDDO 
-                   CALL set_mass_source( k, j, i, ioc, emission_mass_fracs(1,2),&
-                                         arhooc,  source_ijka, fillval )                                    
+
+             ELSE
+!
+!--             Sulphate
+                IF ( index_so4 > 0 )  THEN
+                   ic = cc_i_mod(1)
+                   CALL set_mass_flux( surface, m, ib, index_so4, mass_fracs(ic), arhoh2so4,       &
+                                       source_array(j,i,ib) )
                 ENDIF
+!
+!--             Organic carbon
+                IF ( index_oc > 0 )  THEN
+                   ic = cc_i_mod(2)
+                   CALL set_mass_flux( surface, m, ib, index_oc, mass_fracs(ic),arhooc,            &
+                                       source_array(j,i,ib) )
+                ENDIF
+!
 !--             Black carbon
-                IF ( ibc > 0 ) THEN
-                   CALL set_mass_source( k, j, i, ibc, emission_mass_fracs(1,3),&
-                                         arhobc, source_ijka, fillval )
+                IF ( index_bc > 0 )  THEN
+                   ic = cc_i_mod(3)
+                   CALL set_mass_flux( surface, m, ib, index_bc, mass_fracs(ic), arhobc,           &
+                                       source_array(j,i,ib) )
                 ENDIF
+!
 !--             Dust
-                IF ( idu > 0 ) THEN
-                   CALL set_mass_source( k, j, i, idu, emission_mass_fracs(1,4),&
-                                         arhodu, source_ijka, fillval )
+                IF ( index_du > 0 )  THEN
+                   ic = cc_i_mod(4)
+                   CALL set_mass_flux( surface, m, ib, index_du, mass_fracs(ic), arhodu,           &
+                                       source_array(j,i,ib) )
                 ENDIF
+!
 !--             Sea salt
-                IF ( iss > 0 ) THEN
-                   CALL set_mass_source( k, j, i, iss, emission_mass_fracs(1,5),&
-                                         arhoss, source_ijka, fillval )
+                IF ( index_ss > 0 )  THEN
+                   ic = cc_i_mod(5)
+                   CALL set_mass_flux( surface, m, ib, index_ss, mass_fracs(ic), arhoss,           &
+                                       source_array(j,i,ib) )
                 ENDIF
+!
 !--             Nitric acid
-                IF ( ino > 0 ) THEN
-                   CALL set_mass_source( k, j, i, ino, emission_mass_fracs(1,6),&
-                                         arhohno3, source_ijka, fillval )
+                IF ( index_no > 0 )  THEN
+                    ic = cc_i_mod(6)
+                   CALL set_mass_flux( surface, m, ib, index_no, mass_fracs(ic), arhohno3,         &
+                                       source_array(j,i,ib) )
                 ENDIF
+!
 !--             Ammonia
-                IF ( inh > 0 ) THEN
-                   CALL set_mass_source( k, j, i, inh, emission_mass_fracs(1,7),&
-                                         arhonh3, source_ijka, fillval )
+                IF ( index_nh > 0 )  THEN
+                    ic = cc_i_mod(7)
+                   CALL set_mass_flux( surface, m, ib, index_nh, mass_fracs(ic), arhonh3,          &
+                                       source_array(j,i,ib) )
                 ENDIF
-!                             
-!--             Save aerosol number sources in the end                            
-                DO  b = 1, nbins
-                   IF ( source_ijka(b) /= fillval )                            &
-                   aerosol_number(b)%source(k,j,i) =                           &
-                      aerosol_number(b)%source(k,j,i) + source_ijka(b)
-                ENDDO                     
-             ENDDO    ! k
-          ENDDO    ! j
-       ENDDO    ! i
-
-    ELSE      
-       message_string = 'NetCDF attribute lod is not set properly.'
-       CALL message( 'salsa_mod: salsa_set_source','SA0026', 1, 2, 0, 6, 0 )
-    ENDIF 
- 
-#endif    
- END SUBROUTINE salsa_set_source
- 
+
+             ENDIF
+!
+!--          Save number fluxes in the end
+             surface%answs(m,ib) = surface%answs(m,ib) + source_array(j,i,ib) * rho_air_zw(k-1)
+             aerosol_number(ib)%source(j,i) = aerosol_number(ib)%source(j,i) + surface%answs(m,ib)
+
+          ENDDO  ! ib
+       ENDDO  ! m
+
+    END SUBROUTINE set_flux
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Sets the mass emissions to aerosol arrays in 2a and 2b.
+!------------------------------------------------------------------------------!
+    SUBROUTINE set_mass_flux( surface, surf_num, ib, ispec, mass_frac, prho, nsource )
+
+       USE arrays_3d,                                                                              &
+           ONLY:  rho_air_zw
+
+       USE surface_mod,                                                                            &
+           ONLY:  surf_type
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i   !< loop index
+       INTEGER(iwp) ::  j   !< loop index
+       INTEGER(iwp) ::  k   !< loop index
+       INTEGER(iwp) ::  ic  !< loop index
+
+       INTEGER(iwp), INTENT(in) :: ib        !< Aerosol size bin index
+       INTEGER(iwp), INTENT(in) :: ispec     !< Aerosol species index
+       INTEGER(iwp), INTENT(in) :: surf_num  !< index surface elements
+
+       REAL(wp), INTENT(in) ::  mass_frac    !< mass fraction of a chemical compound in all bins
+       REAL(wp), INTENT(in) ::  nsource      !< number source (#/m2/s)
+       REAL(wp), INTENT(in) ::  prho         !< Aerosol density
+
+       TYPE(surf_type), INTENT(inout) ::  surface  !< respective surface type
+!
+!--    Get indices of respective grid point
+       i = surface%i(surf_num)
+       j = surface%j(surf_num)
+       k = surface%k(surf_num)
+!
+!--    Subrange 2a:
+       ic = ( ispec - 1 ) * nbins_aerosol + ib
+       surface%amsws(surf_num,ic) = surface%amsws(surf_num,ic) + mass_frac * nsource *             &
+                                    aero(ib)%core * prho * rho_air_zw(k-1)
+       aerosol_mass(ic)%source(j,i) = aerosol_mass(ic)%source(j,i) + surface%amsws(surf_num,ic)
+!
+!--    Subrange 2b:
+       IF ( .NOT. no_insoluble )  THEN
+          CALL location_message( '    salsa_mass_flux: All emissions are soluble!', .TRUE. )
+       ENDIF
+
+    END SUBROUTINE set_mass_flux
+
+ END SUBROUTINE salsa_emission_setup
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -8355,322 +8626,349 @@
 !> Sets the gaseous fluxes
 !------------------------------------------------------------------------------!
- SUBROUTINE set_gas_flux( surface, ncat_emission, unit )
- 
-    USE arrays_3d,                                                             &
-        ONLY: dzw, hyp, pt, rho_air_zw
-        
-    USE grid_variables,                                                        &
-        ONLY:  dx, dy
- 
-    USE surface_mod,                                                           &
-        ONLY:  surf_type
-    
+ SUBROUTINE salsa_gas_emission_setup( init )
+
+    USE control_parameters,                                                                        &
+        ONLY:  time_since_reference_point
+
+    USE date_and_time_mod,                                                                         &
+        ONLY:  day_of_month, hour_of_day, index_dd, index_hh, index_mm, month_of_year,             &
+               time_default_indices, time_utc_init
+
+    USE netcdf_data_input_mod,                                                                     &
+        ONLY:  check_existence, chem_emis_att_type, chem_emis_val_type, get_attribute,             &
+               get_variable, inquire_num_variables, inquire_variable_names,                        &
+               netcdf_data_input_get_dimension_length, open_read_file
+
+    USE surface_mod,                                                                               &
+        ONLY:  surf_def_h, surf_lsm_h, surf_usm_h
+
     IMPLICIT NONE
-    
-    CHARACTER(LEN=*) ::  unit       !< flux unit in the input file  
-    INTEGER(iwp) ::  ncat_emission  !< number of emission categories
-    TYPE(surf_type), INTENT(inout) :: surface  !< respective surface type
-    INTEGER(iwp) ::  g   !< loop index
-    INTEGER(iwp) ::  i   !< loop index
-    INTEGER(iwp) ::  j   !< loop index
-    INTEGER(iwp) ::  k   !< loop index
-    INTEGER(iwp) ::  m   !< running index for surface elements
-    INTEGER(iwp) ::  n   !< running index for emission categories
-    REAL(wp), DIMENSION(ngast) ::  conversion_factor 
-    
-    conversion_factor = 1.0_wp
-    
-    DO  m = 1, surface%ns
-!
-!--    Get indices of respective grid point
-       i = surface%i(m)
-       j = surface%j(m)
-       k = surface%k(m)
-       
-       IF ( unit == '#/m2/s' )  THEN
-          conversion_factor = 1.0_wp
-       ELSEIF ( unit == 'g/m2/s' )  THEN
-          conversion_factor(1) = avo / ( amh2so4 * 1000.0_wp )
-          conversion_factor(2) = avo / ( amhno3 * 1000.0_wp )
-          conversion_factor(3) = avo / ( amnh3 * 1000.0_wp )
-          conversion_factor(4) = avo / ( amoc * 1000.0_wp )
-          conversion_factor(5) = avo / ( amoc * 1000.0_wp )
-       ELSEIF ( unit == 'ppm/m2/s' )  THEN
-          conversion_factor = for_ppm_to_nconc * hyp(k) / pt(k,j,i) * ( hyp(k) &
-                              / 100000.0_wp )**0.286_wp * dx * dy * dzw(k)
-       ELSEIF ( unit == 'mumol/m2/s' )  THEN
-          conversion_factor = 1.0E-6_wp * avo
+
+    CHARACTER(LEN=80) ::  daytype = 'workday'  !< default day type
+    CHARACTER(LEN=25) ::  in_name              !< name of a gas in the input file
+
+    CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE ::  var_names   !<  variable names in input data
+
+    INTEGER(iwp) ::  id_chem        !< NetCDF id of chemistry emission file
+    INTEGER(iwp) ::  ig             !< loop index
+    INTEGER(iwp) ::  in             !< running index for emission categories
+    INTEGER(iwp) ::  num_vars       !< number of variables
+
+    LOGICAL  ::  netcdf_extend = .FALSE.  !< NetCDF input file exists
+
+    LOGICAL, INTENT(in) ::  init          !< if .TRUE. --> initialisation call
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  time_factor  !< emission time factor
+
+    TYPE(chem_emis_att_type) ::  chem_emission_att  !< chemistry emission attributes
+    TYPE(chem_emis_val_type) ::  chem_emission      !< chemistry emission values
+
+!
+!-- Reset surface fluxes
+    surf_def_h(0)%gtsws = 0.0_wp
+    surf_lsm_h%gtsws = 0.0_wp
+    surf_usm_h%gtsws = 0.0_wp
+
+    IF ( init )  THEN
+#if defined( __netcdf )
+!
+!--    Check existence of PIDS_CHEM file
+       INQUIRE( FILE = 'PIDS_CHEM' // TRIM( coupling_char ), EXIST = netcdf_extend )
+       IF ( .NOT. netcdf_extend )  THEN
+          message_string = 'Input file PIDS_CHEM' //  TRIM( coupling_char ) // ' missing!'
+          CALL message( 'salsa_gas_emission_setup', 'PA0640', 1, 2, 0, 6, 0 )
+       ENDIF
+!
+!--    Open file in read-only mode
+       CALL open_read_file( 'PIDS_CHEM' // TRIM( coupling_char ), id_chem )
+!
+!--    Read the index and name of chemical components
+       CALL netcdf_data_input_get_dimension_length( id_chem, chem_emission_att%nspec,              &
+                                                    'nspecies' )
+       ALLOCATE( chem_emission_att%species_index(1:chem_emission_att%nspec) )
+       CALL get_variable( id_chem, 'emission_index', chem_emission_att%species_index )
+       CALL get_variable( id_chem, 'emission_name', chem_emission_att%species_name,                &
+                          chem_emission_att%nspec )
+!
+!--    Find the corresponding indices in the model
+       emission_index_chem = 0
+       DO  ig = 1, chem_emission_att%nspec
+          in_name = chem_emission_att%species_name(ig)
+          SELECT CASE ( TRIM( in_name ) )
+             CASE ( 'H2SO4', 'h2so4' )
+                emission_index_chem(1) = ig
+             CASE ( 'HNO3', 'hno3' )
+                emission_index_chem(2) = ig
+             CASE ( 'NH3', 'nh3' )
+                emission_index_chem(3) = ig
+             CASE ( 'OCNV', 'ocnv' )
+                emission_index_chem(4) = ig
+             CASE ( 'OCSV', 'ocsv' )
+                emission_index_chem(5) = ig
+          END SELECT
+       ENDDO
+       IF ( SUM( emission_index_chem ) == 0 )  THEN
+          CALL location_message( '    salsa_gas_emission_setup: no gas emissions', .TRUE. )
+       ENDIF
+!
+!--    Inquire the fill value
+       CALL get_attribute( id_chem, '_FillValue', aero_emission%fill, .FALSE., 'emission_values' )
+!
+!--    Inquire units of emissions
+       CALL get_attribute( id_chem, 'units', chem_emission_att%units, .FALSE., 'emission_values' )
+!
+!--    Inquire the level of detail (lod)
+       CALL get_attribute( id_chem, 'lod', lod_gas_emissions, .FALSE., 'emission_values' )
+!
+!--    Variable names
+       CALL inquire_num_variables( id_chem, num_vars )
+       ALLOCATE( var_names(1:num_vars) )
+       CALL inquire_variable_names( id_chem, var_names )
+!
+!--    Default mode: as total emissions per year
+       IF ( lod_gas_emissions == 1 )  THEN
+
+!
+!--       Get number of emission categories and allocate emission arrays
+          CALL netcdf_data_input_get_dimension_length( id_chem, chem_emission_att%ncat, 'ncat' )
+          ALLOCATE( chem_emission_att%cat_index(1:chem_emission_att%ncat),                         &
+                    time_factor(1:chem_emission_att%ncat) )
+!
+!--       Get emission category names and indices
+          CALL get_variable( id_chem, 'emission_category_name', chem_emission_att%cat_name,        &
+                             chem_emission_att%ncat)
+          CALL get_variable( id_chem, 'emission_category_index', chem_emission_att%cat_index )
+!
+!--       Emission time factors: Find check whether emission time factors are given for each hour
+!--       of year OR based on month, day and hour
+!
+!--       For each hour of year:
+          IF ( check_existence( var_names, 'nhoursyear' ) )  THEN
+             CALL netcdf_data_input_get_dimension_length( id_chem, chem_emission_att%nhoursyear,   &
+                                                          'nhoursyear' )
+             ALLOCATE( chem_emission_att%hourly_emis_time_factor(1:chem_emission_att%ncat,         &
+                                                                 1:chem_emission_att%nhoursyear) )
+             CALL get_variable( id_chem, 'emission_time_factors',                                  &
+                                chem_emission_att%hourly_emis_time_factor,                         &
+                                0, chem_emission_att%nhoursyear-1, 0, chem_emission_att%ncat-1 )
+!
+!--       Based on the month, day and hour:
+          ELSEIF ( check_existence( var_names, 'nmonthdayhour' ) )  THEN
+             CALL netcdf_data_input_get_dimension_length( id_chem, chem_emission_att%nmonthdayhour,&
+                                                          'nmonthdayhour' )
+             ALLOCATE( chem_emission_att%mdh_emis_time_factor(1:chem_emission_att%ncat,            &
+                                                              1:chem_emission_att%nmonthdayhour) )
+             CALL get_variable( id_chem, 'emission_time_factors',                                  &
+                                chem_emission_att%mdh_emis_time_factor,                            &
+                                0, chem_emission_att%nmonthdayhour-1, 0, chem_emission_att%ncat-1 )
+          ELSE
+             message_string = 'emission_time_factors should be given for each nhoursyear OR ' //   &
+                              'nmonthdayhour'
+             CALL message( 'salsa_gas_emission_setup','PA0641', 1, 2, 0, 6, 0 )
+          ENDIF
+!
+!--       Next emission update
+          next_gas_emission_update = MOD( time_utc_init, 3600.0_wp ) - 3600.0_wp
+!
+!--       Allocate and read surface emission data (in total PM) (NOTE that "preprocessed" input data
+!--       array is applied now here)
+          ALLOCATE( chem_emission%preproc_emission_data(nys:nyn,nxl:nxr, 1:chem_emission_att%nspec,&
+                                                        1:chem_emission_att%ncat) )
+          CALL get_variable( id_chem, 'emission_values', chem_emission%preproc_emission_data,      &
+                             0, chem_emission_att%ncat-1, 0, chem_emission_att%nspec-1,            &
+                             nxl, nxr, nys, nyn )
+!
+!--    Pre-processed mode:
+       ELSEIF ( lod_gas_emissions == 2 )  THEN
+!
+!--       Number of time steps in the emission data
+          CALL netcdf_data_input_get_dimension_length( id_chem, chem_emission_att%dt_emission,     &
+                                                       'time' )
+!
+!--       Allocate and read time
+          ALLOCATE( gas_emission_time(1:chem_emission_att%dt_emission) )
+          CALL get_variable( id_chem, 'time', gas_emission_time )
        ELSE
-          message_string = 'Unknown unit for gaseous emissions!'
-          CALL message( 'salsa_mod: set_gas_flux', 'SA0031', 1, 2, 0, 6, 0 )
-       ENDIF
-       
-       DO  n = 1, ncat_emission
-          DO  g = 1, ngast
-             IF ( salsa_gas(g)%source(n,j,i) < 0.0_wp )  THEN
-                salsa_gas(g)%source(n,j,i) = 0.0_wp
-                CYCLE
-             ENDIF
-             surface%gtsws(m,g) = surface%gtsws(m,g) +                         &
-                                  salsa_gas(g)%source(n,j,i) * rho_air_zw(k-1) &
-                                  * conversion_factor(g)
-          ENDDO
+          message_string = 'Unknown lod for emission_values.'
+          CALL message( 'salsa_gas_emission_setup','PA0642', 1, 2, 0, 6, 0 )
+       ENDIF  ! lod
+
+    ENDIF  ! init
+!
+!-- Define and set current emission values:
+
+    IF ( lod_gas_emissions == 1 )  THEN
+!
+!--    Emission time factors for each emission category at current time step
+       IF ( chem_emission_att%nhoursyear > chem_emission_att%nmonthdayhour )  THEN
+!
+!--       Get the index of the current hour
+          CALL time_default_indices( month_of_year, day_of_month, hour_of_day, index_hh )
+          time_factor = chem_emission_att%hourly_emis_time_factor(:,index_hh)
+
+       ELSEIF ( chem_emission_att%nhoursyear < chem_emission_att%nmonthdayhour )  THEN
+!
+!--       Get the index of current hour (index_hh) (TODO: Now "workday" is always assumed.
+!--       Needs to be calculated.)
+          CALL time_default_indices( daytype, month_of_year, day_of_month, hour_of_day,            &
+                                     index_mm, index_dd, index_hh )
+          time_factor = chem_emission_att%mdh_emis_time_factor(:,index_mm) *                       &
+                        chem_emission_att%mdh_emis_time_factor(:,index_dd) *                       &
+                        chem_emission_att%mdh_emis_time_factor(:,index_hh)
+       ENDIF
+!
+!--    Set gas emissions for each emission category
+       DO  in = 1, chem_emission_att%ncat
+!
+!--       Set surface fluxes only for either default, land or urban surface
+          IF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
+             CALL set_gas_flux( surf_def_h(0), emission_index_chem, chem_emission_att%units,       &
+                                chem_emission%preproc_emission_data(:,:,:,in), time_factor(in) )
+          ELSE
+             CALL set_gas_flux( surf_usm_h, emission_index_chem, chem_emission_att%units,          &
+                                chem_emission%preproc_emission_data(:,:,:,in), time_factor(in) )
+             CALL set_gas_flux( surf_lsm_h, emission_index_chem, chem_emission_att%units,          &
+                                chem_emission%preproc_emission_data(:,:,:,in), time_factor(in) )
+          ENDIF
        ENDDO
-    ENDDO
-    
- END SUBROUTINE set_gas_flux 
-  
- 
+!
+!--    The next emission update is again after one hour
+       next_gas_emission_update = next_gas_emission_update + 3600.0_wp
+
+    ELSEIF ( lod_gas_emissions == 2 )  THEN
+!
+!--    Obtain time index for current input starting at 0.
+!--    @todo: At the moment emission data and simulated time correspond to each other.
+       chem_emission_att%i_hour = MINLOC( ABS( gas_emission_time - time_since_reference_point ),   &
+                                          DIM = 1 ) - 1
+!
+!--    Allocate the data input array always before reading in the data and deallocate after (NOTE 
+!--    that "preprocessed" input data array is applied now here)
+       ALLOCATE( chem_emission%default_emission_data(nys:nyn,nxl:nxr,1:nbins_aerosol) )
+!
+!--    Read in the next time step
+       CALL get_variable( id_chem, 'emission_values', chem_emission%default_emission_data,         &
+                          chem_emission_att%i_hour, 0, chem_emission_att%nspec-1, nxl, nxr, nys, nyn )
+!
+!--    Set surface fluxes only for either default, land or urban surface
+       IF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
+          CALL set_gas_flux( surf_def_h(0), emission_index_chem, chem_emission_att%units,          &
+                             chem_emission%default_emission_data )
+       ELSE
+          CALL set_gas_flux( surf_usm_h, emission_index_chem, chem_emission_att%units,             &
+                             chem_emission%default_emission_data )
+          CALL set_gas_flux( surf_lsm_h, emission_index_chem, chem_emission_att%units,             &
+                             chem_emission%default_emission_data )
+       ENDIF
+!
+!--    Determine the next emission update
+       next_gas_emission_update = gas_emission_time(chem_emission_att%i_hour+2)
+
+       DEALLOCATE( chem_emission%default_emission_data )
+    ENDIF
+#else
+    message_string = 'salsa_emission_mode = "read_from_file", but preprocessor directive ' //   &
+                     ' __netcdf is not used in compiling!'
+    CALL message( 'salsa_gas_emission_setup', 'PA0643', 1, 2, 0, 6, 0 )
+
+#endif
+
+    CONTAINS
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Sets the aerosol flux to aerosol arrays in 2a and 2b.
-!------------------------------------------------------------------------------!
- SUBROUTINE set_flux( surface, ncat_emission )
- 
-    USE arrays_3d,                                                             &
-        ONLY:  rho_air_zw
- 
-    USE surface_mod,                                                           &
-        ONLY:  surf_type
-    
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  ncat_emission  !< number of emission categories
-    TYPE(surf_type), INTENT(inout) :: surface  !< respective surface type
-    INTEGER(iwp) ::  b  !< loop index
-    INTEGER(iwp) ::  i   !< loop index
-    INTEGER(iwp) ::  j   !< loop index
-    INTEGER(iwp) ::  k   !< loop index
-    INTEGER(iwp) ::  m   !< running index for surface elements
-    INTEGER(iwp) ::  n   !< loop index for emission categories
-    INTEGER(iwp) ::  c   !< loop index
-    
-    DO  m = 1, surface%ns
-!
-!--    Get indices of respective grid point
-       i = surface%i(m)
-       j = surface%j(m)
-       k = surface%k(m)
-       
-       DO  n = 1, ncat_emission  
-          DO  b = 1, nbins
-             IF (  aerosol_number(b)%source(n,j,i) < 0.0_wp )  THEN
-                aerosol_number(b)%source(n,j,i) = 0.0_wp
-                CYCLE
+!> Set gas fluxes for selected type of surfaces
+!------------------------------------------------------------------------------!
+    SUBROUTINE set_gas_flux( surface, cc_i_mod, unit, source_array, time_fac )
+
+       USE arrays_3d,                                                                              &
+           ONLY: dzw, hyp, pt, rho_air_zw
+
+       USE grid_variables,                                                                         &
+           ONLY:  dx, dy
+
+       USE surface_mod,                                                                            &
+           ONLY:  surf_type
+
+       IMPLICIT NONE
+
+       CHARACTER(LEN=*), INTENT(in) ::  unit  !< flux unit in the input file
+
+       INTEGER(iwp) ::  ig  !< running index for gases
+       INTEGER(iwp) ::  i   !< loop index
+       INTEGER(iwp) ::  j   !< loop index
+       INTEGER(iwp) ::  k   !< loop index
+       INTEGER(iwp) ::  m   !< running index for surface elements
+
+       INTEGER(iwp), DIMENSION(:) ::  cc_i_mod   !< index of different gases in the input data
+
+       LOGICAL ::  use_time_fac  !< .TRUE. is time_fac present
+
+       REAL(wp), OPTIONAL ::  time_fac  !< emission time factor
+
+       REAL(wp), DIMENSION(ngases_salsa) ::  conv     !< unit conversion factor
+
+       REAL(wp), DIMENSION(nys:nyn,nxl:nxr,chem_emission_att%nspec), INTENT(in) ::  source_array  !<
+
+       TYPE(surf_type), INTENT(inout) :: surface  !< respective surface type
+
+       use_time_fac = PRESENT( time_fac )
+
+       DO  m = 1, surface%ns
+!
+!--       Get indices of respective grid point
+          i = surface%i(m)
+          j = surface%j(m)
+          k = surface%k(m)
+!
+!--       Unit conversion factor: convert to SI units (#/m2/s)
+          SELECT CASE ( TRIM( unit ) )
+             CASE ( 'kg/m2/yr' )
+                conv(1) = avo / ( amh2so4 * 3600.0_wp )
+                conv(2) = avo / ( amhno3 * 3600.0_wp )
+                conv(3) = avo / ( amnh3 * 3600.0_wp )
+                conv(4) = avo / ( amoc * 3600.0_wp )
+                conv(5) = avo / ( amoc * 3600.0_wp )
+             CASE ( 'g/m2/yr' )
+                conv(1) = avo / ( amh2so4 * 3.6E+6_wp )
+                conv(2) = avo / ( amhno3 * 3.6E+6_wp )
+                conv(3) = avo / ( amnh3 * 3.6E+6_wp )
+                conv(4) = avo / ( amoc * 3.6E+6_wp )
+                conv(5) = avo / ( amoc * 3.6E+6_wp )
+             CASE ( 'g/m2/s' )
+                conv(1) = avo / ( amh2so4 * 1000.0_wp )
+                conv(2) = avo / ( amhno3 * 1000.0_wp )
+                conv(3) = avo / ( amnh3 * 1000.0_wp )
+                conv(4) = avo / ( amoc * 1000.0_wp )
+                conv(5) = avo / ( amoc * 1000.0_wp )
+             CASE ( '#/m2/s' )
+                conv = 1.0_wp
+             CASE ( 'ppm/m2/s' )
+                conv = for_ppm_to_nconc * hyp(k) / pt(k,j,i) * ( 1.0E5_wp / hyp(k) )**0.286_wp *   &
+                       dx * dy * dzw(k)
+             CASE ( 'mumol/m2/s' )
+                conv = 1.0E-6_wp * avo
+             CASE DEFAULT
+                message_string = 'unknown unit for gas emissions: ' // TRIM( chem_emission_att%units )
+                CALL message( 'set_gas_flux','PA0644', 1, 2, 0, 6, 0 )
+
+          END SELECT
+
+          DO  ig = 1, ngases_salsa
+             IF ( use_time_fac )  THEN
+                surface%gtsws(m,ig) = surface%gtsws(m,ig) + rho_air_zw(k-1) * conv(ig) * time_fac  &
+                                      * MAX( 0.0_wp, source_array(j,i,cc_i_mod(ig) ) )
+             ELSE
+                surface%gtsws(m,ig) = surface%gtsws(m,ig) + rho_air_zw(k-1) * conv(ig)             &
+                                      * MAX( 0.0_wp, source_array(j,i,cc_i_mod(ig) ) )
              ENDIF
-!       
-!--          Set mass fluxes.  First bins include only SO4 and/or OC.      
-
-             IF ( b <= fn1a )  THEN
-!
-!--             Both sulphate and organic carbon
-                IF ( iso4 > 0  .AND.  ioc > 0 )  THEN
-                
-                   c = ( iso4 - 1 ) * nbins + b   
-                   surface%amsws(m,c) = surface%amsws(m,c) +                   &
-                                        emission_mass_fracs(n,1) /             &
-                                        ( emission_mass_fracs(n,1) +           &
-                                          emission_mass_fracs(n,2) ) *         &
-                                          aerosol_number(b)%source(n,j,i) *    &
-                                          api6 * aero(b)%dmid**3.0_wp *        &
-                                          arhoh2so4 * rho_air_zw(k-1)
-                   aerosol_mass(c)%source(n,j,i) =                             &
-                              aerosol_mass(c)%source(n,j,i) + surface%amsws(m,c)
-                   c = ( ioc - 1 ) * nbins + b   
-                   surface%amsws(m,c) = surface%amsws(m,c) +                   &
-                                        emission_mass_fracs(n,2) /             &
-                                        ( emission_mass_fracs(n,1) +           & 
-                                          emission_mass_fracs(n,2) ) *         &
-                                          aerosol_number(b)%source(n,j,i) *    &
-                                          api6 * aero(b)%dmid**3.0_wp * arhooc &
-                                          * rho_air_zw(k-1)
-                   aerosol_mass(c)%source(n,j,i) =                             &
-                              aerosol_mass(c)%source(n,j,i) + surface%amsws(m,c)
-!
-!--             Only sulphates
-                ELSEIF ( iso4 > 0  .AND.  ioc < 0 )  THEN
-                   c = ( iso4 - 1 ) * nbins + b   
-                   surface%amsws(m,c) = surface%amsws(m,c) +                   &
-                                        aerosol_number(b)%source(n,j,i) * api6 &
-                                        * aero(b)%dmid**3.0_wp * arhoh2so4     &
-                                        * rho_air_zw(k-1)
-                   aerosol_mass(c)%source(n,j,i) =                             &
-                              aerosol_mass(c)%source(n,j,i) + surface%amsws(m,c)
-!             
-!--             Only organic carbon             
-                ELSEIF ( iso4 < 0  .AND.  ioc > 0 )  THEN
-                   c = ( ioc - 1 ) * nbins + b   
-                   surface%amsws(m,c) = surface%amsws(m,c) +                   &
-                                        aerosol_number(b)%source(n,j,i) * api6 &
-                                        * aero(b)%dmid**3.0_wp * arhooc        &
-                                        * rho_air_zw(k-1)
-                   aerosol_mass(c)%source(n,j,i) =                             &
-                              aerosol_mass(c)%source(n,j,i) + surface%amsws(m,c)
-                ENDIF
-                
-             ELSEIF ( b > fn1a )  THEN
-!
-!--             Sulphate
-                IF ( iso4 > 0 )  THEN
-                   CALL set_mass_flux( surface, m, b, iso4, n,                 &
-                                       emission_mass_fracs(n,1), arhoh2so4,    &
-                                       aerosol_number(b)%source(n,j,i) )
-                ENDIF 
-!             
-!--             Organic carbon                 
-                IF ( ioc > 0 )  THEN          
-                  CALL set_mass_flux( surface, m, b, ioc, n,                   &
-                                      emission_mass_fracs(n,2), arhooc,        &
-                                      aerosol_number(b)%source(n,j,i) )
-                ENDIF
-!
-!--             Black carbon
-                IF ( ibc > 0 )  THEN
-                   CALL set_mass_flux( surface, m, b, ibc, n,                  &
-                                       emission_mass_fracs(n,3), arhobc,       &
-                                       aerosol_number(b)%source(n,j,i) )
-                ENDIF
-!
-!--             Dust
-                IF ( idu > 0 )  THEN
-                   CALL set_mass_flux( surface, m, b, idu, n,                  &
-                                       emission_mass_fracs(n,4), arhodu,       &
-                                       aerosol_number(b)%source(n,j,i) )
-                ENDIF
-!
-!--             Sea salt
-                IF ( iss > 0 )  THEN
-                   CALL set_mass_flux( surface, m, b, iss, n,                  &
-                                       emission_mass_fracs(n,5), arhoss,       &
-                                       aerosol_number(b)%source(n,j,i) )
-                ENDIF
-!
-!--             Nitric acid
-                IF ( ino > 0 )  THEN
-                   CALL set_mass_flux( surface, m, b, ino, n,                  &
-                                       emission_mass_fracs(n,6), arhohno3,     &
-                                       aerosol_number(b)%source(n,j,i) )
-                ENDIF
-!
-!--             Ammonia
-                IF ( inh > 0 )  THEN
-                   CALL set_mass_flux( surface, m, b, inh, n,                  &
-                                       emission_mass_fracs(n,7), arhonh3,      &
-                                       aerosol_number(b)%source(n,j,i) )
-                ENDIF
-                
-             ENDIF
-!             
-!--          Save number fluxes in the end 
-             surface%answs(m,b) = surface%answs(m,b) +                         &
-                               aerosol_number(b)%source(n,j,i) * rho_air_zw(k-1)
-             aerosol_number(b)%source(n,j,i) = surface%answs(m,b)
-          ENDDO
-       
-       ENDDO
-       
-    ENDDO
-    
- END SUBROUTINE set_flux 
- 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Sets the mass emissions to aerosol arrays in 2a and 2b.
-!------------------------------------------------------------------------------!
- SUBROUTINE set_mass_flux( surface, surf_num, b, ispec, n, mass_frac, prho,    &
-                           nsource )
-                           
-    USE arrays_3d,                                                             &
-        ONLY:  rho_air_zw
-
-    USE surface_mod,                                                           &
-        ONLY:  surf_type
-    
-    IMPLICIT NONE
-
-    INTEGER(iwp), INTENT(in) :: b         !< Aerosol size bin index
-    INTEGER(iwp), INTENT(in) :: ispec     !< Aerosol species index
-    INTEGER(iwp), INTENT(in) :: n         !< emission category number    
-    INTEGER(iwp), INTENT(in) :: surf_num  !< index surface elements
-    REAL(wp), INTENT(in) ::  mass_frac    !< mass fraction of a chemical 
-                                          !< compound in all bins 
-    REAL(wp), INTENT(in) ::  nsource      !< number source (#/m2/s)
-    REAL(wp), INTENT(in) ::  prho         !< Aerosol density
-    TYPE(surf_type), INTENT(inout) ::  surface  !< respective surface type
-     
-    INTEGER(iwp) ::  i  !< loop index 
-    INTEGER(iwp) ::  j  !< loop index
-    INTEGER(iwp) ::  k  !< loop index
-    INTEGER(iwp) ::  c  !< loop index
-    
-!
-!-- Get indices of respective grid point
-    i = surface%i(surf_num)
-    j = surface%j(surf_num)
-    k = surface%k(surf_num)
-!          
-!-- Subrange 2a:
-    c = ( ispec - 1 ) * nbins + b
-    surface%amsws(surf_num,c) = surface%amsws(surf_num,c) + mass_frac * nsource&
-                                * aero(b)%core * prho * rho_air_zw(k-1)
-    aerosol_mass(c)%source(n,j,i) = aerosol_mass(c)%source(n,j,i) +            &
-                                    surface%amsws(surf_num,c)
-!          
-!-- Subrange 2b:
-    IF ( .NOT. no_insoluble )  THEN
-       WRITE(*,*) 'All emissions are soluble!'
-    ENDIF
-    
- END SUBROUTINE set_mass_flux
- 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Sets the mass sources to aerosol arrays in 2a and 2b.
-!------------------------------------------------------------------------------!
- SUBROUTINE set_mass_source( k, j, i,  ispec, mass_frac, prho, nsource, fillval )
-
-    USE surface_mod,                                                           &
-        ONLY:  surf_type
-    
-    IMPLICIT NONE
-    
-    INTEGER(iwp), INTENT(in) :: ispec     !< Aerosol species index
-    REAL(wp), INTENT(in) ::  fillval      !< _FillValue in the NetCDF file
-    REAL(wp), INTENT(in) ::  mass_frac    !< mass fraction of a chemical 
-                                          !< compound in all bins  
-    REAL(wp), INTENT(in), DIMENSION(:) ::  nsource  !< number source
-    REAL(wp), INTENT(in) ::  prho         !< Aerosol density
-    
-    INTEGER(iwp) ::  b !< loop index    
-    INTEGER(iwp) ::  ee !< index: end 
-    INTEGER(iwp) ::  i  !< loop index 
-    INTEGER(iwp) ::  j  !< loop index
-    INTEGER(iwp) ::  k  !< loop index
-    INTEGER(iwp) ::  c  !< loop index
-    INTEGER(iwp) ::  ss !<index: start 
-!          
-!-- Subrange 2a:
-    ss = ( ispec - 1 ) * nbins + in2a
-    ee = ( ispec - 1 ) * nbins + fn2a
-    b = in2a
-    DO c = ss, ee
-       IF ( nsource(b) /= fillval )  THEN
-          aerosol_mass(c)%source(k,j,i) = aerosol_mass(c)%source(k,j,i) +      &
-                                       mass_frac * nsource(b) * aero(b)%core * &
-                                       prho 
-       ENDIF
-       b = b+1
-    ENDDO
-!          
-!-- Subrange 2b:
-    IF ( .NOT. no_insoluble )  THEN
-       WRITE(*,*) 'All sources are soluble!'
-    ENDIF
-    
- END SUBROUTINE set_mass_source 
- 
+          ENDDO  ! ig
+
+       ENDDO  ! m
+
+    END SUBROUTINE set_gas_flux
+
+ END SUBROUTINE salsa_gas_emission_setup
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -8680,44 +8978,39 @@
  SUBROUTINE salsa_check_data_output( var, unit )
  
-    USE control_parameters,                                                    &
+    USE control_parameters,                                                                        &
         ONLY:  message_string
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  unit     !< 
-    CHARACTER (LEN=*) ::  var      !< 
+    CHARACTER(LEN=*) ::  unit     !<
+    CHARACTER(LEN=*) ::  var      !<
 
     SELECT CASE ( TRIM( var ) )
-          
-       CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV',  'g_OCSV',               &
-              'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4',  'N_bin5',  'N_bin6',    &
-              'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12',   &
-              'Ntot' )
+
+       CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV',  'g_OCSV', 'N_bin1', 'N_bin2', 'N_bin3',     &
+              'N_bin4',  'N_bin5',  'N_bin6', 'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10', 'N_bin11',  &
+              'N_bin12', 'Ntot' )
           IF (  .NOT.  salsa )  THEN
-             message_string = 'output of "' // TRIM( var ) // '" requi' //  &
-                       'res salsa = .TRUE.'
-             CALL message( 'check_parameters', 'SA0006', 1, 2, 0, 6, 0 )
+             message_string = 'output of "' // TRIM( var ) // '" requires salsa = .TRUE.'
+             CALL message( 'check_parameters', 'PA0645', 1, 2, 0, 6, 0 )
           ENDIF
           unit = '#/m3'
-          
+
        CASE ( 'LDSA' )
           IF (  .NOT.  salsa )  THEN
-             message_string = 'output of "' // TRIM( var ) // '" requi' //  &
-                       'res salsa = .TRUE.'
-             CALL message( 'check_parameters', 'SA0003', 1, 2, 0, 6, 0 )
+             message_string = 'output of "' // TRIM( var ) // '" requires salsa = .TRUE.'
+             CALL message( 'check_parameters', 'PA0646', 1, 2, 0, 6, 0 )
           ENDIF
-          unit = 'mum2/cm3'          
-          
-       CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4',  'm_bin5',  'm_bin6',    &
-              'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12',   &
-              'PM2.5',  'PM10',   's_BC',   's_DU',    's_H2O',   's_NH',      &
-              's_NO',   's_OC',   's_SO4',  's_SS' )
+          unit = 'mum2/cm3'
+
+       CASE ( 'm_bin1', 'm_bin2',  'm_bin3',  'm_bin4',  'm_bin5', 'm_bin6', 'm_bin7', 'm_bin8',   &
+              'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12', 'PM2.5',  'PM10',   's_BC',   's_DU',     &
+              's_H2O',  's_NH',    's_NO',    's_OC',    's_SO4',  's_SS' )
           IF (  .NOT.  salsa )  THEN
-             message_string = 'output of "' // TRIM( var ) // '" requi' //  &
-                       'res salsa = .TRUE.'
-             CALL message( 'check_parameters', 'SA0001', 1, 2, 0, 6, 0 )
+             message_string = 'output of "' // TRIM( var ) // '" requires salsa = .TRUE.'
+             CALL message( 'check_parameters', 'PA0647', 1, 2, 0, 6, 0 )
           ENDIF
           unit = 'kg/m3'
-             
+
        CASE DEFAULT
           unit = 'illegal'
@@ -8726,5 +9019,5 @@
 
  END SUBROUTINE salsa_check_data_output
- 
+
 !------------------------------------------------------------------------------!
 !
@@ -8734,5 +9027,4 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE salsa_3d_data_averaging( mode, variable )
- 
 
     USE control_parameters
@@ -8744,23 +9036,23 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  mode       !< 
-    CHARACTER (LEN=*) ::  variable   !< 
-
-    INTEGER(iwp) ::  b   !<     
-    INTEGER(iwp) ::  c   !<
-    INTEGER(iwp) ::  i   !<
-    INTEGER(iwp) ::  icc !<
-    INTEGER(iwp) ::  j   !< 
-    INTEGER(iwp) ::  k   !< 
-    
-    REAL(wp) ::  df       !< For calculating LDSA: fraction of particles 
-                          !< depositing in the alveolar (or tracheobronchial)
-                          !< region of the lung. Depends on the particle size 
+    CHARACTER(LEN=*)  ::  mode       !<
+    CHARACTER(LEN=10) ::  vari       !<
+    CHARACTER(LEN=*)  ::  variable   !<
+
+    INTEGER(iwp) ::  found_index  !<
+    INTEGER(iwp) ::  i            !<
+    INTEGER(iwp) ::  ib           !<
+    INTEGER(iwp) ::  ic           !<
+    INTEGER(iwp) ::  j            !<
+    INTEGER(iwp) ::  k            !<
+
+    REAL(wp) ::  df       !< For calculating LDSA: fraction of particles depositing in the alveolar
+                          !< (or tracheobronchial) region of the lung. Depends on the particle size
     REAL(wp) ::  mean_d   !< Particle diameter in micrometres
     REAL(wp) ::  nc       !< Particle number concentration in units 1/cm**3
-    REAL(wp) ::  temp_bin !<
-    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< points to 
-                                                     !< selected output variable
-    
+    REAL(wp) ::  temp_bin !< temporary variable
+
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< points to selected output variable
+
     temp_bin = 0.0_wp
 
@@ -8768,121 +9060,121 @@
 
        SELECT CASE ( TRIM( variable ) )
-       
+
           CASE ( 'g_H2SO4' )
-             IF ( .NOT. ALLOCATED( g_H2SO4_av ) )  THEN
-                ALLOCATE( g_H2SO4_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( g_h2so4_av ) )  THEN
+                ALLOCATE( g_h2so4_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             g_H2SO4_av = 0.0_wp
-             
+             g_h2so4_av = 0.0_wp
+
           CASE ( 'g_HNO3' )
-             IF ( .NOT. ALLOCATED( g_HNO3_av ) )  THEN
-                ALLOCATE( g_HNO3_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( g_hno3_av ) )  THEN
+                ALLOCATE( g_hno3_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             g_HNO3_av = 0.0_wp
-             
+             g_hno3_av = 0.0_wp
+
           CASE ( 'g_NH3' )
-             IF ( .NOT. ALLOCATED( g_NH3_av ) )  THEN
-                ALLOCATE( g_NH3_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( g_nh3_av ) )  THEN
+                ALLOCATE( g_nh3_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             g_NH3_av = 0.0_wp
-             
+             g_nh3_av = 0.0_wp
+
           CASE ( 'g_OCNV' )
-             IF ( .NOT. ALLOCATED( g_OCNV_av ) )  THEN
-                ALLOCATE( g_OCNV_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( g_ocnv_av ) )  THEN
+                ALLOCATE( g_ocnv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             g_OCNV_av = 0.0_wp
-             
+             g_ocnv_av = 0.0_wp
+
           CASE ( 'g_OCSV' )
-             IF ( .NOT. ALLOCATED( g_OCSV_av ) )  THEN
-                ALLOCATE( g_OCSV_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( g_ocsv_av ) )  THEN
+                ALLOCATE( g_ocsv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             g_OCSV_av = 0.0_wp             
-             
+             g_ocsv_av = 0.0_wp
+
           CASE ( 'LDSA' )
-             IF ( .NOT. ALLOCATED( LDSA_av ) )  THEN
-                ALLOCATE( LDSA_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( ldsa_av ) )  THEN
+                ALLOCATE( ldsa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             LDSA_av = 0.0_wp
-             
-          CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6',   &
-                 'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12' )
-             IF ( .NOT. ALLOCATED( Nbins_av ) )  THEN
-                ALLOCATE( Nbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins) )
+             ldsa_av = 0.0_wp
+
+          CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6', 'N_bin7', 'N_bin8',   &
+                 'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12' )
+             IF ( .NOT. ALLOCATED( nbins_av ) )  THEN
+                ALLOCATE( nbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
              ENDIF
-             Nbins_av = 0.0_wp
-             
+             nbins_av = 0.0_wp
+
           CASE ( 'Ntot' )
-             IF ( .NOT. ALLOCATED( Ntot_av ) )  THEN
-                ALLOCATE( Ntot_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( ntot_av ) )  THEN
+                ALLOCATE( ntot_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             Ntot_av = 0.0_wp
-             
-          CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6',   &
-                 'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12' )
+             ntot_av = 0.0_wp
+
+          CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6', 'm_bin7', 'm_bin8',   &
+                 'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12' )
              IF ( .NOT. ALLOCATED( mbins_av ) )  THEN
-                ALLOCATE( mbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins) )
+                ALLOCATE( mbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
              ENDIF
              mbins_av = 0.0_wp
-             
+
           CASE ( 'PM2.5' )
-             IF ( .NOT. ALLOCATED( PM25_av ) )  THEN
-                ALLOCATE( PM25_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( pm25_av ) )  THEN
+                ALLOCATE( pm25_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             PM25_av = 0.0_wp
-             
+             pm25_av = 0.0_wp
+
           CASE ( 'PM10' )
-             IF ( .NOT. ALLOCATED( PM10_av ) )  THEN
-                ALLOCATE( PM10_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( pm10_av ) )  THEN
+                ALLOCATE( pm10_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             PM10_av = 0.0_wp
-             
+             pm10_av = 0.0_wp
+
           CASE ( 's_BC' )
-             IF ( .NOT. ALLOCATED( s_BC_av ) )  THEN
-                ALLOCATE( s_BC_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_bc_av ) )  THEN
+                ALLOCATE( s_bc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_BC_av = 0.0_wp
-          
+             s_bc_av = 0.0_wp
+
           CASE ( 's_DU' )
-             IF ( .NOT. ALLOCATED( s_DU_av ) )  THEN
-                ALLOCATE( s_DU_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_du_av ) )  THEN
+                ALLOCATE( s_du_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_DU_av = 0.0_wp
-             
+             s_du_av = 0.0_wp
+
           CASE ( 's_H2O' )
-             IF ( .NOT. ALLOCATED( s_H2O_av ) )  THEN
-                ALLOCATE( s_H2O_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_h2o_av ) )  THEN
+                ALLOCATE( s_h2o_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_H2O_av = 0.0_wp
-             
+             s_h2o_av = 0.0_wp
+
           CASE ( 's_NH' )
-             IF ( .NOT. ALLOCATED( s_NH_av ) )  THEN
-                ALLOCATE( s_NH_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_nh_av ) )  THEN
+                ALLOCATE( s_nh_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_NH_av = 0.0_wp
-             
+             s_nh_av = 0.0_wp
+
           CASE ( 's_NO' )
-             IF ( .NOT. ALLOCATED( s_NO_av ) )  THEN
-                ALLOCATE( s_NO_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_no_av ) )  THEN
+                ALLOCATE( s_no_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_NO_av = 0.0_wp
-             
+             s_no_av = 0.0_wp
+
           CASE ( 's_OC' )
-             IF ( .NOT. ALLOCATED( s_OC_av ) )  THEN
-                ALLOCATE( s_OC_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_oc_av ) )  THEN
+                ALLOCATE( s_oc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_OC_av = 0.0_wp
-             
+             s_oc_av = 0.0_wp
+
           CASE ( 's_SO4' )
-             IF ( .NOT. ALLOCATED( s_SO4_av ) )  THEN
-                ALLOCATE( s_SO4_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_so4_av ) )  THEN
+                ALLOCATE( s_so4_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_SO4_av = 0.0_wp   
-          
+             s_so4_av = 0.0_wp   
+
           CASE ( 's_SS' )
-             IF ( .NOT. ALLOCATED( s_SS_av ) )  THEN
-                ALLOCATE( s_SS_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             IF ( .NOT. ALLOCATED( s_ss_av ) )  THEN
+                ALLOCATE( s_ss_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
              ENDIF
-             s_SS_av = 0.0_wp
-          
+             s_ss_av = 0.0_wp
+
           CASE DEFAULT
              CONTINUE
@@ -8893,31 +9185,42 @@
 
        SELECT CASE ( TRIM( variable ) )
-       
+
           CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV', 'g_OCSV' )
-             IF ( TRIM( variable(3:) ) == 'H2SO4' )  THEN
-                icc = 1
-                to_be_resorted => g_H2SO4_av
-             ELSEIF ( TRIM( variable(3:) ) == 'HNO3' )  THEN
-                icc = 2
-                to_be_resorted => g_HNO3_av   
-             ELSEIF ( TRIM( variable(3:) ) == 'NH3' )  THEN
-                icc = 3
-                to_be_resorted => g_NH3_av   
-             ELSEIF ( TRIM( variable(3:) ) == 'OCNV' )  THEN
-                icc = 4
-                to_be_resorted => g_OCNV_av   
-             ELSEIF ( TRIM( variable(3:) ) == 'OCSV' )  THEN
-                icc = 5
-                to_be_resorted => g_OCSV_av        
-             ENDIF
+
+             vari = TRIM( variable(3:) )
+
+             SELECT CASE( vari )
+
+                CASE( 'H2SO4' )
+                   found_index = 1
+                   to_be_resorted => g_h2so4_av
+
+                CASE( 'HNO3' )
+                   found_index = 2
+                   to_be_resorted => g_hno3_av
+
+                CASE( 'NH3' )
+                   found_index = 3
+                   to_be_resorted => g_nh3_av
+
+                CASE( 'OCNV' )
+                   found_index = 4
+                   to_be_resorted => g_ocnv_av
+
+                CASE( 'OCSN' )
+                   found_index = 5
+                   to_be_resorted => g_ocsv_av
+
+             END SELECT
+
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      to_be_resorted(k,j,i) = to_be_resorted(k,j,i) +         &
-                                              salsa_gas(icc)%conc(k,j,i)
+                      to_be_resorted(k,j,i) = to_be_resorted(k,j,i) +                              &
+                                              salsa_gas(found_index)%conc(k,j,i)
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           CASE ( 'LDSA' )
              DO  i = nxlg, nxrg
@@ -8925,60 +9228,56 @@
                    DO  k = nzb, nzt+1
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins 
-!                      
+                      DO  ib = 1, nbins_aerosol
+!
 !--                      Diameter in micrometres
-                         mean_d = 1.0E+6_wp * Ra_dry(k,j,i,b) * 2.0_wp
-!                               
-!--                      Deposition factor: alveolar (use Ra_dry)                              
-                         df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp *     &
-                                ( LOG( mean_d ) + 2.84_wp )**2.0_wp )          &
-                                  + 19.11_wp * EXP( -0.482_wp *                &
-                                  ( LOG( mean_d ) - 1.362_wp )**2.0_wp ) )
-!                                    
+                         mean_d = 1.0E+6_wp * ra_dry(k,j,i,ib) * 2.0_wp
+!
+!--                      Deposition factor: alveolar (use ra_dry)
+                         df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp * ( LOG( mean_d ) +       &
+                                2.84_wp )**2 ) + 19.11_wp * EXP( -0.482_wp * ( LOG( mean_d ) -     &
+                                1.362_wp )**2 ) )
+!
 !--                      Number concentration in 1/cm3
-                         nc = 1.0E-6_wp * aerosol_number(b)%conc(k,j,i)    
-!                         
-!--                      Lung-deposited surface area LDSA (units mum2/cm3)                            
-                         temp_bin = temp_bin + pi * mean_d**2.0_wp * df * nc
+                         nc = 1.0E-6_wp * aerosol_number(ib)%conc(k,j,i)
+!
+!--                      Lung-deposited surface area LDSA (units mum2/cm3)
+                         temp_bin = temp_bin + pi * mean_d**2 * df * nc
                       ENDDO
-                      LDSA_av(k,j,i) = LDSA_av(k,j,i) + temp_bin
+                      ldsa_av(k,j,i) = ldsa_av(k,j,i) + temp_bin
                    ENDDO
                 ENDDO
              ENDDO
-             
-          CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6',   &
-                 'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12' )
+
+          CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6', 'N_bin7', 'N_bin8',   &
+                 'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      DO  b = 1, nbins 
-                         Nbins_av(k,j,i,b) = Nbins_av(k,j,i,b) +               &
-                                             aerosol_number(b)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         nbins_av(k,j,i,ib) = nbins_av(k,j,i,ib) + aerosol_number(ib)%conc(k,j,i)
                       ENDDO
                    ENDDO
                 ENDDO
              ENDDO
-          
+
           CASE ( 'Ntot' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      DO  b = 1, nbins 
-                         Ntot_av(k,j,i) = Ntot_av(k,j,i) +                     &
-                                          aerosol_number(b)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         ntot_av(k,j,i) = ntot_av(k,j,i) + aerosol_number(ib)%conc(k,j,i)
                       ENDDO
                    ENDDO
                 ENDDO
              ENDDO
-             
-          CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6',   &
-                 'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12' )
+
+          CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6', 'm_bin7', 'm_bin8',   &
+                 'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      DO  b = 1, nbins 
-                         DO  c = b, nbins*ncc_tot, nbins
-                            mbins_av(k,j,i,b) = mbins_av(k,j,i,b) +            &
-                                                aerosol_mass(c)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         DO  ic = ib, nbins_aerosol * ncomponents_mass, nbins_aerosol
+                            mbins_av(k,j,i,ib) = mbins_av(k,j,i,ib) + aerosol_mass(ic)%conc(k,j,i)
                          ENDDO
                       ENDDO
@@ -8986,5 +9285,5 @@
                 ENDDO
              ENDDO
-             
+
           CASE ( 'PM2.5' )
              DO  i = nxlg, nxrg
@@ -8992,16 +9291,16 @@
                    DO  k = nzb, nzt+1
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-                         IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 2.5E-6_wp )  THEN
-                            DO  c = b, nbins*ncc, nbins
-                               temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 2.5E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
                             ENDDO
                          ENDIF
                       ENDDO
-                      PM25_av(k,j,i) = PM25_av(k,j,i) + temp_bin
+                      pm25_av(k,j,i) = pm25_av(k,j,i) + temp_bin
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           CASE ( 'PM10' )
              DO  i = nxlg, nxrg
@@ -9009,33 +9308,32 @@
                    DO  k = nzb, nzt+1
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-                         IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 10.0E-6_wp )  THEN
-                            DO  c = b, nbins*ncc, nbins
-                               temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 10.0E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
                             ENDDO
                          ENDIF
                       ENDDO
-                      PM10_av(k,j,i) = PM10_av(k,j,i) + temp_bin
+                      pm10_av(k,j,i) = pm10_av(k,j,i) + temp_bin
                    ENDDO
                 ENDDO
              ENDDO
-             
-          CASE ( 's_BC', 's_DU', 's_H2O', 's_NH', 's_NO', 's_OC', 's_SO4',     &
-                 's_SS' )
+
+          CASE ( 's_BC', 's_DU', 's_H2O', 's_NH', 's_NO', 's_OC', 's_SO4', 's_SS' )
              IF ( is_used( prtcl, TRIM( variable(3:) ) ) )  THEN
-                icc = get_index( prtcl, TRIM( variable(3:) ) )
-                IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_BC_av
-                IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_DU_av   
-                IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_NH_av   
-                IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_NO_av   
-                IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_OC_av   
-                IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_SO4_av   
-                IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_SS_av       
+                found_index = get_index( prtcl, TRIM( variable(3:) ) )
+                IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_bc_av
+                IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_du_av
+                IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_nh_av
+                IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_no_av
+                IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_oc_av
+                IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_so4_av
+                IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_ss_av
                 DO  i = nxlg, nxrg
                    DO  j = nysg, nyng
                       DO  k = nzb, nzt+1
-                         DO  c = ( icc-1 )*nbins+1, icc*nbins 
-                            to_be_resorted(k,j,i) = to_be_resorted(k,j,i) +    &
-                                                    aerosol_mass(c)%conc(k,j,i)
+                         DO  ic = ( found_index-1 ) * nbins_aerosol + 1, found_index * nbins_aerosol
+                            to_be_resorted(k,j,i) = to_be_resorted(k,j,i) +                        &
+                                                    aerosol_mass(ic)%conc(k,j,i)
                          ENDDO
                       ENDDO
@@ -9043,5 +9341,5 @@
                 ENDDO
              ENDIF
-             
+
           CASE DEFAULT
              CONTINUE
@@ -9052,73 +9350,70 @@
 
        SELECT CASE ( TRIM( variable ) )
-       
+
           CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV', 'g_OCSV' )
              IF ( TRIM( variable(3:) ) == 'H2SO4' )  THEN
-                icc = 1
-                to_be_resorted => g_H2SO4_av
+                found_index = 1
+                to_be_resorted => g_h2so4_av
              ELSEIF ( TRIM( variable(3:) ) == 'HNO3' )  THEN
-                icc = 2
-                to_be_resorted => g_HNO3_av   
+                found_index = 2
+                to_be_resorted => g_hno3_av
              ELSEIF ( TRIM( variable(3:) ) == 'NH3' )  THEN
-                icc = 3
-                to_be_resorted => g_NH3_av   
+                found_index = 3
+                to_be_resorted => g_nh3_av
              ELSEIF ( TRIM( variable(3:) ) == 'OCNV' )  THEN
-                icc = 4
-                to_be_resorted => g_OCNV_av   
+                found_index = 4
+                to_be_resorted => g_ocnv_av
              ELSEIF ( TRIM( variable(3:) ) == 'OCSV' )  THEN
-                icc = 5
-                to_be_resorted => g_OCSV_av        
+                found_index = 5
+                to_be_resorted => g_ocsv_av
              ENDIF
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      to_be_resorted(k,j,i) = to_be_resorted(k,j,i)            &
-                                             / REAL( average_count_3d, KIND=wp )
+                      to_be_resorted(k,j,i) = to_be_resorted(k,j,i) /                              &
+                                              REAL( average_count_3d, KIND=wp )
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           CASE ( 'LDSA' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      LDSA_av(k,j,i) = LDSA_av(k,j,i)                          &
-                                        / REAL( average_count_3d, KIND=wp )
+                      ldsa_av(k,j,i) = ldsa_av(k,j,i) / REAL( average_count_3d, KIND=wp )
                    ENDDO
                 ENDDO
              ENDDO
-             
-          CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6',   &
-                 'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12' )
+
+          CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6', 'N_bin7', 'N_bin8',   &
+                 'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      DO  b = 1, nbins 
-                         Nbins_av(k,j,i,b) = Nbins_av(k,j,i,b)                 &
-                                             / REAL( average_count_3d, KIND=wp )
+                      DO  ib = 1, nbins_aerosol
+                         nbins_av(k,j,i,ib) = nbins_av(k,j,i,ib) / REAL( average_count_3d, KIND=wp )
                       ENDDO
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           CASE ( 'Ntot' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      Ntot_av(k,j,i) = Ntot_av(k,j,i)                          &
-                                        / REAL( average_count_3d, KIND=wp )
+                      ntot_av(k,j,i) = ntot_av(k,j,i) / REAL( average_count_3d, KIND=wp )
                    ENDDO
                 ENDDO
              ENDDO
-             
-          CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6',   &
-                 'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12' )
+
+          CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6', 'm_bin7', 'm_bin8',   &
+                 'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      DO  b = 1, nbins 
-                         DO  c = b, nbins*ncc, nbins
-                            mbins_av(k,j,i,b) = mbins_av(k,j,i,b)              &
-                                             / REAL( average_count_3d, KIND=wp )
+                      DO  ib = 1, nbins_aerosol
+                         DO  ic = ib, nbins_aerosol * ncomponents_mass, nbins_aerosol
+                            mbins_av(k,j,i,ib) = mbins_av(k,j,i,ib) /                              &
+                                                 REAL( average_count_3d, KIND=wp)
                          ENDDO
                       ENDDO
@@ -9126,40 +9421,37 @@
                 ENDDO
              ENDDO
-             
+
           CASE ( 'PM2.5' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      PM25_av(k,j,i) = PM25_av(k,j,i) /                        &
-                                       REAL( average_count_3d, KIND=wp )
+                      pm25_av(k,j,i) = pm25_av(k,j,i) / REAL( average_count_3d, KIND=wp )
                    ENDDO
                 ENDDO
              ENDDO
-             
+
           CASE ( 'PM10' )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      PM10_av(k,j,i) = PM10_av(k,j,i) /                        &
-                                       REAL( average_count_3d, KIND=wp )
+                      pm10_av(k,j,i) = pm10_av(k,j,i) / REAL( average_count_3d, KIND=wp )
                    ENDDO
                 ENDDO
              ENDDO
-             
-          CASE ( 's_BC', 's_DU', 's_H2O', 's_NH', 's_NO', 's_OC', 's_SO4',     &
-                 's_SS' )
+
+          CASE ( 's_BC', 's_DU', 's_H2O', 's_NH', 's_NO', 's_OC', 's_SO4', 's_SS' )
              IF ( is_used( prtcl, TRIM( variable(3:) ) ) )  THEN
-                icc = get_index( prtcl, TRIM( variable(3:) ) )
-                IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_BC_av
-                IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_DU_av   
-                IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_NH_av   
-                IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_NO_av   
-                IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_OC_av   
-                IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_SO4_av   
-                IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_SS_av 
+                found_index = get_index( prtcl, TRIM( variable(3:) ) )
+                IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_bc_av
+                IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_du_av
+                IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_nh_av
+                IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_no_av
+                IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_oc_av
+                IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_so4_av
+                IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_ss_av 
                 DO  i = nxlg, nxrg
                    DO  j = nysg, nyng
                       DO  k = nzb, nzt+1
-                         to_be_resorted(k,j,i) = to_be_resorted(k,j,i) /       &
+                         to_be_resorted(k,j,i) = to_be_resorted(k,j,i) /                           &
                                                  REAL( average_count_3d, KIND=wp )
                       ENDDO
@@ -9181,7 +9473,6 @@
 !> Subroutine defining 2D output variables
 !------------------------------------------------------------------------------!
- SUBROUTINE salsa_data_output_2d( av, variable, found, grid, mode, local_pf,   &
-                                  two_d, nzb_do, nzt_do )
- 
+ SUBROUTINE salsa_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
+
     USE indices
 
@@ -9191,434 +9482,76 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  grid       !< 
-    CHARACTER (LEN=*) ::  mode       !< 
-    CHARACTER (LEN=*) ::  variable   !<
-    CHARACTER (LEN=5) ::  vari       !<  trimmed format of variable
-
-    INTEGER(iwp) ::  av      !< 
-    INTEGER(iwp) ::  b       !< running index: size bins
-    INTEGER(iwp) ::  c       !< running index: mass bins
-    INTEGER(iwp) ::  i       !<
-    INTEGER(iwp) ::  icc     !< index of a chemical compound
-    INTEGER(iwp) ::  j       !< 
-    INTEGER(iwp) ::  k       !< 
-    INTEGER(iwp) ::  nzb_do  !< 
-    INTEGER(iwp) ::  nzt_do  !< 
-
-    LOGICAL ::  found        !< 
-    LOGICAL ::  two_d        !< flag parameter that indicates 2D variables 
-                             !< (horizontal cross sections)
-    
-    REAL(wp) ::  df          !< For calculating LDSA: fraction of particles 
-                             !< depositing in the alveolar (or tracheobronchial)
-                             !< region of the lung. Depends on the particle size 
-    REAL(wp) ::  fill_value = -9999.0_wp  !< value for the _FillValue attribute                          
-    REAL(wp) ::  mean_d      !< Particle diameter in micrometres
-    REAL(wp) ::  nc          !< Particle number concentration in units 1/cm**3
-    REAL(wp) ::  temp_bin    !< temporary array for calculating output variables
-    
+    CHARACTER(LEN=*) ::  grid       !<
+    CHARACTER(LEN=*) ::  mode       !<
+    CHARACTER(LEN=*) ::  variable   !<
+    CHARACTER(LEN=5) ::  vari       !<  trimmed format of variable
+
+    INTEGER(iwp) ::  av           !<
+    INTEGER(iwp) ::  found_index  !< index of a chemical compound
+    INTEGER(iwp) ::  i            !<
+    INTEGER(iwp) ::  ib           !< running index: size bins
+    INTEGER(iwp) ::  ic           !< running index: mass bins
+    INTEGER(iwp) ::  j            !<
+    INTEGER(iwp) ::  k            !<
+    INTEGER(iwp) ::  nzb_do       !<
+    INTEGER(iwp) ::  nzt_do       !<
+
+    LOGICAL ::  found  !<
+    LOGICAL ::  two_d  !< flag parameter to indicate 2D variables (horizontal cross sections)
+
+    REAL(wp) ::  df                       !< For calculating LDSA: fraction of particles
+                                          !< depositing in the alveolar (or tracheobronchial)
+                                          !< region of the lung. Depends on the particle size
+    REAL(wp) ::  fill_value = -9999.0_wp  !< value for the _FillValue attribute
+    REAL(wp) ::  mean_d                   !< Particle diameter in micrometres
+    REAL(wp) ::  nc                       !< Particle number concentration in units 1/cm**3
+    REAL(wp) ::  temp_bin                 !< temporary array for calculating output variables
+
     REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf  !< output
-    
+
     REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted           !< pointer
-    
 !
 !-- Next statement is to avoid compiler warning about unused variable. May be removed in future.
     IF ( two_d )  CONTINUE
-    
+
     found = .TRUE.
     temp_bin  = 0.0_wp
-    
-    IF ( TRIM( variable(1:2) ) == 'g_' )  THEN
-       vari = TRIM( variable( 3:LEN( TRIM( variable ) ) - 3 ) )
-       IF ( av == 0 )  THEN
-          IF ( vari == 'H2SO4')  icc = 1
-          IF ( vari == 'HNO3')   icc = 2
-          IF ( vari == 'NH3')    icc = 3
-          IF ( vari == 'OCNV')   icc = 4
-          IF ( vari == 'OCSV')   icc = 5
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   local_pf(i,j,k) = MERGE( salsa_gas(icc)%conc(k,j,i),        &
-                                            REAL( fill_value, KIND = wp ),     &
-                                            BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ELSE
-          IF ( vari == 'H2SO4' )  to_be_resorted => g_H2SO4_av
-          IF ( vari == 'HNO3' )   to_be_resorted => g_HNO3_av   
-          IF ( vari == 'NH3' )    to_be_resorted => g_NH3_av   
-          IF ( vari == 'OCNV' )   to_be_resorted => g_OCNV_av   
-          IF ( vari == 'OCSV' )   to_be_resorted => g_OCSV_av        
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),             &
-                                            REAL( fill_value, KIND = wp ),     &
-                                            BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-
-       IF ( mode == 'xy' )  grid = 'zu'
-
-    ELSEIF ( TRIM( variable(1:4) ) == 'LDSA' )  THEN
-       IF ( av == 0 )  THEN
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   temp_bin = 0.0_wp
-                   DO  b = 1, nbins
-!                      
-!--                   Diameter in micrometres
-                      mean_d = 1.0E+6_wp * Ra_dry(k,j,i,b) * 2.0_wp 
-!                               
-!--                   Deposition factor: alveolar                               
-                      df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp * ( LOG( &
-                             mean_d ) + 2.84_wp )**2.0_wp ) + 19.11_wp * EXP(  &
-                            -0.482_wp * ( LOG( mean_d ) - 1.362_wp )**2.0_wp ) )
-!                                    
-!--                   Number concentration in 1/cm3
-                      nc = 1.0E-6_wp * aerosol_number(b)%conc(k,j,i)
-!                         
-!--                   Lung-deposited surface area LDSA (units mum2/cm3)                       
-                      temp_bin = temp_bin + pi * mean_d**2.0_wp * df * nc 
-                   ENDDO
-                   local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = & 
-                                            wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ELSE
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   local_pf(i,j,k) = MERGE( LDSA_av(k,j,i), REAL( fill_value,  &
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-
-       IF ( mode == 'xy' )  grid = 'zu'
-       
-    ELSEIF ( TRIM( variable(1:5) ) == 'N_bin' )  THEN
-       
-       vari = TRIM( variable( 6:LEN( TRIM( variable ) ) - 3 ) )
-    
-       IF ( TRIM( vari ) == '1' ) b = 1
-       IF ( TRIM( vari ) == '2' ) b = 2
-       IF ( TRIM( vari ) == '3' ) b = 3
-       IF ( TRIM( vari ) == '4' ) b = 4
-       IF ( TRIM( vari ) == '5' ) b = 5
-       IF ( TRIM( vari ) == '6' ) b = 6
-       IF ( TRIM( vari ) == '7' ) b = 7
-       IF ( TRIM( vari ) == '8' ) b = 8
-       IF ( TRIM( vari ) == '9' ) b = 9
-       IF ( TRIM( vari ) == '10' ) b = 10
-       IF ( TRIM( vari ) == '11' ) b = 11
-       IF ( TRIM( vari ) == '12' ) b = 12
-       
-       IF ( av == 0 )  THEN
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do                      
-                   local_pf(i,j,k) = MERGE( aerosol_number(b)%conc(k,j,i),     &
-                                            REAL( fill_value, KIND = wp ),     &
-                                            BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ELSE
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do                      
-                   local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,b),                 &
-                                            REAL( fill_value, KIND = wp ),     &
-                                            BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-       
-       IF ( mode == 'xy' )  grid = 'zu'
-    
-    ELSEIF ( TRIM( variable(1:4) ) == 'Ntot' )  THEN
-       IF ( av == 0 )  THEN
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   temp_bin = 0.0_wp
-                   DO  b = 1, nbins
-                      temp_bin = temp_bin + aerosol_number(b)%conc(k,j,i)
-                   ENDDO
-                   local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = &
-                                            wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ELSE
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   local_pf(i,j,k) = MERGE( Ntot_av(k,j,i), REAL( fill_value,  &
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-
-       IF ( mode == 'xy' )  grid = 'zu'
-    
-    
-    ELSEIF ( TRIM( variable(1:5) ) == 'm_bin' )  THEN
-       
-       vari = TRIM( variable( 6:LEN( TRIM( variable ) ) - 3 ) )
-    
-       IF ( TRIM( vari ) == '1' ) b = 1
-       IF ( TRIM( vari ) == '2' ) b = 2
-       IF ( TRIM( vari ) == '3' ) b = 3
-       IF ( TRIM( vari ) == '4' ) b = 4
-       IF ( TRIM( vari ) == '5' ) b = 5
-       IF ( TRIM( vari ) == '6' ) b = 6
-       IF ( TRIM( vari ) == '7' ) b = 7
-       IF ( TRIM( vari ) == '8' ) b = 8
-       IF ( TRIM( vari ) == '9' ) b = 9
-       IF ( TRIM( vari ) == '10' ) b = 10
-       IF ( TRIM( vari ) == '11' ) b = 11
-       IF ( TRIM( vari ) == '12' ) b = 12
-       
-       IF ( av == 0 )  THEN
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do   
-                   temp_bin = 0.0_wp
-                   DO  c = b, ncc_tot * nbins, nbins
-                      temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
-                   ENDDO
-                   local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value,        &
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) )
-                ENDDO
-             ENDDO
-          ENDDO
-       ELSE
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do                      
-                   local_pf(i,j,k) = MERGE( mbins_av(k,j,i,b), REAL( fill_value,&
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-       
-       IF ( mode == 'xy' )  grid = 'zu'
-    
-    ELSEIF ( TRIM( variable(1:5) ) == 'PM2.5' )  THEN
-       IF ( av == 0 )  THEN
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   temp_bin = 0.0_wp
-                   DO  b = 1, nbins
-                      IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 2.5E-6_wp )  THEN
-                         DO  c = b, nbins*ncc, nbins
-                            temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
-                         ENDDO
-                      ENDIF
-                   ENDDO
-                   local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value,        &
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ELSE
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   local_pf(i,j,k) = MERGE( PM25_av(k,j,i), REAL( fill_value,  &
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-
-       IF ( mode == 'xy' )  grid = 'zu'
-    
-    
-    ELSEIF ( TRIM( variable(1:4) ) == 'PM10' )  THEN
-       IF ( av == 0 )  THEN
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   temp_bin = 0.0_wp
-                   DO  b = 1, nbins
-                      IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 10.0E-6_wp )  THEN
-                         DO  c = b, nbins*ncc, nbins
-                            temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
-                         ENDDO
-                      ENDIF
-                   ENDDO
-                   local_pf(i,j,k) = MERGE( temp_bin,  REAL( fill_value,       &
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ELSE
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_do, nzt_do
-                   local_pf(i,j,k) = MERGE( PM10_av(k,j,i), REAL( fill_value,  &
-                                            KIND = wp ), BTEST(                &
-                                            wall_flags_0(k,j,i), 0 ) ) 
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-
-       IF ( mode == 'xy' )  grid = 'zu'
-    
-    ELSEIF ( TRIM( variable(1:2) ) == 's_' )  THEN
-       vari = TRIM( variable( 3:LEN( TRIM( variable ) ) - 3 ) )
-       IF ( is_used( prtcl, vari ) )  THEN
-          icc = get_index( prtcl, vari )
+
+    SELECT CASE ( TRIM( variable( 1:LEN( TRIM( variable ) ) - 3 ) ) )  ! cut out _xy, _xz or _yz
+
+       CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV', 'g_OCSV' )
+          vari = TRIM( variable( 3:LEN( TRIM( variable ) ) - 3 ) )
           IF ( av == 0 )  THEN
+             IF ( vari == 'H2SO4')  found_index = 1
+             IF ( vari == 'HNO3')   found_index = 2
+             IF ( vari == 'NH3')    found_index = 3
+             IF ( vari == 'OCNV')   found_index = 4
+             IF ( vari == 'OCSV')   found_index = 5
              DO  i = nxl, nxr
                 DO  j = nys, nyn
                    DO  k = nzb_do, nzt_do
-                      temp_bin = 0.0_wp
-                      DO  c = ( icc-1 )*nbins+1, icc*nbins, 1
-                         temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
-                      ENDDO
-                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value,     &
-                                               KIND = wp ), BTEST(             &
-                                               wall_flags_0(k,j,i), 0 ) ) 
+                      local_pf(i,j,k) = MERGE( salsa_gas(found_index)%conc(k,j,i), REAL( fill_value, &
+                                               KIND = wp ),  BTEST( wall_flags_0(k,j,i), 0 ) ) 
                    ENDDO
                 ENDDO
              ENDDO
           ELSE
-             IF ( vari == 'BC' )   to_be_resorted => s_BC_av
-             IF ( vari == 'DU' )   to_be_resorted => s_DU_av   
-             IF ( vari == 'NH' )   to_be_resorted => s_NH_av   
-             IF ( vari == 'NO' )   to_be_resorted => s_NO_av   
-             IF ( vari == 'OC' )   to_be_resorted => s_OC_av   
-             IF ( vari == 'SO4' )  to_be_resorted => s_SO4_av   
-             IF ( vari == 'SS' )   to_be_resorted => s_SS_av       
+             IF ( vari == 'H2SO4' )  to_be_resorted => g_h2so4_av
+             IF ( vari == 'HNO3' )   to_be_resorted => g_hno3_av
+             IF ( vari == 'NH3' )    to_be_resorted => g_nh3_av
+             IF ( vari == 'OCNV' )   to_be_resorted => g_ocnv_av
+             IF ( vari == 'OCSV' )   to_be_resorted => g_ocsv_av
              DO  i = nxl, nxr
                 DO  j = nys, nyn
                    DO  k = nzb_do, nzt_do
-                      local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),          &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                      local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,            &
+                                               KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
              ENDDO
           ENDIF
-       ELSE
-          local_pf = fill_value
-       ENDIF
-
-       IF ( mode == 'xy' )  grid = 'zu'
-       
-    ELSE
-       found = .FALSE.
-       grid  = 'none'
-    
-    ENDIF
- 
- END SUBROUTINE salsa_data_output_2d
-
- 
-!------------------------------------------------------------------------------!
-!
-! Description:
-! ------------
-!> Subroutine defining 3D output variables
-!------------------------------------------------------------------------------!
- SUBROUTINE salsa_data_output_3d( av, variable, found, local_pf, nzb_do,       &
-                                  nzt_do )
-
-    USE indices
-
-    USE kinds
-    
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=*), INTENT(in) ::  variable   !< 
-    
-    INTEGER(iwp) ::  av      !<
-    INTEGER(iwp) ::  b       !< running index: size bins    
-    INTEGER(iwp) ::  c       !< running index: mass bins
-    INTEGER(iwp) ::  i       !<
-    INTEGER(iwp) ::  icc     !< index of a chemical compound
-    INTEGER(iwp) ::  j       !< 
-    INTEGER(iwp) ::  k       !< 
-    INTEGER(iwp) ::  nzb_do  !< 
-    INTEGER(iwp) ::  nzt_do  !<   
-
-    LOGICAL ::  found      !< 
-    
-    REAL(wp) ::  df        !< For calculating LDSA: fraction of particles 
-                           !< depositing in the alveolar (or tracheobronchial)
-                           !< region of the lung. Depends on the particle size 
-    REAL(wp) ::  fill_value = -9999.0_wp   !< value for the _FillValue attribute
-    REAL(wp) ::  mean_d    !< Particle diameter in micrometres
-    REAL(wp) ::  nc        !< Particle number concentration in units 1/cm**3
-    REAL(wp) ::  temp_bin  !< temporary array for calculating output variables    
-
-    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf  !< local 
-    
-    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< pointer
-                                                     
-       
-    found     = .TRUE.
-    temp_bin  = 0.0_wp
-    
-    SELECT CASE ( TRIM( variable ) )
-    
-       CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV',  'g_OCSV' )
-          IF ( av == 0 )  THEN
-             IF ( TRIM( variable ) == 'g_H2SO4')  icc = 1
-             IF ( TRIM( variable ) == 'g_HNO3')   icc = 2
-             IF ( TRIM( variable ) == 'g_NH3')    icc = 3
-             IF ( TRIM( variable ) == 'g_OCNV')   icc = 4
-             IF ( TRIM( variable ) == 'g_OCSV')   icc = 5
-             
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do
-                      local_pf(i,j,k) = MERGE( salsa_gas(icc)%conc(k,j,i),     &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ELSE
-             IF ( TRIM( variable(3:) ) == 'H2SO4' ) to_be_resorted => g_H2SO4_av
-             IF ( TRIM( variable(3:) ) == 'HNO3' )  to_be_resorted => g_HNO3_av   
-             IF ( TRIM( variable(3:) ) == 'NH3' )   to_be_resorted => g_NH3_av   
-             IF ( TRIM( variable(3:) ) == 'OCNV' )  to_be_resorted => g_OCNV_av   
-             IF ( TRIM( variable(3:) ) == 'OCSV' )  to_be_resorted => g_OCSV_av 
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do
-                      local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),          &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ENDIF
-          
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
        CASE ( 'LDSA' )
           IF ( av == 0 )  THEN
@@ -9627,23 +9560,489 @@
                    DO  k = nzb_do, nzt_do
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-!                      
+                      DO  ib = 1, nbins_aerosol
+!
 !--                      Diameter in micrometres
-                         mean_d = 1.0E+6_wp * Ra_dry(k,j,i,b) * 2.0_wp 
-!                               
-!--                      Deposition factor: alveolar                             
-                         df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp *     &
-                              ( LOG( mean_d ) + 2.84_wp )**2.0_wp ) + 19.11_wp &
-                              * EXP( -0.482_wp * ( LOG( mean_d ) - 1.362_wp    &
-                                )**2.0_wp ) )
-!                                    
+                         mean_d = 1.0E+6_wp * ra_dry(k,j,i,ib) * 2.0_wp 
+!
+!--                      Deposition factor: alveolar
+                         df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp * ( LOG( mean_d ) +       &
+                                2.84_wp )**2 ) + 19.11_wp * EXP( -0.482_wp * ( LOG( mean_d ) -     &
+                                1.362_wp )**2 ) )
+!
 !--                      Number concentration in 1/cm3
-                         nc = 1.0E-6_wp * aerosol_number(b)%conc(k,j,i)
-!                         
+                         nc = 1.0E-6_wp * aerosol_number(ib)%conc(k,j,i)
+!
 !--                      Lung-deposited surface area LDSA (units mum2/cm3)
-                         temp_bin = temp_bin + pi * mean_d**2.0_wp * df * nc 
+                         temp_bin = temp_bin + pi * mean_d**2 * df * nc
                       ENDDO
-                      local_pf(i,j,k) = MERGE( temp_bin,                       &
-                                               REAL( fill_value, KIND = wp ),  &
+
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( ldsa_av(k,j,i), REAL( fill_value, KIND = wp ),      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
+       CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4',   'N_bin5',  'N_bin6', 'N_bin7', 'N_bin8',   &
+              'N_bin9', 'N_bin10' , 'N_bin11', 'N_bin12' )
+          vari = TRIM( variable( 6:LEN( TRIM( variable ) ) - 3 ) )
+
+          IF ( vari == '1' ) ib = 1
+          IF ( vari == '2' ) ib = 2
+          IF ( vari == '3' ) ib = 3
+          IF ( vari == '4' ) ib = 4
+          IF ( vari == '5' ) ib = 5
+          IF ( vari == '6' ) ib = 6
+          IF ( vari == '7' ) ib = 7
+          IF ( vari == '8' ) ib = 8
+          IF ( vari == '9' ) ib = 9
+          IF ( vari == '10' ) ib = 10
+          IF ( vari == '11' ) ib = 11
+          IF ( vari == '12' ) ib = 12
+
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( aerosol_number(ib)%conc(k,j,i), REAL( fill_value,   &
+                                               KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( nbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
+       CASE ( 'Ntot' )
+
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ib = 1, nbins_aerosol
+                         temp_bin = temp_bin + aerosol_number(ib)%conc(k,j,i)
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( ntot_av(k,j,i), REAL( fill_value, KIND = wp ),      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
+       CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4',   'm_bin5',  'm_bin6', 'm_bin7', 'm_bin8',   &
+              'm_bin9', 'm_bin10' , 'm_bin11', 'm_bin12' )
+          vari = TRIM( variable( 6:LEN( TRIM( variable ) ) - 3 ) )
+
+          IF ( vari == '1' ) ib = 1
+          IF ( vari == '2' ) ib = 2
+          IF ( vari == '3' ) ib = 3
+          IF ( vari == '4' ) ib = 4
+          IF ( vari == '5' ) ib = 5
+          IF ( vari == '6' ) ib = 6
+          IF ( vari == '7' ) ib = 7
+          IF ( vari == '8' ) ib = 8
+          IF ( vari == '9' ) ib = 9
+          IF ( vari == '10' ) ib = 10
+          IF ( vari == '11' ) ib = 11
+          IF ( vari == '12' ) ib = 12
+
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ic = ib, ncomponents_mass * nbins_aerosol, nbins_aerosol
+                         temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( mbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
+       CASE ( 'PM2.5' )
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 2.5E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
+                            ENDDO
+                         ENDIF
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( pm25_av(k,j,i), REAL( fill_value, KIND = wp ),      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
+       CASE ( 'PM10' )
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 10.0E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
+                            ENDDO
+                         ENDIF
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin,  REAL( fill_value, KIND = wp ),           &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( pm10_av(k,j,i), REAL( fill_value, KIND = wp ),      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
+       CASE ( 's_BC', 's_DU', 's_H2O', 's_NH', 's_NO', 's_OC', 's_SO4', 's_SS' )
+          vari = TRIM( variable( 3:LEN( TRIM( variable ) ) - 3 ) )
+          IF ( is_used( prtcl, vari ) )  THEN
+             found_index = get_index( prtcl, vari )
+             IF ( av == 0 )  THEN
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
+                      DO  k = nzb_do, nzt_do
+                         temp_bin = 0.0_wp
+                         DO  ic = ( found_index-1 ) * nbins_aerosol+1, found_index * nbins_aerosol
+                            temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
+                         ENDDO
+                         local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
+                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                      ENDDO
+                   ENDDO
+                ENDDO
+             ELSE
+                IF ( vari == 'BC' )   to_be_resorted => s_bc_av
+                IF ( vari == 'DU' )   to_be_resorted => s_du_av
+                IF ( vari == 'NH' )   to_be_resorted => s_nh_av
+                IF ( vari == 'NO' )   to_be_resorted => s_no_av
+                IF ( vari == 'OC' )   to_be_resorted => s_oc_av
+                IF ( vari == 'SO4' )  to_be_resorted => s_so4_av
+                IF ( vari == 'SS' )   to_be_resorted => s_ss_av
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
+                      DO  k = nzb_do, nzt_do
+                         local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,         &
+                                                  KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                      ENDDO
+                   ENDDO
+                ENDDO
+             ENDIF
+          ELSE
+             local_pf = fill_value
+          ENDIF
+
+          IF ( mode == 'xy' )  grid = 'zu'
+
+       CASE DEFAULT
+          found = .FALSE.
+          grid  = 'none'
+
+    END SELECT
+
+ END SUBROUTINE salsa_data_output_2d
+
+!------------------------------------------------------------------------------!
+!
+! Description:
+! ------------
+!> Subroutine defining 3D output variables
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
+
+    USE indices
+
+    USE kinds
+
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=*), INTENT(in) ::  variable   !<
+
+    INTEGER(iwp) ::  av           !<
+    INTEGER(iwp) ::  found_index  !< index of a chemical compound
+    INTEGER(iwp) ::  ib           !< running index: size bins
+    INTEGER(iwp) ::  ic           !< running index: mass bins
+    INTEGER(iwp) ::  i            !<
+    INTEGER(iwp) ::  j            !<
+    INTEGER(iwp) ::  k            !<
+    INTEGER(iwp) ::  nzb_do       !<
+    INTEGER(iwp) ::  nzt_do       !<
+
+    LOGICAL ::  found      !<
+
+    REAL(wp) ::  df                       !< For calculating LDSA: fraction of particles
+                                          !< depositing in the alveolar (or tracheobronchial)
+                                          !< region of the lung. Depends on the particle size
+    REAL(wp) ::  fill_value = -9999.0_wp  !< value for the _FillValue attribute
+    REAL(wp) ::  mean_d                   !< Particle diameter in micrometres
+    REAL(wp) ::  nc                       !< Particle number concentration in units 1/cm**3
+    REAL(wp) ::  temp_bin                 !< temporary array for calculating output variables
+
+    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf  !< local
+
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< pointer
+
+    found     = .TRUE.
+    temp_bin  = 0.0_wp
+
+    SELECT CASE ( TRIM( variable ) )
+
+       CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV',  'g_OCSV' )
+          IF ( av == 0 )  THEN
+             IF ( TRIM( variable ) == 'g_H2SO4')  found_index = 1
+             IF ( TRIM( variable ) == 'g_HNO3')   found_index = 2
+             IF ( TRIM( variable ) == 'g_NH3')    found_index = 3
+             IF ( TRIM( variable ) == 'g_OCNV')   found_index = 4
+             IF ( TRIM( variable ) == 'g_OCSV')   found_index = 5
+
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( salsa_gas(found_index)%conc(k,j,i),                 &
+                                               REAL( fill_value, KIND = wp ),                      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             IF ( TRIM( variable(3:) ) == 'H2SO4' ) to_be_resorted => g_h2so4_av
+             IF ( TRIM( variable(3:) ) == 'HNO3' )  to_be_resorted => g_hno3_av
+             IF ( TRIM( variable(3:) ) == 'NH3' )   to_be_resorted => g_nh3_av
+             IF ( TRIM( variable(3:) ) == 'OCNV' )  to_be_resorted => g_ocnv_av
+             IF ( TRIM( variable(3:) ) == 'OCSV' )  to_be_resorted => g_ocsv_av
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,            &
+                                               KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+       CASE ( 'LDSA' )
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ib = 1, nbins_aerosol
+!
+!--                      Diameter in micrometres
+                         mean_d = 1.0E+6_wp * ra_dry(k,j,i,ib) * 2.0_wp
+!
+!--                      Deposition factor: alveolar
+                         df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp * ( LOG( mean_d ) +       &
+                                2.84_wp )**2 ) + 19.11_wp * EXP( -0.482_wp * ( LOG( mean_d ) -     &
+                                1.362_wp )**2 ) )
+!
+!--                      Number concentration in 1/cm3
+                         nc = 1.0E-6_wp * aerosol_number(ib)%conc(k,j,i)
+!
+!--                      Lung-deposited surface area LDSA (units mum2/cm3)
+                         temp_bin = temp_bin + pi * mean_d**2 * df * nc 
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( ldsa_av(k,j,i), REAL( fill_value, KIND = wp ),      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+       CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6', 'N_bin7', 'N_bin8',      &
+              'N_bin9', 'N_bin10', 'N_bin11', 'N_bin12' )
+          IF ( TRIM( variable(6:) ) == '1' ) ib = 1
+          IF ( TRIM( variable(6:) ) == '2' ) ib = 2
+          IF ( TRIM( variable(6:) ) == '3' ) ib = 3
+          IF ( TRIM( variable(6:) ) == '4' ) ib = 4
+          IF ( TRIM( variable(6:) ) == '5' ) ib = 5
+          IF ( TRIM( variable(6:) ) == '6' ) ib = 6
+          IF ( TRIM( variable(6:) ) == '7' ) ib = 7
+          IF ( TRIM( variable(6:) ) == '8' ) ib = 8
+          IF ( TRIM( variable(6:) ) == '9' ) ib = 9
+          IF ( TRIM( variable(6:) ) == '10' ) ib = 10
+          IF ( TRIM( variable(6:) ) == '11' ) ib = 11
+          IF ( TRIM( variable(6:) ) == '12' ) ib = 12
+
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( aerosol_number(ib)%conc(k,j,i), REAL( fill_value,   &
+                                               KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( nbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+       CASE ( 'Ntot' )
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ib = 1, nbins_aerosol
+                         temp_bin = temp_bin + aerosol_number(ib)%conc(k,j,i)
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( ntot_av(k,j,i), REAL( fill_value, KIND = wp ),      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+       CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6', 'm_bin7', 'm_bin8',      &
+              'm_bin9', 'm_bin10' , 'm_bin11', 'm_bin12' )
+          IF ( TRIM( variable(6:) ) == '1' ) ib = 1
+          IF ( TRIM( variable(6:) ) == '2' ) ib = 2
+          IF ( TRIM( variable(6:) ) == '3' ) ib = 3
+          IF ( TRIM( variable(6:) ) == '4' ) ib = 4
+          IF ( TRIM( variable(6:) ) == '5' ) ib = 5
+          IF ( TRIM( variable(6:) ) == '6' ) ib = 6
+          IF ( TRIM( variable(6:) ) == '7' ) ib = 7
+          IF ( TRIM( variable(6:) ) == '8' ) ib = 8
+          IF ( TRIM( variable(6:) ) == '9' ) ib = 9
+          IF ( TRIM( variable(6:) ) == '10' ) ib = 10
+          IF ( TRIM( variable(6:) ) == '11' ) ib = 11
+          IF ( TRIM( variable(6:) ) == '12' ) ib = 12
+
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ic = ib, ncomponents_mass * nbins_aerosol, nbins_aerosol
+                         temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                   ENDDO
+                ENDDO
+             ENDDO
+          ELSE
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      local_pf(i,j,k) = MERGE( mbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                   ENDDO
+                ENDDO
+             ENDDO
+          ENDIF
+
+       CASE ( 'PM2.5' )
+          IF ( av == 0 )  THEN
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
+                   DO  k = nzb_do, nzt_do
+                      temp_bin = 0.0_wp
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 2.5E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
+                            ENDDO
+                         ENDIF
+                      ENDDO
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
                                                BTEST( wall_flags_0(k,j,i), 0 ) ) 
                    ENDDO
@@ -9654,6 +10053,5 @@
                 DO  j = nys, nyn
                    DO  k = nzb_do, nzt_do
-                      local_pf(i,j,k) = MERGE( LDSA_av(k,j,i),                 &
-                                               REAL( fill_value, KIND = wp ),  &
+                      local_pf(i,j,k) = MERGE( pm25_av(k,j,i), REAL( fill_value, KIND = wp ),      &
                                                BTEST( wall_flags_0(k,j,i), 0 ) ) 
                    ENDDO
@@ -9661,43 +10059,6 @@
              ENDDO
           ENDIF
-          
-       CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4',   'N_bin5',  'N_bin6',   &
-              'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10' , 'N_bin11', 'N_bin12' )
-          IF ( TRIM( variable(6:) ) == '1' ) b = 1
-          IF ( TRIM( variable(6:) ) == '2' ) b = 2
-          IF ( TRIM( variable(6:) ) == '3' ) b = 3
-          IF ( TRIM( variable(6:) ) == '4' ) b = 4
-          IF ( TRIM( variable(6:) ) == '5' ) b = 5
-          IF ( TRIM( variable(6:) ) == '6' ) b = 6
-          IF ( TRIM( variable(6:) ) == '7' ) b = 7
-          IF ( TRIM( variable(6:) ) == '8' ) b = 8
-          IF ( TRIM( variable(6:) ) == '9' ) b = 9
-          IF ( TRIM( variable(6:) ) == '10' ) b = 10
-          IF ( TRIM( variable(6:) ) == '11' ) b = 11
-          IF ( TRIM( variable(6:) ) == '12' ) b = 12
-          
-          IF ( av == 0 )  THEN
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do                      
-                      local_pf(i,j,k) = MERGE( aerosol_number(b)%conc(k,j,i),  &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ELSE
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do                      
-                      local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,b),              &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ENDIF
-          
-       CASE ( 'Ntot' )
+
+       CASE ( 'PM10' )
           IF ( av == 0 )  THEN
              DO  i = nxl, nxr
@@ -9705,9 +10066,12 @@
                    DO  k = nzb_do, nzt_do
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins                         
-                         temp_bin = temp_bin + aerosol_number(b)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 10.0E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
+                            ENDDO
+                         ENDIF
                       ENDDO
-                      local_pf(i,j,k) = MERGE( temp_bin,                       &
-                                               REAL( fill_value, KIND = wp ),  &
+                      local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
                                                BTEST( wall_flags_0(k,j,i), 0 ) ) 
                    ENDDO
@@ -9718,118 +10082,14 @@
                 DO  j = nys, nyn
                    DO  k = nzb_do, nzt_do
-                      local_pf(i,j,k) = MERGE( Ntot_av(k,j,i),                 &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                      local_pf(i,j,k) = MERGE( pm10_av(k,j,i), REAL( fill_value, KIND = wp ),      &
+                                               BTEST( wall_flags_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
              ENDDO
           ENDIF
-          
-       CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4',   'm_bin5',  'm_bin6',   &
-              'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10' , 'm_bin11', 'm_bin12' )
-          IF ( TRIM( variable(6:) ) == '1' ) b = 1
-          IF ( TRIM( variable(6:) ) == '2' ) b = 2
-          IF ( TRIM( variable(6:) ) == '3' ) b = 3
-          IF ( TRIM( variable(6:) ) == '4' ) b = 4
-          IF ( TRIM( variable(6:) ) == '5' ) b = 5
-          IF ( TRIM( variable(6:) ) == '6' ) b = 6
-          IF ( TRIM( variable(6:) ) == '7' ) b = 7
-          IF ( TRIM( variable(6:) ) == '8' ) b = 8
-          IF ( TRIM( variable(6:) ) == '9' ) b = 9
-          IF ( TRIM( variable(6:) ) == '10' ) b = 10
-          IF ( TRIM( variable(6:) ) == '11' ) b = 11
-          IF ( TRIM( variable(6:) ) == '12' ) b = 12
-          
-          IF ( av == 0 )  THEN
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do   
-                      temp_bin = 0.0_wp
-                      DO  c = b, ncc_tot * nbins, nbins
-                         temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
-                      ENDDO
-                      local_pf(i,j,k) = MERGE( temp_bin,                       &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
-                   ENDDO
-                ENDDO
-             ENDDO
-          ELSE
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do                      
-                      local_pf(i,j,k) = MERGE( mbins_av(k,j,i,b),              &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ENDIF
-          
-       CASE ( 'PM2.5' )
-          IF ( av == 0 )  THEN
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do
-                      temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-                         IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 2.5E-6_wp )  THEN
-                            DO  c = b, nbins * ncc, nbins
-                               temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
-                            ENDDO
-                         ENDIF
-                      ENDDO
-                      local_pf(i,j,k) = MERGE( temp_bin,                       &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ELSE
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do
-                      local_pf(i,j,k) = MERGE( PM25_av(k,j,i),                 &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ENDIF
-          
-       CASE ( 'PM10' )
-          IF ( av == 0 )  THEN
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do
-                      temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-                         IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 10.0E-6_wp )  THEN
-                            DO  c = b, nbins * ncc, nbins
-                               temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
-                            ENDDO
-                         ENDIF
-                      ENDDO
-                      local_pf(i,j,k) = MERGE( temp_bin,                       &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ELSE
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_do, nzt_do
-                      local_pf(i,j,k) = MERGE( PM10_av(k,j,i),                 &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
-                   ENDDO
-                ENDDO
-             ENDDO
-          ENDIF
-                 
+
        CASE ( 's_BC', 's_DU', 's_H2O', 's_NH', 's_NO', 's_OC', 's_SO4', 's_SS' )
           IF ( is_used( prtcl, TRIM( variable(3:) ) ) )  THEN
-             icc = get_index( prtcl, TRIM( variable(3:) ) )
+             found_index = get_index( prtcl, TRIM( variable(3:) ) )
              IF ( av == 0 )  THEN
                 DO  i = nxl, nxr
@@ -9837,27 +10097,25 @@
                       DO  k = nzb_do, nzt_do
                          temp_bin = 0.0_wp
-                         DO  c = ( icc-1 )*nbins+1, icc*nbins                          
-                            temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
+                         DO  ic = ( found_index-1 ) * nbins_aerosol + 1, found_index * nbins_aerosol
+                            temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
                          ENDDO
-                         local_pf(i,j,k) = MERGE( temp_bin,                    &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                         local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
+                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
                 ENDDO
              ELSE
-                IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_BC_av
-                IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_DU_av   
-                IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_NH_av   
-                IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_NO_av   
-                IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_OC_av   
-                IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_SO4_av   
-                IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_SS_av 
+                IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_bc_av
+                IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_du_av
+                IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_nh_av
+                IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_no_av
+                IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_oc_av
+                IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_so4_av
+                IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_ss_av
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      DO  k = nzb_do, nzt_do                      
-                         local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),       &
-                                               REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                      DO  k = nzb_do, nzt_do
+                         local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,         &
+                                                  KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -9865,4 +10123,5 @@
              ENDIF
           ENDIF
+
        CASE DEFAULT
           found = .FALSE.
@@ -9879,32 +10138,32 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE salsa_data_output_mask( av, variable, found, local_pf )
- 
-    USE arrays_3d,                                                             &
+
+    USE arrays_3d,                                                                                 &
         ONLY:  tend
- 
-    USE control_parameters,                                                    &
+
+    USE control_parameters,                                                                        &
         ONLY:  mask_size_l, mask_surface, mid
-        
-    USE surface_mod,                                                           &
-        ONLY:  get_topography_top_index_ji       
- 
+
+    USE surface_mod,                                                                               &
+        ONLY:  get_topography_top_index_ji
+
     IMPLICIT NONE
-    
+
     CHARACTER(LEN=5) ::  grid      !< flag to distinquish between staggered grid
-    CHARACTER(LEN=*) ::  variable  !< 
+    CHARACTER(LEN=*) ::  variable  !<
     CHARACTER(LEN=7) ::  vari      !< trimmed format of variable
 
-    INTEGER(iwp) ::  av              !< 
-    INTEGER(iwp) ::  b               !< loop index for aerosol size number bins
-    INTEGER(iwp) ::  c               !< loop index for chemical components
+    INTEGER(iwp) ::  av              !<
+    INTEGER(iwp) ::  found_index     !< index of a chemical compound
+    INTEGER(iwp) ::  ib              !< loop index for aerosol size number bins
+    INTEGER(iwp) ::  ic              !< loop index for chemical components
     INTEGER(iwp) ::  i               !< loop index in x-direction
-    INTEGER(iwp) ::  icc             !< index of a chemical compound
     INTEGER(iwp) ::  j               !< loop index in y-direction
     INTEGER(iwp) ::  k               !< loop index in z-direction
     INTEGER(iwp) ::  topo_top_ind    !< k index of highest horizontal surface
-    
-    LOGICAL ::  found      !< 
+
+    LOGICAL ::  found      !<
     LOGICAL ::  resorted   !<
-    
+
     REAL(wp) ::  df        !< For calculating LDSA: fraction of particles 
                            !< depositing in the alveolar (or tracheobronchial)
@@ -9912,8 +10171,8 @@
     REAL(wp) ::  mean_d    !< Particle diameter in micrometres
     REAL(wp) ::  nc        !< Particle number concentration in units 1/cm**3
-    REAL(wp) ::  temp_bin  !< temporary array for calculating output variables    
-
-    REAL(wp), DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) ::  local_pf   !< 
-    
+    REAL(wp) ::  temp_bin  !< temporary array for calculating output variables
+
+    REAL(wp), DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) ::  local_pf   !<
+
     REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< pointer
 
@@ -9924,5 +10183,5 @@
 
     SELECT CASE ( TRIM( variable ) )
-    
+
        CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV',  'g_OCSV' )
           vari = TRIM( variable )
@@ -9932,13 +10191,13 @@
              IF ( vari == 'g_NH3')    to_be_resorted => salsa_gas(3)%conc
              IF ( vari == 'g_OCNV')   to_be_resorted => salsa_gas(4)%conc
-             IF ( vari == 'g_OCSV')   to_be_resorted => salsa_gas(5)%conc 
+             IF ( vari == 'g_OCSV')   to_be_resorted => salsa_gas(5)%conc
           ELSE
-             IF ( vari == 'g_H2SO4') to_be_resorted => g_H2SO4_av
-             IF ( vari == 'g_HNO3')  to_be_resorted => g_HNO3_av   
-             IF ( vari == 'g_NH3')   to_be_resorted => g_NH3_av   
-             IF ( vari == 'g_OCNV')  to_be_resorted => g_OCNV_av   
-             IF ( vari == 'g_OCSV')  to_be_resorted => g_OCSV_av
+             IF ( vari == 'g_H2SO4') to_be_resorted => g_h2so4_av
+             IF ( vari == 'g_HNO3')  to_be_resorted => g_hno3_av
+             IF ( vari == 'g_NH3')   to_be_resorted => g_nh3_av
+             IF ( vari == 'g_OCNV')  to_be_resorted => g_ocnv_av
+             IF ( vari == 'g_OCSV')  to_be_resorted => g_ocsv_av
           ENDIF
-          
+
        CASE ( 'LDSA' )
           IF ( av == 0 )  THEN
@@ -9947,20 +10206,19 @@
                    DO  k = nzb, nz_do3d
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-!                      
+                      DO  ib = 1, nbins_aerosol
+!
 !--                      Diameter in micrometres
-                         mean_d = 1.0E+6_wp * Ra_dry(k,j,i,b) * 2.0_wp
-!                               
-!--                      Deposition factor: alveolar                                
-                         df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp *     &
-                              ( LOG( mean_d ) + 2.84_wp )**2.0_wp ) + 19.11_wp &
-                              * EXP( -0.482_wp * ( LOG( mean_d ) - 1.362_wp    &
-                                )**2.0_wp ) )
-!                                    
+                         mean_d = 1.0E+6_wp * ra_dry(k,j,i,ib) * 2.0_wp
+!
+!--                      Deposition factor: alveolar
+                         df = ( 0.01555_wp / mean_d ) * ( EXP( -0.416_wp * ( LOG( mean_d ) +       &
+                                2.84_wp )**2 ) + 19.11_wp * EXP( -0.482_wp * ( LOG( mean_d ) -     &
+                                1.362_wp )**2 ) )
+!
 !--                      Number concentration in 1/cm3
-                         nc = 1.0E-6_wp * aerosol_number(b)%conc(k,j,i)
-!                         
+                         nc = 1.0E-6_wp * aerosol_number(ib)%conc(k,j,i)
+!
 !--                      Lung-deposited surface area LDSA (units mum2/cm3)
-                         temp_bin = temp_bin + pi * mean_d**2.0_wp * df * nc 
+                         temp_bin = temp_bin + pi * mean_d**2 * df * nc
                       ENDDO
                       tend(k,j,i) = temp_bin
@@ -9972,6 +10230,5 @@
                    DO  j = 1, mask_size_l(mid,2)
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j),&
-                                                 mask_i(mid,i) )
+                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
                    ENDDO
@@ -9980,10 +10237,8 @@
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
-                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),&
-                                                                  mask_i(mid,i),&
+                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i),    &
                                                                   grid )
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),&
-                                                      nzt+1 ),                 &
+                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k), nzt+1 ),         &
                                                  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
@@ -9993,44 +10248,41 @@
              resorted = .TRUE.
           ELSE
-             to_be_resorted => LDSA_av
+             to_be_resorted => ldsa_av
           ENDIF
-          
-       CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4',   'N_bin5',  'N_bin6',   &
-              'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10' , 'N_bin11', 'N_bin12' )
-          IF ( TRIM( variable(6:) ) == '1' ) b = 1
-          IF ( TRIM( variable(6:) ) == '2' ) b = 2
-          IF ( TRIM( variable(6:) ) == '3' ) b = 3
-          IF ( TRIM( variable(6:) ) == '4' ) b = 4
-          IF ( TRIM( variable(6:) ) == '5' ) b = 5
-          IF ( TRIM( variable(6:) ) == '6' ) b = 6
-          IF ( TRIM( variable(6:) ) == '7' ) b = 7
-          IF ( TRIM( variable(6:) ) == '8' ) b = 8
-          IF ( TRIM( variable(6:) ) == '9' ) b = 9
-          IF ( TRIM( variable(6:) ) == '10' ) b = 10
-          IF ( TRIM( variable(6:) ) == '11' ) b = 11
-          IF ( TRIM( variable(6:) ) == '12' ) b = 12
-          
+
+       CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4',   'N_bin5',  'N_bin6', 'N_bin7', 'N_bin8',   &
+              'N_bin9', 'N_bin10' , 'N_bin11', 'N_bin12' )
+          IF ( TRIM( variable(6:) ) == '1' ) ib = 1
+          IF ( TRIM( variable(6:) ) == '2' ) ib = 2
+          IF ( TRIM( variable(6:) ) == '3' ) ib = 3
+          IF ( TRIM( variable(6:) ) == '4' ) ib = 4
+          IF ( TRIM( variable(6:) ) == '5' ) ib = 5
+          IF ( TRIM( variable(6:) ) == '6' ) ib = 6
+          IF ( TRIM( variable(6:) ) == '7' ) ib = 7
+          IF ( TRIM( variable(6:) ) == '8' ) ib = 8
+          IF ( TRIM( variable(6:) ) == '9' ) ib = 9
+          IF ( TRIM( variable(6:) ) == '10' ) ib = 10
+          IF ( TRIM( variable(6:) ) == '11' ) ib = 11
+          IF ( TRIM( variable(6:) ) == '12' ) ib = 12
+
           IF ( av == 0 )  THEN
-             IF ( .NOT. mask_surface(mid) )  THEN   
+             IF ( .NOT. mask_surface(mid) )  THEN
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = aerosol_number(b)%conc( mask_k(mid,k),&
-                                                                   mask_j(mid,j),&
-                                                                   mask_i(mid,i) )
+                         local_pf(i,j,k) = aerosol_number(ib)%conc( mask_k(mid,k), mask_j(mid,j),  &
+                                                                    mask_i(mid,i) )
                       ENDDO
                    ENDDO
                 ENDDO
-             ELSE 
+             ELSE
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
-                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),&
-                                                                  mask_i(mid,i),&
+                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i),    &
                                                                   grid )
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = aerosol_number(b)%conc(             &
-                                           MIN( topo_top_ind+mask_k(mid,k),    &
-                                                nzt+1 ),                 &
-                                           mask_j(mid,j), mask_i(mid,i) )
+                         local_pf(i,j,k) = aerosol_number(ib)%conc(MIN( topo_top_ind+mask_k(mid,k),&
+                                                                        nzt+1 ),                   &
+                                                                   mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
                    ENDDO
@@ -10039,7 +10291,7 @@
              resorted = .TRUE.
           ELSE
-             to_be_resorted => Nbins_av(:,:,:,b)
+             to_be_resorted => nbins_av(:,:,:,ib)
           ENDIF
-          
+
        CASE ( 'Ntot' )
           IF ( av == 0 )  THEN
@@ -10048,6 +10300,6 @@
                    DO  k = nzb, nz_do3d
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-                         temp_bin = temp_bin + aerosol_number(b)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         temp_bin = temp_bin + aerosol_number(ib)%conc(k,j,i)
                       ENDDO
                       tend(k,j,i) = temp_bin
@@ -10059,6 +10311,5 @@
                    DO  j = 1, mask_size_l(mid,2)
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j),&
-                                                 mask_i(mid,i) )
+                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
                    ENDDO
@@ -10067,10 +10318,8 @@
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
-                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),&
-                                                                  mask_i(mid,i),&
+                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i),    &
                                                                   grid )
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),&
-                                                      nzt+1 ),                 &
+                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k), nzt+1 ),         &
                                                  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
@@ -10080,22 +10329,22 @@
              resorted = .TRUE.
           ELSE
-             to_be_resorted => Ntot_av
+             to_be_resorted => ntot_av
           ENDIF
-          
-       CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4',   'm_bin5',  'm_bin6',   &
-              'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10' , 'm_bin11', 'm_bin12' )
-          IF ( TRIM( variable(6:) ) == '1' ) b = 1
-          IF ( TRIM( variable(6:) ) == '2' ) b = 2
-          IF ( TRIM( variable(6:) ) == '3' ) b = 3
-          IF ( TRIM( variable(6:) ) == '4' ) b = 4
-          IF ( TRIM( variable(6:) ) == '5' ) b = 5
-          IF ( TRIM( variable(6:) ) == '6' ) b = 6
-          IF ( TRIM( variable(6:) ) == '7' ) b = 7
-          IF ( TRIM( variable(6:) ) == '8' ) b = 8
-          IF ( TRIM( variable(6:) ) == '9' ) b = 9
-          IF ( TRIM( variable(6:) ) == '10' ) b = 10
-          IF ( TRIM( variable(6:) ) == '11' ) b = 11
-          IF ( TRIM( variable(6:) ) == '12' ) b = 12
-          
+
+       CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6', 'm_bin7', 'm_bin8',      &
+              'm_bin9', 'm_bin10', 'm_bin11', 'm_bin12' )
+          IF ( TRIM( variable(6:) ) == '1' ) ib = 1
+          IF ( TRIM( variable(6:) ) == '2' ) ib = 2
+          IF ( TRIM( variable(6:) ) == '3' ) ib = 3
+          IF ( TRIM( variable(6:) ) == '4' ) ib = 4
+          IF ( TRIM( variable(6:) ) == '5' ) ib = 5
+          IF ( TRIM( variable(6:) ) == '6' ) ib = 6
+          IF ( TRIM( variable(6:) ) == '7' ) ib = 7
+          IF ( TRIM( variable(6:) ) == '8' ) ib = 8
+          IF ( TRIM( variable(6:) ) == '9' ) ib = 9
+          IF ( TRIM( variable(6:) ) == '10' ) ib = 10
+          IF ( TRIM( variable(6:) ) == '11' ) ib = 11
+          IF ( TRIM( variable(6:) ) == '12' ) ib = 12
+
           IF ( av == 0 )  THEN
              DO  i = nxl, nxr
@@ -10103,17 +10352,16 @@
                    DO  k = nzb, nz_do3d
                       temp_bin = 0.0_wp
-                      DO  c = b, ncc_tot*nbins, nbins
-                         temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
+                      DO  ic = ib, ncomponents_mass * nbins_aerosol, nbins_aerosol
+                         temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
                       ENDDO
                       tend(k,j,i) = temp_bin
                    ENDDO
                 ENDDO
-             ENDDO   
-             IF ( .NOT. mask_surface(mid) )  THEN   
+             ENDDO
+             IF ( .NOT. mask_surface(mid) )  THEN
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j),&
-                                                 mask_i(mid,i) )
+                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
                    ENDDO
@@ -10122,10 +10370,8 @@
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
-                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),&
-                                                                  mask_i(mid,i),&
+                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i),    &
                                                                   grid )
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),&
-                                                      nzt+1 ),                 &
+                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k), nzt+1 ),         &
                                                  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
@@ -10135,7 +10381,7 @@
              resorted = .TRUE.
           ELSE
-             to_be_resorted => mbins_av(:,:,:,b)
+             to_be_resorted => mbins_av(:,:,:,ib)
           ENDIF
-       
+
        CASE ( 'PM2.5' )
           IF ( av == 0 )  THEN
@@ -10144,8 +10390,8 @@
                    DO  k = nzb, nz_do3d
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-                         IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 2.5E-6_wp )  THEN
-                            DO  c = b, nbins * ncc, nbins
-                               temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 2.5E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
                             ENDDO
                          ENDIF
@@ -10155,10 +10401,9 @@
                 ENDDO
              ENDDO 
-             IF ( .NOT. mask_surface(mid) )  THEN   
+             IF ( .NOT. mask_surface(mid) )  THEN
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j),&
-                                                 mask_i(mid,i) )
+                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
                    ENDDO
@@ -10167,10 +10412,8 @@
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
-                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),&
-                                                                  mask_i(mid,i),&
+                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i),    &
                                                                   grid )
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),&
-                                                      nzt+1 ),                 &
+                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k), nzt+1 ),         &
                                                  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
@@ -10180,7 +10423,7 @@
              resorted = .TRUE.
           ELSE
-             to_be_resorted => PM25_av
+             to_be_resorted => pm25_av
           ENDIF
-          
+
        CASE ( 'PM10' )
           IF ( av == 0 )  THEN
@@ -10189,8 +10432,8 @@
                    DO  k = nzb, nz_do3d
                       temp_bin = 0.0_wp
-                      DO  b = 1, nbins
-                         IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 10.0E-6_wp )  THEN
-                            DO  c = b, nbins * ncc, nbins
-                               temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
+                      DO  ib = 1, nbins_aerosol
+                         IF ( 2.0_wp * ra_dry(k,j,i,ib) <= 10.0E-6_wp )  THEN
+                            DO  ic = ib, nbins_aerosol * ncc, nbins_aerosol
+                               temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
                             ENDDO
                          ENDIF
@@ -10200,10 +10443,9 @@
                 ENDDO
              ENDDO 
-             IF ( .NOT. mask_surface(mid) )  THEN   
+             IF ( .NOT. mask_surface(mid) )  THEN
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j),&
-                                                 mask_i(mid,i) )
+                         local_pf(i,j,k) = tend( mask_k(mid,k),  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
                    ENDDO
@@ -10212,10 +10454,8 @@
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
-                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),&
-                                                                  mask_i(mid,i),&
+                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i),    &
                                                                   grid )
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),&
-                                                      nzt+1 ),                 &
+                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k), nzt+1 ),         &
                                                  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
@@ -10225,17 +10465,17 @@
              resorted = .TRUE.
           ELSE
-             to_be_resorted => PM10_av
+             to_be_resorted => pm10_av
           ENDIF
-          
+
        CASE ( 's_BC', 's_DU', 's_NH', 's_NO', 's_OC', 's_SO4', 's_SS' )
           IF ( av == 0 )  THEN
              IF ( is_used( prtcl, TRIM( variable(3:) ) ) )  THEN
-                icc = get_index( prtcl, TRIM( variable(3:) ) )
+                found_index = get_index( prtcl, TRIM( variable(3:) ) )
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
                       DO  k = nzb, nz_do3d
                          temp_bin = 0.0_wp
-                         DO  c = ( icc-1 )*nbins+1, icc*nbins 
-                            temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)
+                         DO  ic = ( found_index-1 ) * nbins_aerosol + 1, found_index * nbins_aerosol
+                            temp_bin = temp_bin + aerosol_mass(ic)%conc(k,j,i)
                          ENDDO
                          tend(k,j,i) = temp_bin
@@ -10246,22 +10486,19 @@
                 tend = 0.0_wp
              ENDIF
-             IF ( .NOT. mask_surface(mid) )  THEN   
+             IF ( .NOT. mask_surface(mid) )  THEN
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j), &
-                                                 mask_i(mid,i) )
+                         local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
                    ENDDO
                 ENDDO
-             ELSE      
+             ELSE
                 DO  i = 1, mask_size_l(mid,1)
                    DO  j = 1, mask_size_l(mid,2)
-                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),&
-                                                                  mask_i(mid,i),&
+                      topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i),    &
                                                                   grid )
                       DO  k = 1, mask_size_l(mid,3)
-                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),&
-                                                      nzt+1 ),&
+                         local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k), nzt+1 ),         &
                                                  mask_j(mid,j), mask_i(mid,i) )
                       ENDDO
@@ -10271,28 +10508,26 @@
              resorted = .TRUE.
           ELSE
-             IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_BC_av
-             IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_DU_av   
-             IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_NH_av   
-             IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_NO_av   
-             IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_OC_av   
-             IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_SO4_av   
-             IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_SS_av
+             IF ( TRIM( variable(3:) ) == 'BC' )   to_be_resorted => s_bc_av
+             IF ( TRIM( variable(3:) ) == 'DU' )   to_be_resorted => s_du_av
+             IF ( TRIM( variable(3:) ) == 'NH' )   to_be_resorted => s_nh_av
+             IF ( TRIM( variable(3:) ) == 'NO' )   to_be_resorted => s_no_av
+             IF ( TRIM( variable(3:) ) == 'OC' )   to_be_resorted => s_oc_av
+             IF ( TRIM( variable(3:) ) == 'SO4' )  to_be_resorted => s_so4_av
+             IF ( TRIM( variable(3:) ) == 'SS' )   to_be_resorted => s_ss_av
           ENDIF
-       
+
        CASE DEFAULT
           found = .FALSE.
-    
+
     END SELECT
-    
-    
+
     IF ( .NOT. resorted )  THEN
        IF ( .NOT. mask_surface(mid) )  THEN
 !
-!--       Default masked output    
+!--       Default masked output
           DO  i = 1, mask_size_l(mid,1)
              DO  j = 1, mask_size_l(mid,2)
                 DO  k = 1, mask_size_l(mid,3)
-                   local_pf(i,j,k) = to_be_resorted( mask_k(mid,k),            &
-                                                     mask_j(mid,j),mask_i(mid,i) )
+                   local_pf(i,j,k) = to_be_resorted( mask_k(mid,k), mask_j(mid,j),mask_i(mid,i) )
                 ENDDO
              ENDDO
@@ -10300,16 +10535,14 @@
        ELSE
 !
-!--       Terrain-following masked output      
+!--       Terrain-following masked output
           DO  i = 1, mask_size_l(mid,1)
              DO  j = 1, mask_size_l(mid,2)
 !
 !--             Get k index of highest horizontal surface
-                topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),     &
-                                                            mask_i(mid,i), grid )
+                topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), mask_i(mid,i), grid )
 !
 !--             Save output array
                 DO  k = 1, mask_size_l(mid,3)
-                   local_pf(i,j,k) = to_be_resorted( MIN( topo_top_ind+mask_k(mid,k),&
-                                                          nzt+1 ),             &
+                   local_pf(i,j,k) = to_be_resorted( MIN( topo_top_ind+mask_k(mid,k), nzt+1 ),     &
                                                      mask_j(mid,j), mask_i(mid,i) )
                 ENDDO
@@ -10318,7 +10551,6 @@
        ENDIF
     ENDIF
-    
+
  END SUBROUTINE salsa_data_output_mask
- 
 
  END MODULE salsa_mod
Index: /palm/trunk/SOURCE/salsa_util_mod.f90
===================================================================
--- /palm/trunk/SOURCE/salsa_util_mod.f90	(revision 3863)
+++ /palm/trunk/SOURCE/salsa_util_mod.f90	(revision 3864)
@@ -25,7 +25,10 @@
 ! -----------------
 ! $Id$
+! Formatting changes
+!
+! 3845 2019-04-01 13:41:55Z monakurppa
 ! Initial revision
-! 
-! 
+!
+!
 !
 ! Authors:
@@ -39,83 +42,84 @@
 !------------------------------------------------------------------------------!
  MODULE salsa_util_mod
- 
+
+    USE control_parameters,                                                                        &
+        ONLY:  message_string
+
     USE kinds
-    
+
     USE pegrid
-    
+
     IMPLICIT NONE
-    
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  sums_salsa_ws_l !< subdomain sum 
-                                        !< of vertical passive salsa flux w's' 
-                                        !< (5th-order advection scheme only)
 
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  sums_salsa_ws_l !< subdomain sum of vertical salsa 
+                                                              !< flux w's' (5th-order advection 
+                                                              !< scheme only)
+!
 !-- Component index
     TYPE component_index
-       INTEGER(iwp) ::  ncomp !< Number of components
-       INTEGER(iwp), ALLOCATABLE ::  ind(:) !< Component index
-       CHARACTER(len=3), ALLOCATABLE ::  comp(:) !< Component name
-    END TYPE component_index 
-    
+       INTEGER(iwp) ::  ncomp  !< Number of components
+       INTEGER(iwp), ALLOCATABLE ::  ind(:)  !< Component index
+       CHARACTER(len=3), ALLOCATABLE ::  comp(:)  !< Component name
+    END TYPE component_index
+
     SAVE
-    
+
     INTERFACE component_index_constructor
        MODULE PROCEDURE component_index_constructor
     END INTERFACE component_index_constructor
-    
+
     INTERFACE get_index
        MODULE PROCEDURE get_index
     END INTERFACE get_index
-    
-    INTERFACE get_n_comp
-       MODULE PROCEDURE get_n_comp
-    END INTERFACE get_n_comp
-    
+
     INTERFACE is_used
        MODULE PROCEDURE is_used
     END INTERFACE is_used
-    
+
     PRIVATE
-    PUBLIC component_index, component_index_constructor, get_index, get_n_comp,&
-           is_used, sums_salsa_ws_l
-    
+    PUBLIC component_index, component_index_constructor, get_index, is_used, sums_salsa_ws_l
+
  CONTAINS
-    
-!------------------------------------------------------------------------------!    
+
+!------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Creates index tables for different (aerosol) components 
 !------------------------------------------------------------------------------!
-    SUBROUTINE component_index_constructor( SELF, ncomp, nlist, listcomp )
+    SUBROUTINE component_index_constructor( self, ncomp, nlist, listcomp )
 
        IMPLICIT NONE
-       
-       TYPE(component_index), INTENT(inout) ::  SELF !< Object containing the indices 
-                                                     !< of different aerosol components
-       INTEGER(iwp), INTENT(inout) ::  ncomp !< Number of components
-       INTEGER(iwp), INTENT(in) ::     nlist !< Maximum number of components
-       CHARACTER(len=3), INTENT(in) ::  listcomp(nlist) !< List cof component
-                                                        !< names
-       INTEGER(iwp) ::  i, jj
-       
+
+       INTEGER(iwp) ::  i   !<
+       INTEGER(iwp) ::  jj  !<
+
+       INTEGER(iwp), INTENT(in) ::  nlist ! < Maximum number of components
+
+       INTEGER(iwp), INTENT(inout) ::  ncomp  !< Number of components
+
+       TYPE(component_index), INTENT(inout) ::  self  !< Object containing the indices of different
+                                                      !< aerosol components
+       CHARACTER(len=3), INTENT(in) ::  listcomp(nlist)  !< List cof component names
+
        ncomp = 0
-       
-       DO  WHILE ( listcomp(ncomp+1) /= '  ' .AND. ncomp < nlist )
+
+       DO WHILE ( listcomp(ncomp+1) /= '  ' .AND. ncomp < nlist )
           ncomp = ncomp + 1
        ENDDO
-       
-       SELF%ncomp = ncomp 
-       ALLOCATE( SELF%ind(ncomp), SELF%comp(ncomp) )
-       
-       DO i = 1, ncomp
-          SELF%ind(i) = i
+
+       self%ncomp = ncomp
+       ALLOCATE( self%ind(ncomp), self%comp(ncomp) )
+
+       DO  i = 1, ncomp
+          self%ind(i) = i
        ENDDO
-       
+
        jj = 1
-       DO i = 1, nlist
+       DO  i = 1, nlist
           IF ( listcomp(i) == '') CYCLE
-          SELF%comp(jj) = listcomp(i)
-          jj = jj+1
+          self%comp(jj) = listcomp(i)
+          jj = jj + 1
        ENDDO
-       
+
     END SUBROUTINE component_index_constructor
 
@@ -125,46 +129,29 @@
 !> Gives the index of a component in the component list
 !------------------------------------------------------------------------------!
-    INTEGER FUNCTION get_index( SELF, incomp )
+    INTEGER FUNCTION get_index( self, incomp )
 
        IMPLICIT NONE
-       
-       TYPE(component_index), INTENT(in) ::  SELF !< Object containing the 
-                                                  !< indices of different 
-                                                  !< aerosol components
+
        CHARACTER(len=*), INTENT(in) ::  incomp !< Component name
        INTEGER(iwp) ::  i
-       
-       IF ( ANY(SELF%comp == incomp) ) THEN
+
+       TYPE(component_index), INTENT(in) ::  self  !< Object containing the indices of different
+                                                   !< aerosol components
+       IF ( ANY( self%comp == incomp ) ) THEN
           i = 1
-          DO WHILE ( (SELF%comp(i) /= incomp) )
-             i = i+1
+          DO WHILE ( (self%comp(i) /= incomp) )
+             i = i + 1
           ENDDO
           get_index = i
        ELSEIF ( incomp == 'H2O' ) THEN
-          get_index = SELF%ncomp + 1
+          get_index = self%ncomp + 1
        ELSE
-          STOP 1 ! "INFO for Developer: please use the message routine to pass the output string" get_index: FAILED, no such component -
+          WRITE( message_string, * ) 'Incorrect component name given!'
+          CALL message( 'get_index', 'PA0591', 1, 2, 0, 6, 0 )
        ENDIF
-       
+
        RETURN
-       
+
     END FUNCTION get_index
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Get the number of (aerosol) components used
-!------------------------------------------------------------------------------!
-    INTEGER FUNCTION get_n_comp( SELF )
-
-       IMPLICIT NONE
-
-       TYPE(component_index), INTENT(in) ::  SELF !< Object containing the 
-                                                  !< indices of different 
-                                                  !< aerosol components
-       get_n_comp = SELF%ncomp
-       RETURN
-       
-    END FUNCTION
 
 !------------------------------------------------------------------------------!
@@ -173,21 +160,19 @@
 !> Tells if the (aerosol) component is being used in the simulation
 !------------------------------------------------------------------------------!
-    LOGICAL FUNCTION is_used( SELF, icomp )
+    LOGICAL FUNCTION is_used( self, icomp )
 
        IMPLICIT NONE
-       
-       TYPE(component_index), INTENT(in) ::  SELF !< Object containing the 
-                                                  !< indices of different 
-                                                  !< aerosol components
+
        CHARACTER(len=*), INTENT(in) ::  icomp !< Component name
-       
-       IF ( ANY(SELF%comp == icomp) ) THEN
+
+       TYPE(component_index), INTENT(in) ::  self  !< Object containing the indices of different
+                                                   !< aerosol components
+
+       IF ( ANY(self%comp == icomp) ) THEN
           is_used = .TRUE.
        ELSE
           is_used = .FALSE.
        ENDIF
-       
-       RETURN
-       
+
     END FUNCTION
 
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 3863)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 3864)
@@ -25,4 +25,14 @@
 ! -----------------
 ! $Id$
+! Modifications made for salsa:
+! - Call salsa_emission_update at each time step but do the checks within
+!   salsa_emission_update (i.e. skip_time_do_salsa >= time_since_reference_point
+!   and next_aero_emission_update <= time_since_reference_point ).
+! - Renamed nbins --> nbins_aerosol, ncc_tot --> ncomponents_mass and 
+!   ngast --> ngases_salsa and loop indices b, c and sg to ib, ic and ig
+! - Apply nesting for salsa variables
+! - Removed cpu_log calls speciffic for salsa.
+! 
+! 3833 2019-03-28 15:04:04Z forkel
 ! added USE chem_gasphase_mod, replaced nspec by nvar since fixed compounds are not integrated
 ! 
@@ -567,5 +577,5 @@
     USE nesting_offl_mod,                                                                          &
         ONLY:  nesting_offl_bc, nesting_offl_mass_conservation
-        
+
     USE netcdf_data_input_mod,                                                                     &
         ONLY:  chem_emis, chem_emis_att, nest_offl, netcdf_data_input_offline_nesting
@@ -591,8 +601,9 @@
         ONLY: dt_radiation, force_radiation_call, radiation, radiation_control,                    &
               radiation_interaction, radiation_interactions, skip_time_do_radiation, time_radiation
-         
+
     USE salsa_mod,                                                                                 &
-        ONLY: aerosol_number, aerosol_mass, nbins, ncc_tot, ngast, salsa_boundary_conds,           &
-              salsa_gas, salsa_gases_from_chem, skip_time_do_salsa
+        ONLY: aerosol_number, aerosol_mass, bc_am_t_val, bc_an_t_val, bc_gt_t_val,                 &
+              nbins_aerosol, ncomponents_mass, ngases_salsa, salsa_boundary_conds,                 &
+              salsa_emission_update, salsa_gas, salsa_gases_from_chem, skip_time_do_salsa
 
     USE spectra_mod,                                                                               &
@@ -629,5 +640,5 @@
                vnest_boundary_conds_khkm, vnest_deallocate, vnest_init, vnest_init_fine,           &
                vnest_start_time
-               
+
     USE virtual_measurement_mod,                                                                   &
         ONLY:  vm_data_output, vm_sampling, vm_time_start
@@ -667,8 +678,9 @@
 
     CHARACTER (LEN=9) ::  time_to_string   !<
-    
-    INTEGER(iwp)      ::  b !< index for aerosol size bins    
-    INTEGER(iwp)      ::  c !< index for chemical compounds in aerosol size bins
-    INTEGER(iwp)      ::  g !< index for gaseous compounds 
+
+    INTEGER(iwp)      ::  ib        !< index for aerosol size bins
+    INTEGER(iwp)      ::  ic        !< index for aerosol mass bins
+    INTEGER(iwp)      ::  icc       !< additional index for aerosol mass bins
+    INTEGER(iwp)      ::  ig        !< index for salsa gases
     INTEGER(iwp)      ::  lsp
     INTEGER(iwp)      ::  lsp_usr   !<
@@ -856,4 +868,21 @@
               ENDDO
            ENDIF
+           IF ( salsa  .AND.  time_since_reference_point >= skip_time_do_salsa )  THEN
+              DO  ib = 1, nbins_aerosol
+                 bc_an_t_val = ( aerosol_number(ib)%init(nzt+1) - aerosol_number(ib)%init(nzt) ) / &
+                               dzu(nzt+1)
+                 DO  ic = 1, ncomponents_mass
+                    icc = ( ic - 1 ) * nbins_aerosol + ib
+                    bc_am_t_val = ( aerosol_mass(icc)%init(nzt+1) - aerosol_mass(icc)%init(nzt) ) /&
+                                  dzu(nzt+1)
+                 ENDDO
+              ENDDO
+              IF ( .NOT. salsa_gases_from_chem )  THEN
+                 DO  ig = 1, ngases_salsa
+                    bc_gt_t_val = ( salsa_gas(ig)%init(nzt+1) - salsa_gas(ig)%init(nzt) ) /        &
+                                  dzu(nzt+1)
+                 ENDDO
+              ENDIF
+           ENDIF
        ENDIF
 !
@@ -1028,30 +1057,23 @@
           ENDIF
 
-          IF ( salsa  .AND.  time_since_reference_point >= skip_time_do_salsa )&
-          THEN
-             CALL cpu_log( log_point_s(91), 'salsa exch-horiz ', 'start' )
-             DO  b = 1, nbins
-                CALL exchange_horiz( aerosol_number(b)%conc_p, nbgp )
-                CALL cpu_log( log_point_s(93), 'salsa decycle', 'start' )
-                CALL salsa_boundary_conds( aerosol_number(b)%conc_p, aerosol_number(b)%init )
-                CALL cpu_log( log_point_s(93), 'salsa decycle', 'stop' )
-                DO  c = 1, ncc_tot
-                   CALL exchange_horiz( aerosol_mass((c-1)*nbins+b)%conc_p, nbgp )
-                   CALL cpu_log( log_point_s(93), 'salsa decycle', 'start' )
-                   CALL salsa_boundary_conds( aerosol_mass((c-1)*nbins+b)%conc_p,                  &
-                                              aerosol_mass((c-1)*nbins+b)%init )
-                   CALL cpu_log( log_point_s(93), 'salsa decycle', 'stop' )
+          IF ( salsa  .AND.  time_since_reference_point >= skip_time_do_salsa )  THEN
+!
+!--          Exchange ghost points and decycle boundary concentrations if needed
+             DO  ib = 1, nbins_aerosol
+                CALL exchange_horiz( aerosol_number(ib)%conc_p, nbgp )
+                CALL salsa_boundary_conds( aerosol_number(ib)%conc_p, aerosol_number(ib)%init )
+                DO  ic = 1, ncomponents_mass
+                   icc = ( ic - 1 ) * nbins_aerosol + ib
+                   CALL exchange_horiz( aerosol_mass(icc)%conc_p, nbgp )
+                   CALL salsa_boundary_conds( aerosol_mass(icc)%conc_p, aerosol_mass(icc)%init )
                 ENDDO
              ENDDO
              IF ( .NOT. salsa_gases_from_chem )  THEN
-                DO  g = 1, ngast
-                   CALL exchange_horiz( salsa_gas(g)%conc_p, nbgp ) 
-                   CALL cpu_log( log_point_s(93), 'salsa decycle', 'start' )
-                   CALL salsa_boundary_conds( salsa_gas(g)%conc_p, salsa_gas(g)%init )
-                   CALL cpu_log( log_point_s(93), 'salsa decycle', 'stop' )
-             ENDDO
+                DO  ig = 1, ngases_salsa
+                   CALL exchange_horiz( salsa_gas(ig)%conc_p, nbgp )
+                   CALL salsa_boundary_conds( salsa_gas(ig)%conc_p, salsa_gas(ig)%init )
+                ENDDO
              ENDIF
-             CALL cpu_log( log_point_s(91), 'salsa exch-horiz ', 'stop' )
-          ENDIF         
+          ENDIF
           CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
 
@@ -1108,5 +1130,5 @@
 
                 IF ( passive_scalar )  CALL exchange_horiz( s, nbgp )  
-               
+
                 IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e, nbgp )
 
@@ -1120,4 +1142,23 @@
                    ENDDO
                 ENDIF
+
+                IF ( salsa  .AND. time_since_reference_point >= skip_time_do_salsa )  THEN
+                   DO  ib = 1, nbins_aerosol
+                      CALL exchange_horiz( aerosol_number(ib)%conc, nbgp )
+                      CALL salsa_boundary_conds( aerosol_number(ib)%conc, aerosol_number(ib)%init )
+                      DO  ic = 1, ncomponents_mass
+                         icc = ( ic - 1 ) * nbins_aerosol + ib
+                         CALL exchange_horiz( aerosol_mass(icc)%conc, nbgp )
+                         CALL salsa_boundary_conds( aerosol_mass(icc)%conc, aerosol_mass(icc)%init )
+                      ENDDO
+                   ENDDO
+                   IF ( .NOT. salsa_gases_from_chem )  THEN
+                      DO  ig = 1, ngases_salsa
+                         CALL exchange_horiz( salsa_gas(ig)%conc, nbgp )
+                         CALL salsa_boundary_conds( salsa_gas(ig)%conc, salsa_gas(ig)%init )
+                      ENDDO
+                   ENDIF
+                ENDIF
+                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
 
              ENDIF
@@ -1407,5 +1448,12 @@
           ENDIF
        ENDIF
-
+!
+!--    If required, consider aerosol emissions for the salsa model
+       IF ( salsa )  THEN
+!
+!--       Call emission routine to update emissions if needed
+          CALL salsa_emission_update
+
+       ENDIF
 !
 !--    If required, calculate indoor temperature, waste heat, heat flux
