InitHistInitPops Subroutine

public subroutine InitHistInitPops()

Uses

Arguments

None

Contents

Source Code


Source Code

    SUBROUTINE InitHistInitPops()
        USE CalcData, only: InitiatorWalkNo
        INTEGER :: ierr
        character(*), parameter :: this_routine = 'InitHistInitPops'

        if (allocated(HistInitPops)) then
            deallocate(HistInitPops, stat=ierr)
            call LogMemDealloc(this_routine, HistInitPopsTag, ierr)
        end if

        allocate(HistInitPops(2, 25000), stat=ierr)
        call LogMemAlloc('HistInitPops', 50000, 4, this_routine, &
                         HistInitPopsTag, ierr)
        HistInitPops = 0

        if (iProcIndex == 0) then
            if (allocated(AllHistInitPops)) then
                deallocate(AllHistInitPops, stat=ierr)
                call LogMemDealloc(this_routine, AllHistInitPopsTag, ierr)
            end if

            allocate(AllHistInitPops(2, 25000), stat=ierr)
            CALL LogMemAlloc('AllHistInitPops', 50000, 4, this_routine, &
                             AllHistInitPopsTag, ierr)
            AllHistInitPops = 0
#ifdef DEBUG_
        else
            ! in debug mode, we have to allocate this on all procs
            if (allocated(AllHistInitPops)) then
                deallocate(AllHistInitPops, stat=ierr)
            end if

            allocate(AllHistInitPops(2, 1), stat=ierr)
            AllHistInitPops = 0
#endif
        end if

        InitBinMin = log(REAL(InitiatorWalkNo + 1, dp))
        InitBinMax = log(1000000.0_dp)
        InitBinIter = ABS(InitBinMax - InitBinMin) / 25000.0

    END SUBROUTINE InitHistInitPops