subroutine trmpi_check(cstr)

  use trmpi
  implicit NONE

  ! check if module is initialized.  Exit with error message if not.

  character*(*), intent(in) :: cstr  ! caller ID string

  !---------------------

  if(trmpi_numprocs == 0) then

     write(trmpi_lunmsg,*) ' ?trmpi_check call from '//trim(cstr)//': '// &
          'module not initialized!'
     call bad_exit

  endif

end subroutine trmpi_check
