7   use mpi, 
only : mpi_sum, mpi_in_place
 
   35     type(model_state_type), 
target, 
intent(inout) :: current_state
 
   39     rnhpts=1.0_default_precision/real(current_state%global_grid%size(x_index)*current_state%global_grid%size(y_index))
 
   41     start_x=current_state%local_grid%local_domain_start_index(x_index)
 
   42     end_x=current_state%local_grid%local_domain_end_index(x_index)
 
   43     start_y=current_state%local_grid%local_domain_start_index(y_index)
 
   44     end_y=current_state%local_grid%local_domain_end_index(y_index)
 
   47     if (.not. current_state%continuation_run) 
then 
   48       allocate(current_state%global_grid%configuration%vertical%olubar(current_state%local_grid%size(z_index)),&
 
   49            current_state%global_grid%configuration%vertical%olzubar(current_state%local_grid%size(z_index)))
 
   54     if (.not. current_state%continuation_run) 
then 
   55       allocate(current_state%global_grid%configuration%vertical%olvbar(current_state%local_grid%size(z_index)),&
 
   56            current_state%global_grid%configuration%vertical%olzvbar(current_state%local_grid%size(z_index)))
 
   60     if (current_state%th%active) 
then 
   61       if (.not. current_state%continuation_run) 
then 
   62         allocate(current_state%global_grid%configuration%vertical%olthbar(current_state%local_grid%size(z_index)),&
 
   63              current_state%global_grid%configuration%vertical%olzthbar(current_state%local_grid%size(z_index)))
 
   67     if (current_state%number_q_fields .gt. 0) 
then 
   69       if (.not. current_state%continuation_run) 
then 
   70         allocate(current_state%global_grid%configuration%vertical%olqbar(current_state%local_grid%size(z_index), &
 
   71              current_state%number_q_fields), current_state%global_grid%configuration%vertical%olzqbar(&
 
   72              current_state%local_grid%size(z_index), current_state%number_q_fields))
 
   84     type(model_state_type), 
target, 
intent(inout) :: current_state
 
   93     type(model_state_type), 
target, 
intent(inout) :: current_state
 
  101     type(model_state_type), 
target, 
intent(inout) :: current_state
 
  103     integer :: bar_index, i
 
  109     current_state%global_grid%configuration%vertical%olubar(:)=
bartmp(:, bar_index)*
rnhpts 
  110     current_state%global_grid%configuration%vertical%olzubar(:)=
bartmp(:, bar_index+1)*
rnhpts 
  111     bar_index=bar_index+2
 
  114     current_state%global_grid%configuration%vertical%olvbar(:)=
bartmp(:, bar_index)*
rnhpts 
  115     current_state%global_grid%configuration%vertical%olzvbar(:)=
bartmp(:, bar_index+1)*
rnhpts 
  116     bar_index=bar_index+2
 
  118     if (current_state%th%active) 
then 
  119       current_state%global_grid%configuration%vertical%olthbar(:)=
bartmp(:, bar_index)*
rnhpts 
  120       current_state%global_grid%configuration%vertical%olzthbar(:)=
bartmp(:, bar_index+1)*
rnhpts 
  121       bar_index=bar_index+2
 
  123     do i=1,current_state%number_q_fields
 
  124       if (current_state%q(i)%active) 
then 
  125         current_state%global_grid%configuration%vertical%olqbar(:, i)=
bartmp(:, bar_index)*
rnhpts 
  126         current_state%global_grid%configuration%vertical%olzqbar(:, i)=
bartmp(:, bar_index+1)*
rnhpts 
  127         bar_index=bar_index+2
 
  136     type(model_state_type), 
intent(inout) :: current_state
 
  138     integer :: k, n, bar_index, ierr    
 
  140     do k=current_state%local_grid%local_domain_start_index(z_index), current_state%local_grid%local_domain_end_index(z_index)
 
  145       bar_index=bar_index+2
 
  150       bar_index=bar_index+2
 
  152       if (current_state%th%active) 
then 
  155         bar_index=bar_index+2
 
  157       do n=1,current_state%number_q_fields
 
  158         if (current_state%q(n)%active) 
then 
  161           bar_index=bar_index+2
 
  166     call mpi_allreduce(mpi_in_place, 
bartmp, 
bar_fields*current_state%local_grid%size(z_index), precision_type, mpi_sum, &
 
  167          current_state%parallel%monc_communicator, ierr)