!===============================================================================
!
! seed_mpi.F90
!
!-------------------------------------------------------------------------------
!
! Copyright (C) 1998-2003 Hinnerk Stueben
!
! This file is part of BQCD -- Berlin Quantum ChromoDynamics program
!
! BQCD is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! BQCD is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with BQCD.  If not, see <http://www.gnu.org/licenses/>.
!
!-------------------------------------------------------------------------------
# include "defs.h"

!-------------------------------------------------------------------------------
subroutine seed_broadcast(seed)

  use module_function_decl
  implicit none
  SEED     seed
  integer(8) seed8l, seed8g
  if (my_pe()==0) then
    seed8l=seed
  else
    seed8l=0
  endif

  call global_sum_var(seed8l, seed8g, 1, 3)

  seed=seed8g
end  

!-------------------------------------------------------------------------------
subroutine seed_compare(seed)

  use module_function_decl
  implicit none
  SEED     seed

  integer(8) seed8l, seed8_min, seed8_max

  seed8l=seed

  call global_sum_var(seed8l, seed8_max, 1, 4)
  call global_sum_var(seed8l, seed8_min, 1, 5)

  if (seed8_max /= seed8_min) call die('rancheck(): seeds differ')

end

!===============================================================================
