WriteInitPops Subroutine

public subroutine WriteInitPops(Iter)

Uses

Arguments

Type IntentOptional Attributes Name
integer :: Iter

Contents

Source Code


Source Code

    SUBROUTINE WriteInitPops(Iter)
        use util_mod, only: get_free_unit
        CHARACTER(len=21) :: abstr
        INTEGER :: i, Iter, iunit
        real(dp) :: InitBinCurr

!This will open a file called InitPops-"Iter" on unit number 17.
        abstr = 'InitPops-'//str(Iter)

        call MPIReduce(HistInitPops, MPI_SUM, AllHistInitPops)

        IF (iProcIndex == 0) THEN
            iunit = get_free_unit()
            open(iunit, FILE=abstr, STATUS='unknown')

            InitBinCurr = (-1) * InitBinMax
            do i = 25000, 1, -1
                IF (AllHistInitPops(1, i) /= 0) write(iunit, '(F20.10,2I20)') &
                    InitBinCurr, (-1) * (NINT(EXP(ABS(InitBinCurr)))), AllHistInitPops(1, i)
                InitBinCurr = InitBinCurr + InitBinIter
            end do

            InitBinCurr = InitBinMin
            do i = 1, 25000
                IF (AllHistInitPops(2, i) /= 0) write(iunit, '(F20.10,2I20)') &
                    InitBinCurr, NINT(EXP(InitBinCurr)), AllHistInitPops(2, i)
                InitBinCurr = InitBinCurr + InitBinIter
            end do

            close(iunit)
            AllHistInitPops(:, :) = 0
        end if
        HistInitPops(:, :) = 0

    END SUBROUTINE WriteInitPops