blob: 51d1ee723f6341d16813b7be8316e49c920ab7a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
module chkhist_mod
implicit none
contains
subroutine chkhist(mrsym, nmax, ipk)
implicit none
!--------------------------------------------------------------------
! Arguments
!--------------------------------------------------------------------
integer, intent(in) :: mrsym(63)
integer, intent(out) :: nmax
integer, intent(out) :: ipk
!--------------------------------------------------------------------
! Locals
!--------------------------------------------------------------------
integer :: hist(0:63)
integer :: i, j
!--------------------------------------------------------------------
! Initialize histogram
!--------------------------------------------------------------------
do i = 0, 63
hist(i) = 0
enddo
!--------------------------------------------------------------------
! Count occurrences
!--------------------------------------------------------------------
do j = 1, 63
i = mrsym(j)
hist(i) = hist(i) + 1
enddo
!--------------------------------------------------------------------
! Find maximum bin and its index
!--------------------------------------------------------------------
nmax = 0
do i = 0, 63
if (hist(i) > nmax) then
nmax = hist(i)
ipk = i + 1
endif
enddo
end subroutine chkhist
end module chkhist_mod
|