module OW_mpi

 use mpi_sep
 implicit none
  !----------------------------------------------------------------
  type weipar
     integer :: n_mpi !! no of nodes
     integer :: n_omp !! no of procs / node
     integer :: i_mpi !! node rank

     character(len=MPI_MAX_PROCESSOR_NAME) :: name
     character(128) :: suffix !! tag suffix
     
     logical :: mpi
  end type weipar
  !----------------------------------------------------------------
  type(weipar), public :: wpar

  !! total number of processors
  integer, private :: npro

 !----------------------------------------------------------------
 subroutine owwei_mpi_init()

 write(0,*) "before MPI_COMM_SIZE"
 call MPI_COMM_SIZE_(MPI_COMM_WORLD, wpar%n_mpi, ierr)
 write(0,*) "before MPI_COMM_RANK"
 call MPI_COMM_RANK_(MPI_COMM_WORLD, wpar%i_mpi, ierr)
 !! number of processors on each node
 !$OMP PARALLEL
 wpar%n_omp = omp_get_num_threads()
 !$OMP END PARALLEL

 end subroutine
 !----------------------------------------------------------------

end module
